Changeset 1479
- Timestamp:
- 02/15/07 16:43:38 (2 years ago)
- Files:
-
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainPane.java (deleted)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainSourceConnectionAnchor.java (modified) (5 diffs)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainTargetConnectionAnchor.java (modified) (3 diffs)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/PolicyConnectionLayer.java (deleted)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/AbstractConnectionEditPart.java (modified) (4 diffs)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainEditPart.java (modified) (5 diffs)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainXYLayoutEditPolicy.java (modified) (2 diffs)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyContainerEditPart.java (modified) (1 diff)
- trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyContainerHighlightEditPolicy.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainSourceConnectionAnchor.java
r1476 r1479 20 20 public class DomainSourceConnectionAnchor 21 21 extends ChopboxAnchor //extends AbstractConnectionAnchor 22 //implements AnchorListener22 implements AnchorListener 23 23 { 24 24 DomainTargetConnectionAnchor m_peer = null; … … 37 37 38 38 m_peer = i_peer; 39 //i_peer.addAnchorListener(this);40 //addAnchorListener(i_peer);39 i_peer.addAnchorListener(this); 40 addAnchorListener(i_peer); 41 41 } 42 42 … … 74 74 75 75 super.ancestorMoved (figure); 76 //getOwner().repaint();76 getOwner().repaint(); 77 77 } 78 78 … … 91 91 */ 92 92 System.out.println("Source Anchor Moved - owner " + getOwner()); 93 /* 93 94 94 for (Iterator itr = listeners.iterator(); itr.hasNext (); ) 95 95 { … … 99 99 listener.anchorMoved(this); 100 100 } 101 */ 101 102 102 } 103 103 trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainTargetConnectionAnchor.java
r1476 r1479 16 16 import org.eclipse.draw2d.IFigure; 17 17 import org.eclipse.draw2d.geometry.Point; 18 import org.eclipse.draw2d.geometry.Rectangle;19 18 20 19 public class DomainTargetConnectionAnchor 21 20 extends ChopboxAnchor 22 //implements AnchorListener21 implements AnchorListener 23 22 { 24 23 … … 89 88 } 90 89 91 //anchorMoved(this);90 anchorMoved(this); 92 91 } 93 92 … … 118 117 listener.anchorMoved(this); 119 118 } 120 121 122 119 } 123 120 trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/AbstractConnectionEditPart.java
r1475 r1479 48 48 new XYAnchor(new Point(100, 100)); 49 49 50 private IFigure m_connectionLayer = null;50 // private IFigure m_connectionLayer = null; 51 51 /** 52 52 * Provides accessibility support for when connections are also themselves nodes. If a … … 287 287 if (!wasNull && (!bSameParent || becomingNull)) 288 288 removeNotify(); 289 m_connectionLayer = null;289 // m_connectionLayer = null; 290 290 super.setParent(parent); 291 291 if (!becomingNull && (!bSameParent || wasNull)) … … 339 339 EditPart ep = getSource().getParent(); 340 340 EditPart epParent = editPart.getParent(); 341 EditPart thisPart = this;342 EditPart thisSourceParent = getSource().getParent();343 Assert.isTrue( getSource().getParent() == editPart.getParent()344 || getSource().getParent()== editPart345 || getSource() == e ditPart.getParent(), "Connection end points must have same parent");341 // EditPart thisPart = this; 342 // EditPart thisSourceParent = getSource().getParent(); 343 Assert.isTrue(ep == epParent 344 || ep == editPart 345 || getSource() == epParent, "Connection end points must have same parent"); 346 346 } 347 347 … … 367 367 368 368 IFigure layer_figure = super.getLayer(layer); 369 if (LayerConstants.CONNECTION_LAYER.equals(layer)) 370 { 371 if (m_connectionLayer == null) 372 { 373 m_connectionLayer = layer_figure; 374 if (parent != null && parent instanceof DomainEditPart) 375 m_connectionLayer = ((DomainEditPart) parent).getConnectionLayer(); 376 } 377 layer_figure = m_connectionLayer; 369 370 if (parent instanceof DomainEditPart) 371 { 372 layer_figure = ((DomainEditPart) parent).getLayer (layer); 373 378 374 } 379 375 trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainEditPart.java
r1476 r1479 15 15 import org.eclipse.draw2d.ConnectionLayer; 16 16 import org.eclipse.draw2d.FreeformLayer; 17 import org.eclipse.draw2d.FreeformLayeredPane; 17 18 import org.eclipse.draw2d.FreeformLayout; 18 import org.eclipse.draw2d.FreeformViewport;19 19 import org.eclipse.draw2d.IFigure; 20 20 import org.eclipse.draw2d.LayeredPane; 21 21 import org.eclipse.draw2d.ScalableFreeformLayeredPane; 22 import org.eclipse.draw2d.ScalableLayeredPane;23 import org.eclipse.draw2d.ScrollPane;24 22 import org.eclipse.draw2d.ShortestPathConnectionRouter; 25 23 import org.eclipse.draw2d.StackLayout; 26 import org.eclipse.draw2d.Viewport;27 24 import org.eclipse.draw2d.XYLayout; 28 25 import org.eclipse.gef.ConnectionEditPart; … … 35 32 import com.tresys.framework.compiler.policy.Enter; 36 33 import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainFigure; 37 import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainPane;38 34 import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainSourceConnectionAnchor; 39 35 import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainTargetConnectionAnchor; 40 import com.tresys.framework.plugin.editor.policy.graphic.figure.PolicyConnectionLayer;41 36 import com.tresys.framework.plugin.editor.policy.graphic.figure.UserDomainFigure; 42 37 import com.tresys.framework.plugin.editor.policy.graphic.model.AccessConnection; … … 52 47 private Map targetAnchors = new HashMap (); 53 48 54 private ConnectionLayer m_connectionLayer= null;55 private IFigure pane= null;56 49 private LayeredPane m_layers = null; 50 private FreeformLayeredPane m_printableLayers = null; 51 57 52 public DomainEditPart () 58 53 { 59 54 super (); 60 55 } 56 57 protected LayeredPane getPrintableLayers () 58 { 59 if (m_printableLayers == null) 60 { 61 FreeformLayer mainLayer = new FreeformLayer (); 62 mainLayer.setLayoutManager(new FreeformLayout ()); 63 64 ConnectionLayer connectionLayer = new ConnectionLayer (); 65 connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter (mainLayer)); 66 67 m_printableLayers = new FreeformLayeredPane (); 68 m_printableLayers.setLayoutManager(new StackLayout ()); 69 m_printableLayers.add (connectionLayer, LayerConstants.CONNECTION_LAYER); 70 m_printableLayers.add (mainLayer, LayerConstants.PRIMARY_LAYER); 71 72 } 73 74 return m_printableLayers; 75 } 76 77 protected LayeredPane createLayers () 78 { 79 IFigure fig = getFigure (); 80 fig.setLayoutManager(new StackLayout ()); 81 82 83 ScalableFreeformLayeredPane layers = new ScalableFreeformLayeredPane (); 84 layers.setLayoutManager(new StackLayout ()); 85 layers.setScale(.75); 86 87 IFigure figureConetnts = layers; 88 89 // layers.add (new GridLayer (), LayerConstants.GRID_LAYER); 90 layers.add (getPrintableLayers (), LayerConstants.PRINTABLE_LAYERS); 91 // layers.add (new FreeformLayer (), LayerConstants.HANDLE_LAYER); 92 //layers.add (new FeedbackLayer (), LayerConstants.FEEDBACK_LAYER); 93 // layers.add (new GuideLayer (), LayerConstants.GUIDE_LAYER); 94 95 /* 96 // for scrolling in domains 97 // may cause problems with connection routing 98 ScrollPane scrollPane = new ScrollPane (); 99 // scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER); 100 // scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER); 101 scrollPane.setViewport (new FreeformViewport ()); 102 scrollPane.setContents(layers); 103 figureConetnts = scrollPane; 104 // */ 105 106 fig.add (figureConetnts); 107 108 return layers; 109 } 61 110 62 111 protected IFigure getLayer (Object layer) 63 112 { 64 if (LayerConstants.CONNECTION_LAYER.equals(layer)) 65 { 66 if (m_connectionLayer == null) 67 { 68 m_connectionLayer = new PolicyConnectionLayer (); 69 } 70 71 return m_connectionLayer; 72 } 73 return super.getLayer (layer); 113 if (m_layers == null) 114 m_layers = createLayers (); 115 116 IFigure fig = m_layers.getLayer(layer); 117 if (fig == null) 118 fig = m_printableLayers.getLayer(layer); 119 120 if (fig == null) 121 fig = super.getLayer(layer); 122 123 return fig; 74 124 } 75 125 … … 85 135 fig = new DomainFigure(); 86 136 } 87 //FIXME: should there be another else here to ensure no null pointer issues?88 89 137 90 138 return fig; … … 119 167 } 120 168 121 public ConnectionLayer getConnectionLayer ()122 {123 return (ConnectionLayer) getLayer (LayerConstants.CONNECTION_LAYER);124 }125 126 169 public IFigure getContentPane () 127 170 { 171 /* 128 172 IFigure fig = getFigure(); 129 173 if (!(fig instanceof DomainFigure)) 130 174 return null; 131 132 if (pane == null)133 {134 pane = new ScalableFreeformLayeredPane ();135 pane.setLayoutManager (new FreeformLayout ());136 // pane.setScale(0.75);137 /*138 ScrollPane scrollPane = new ScrollPane ();139 scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER);140 scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER);141 scrollPane.142 fig.setLayoutManager(new StackLayout ()); // XYLayout ());143 fig.add (scrollPane);144 scrollPane.setViewport(new FreeformViewport ());145 scrollPane.setContents(pane);146 // fig.147 // fig.add(pane);148 175 */ 149 DomainPane domainPane = new DomainPane (pane); 150 fig.setLayoutManager(new StackLayout ()); // XYLayout ()); 151 fig.add (domainPane); 152 153 ConnectionLayer connLayer = (ConnectionLayer)getLayer(LayerConstants.CONNECTION_LAYER); 154 connLayer.setConnectionRouter (new ShortestPathConnectionRouter (pane)); 155 156 pane.add(connLayer, LayerConstants.CONNECTION_LAYER); 157 } 158 /* 159 160 if (pane == null) 161 { 162 // ScrollPane scrollPane = new ScrollPane (); 163 pane = new FreeformLayer (); 164 pane.setLayoutManager(new FreeformLayout ()); 165 fig.setLayoutManager(new FreeformLayout ()); 166 } 167 */ 168 return pane; 176 177 return getLayer (LayerConstants.PRIMARY_LAYER); 178 169 179 } 170 180 trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainXYLayoutEditPolicy.java
r1476 r1479 13 13 import org.eclipse.draw2d.geometry.Rectangle; 14 14 15 import com.tresys.framework.plugin.editor.policy.graphic.model.Shape;16 17 15 public class DomainXYLayoutEditPolicy 18 16 extends PolicyXYLayoutEditPolicy … … 22 20 { 23 21 super (i_layout); 24 // TODO Auto-generated constructor stub25 22 } 23 24 /** 25 * constrain the rectnage to be contained in the parent domain 26 */ 26 27 27 28 public Object getConstraintFor (Rectangle r) 28 29 { 30 Dimension shapeSize = getLayoutContainer().getSize(); 31 29 32 if (r.x < 5) 30 33 r.x = 5; 31 34 if (r.y < 5) 32 35 r.y = 5; 33 34 Dimension shapeSize = ((Shape) getHost().getModel()).getSize(); 35 36 if (r.y + r.height > shapeSize.height - 10) 37 r.y = shapeSize.height - 10 - r.height; 38 if (r.x + r.width > shapeSize.width -10) 39 r.x = shapeSize.width - 10 - r.width; 40 36 37 if (r.height > shapeSize.height) 38 r.height = shapeSize.height - 10; 39 if (r.width > shapeSize.width) 40 r.width = shapeSize.width - 10; 41 42 if (r.y + r.height > shapeSize.height - 5) 43 r.y = shapeSize.height - 5 - r.height; 44 if (r.x + r.width > shapeSize.width - 5) 45 r.x = shapeSize.width - 5 - r.width; 46 41 47 return super.getConstraintFor (r); 42 48 } trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyContainerEditPart.java
r1476 r1479 15 15 import java.util.List; 16 16 17 import org.eclipse.draw2d.XYLayout;18 17 import org.eclipse.gef.EditPart; 19 18 import org.eclipse.gef.EditPolicy; trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyContainerHighlightEditPolicy.java
r1336 r1479 46 46 private IFigure getContainerFigure () 47 47 { 48 return ((GraphicalEditPart) getHost ()).getFigure (); 48 // ((DomainEditPart) getHost ()).getL 49 return ((GraphicalEditPart) getHost ()).getContentPane(); // getFigure (); 49 50 } 50 51
