1.1 --- a/compapp.casaeditor/src/org/netbeans/modules/compapp/casaeditor/design/CasaModelGraphScene.java Fri Apr 13 05:15:20 2007 +0000
1.2 +++ b/compapp.casaeditor/src/org/netbeans/modules/compapp/casaeditor/design/CasaModelGraphScene.java Fri Apr 13 06:26:31 2007 +0000
1.3 @@ -157,10 +157,16 @@
1.4 }
1.5
1.6
1.7 + // Our layout is finalized if every node widget's location matches its model location.
1.8 public boolean isLayoutFinalized() {
1.9 return mIsLayoutFinalized;
1.10 }
1.11
1.12 + // Our layout is finalized if every node widget's location matches its model location.
1.13 + public void setLayoutFinalized(boolean isFinalized) {
1.14 + mIsLayoutFinalized = isFinalized;
1.15 + }
1.16 +
1.17 public void persistLocation(CasaNodeWidget widget, Point location) {
1.18 if (location != null && widget.getBounds() != null) {
1.19 if (!isAdjusting()) {
2.1 --- a/compapp.casaeditor/src/org/netbeans/modules/compapp/casaeditor/design/CasaModelGraphUtilities.java Fri Apr 13 05:15:20 2007 +0000
2.2 +++ b/compapp.casaeditor/src/org/netbeans/modules/compapp/casaeditor/design/CasaModelGraphUtilities.java Fri Apr 13 06:26:31 2007 +0000
2.3 @@ -102,6 +102,10 @@
2.4 scene.removeRegion(ob);
2.5 }
2.6
2.7 + // Initially the empty graph should be finalized, we later set this to
2.8 + // false if any node widget we add has an invalid model location.
2.9 + scene.setLayoutFinalized(true);
2.10 +
2.11 // add JBIComponent objects to scene
2.12
2.13 // add regions
2.14 @@ -205,17 +209,6 @@
2.15 }
2.16 externalRegionWidget.setPreferredBounds(new Rectangle(externalWidth, RegionUtilities.DEFAULT_HEIGHT));
2.17
2.18 - // Set up a new connection router to account for the widgets in our regions.
2.19 - // We, temporarily, do not use the standard OrthogonalSearchRouter. We used a slightly
2.20 - // modified version that can support passing in the context ConnectionWidget so that
2.21 - // connections that share endpoints do not collide with each other.
2.22 -// scene.setRouter(RouterFactory.createOrthogonalSearchRouter(new CasaCollisionCollector(
2.23 -// scene.setRouter(new CasaOrthogonalSearchRouter(new CasaCollisionCollector(
2.24 -// bindingRegionWidget,
2.25 -// engineRegionWidget,
2.26 -// externalRegionWidget,
2.27 -// scene.getConnectionLayer())));
2.28 -
2.29 // Resizers
2.30 scene.getLeftResizer().setPreferredLocation( new Point(
2.31 engineRegionWidget.getPreferredLocation().x - RegionUtilities.RESIZER_HALF_WIDTH,
2.32 @@ -252,6 +245,8 @@
2.33 // set the location
2.34 if (x > 0 && y > 0) {
2.35 widget.setPreferredLocation(new Point(x, y));
2.36 + } else {
2.37 + scene.setLayoutFinalized(false);
2.38 }
2.39
2.40 return widget;
2.41 @@ -277,6 +272,8 @@
2.42 // set the location
2.43 if (x > 0 && y > 0) {
2.44 widget.setPreferredLocation(new Point(x, y));
2.45 + } else {
2.46 + scene.setLayoutFinalized(false);
2.47 }
2.48
2.49 return widget;