From f2200595b4d00dbcdbf62f166295f585d9e102cb Mon Sep 17 00:00:00 2001 From: Rick Tierney Date: Mar 07 2017 17:37:31 +0000 Subject: Updated TopGraphComponent to be compatible with the new JGraphX 3.6.0.0 --- diff --git a/opa-fmgui.spec b/opa-fmgui.spec index 389917f..ec7f96b 100644 --- a/opa-fmgui.spec +++ b/opa-fmgui.spec @@ -42,13 +42,14 @@ Name: opa-fmgui Version: 10.1.0.0 -Release: 113%{?dist} +Release: 114%{?dist} Summary: Intel Omni-Path Architecture Fabric Manager Graphical User Interface Group: Applications/System License: BSD and LGPLv2+ URL: https://github.com/01org/opa-fmgui Source0: %{name}-%{version}.tar.gz BuildArch: noarch +Patch1: stl-14927-jgraphx-update.patch BuildRequires: gradle-local BuildRequires: maven-local @@ -117,14 +118,13 @@ FMGUI is the Intel Omni-Path Architecture Fabric Manager Graphical User Interface. It can be run by invoking the Bourne shell script opa-fmgui. %prep -%autosetup -n %{name}-%{version} -%setup -q +%autosetup -p1 -n %{name}-%{version} %build %if 0%{?fedora} >= 24 %gradle_build -i copyDeps %else - gradle --offline copyDeps build + gradle copyDeps build %endif %install @@ -184,6 +184,10 @@ fi %config(noreplace) %{_sysconfdir}/profile.d/fmguivars.sh %changelog +* Tue Mar 07 2017 Rick Tierney 10.1.0.0-114 +- Updated TopGraphComponent to be compatible with the new JGraphX 3.6.0.0 +[+stl-14927-jgraphx-update.patch] + * Sat Feb 11 2017 Fedora Release Engineering - 10.1.0.0-113 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/stl-14927-jgraphx-update.patch b/stl-14927-jgraphx-update.patch new file mode 100644 index 0000000..916b1ae --- /dev/null +++ b/stl-14927-jgraphx-update.patch @@ -0,0 +1,795 @@ +diff -cr 10.1/src/com/intel/stl/ui/network/TopGraphComponent.java 10.4/src/com/intel/stl/ui/network/TopGraphComponent.java +*** 10.1/src/com/intel/stl/ui/network/TopGraphComponent.java 2017-01-20 04:40:10.053889049 -0500 +--- 10.4/src/com/intel/stl/ui/network/TopGraphComponent.java 2017-01-20 04:42:31.002896219 -0500 +*************** +*** 1,9 **** + /** + * Copyright (c) 2015, Intel Corporation +! * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +! * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright +--- 1,9 ---- + /** + * Copyright (c) 2015, Intel Corporation +! * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: +! * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright +*************** +*** 12,18 **** + * * Neither the name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. +! * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +--- 12,18 ---- + * * Neither the name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. +! * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +*************** +*** 73,80 **** + public class TopGraphComponent extends mxGraphComponent { + private static final long serialVersionUID = -3168649345200765940L; + +! private static final Logger log = LoggerFactory +! .getLogger(TopGraphComponent.class); + + private boolean graphBuffered = true; + +--- 73,80 ---- + public class TopGraphComponent extends mxGraphComponent { + private static final long serialVersionUID = -3168649345200765940L; + +! private static final Logger log = +! LoggerFactory.getLogger(TopGraphComponent.class); + + private boolean graphBuffered = true; + +*************** +*** 100,106 **** + + /** + * Description: +! * + * @param graph + */ + public TopGraphComponent(IBackgroundService updateService, TopGraph graph) { +--- 100,106 ---- + + /** + * Description: +! * + * @param graph + */ + public TopGraphComponent(IBackgroundService updateService, TopGraph graph) { +*************** +*** 148,154 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createGraphControl() + */ + @Override +--- 148,154 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createGraphControl() + */ + @Override +*************** +*** 173,179 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createHandlers() + */ + @Override +--- 173,179 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createHandlers() + */ + @Override +*************** +*** 216,222 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createPanningHandler() + */ + @Override +--- 216,222 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createPanningHandler() + */ + @Override +*************** +*** 226,232 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createGraphHandler() + */ + @Override +--- 226,232 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createGraphHandler() + */ + @Override +*************** +*** 236,242 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createSelectionCellsHandler() + */ + @Override +--- 236,242 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#createSelectionCellsHandler() + */ + @Override +*************** +*** 246,252 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#installDoubleClickHandler() + */ + @Override +--- 246,252 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#installDoubleClickHandler() + */ + @Override +*************** +*** 255,264 **** + + /* + * (non-Javadoc) +! * +! * @see +! * com.mxgraph.swing.mxGraphComponent#isPanningEvent(java.awt.event.MouseEvent +! * ) + */ + @Override + public boolean isPanningEvent(MouseEvent event) { +--- 255,263 ---- + + /* + * (non-Javadoc) +! * +! * @see com.mxgraph.swing.mxGraphComponent#isPanningEvent(java.awt.event. +! * MouseEvent ) + */ + @Override + public boolean isPanningEvent(MouseEvent event) { +*************** +*** 267,276 **** + + /* + * (non-Javadoc) +! * +! * @see +! * com.mxgraph.swing.mxGraphComponent#createHandler(com.mxgraph.view.mxCellState +! * ) + */ + @Override + public mxCellHandler createHandler(mxCellState state) { +--- 266,274 ---- + + /* + * (non-Javadoc) +! * +! * @see com.mxgraph.swing.mxGraphComponent#createHandler(com.mxgraph.view. +! * mxCellState ) + */ + @Override + public mxCellHandler createHandler(mxCellState state) { +*************** +*** 284,290 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#selectRegion(java.awt.Rectangle, + * java.awt.event.MouseEvent) + */ +--- 282,288 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#selectRegion(java.awt.Rectangle, + * java.awt.event.MouseEvent) + */ +*************** +*** 303,309 **** + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#getCellAt(int, int, boolean, + * java.lang.Object) + */ +--- 301,307 ---- + + /* + * (non-Javadoc) +! * + * @see com.mxgraph.swing.mxGraphComponent#getCellAt(int, int, boolean, + * java.lang.Object) + */ +*************** +*** 348,354 **** + } + + if (parent != null) { +! Point previousTranslate = canvas.getTranslate(); + double previousScale = canvas.getScale(); + + try { +--- 346,352 ---- + } + + if (parent != null) { +! mxPoint previousTranslate = canvas.getTranslate(); + double previousScale = canvas.getScale(); + + try { +*************** +*** 366,374 **** + } + + Object cell = model.getChildAt(parent, i); +! Object result = +! findCellAt(id, x, y, hitSwimlaneContent, cell, +! vertex); + + if (result != null) { + return result; +--- 364,371 ---- + } + + Object cell = model.getChildAt(parent, i); +! Object result = findCellAt(id, x, y, hitSwimlaneContent, +! cell, vertex); + + if (result != null) { + return result; +*************** +*** 376,393 **** + && (vertex == model.isVertex(cell))) { + mxCellState state = view.getState(cell); + +! if (state != null +! && canvas.intersects(this, hit, state) + && (!graph.isSwimlane(cell) +! || hitSwimlaneContent || (transparentSwimlaneContent && !canvas +! .hitSwimlaneContent(this, state, x, y)))) { + return cell; + } + } + } + } finally { + canvas.setScale(previousScale); +! canvas.setTranslate(previousTranslate.x, previousTranslate.y); + } + } + +--- 373,392 ---- + && (vertex == model.isVertex(cell))) { + mxCellState state = view.getState(cell); + +! if (state != null && canvas.intersects(this, hit, state) + && (!graph.isSwimlane(cell) +! || hitSwimlaneContent +! || (transparentSwimlaneContent +! && !canvas.hitSwimlaneContent( +! this, state, x, y)))) { + return cell; + } + } + } + } finally { + canvas.setScale(previousScale); +! canvas.setTranslate(previousTranslate.getX(), +! previousTranslate.getY()); + } + } + +*************** +*** 396,402 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.mxGraphComponent#setGraph(com.mxgraph.view.mxGraph) + */ +--- 395,401 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.mxGraphComponent#setGraph(com.mxgraph.view.mxGraph) + */ +*************** +*** 429,437 **** + selectionListener); + } + } else { +! throw new IllegalArgumentException("graph " +! + value.getClass().getName() + " is not " +! + TopGraph.class.getName()); + } + } + +--- 428,436 ---- + selectionListener); + } + } else { +! throw new IllegalArgumentException( +! "graph " + value.getClass().getName() + " is not " +! + TopGraph.class.getName()); + } + } + +*************** +*** 466,472 **** + + /** + * Description: +! * + * @param point + */ + public void zoomIn(Point point) { +--- 465,471 ---- + + /** + * Description: +! * + * @param point + */ + public void zoomIn(Point point) { +*************** +*** 475,481 **** + + /** + * Description: +! * + * @param point + */ + public void zoomOut(Point point) { +--- 474,480 ---- + + /** + * Description: +! * + * @param point + */ + public void zoomOut(Point point) { +*************** +*** 489,501 **** + double newScale = view.getScale() * factor; + if (Math.abs(newScale - view.getScale()) > 1e-4 + && newScale > 1e-3) { +! mxPoint translate = +! point == null ? new mxPoint() : getTranslate(point, +! view.getScale(), newScale); + mxPoint oldTranslate = view.getTranslate(); +! view.scaleAndTranslate(newScale, translate.getX() +! + oldTranslate.getX(), translate.getY() +! + oldTranslate.getY()); + restartTimer(); + // System.out.println("ScaleAndTranslate " + view.getScale() + // + " " +--- 488,499 ---- + double newScale = view.getScale() * factor; + if (Math.abs(newScale - view.getScale()) > 1e-4 + && newScale > 1e-3) { +! mxPoint translate = point == null ? new mxPoint() +! : getTranslate(point, view.getScale(), newScale); + mxPoint oldTranslate = view.getTranslate(); +! view.scaleAndTranslate(newScale, +! translate.getX() + oldTranslate.getX(), +! translate.getY() + oldTranslate.getY()); + restartTimer(); + // System.out.println("ScaleAndTranslate " + view.getScale() + // + " " +*************** +*** 505,511 **** + }); + } + +! protected mxPoint getTranslate(Point point, double oldScale, double newScale) { + int x = point.x; + int y = point.y; + double f = (newScale - oldScale) / (oldScale * newScale); +--- 503,510 ---- + }); + } + +! protected mxPoint getTranslate(Point point, double oldScale, +! double newScale) { + int x = point.x; + int y = point.y; + double f = (newScale - oldScale) / (oldScale * newScale); +*************** +*** 529,536 **** + double oldScale = view.getScale(); + mxPoint trans = view.getTranslate(); + // zoom to fit selected area +! view.scaleAndTranslate(oldScale * newScale, -rect.x / oldScale +! + trans.getX(), -rect.y / oldScale + trans.getY()); + // System.out.println("ScaleAndTranslate " + view.getScale() + // + " " + // + view.getTranslate()); +--- 528,536 ---- + double oldScale = view.getScale(); + mxPoint trans = view.getTranslate(); + // zoom to fit selected area +! view.scaleAndTranslate(oldScale * newScale, +! -rect.x / oldScale + trans.getX(), +! -rect.y / oldScale + trans.getY()); + // System.out.println("ScaleAndTranslate " + view.getScale() + // + " " + // + view.getTranslate()); +*************** +*** 539,554 **** + + protected void restartTimer() { + if (repaintTimer == null) { +! repaintTimer = +! new Timer(UIConstants.UPDATE_TIME / 2, +! new ActionListener() { +! @Override +! public void actionPerformed(ActionEvent e) { +! if (repaintTimer != null) { +! updateGraph(); +! } +! } +! }); + repaintTimer.setRepeats(false); + } + repaintTimer.restart(); +--- 539,553 ---- + + protected void restartTimer() { + if (repaintTimer == null) { +! repaintTimer = new Timer(UIConstants.UPDATE_TIME / 2, +! new ActionListener() { +! @Override +! public void actionPerformed(ActionEvent e) { +! if (repaintTimer != null) { +! updateGraph(); +! } +! } +! }); + repaintTimer.setRepeats(false); + } + repaintTimer.restart(); +*************** +*** 567,573 **** + + /** + * Description: +! * + * @param graphComponent + */ + public PanningHandler(mxGraphComponent graphComponent) { +--- 566,572 ---- + + /** + * Description: +! * + * @param graphComponent + */ + public PanningHandler(mxGraphComponent graphComponent) { +*************** +*** 576,582 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxPanningHandler#mousePressed(java.awt. + * event.MouseEvent) +--- 575,581 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxPanningHandler#mousePressed(java.awt. + * event.MouseEvent) +*************** +*** 584,590 **** + @Override + public void mousePressed(final MouseEvent e) { + if (isEnabled() && !e.isConsumed() +! && graphComponent.isPanningEvent(e) && !e.isPopupTrigger()) { + graphControl.setCursor(mxGraphHandler.FOLD_CURSOR); + updateService.submit(new Runnable() { + @Override +--- 583,590 ---- + @Override + public void mousePressed(final MouseEvent e) { + if (isEnabled() && !e.isConsumed() +! && graphComponent.isPanningEvent(e) +! && !e.isPopupTrigger()) { + graphControl.setCursor(mxGraphHandler.FOLD_CURSOR); + updateService.submit(new Runnable() { + @Override +*************** +*** 607,615 **** + int dx = e.getX() - start.x; + int dy = e.getY() - start.y; + double scale = view.getScale(); +! view.setTranslate(new mxPoint(viewTranslate.getX() +! + dx / scale, viewTranslate.getY() + dy +! / scale)); + restartTimer(); + } + e.consume(); +--- 607,615 ---- + int dx = e.getX() - start.x; + int dy = e.getY() - start.y; + double scale = view.getScale(); +! view.setTranslate(new mxPoint( +! viewTranslate.getX() + dx / scale, +! viewTranslate.getY() + dy / scale)); + restartTimer(); + } + e.consume(); +*************** +*** 620,626 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxPanningHandler#mouseReleased(java.awt + * .event.MouseEvent) +--- 620,626 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxPanningHandler#mouseReleased(java.awt + * .event.MouseEvent) +*************** +*** 639,645 **** + + /** + * Description: +! * + * @param graphComponent + */ + public GraphHandler(mxGraphComponent graphComponent) { +--- 639,645 ---- + + /** + * Description: +! * + * @param graphComponent + */ + public GraphHandler(mxGraphComponent graphComponent) { +*************** +*** 649,655 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxGraphHandler#mousePressed(java.awt.event + * .MouseEvent) +--- 649,655 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxGraphHandler#mousePressed(java.awt.event + * .MouseEvent) +*************** +*** 663,669 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxGraphHandler#mouseReleased(java.awt.event + * .MouseEvent) +--- 663,669 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxGraphHandler#mouseReleased(java.awt.event + * .MouseEvent) +*************** +*** 691,714 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxGraphHandler#getCursor(java.awt.event + * .MouseEvent) + */ + @Override + protected synchronized Cursor getCursor(MouseEvent e) { +! mxCell cell = +! (mxCell) graphComponent +! .getCellAt(e.getX(), e.getY(), false); + + updateHighlight(cellFindingId.get(), cell); + if (cell == null) { + return null; + } + +! if (isMoveEnabled() +! && graphComponent.getGraph().isCellMovable(cell) + && isDragTrigger(e)) { + return MOVE_CURSOR; + } else { +--- 691,712 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.handler.mxGraphHandler#getCursor(java.awt.event + * .MouseEvent) + */ + @Override + protected synchronized Cursor getCursor(MouseEvent e) { +! mxCell cell = (mxCell) graphComponent.getCellAt(e.getX(), e.getY(), +! false); + + updateHighlight(cellFindingId.get(), cell); + if (cell == null) { + return null; + } + +! if (isMoveEnabled() && graphComponent.getGraph().isCellMovable(cell) + && isDragTrigger(e)) { + return MOVE_CURSOR; + } else { +*************** +*** 790,808 **** + g2d.dispose(); + } + } finally { +! log.info("Create GraphBuffer-" +! + id +! + " " +! + (img == null ? "" : img.getWidth() + "x" +! + img.getHeight()) + " on " + graph + " in " +! + (System.currentTimeMillis() - t) + " ms"); + } + return new GraphBuffer(view, img, newTrans, newScale); + } + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.mxGraphComponent.mxGraphControl#paint(java.awt. + * Graphics) +--- 788,807 ---- + g2d.dispose(); + } + } finally { +! log.info( +! "Create GraphBuffer-" + id + " " +! + (img == null ? "" +! : img.getWidth() + "x" +! + img.getHeight()) +! + " on " + graph + " in " +! + (System.currentTimeMillis() - t) + " ms"); + } + return new GraphBuffer(view, img, newTrans, newScale); + } + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.mxGraphComponent.mxGraphControl#paint(java.awt. + * Graphics) +*************** +*** 831,837 **** + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.mxGraphComponent.mxGraphControl#updatePreferredSize + * () +--- 830,836 ---- + + /* + * (non-Javadoc) +! * + * @see + * com.mxgraph.swing.mxGraphComponent.mxGraphControl#updatePreferredSize + * () +*************** +*** 852,858 **** + + /** + * Description: +! * + * @param image + * @param trans + * @param scale +--- 851,857 ---- + + /** + * Description: +! * + * @param image + * @param trans + * @param scale +diff -cr 10.1/src/META-INF/MANIFEST.MF 10.4/src/META-INF/MANIFEST.MF +*** 10.1/src/META-INF/MANIFEST.MF 2017-03-07 06:38:29.828359401 -0500 +--- 10.4/src/META-INF/MANIFEST.MF 2017-03-07 06:39:52.194363591 -0500 +*************** +*** 6,13 **** + Implementation-Vendor: Intel Corporation + Implementation-Version: 10.0.0.DEV + Schema-Version: 37 +! Intel-OPAFM-Version: 10.1.0.0.112 +! Intel-Build-Id: 10_1_0_0_112 + Intel-Build-Date: 2016-05-14 08:54:41 + Main-Class: com.intel.stl.main.FMGuiApp + +--- 6,13 ---- + Implementation-Vendor: Intel Corporation + Implementation-Version: 10.0.0.DEV + Schema-Version: 37 +! Intel-OPAFM-Version: 10.1.0.0.114 +! Intel-Build-Id: 10_1_0_0_114 + Intel-Build-Date: 2016-05-14 08:54:41 + Main-Class: com.intel.stl.main.FMGuiApp +