From: <ger...@us...> - 2012-06-07 21:14:59
|
Revision: 6631 http://squirrel-sql.svn.sourceforge.net/squirrel-sql/?rev=6631&view=rev Author: gerdwagner Date: 2012-06-07 21:14:53 +0000 (Thu, 07 Jun 2012) Log Message: ----------- Graph Plugin: Tables can be selected by rectangle selection like icons on a desktop of modern operating systems. Modified Paths: -------------- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/RectangleSelectionHandler.java trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/ConstraintView.java trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/GraphDesktopController.java Modified: trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/RectangleSelectionHandler.java =================================================================== --- trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/RectangleSelectionHandler.java 2012-06-07 20:39:24 UTC (rev 6630) +++ trunk/sql12/fw/src/main/java/net/sourceforge/squirrel_sql/fw/gui/RectangleSelectionHandler.java 2012-06-07 21:14:53 UTC (rev 6631) @@ -13,6 +13,7 @@ private Point _dragBeginPoint = null; private Point _dragEndPoint = null; private RectangleSelectionListener _rectangleSelectionListener; + private boolean _cancelCurrentSelection; public RectangleSelectionHandler(JComponent comp) @@ -42,7 +43,7 @@ */ public void paintRectWhenNeeded(Graphics g) { - if(null != _dragBeginPoint && null != _dragEndPoint && false == _dragBeginPoint.equals(_dragEndPoint)) + if(false == _cancelCurrentSelection && null != _dragBeginPoint && null != _dragEndPoint && false == _dragBeginPoint.equals(_dragEndPoint)) { int x = Math.min(_dragBeginPoint.x, _dragEndPoint.x); int y = Math.min(_dragBeginPoint.y, _dragEndPoint.y); @@ -84,12 +85,13 @@ private void onMouseReleased() { - if (null != _rectangleSelectionListener && null != _dragBeginPoint && null != _dragEndPoint) + if (false == _cancelCurrentSelection && null != _rectangleSelectionListener && null != _dragBeginPoint && null != _dragEndPoint) { _rectangleSelectionListener.rectSelected(_dragBeginPoint, _dragEndPoint); } _dragBeginPoint = null; _dragEndPoint = null; + _cancelCurrentSelection = false; _comp.repaint(); } @@ -111,4 +113,9 @@ Rectangle selRect = new Rectangle(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y), Math.abs(p1.x - p2.x), Math.abs(p1.y - p2.y)); return bounds.intersects(selRect); } + + public void cancelCurrentSelection() + { + _cancelCurrentSelection = true; + } } Modified: trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/ConstraintView.java =================================================================== --- trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/ConstraintView.java 2012-06-07 20:39:24 UTC (rev 6630) +++ trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/ConstraintView.java 2012-06-07 21:14:53 UTC (rev 6631) @@ -782,8 +782,10 @@ maybeShowPopup(e); } - public void mouseDragged(MouseEvent e) + public boolean mouseDragged(MouseEvent e) { + boolean foldingPointMoved = false; + if (false == _constraintGraph.isHitOnConnectLine()) { double zoom = _desktopController.getZoomer().getZoom(); @@ -795,6 +797,7 @@ //_constraintGraph.moveLastHitFoldingPointTo(point); _constraintGraph.moveLastHitFoldingPointTo(new FoldingPoint(backTransformedPoint, _desktopController.getZoomer())); + foldingPointMoved = true; ConstraintViewListener[] listeners = @@ -804,6 +807,8 @@ listeners[i].foldingPointMoved(this); } } + + return foldingPointMoved; } public FoldingPoint getFirstFoldingPoint() Modified: trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/GraphDesktopController.java =================================================================== --- trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/GraphDesktopController.java 2012-06-07 20:39:24 UTC (rev 6630) +++ trunk/sql12/plugins/graph/src/main/java/net/sourceforge/squirrel_sql/plugins/graph/GraphDesktopController.java 2012-06-07 21:14:53 UTC (rev 6631) @@ -761,7 +761,10 @@ { if(null != _lastPressedConstraintView) { - _lastPressedConstraintView.mouseDragged(e); + if(_lastPressedConstraintView.mouseDragged(e)) + { + _rectangleSelectionHandler.cancelCurrentSelection(); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |