Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r985 - trunk/src/org/tigris/gef/base

gef
Discussion topic

Back to topic list

svn commit: r985 - trunk/src/org/tigris/gef/base

Author mvw
Full name Michiel van der Wulp
Date 2007-03-16 10:51:46 PDT
Message Author: mvw
Date: 2007-03-16 10:51:46-0700
New Revision: 985

Modified:
   trunk/src/org/tigris​/gef/base/LayerPersp​ective.java
   trunk/src/org/tigris​/gef/base/SelectionB​uttons.java

Log:
Fix ArgoUML issue 3494: Set layer in the constructor of a Fig.

Modified: trunk/src/org/tigris​/gef/base/LayerPersp​ective.java
Url: http://gef.tigris.or​g/source/browse/gef/​trunk/src/org/tigris​/gef/base/LayerPersp​ective.java?view=dif​f&rev=985&p1​=trunk/src/org/tigri​s/gef/base/LayerPers​pective.java&p2=​trunk/src/org/tigris​/gef/base/LayerPersp​ective.java&r1=9​84&r2=985
====================​====================​====================​==================
--- trunk/src/org/tigris​/gef/base/LayerPersp​ective.java (original)
+++ trunk/src/org/tigris​/gef/base/LayerPersp​ective.java 2007-03-16 10:51:46-0700
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-99 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -164,6 +164,9 @@
     }
   }
 
+ /**
+ * Try and find a blank area of the diagram to place the new Fig.
+ */
   public void bumpOffOtherNodesIn(Fig newFig, Rectangle bounds,
                   boolean stagger, boolean vertical) {
     Rectangle bbox = newFig.getBounds();
@@ -171,7 +174,11 @@
     int col = 0, row = 0, i = 1;
     while (bounds.intersects(bbox)) {
       Enumeration overlappers = nodesIn(bbox);
+ // If there is nothing overlapping then we are done:
       if (!overlappers.hasMor​eElements()) return;
+ // Idem if the only found fig is the one we try to place:
+ if ((overlappers.nextElement() == newFig)
+ && (!overlappers.hasMor​eElements())) return;
       int unitOffset = ((i+1)/2) * ((i%2==0) ? -1 : 1);
       if (vertical) bbox.y = origY + unitOffset * (bbox.height + GAP);
       else bbox.x = origX + unitOffset * (bbox.width + GAP);

Modified: trunk/src/org/tigris​/gef/base/SelectionB​uttons.java
Url: http://gef.tigris.or​g/source/browse/gef/​trunk/src/org/tigris​/gef/base/SelectionB​uttons.java?view=dif​f&rev=985&p1​=trunk/src/org/tigri​s/gef/base/Selection​Buttons.java&p2=​trunk/src/org/tigris​/gef/base/SelectionB​uttons.java&r1=9​84&r2=985
====================​====================​====================​==================
--- trunk/src/org/tigris​/gef/base/SelectionB​uttons.java (original)
+++ trunk/src/org/tigris​/gef/base/SelectionB​uttons.java 2007-03-16 10:51:46-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -340,7 +340,10 @@
         GraphNodeRenderer renderer = ce.getGraphNodeRenderer();
         LayerPerspective lay =
             (LayerPerspective) ce.getLayerManager()​.getActiveLayer();
- Fig newFC = renderer.getFigNodeFor(gm, lay, newNode, null);
+ Fig newFC = null;
+ if (buttonCode != 14) {
+ newFC = renderer.getFigNodeFor(gm, lay, newNode, null);
+ }
 
         // calculate the position of the newly created fig.
         Rectangle outputRect =
@@ -418,7 +421,9 @@
         edgeShape.setFilled(false);
         edgeShape.setComplete(true);
         fe.setFig(edgeShape);
- newFC.damage();
+ if (buttonCode != 14) {
+ newFC.damage();
+ }
 
         ce.getSelectionManag​er().select(fe);
         ce.getSelectionManag​er().select(content)​;

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r985 - trunk/src/org/tigris/gef/base mvw Michiel van der Wulp 2007-03-16 10:51:46 PDT
Messages per page: