Changeset 1476
- Timestamp:
- 02/13/07 15:05:22
(2 years ago)
- Author:
- dsugar
- Message:
more work on problems with arrow routing. Not getting very far. Lots of debugging output in line still.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1453 |
r1476 |
|
| 83 | 83 | Access access = null; |
|---|
| 84 | 84 | if (resource instanceof BaseResource) |
|---|
| | 85 | { |
|---|
| 85 | 86 | access = new AccessBaseResource (domain, (BaseResource) resource, m_nVerb, tok, null, null); |
|---|
| 86 | | else if (resource instanceof Resource) { |
|---|
| 87 | | try { |
|---|
| | 87 | } |
|---|
| | 88 | else if (resource instanceof Resource) |
|---|
| | 89 | { |
|---|
| | 90 | try |
|---|
| | 91 | { |
|---|
| 88 | 92 | access = new AccessResource (domain, (Resource) resource, m_nVerb, tok, null, null); |
|---|
| 89 | | } catch(UnrevokableException ue) { |
|---|
| | 93 | } |
|---|
| | 94 | catch(UnrevokableException ue) |
|---|
| | 95 | { |
|---|
| 90 | 96 | tok.Error("This type of Rdef AccessDefn cannot be wrapped inside a boolean", ErrorHandler.ERROR_BOOLEAN_WRAP, access.toString()); |
|---|
| 91 | 97 | return null; |
|---|
| 92 | 98 | } |
|---|
| 93 | 99 | } |
|---|
| 94 | | AccessConnection connection = new AccessConnection(i_domain, i_resource, access, outerConn); |
|---|
| | 100 | |
|---|
| | 101 | System.out.println ("Create Access Connection: Source: " + i_resource.toString() + " Target: " + i_domain.toString()); |
|---|
| | 102 | AccessConnection connection = new AccessConnection (i_domain, i_resource, access, outerConn); |
|---|
| 95 | 103 | if (m_NewConnections == null) |
|---|
| 96 | 104 | m_NewConnections = new Vector (); |
|---|
| r1474 |
r1476 |
|
| 19 | 19 | |
|---|
| 20 | 20 | public class DomainSourceConnectionAnchor |
|---|
| 21 | | extends ChopboxAnchor//extends AbstractConnectionAnchor |
|---|
| 22 | | implements AnchorListener |
|---|
| | 21 | extends ChopboxAnchor //extends AbstractConnectionAnchor |
|---|
| | 22 | // implements AnchorListener |
|---|
| 23 | 23 | { |
|---|
| 24 | 24 | DomainTargetConnectionAnchor m_peer = null; |
|---|
| | 25 | // Rectangle m_figBounds = null; |
|---|
| 25 | 26 | Point m_prevRefPoint = null; |
|---|
| 26 | 27 | |
|---|
| … | … | |
| 33 | 34 | { |
|---|
| 34 | 35 | super (owner); |
|---|
| | 36 | System.out.println("Create DomainSourceConnectionAnchor for figure: " + owner.toString() + " peer: " + i_peer.toString()); |
|---|
| | 37 | |
|---|
| 35 | 38 | m_peer = i_peer; |
|---|
| 36 | | i_peer.addAnchorListener(this); |
|---|
| 37 | | addAnchorListener(i_peer); |
|---|
| | 39 | // i_peer.addAnchorListener(this); |
|---|
| | 40 | // addAnchorListener(i_peer); |
|---|
| 38 | 41 | } |
|---|
| 39 | 42 | |
|---|
| … | … | |
| 64 | 67 | public void ancestorMoved (IFigure figure) |
|---|
| 65 | 68 | { |
|---|
| 66 | | System.out.println("Source Ancestor Moved - owner " + getOwner()); |
|---|
| 67 | | |
|---|
| | 69 | // if (figure.getBounds().equals(m_figBounds)) |
|---|
| | 70 | // return; |
|---|
| | 71 | |
|---|
| | 72 | System.out.println("Source Ancestor Moved - owner " + getOwner() + " figure: " + figure ); |
|---|
| | 73 | // m_figBounds = figure.getBounds().getCopy(); |
|---|
| | 74 | |
|---|
| 68 | 75 | super.ancestorMoved (figure); |
|---|
| 69 | | getOwner().repaint(); |
|---|
| | 76 | // getOwner().repaint(); |
|---|
| 70 | 77 | } |
|---|
| 71 | 78 | |
|---|
| 72 | 79 | public void anchorMoved (ConnectionAnchor anchor) |
|---|
| 73 | 80 | { |
|---|
| 74 | | getOwner().repaint(); |
|---|
| | 81 | // getOwner().repaint(); |
|---|
| 75 | 82 | /* |
|---|
| 76 | 83 | if (m_prevRefPoint == null) |
|---|
| … | … | |
| 84 | 91 | */ |
|---|
| 85 | 92 | System.out.println("Source Anchor Moved - owner " + getOwner()); |
|---|
| | 93 | /* |
|---|
| 86 | 94 | for (Iterator itr = listeners.iterator(); itr.hasNext (); ) |
|---|
| 87 | 95 | { |
|---|
| … | … | |
| 91 | 99 | listener.anchorMoved(this); |
|---|
| 92 | 100 | } |
|---|
| 93 | | |
|---|
| | 101 | */ |
|---|
| 94 | 102 | } |
|---|
| 95 | 103 | |
|---|
| r1474 |
r1476 |
|
| 16 | 16 | import org.eclipse.draw2d.IFigure; |
|---|
| 17 | 17 | import org.eclipse.draw2d.geometry.Point; |
|---|
| | 18 | import org.eclipse.draw2d.geometry.Rectangle; |
|---|
| 18 | 19 | |
|---|
| 19 | 20 | public class DomainTargetConnectionAnchor |
|---|
| 20 | 21 | extends ChopboxAnchor |
|---|
| 21 | | implements AnchorListener |
|---|
| | 22 | // implements AnchorListener |
|---|
| 22 | 23 | { |
|---|
| 23 | 24 | |
|---|
| 24 | 25 | Point fixedLoc = null; |
|---|
| 25 | 26 | Point m_prevRefPoint = null; |
|---|
| | 27 | // Rectangle m_figBounds = null; |
|---|
| 26 | 28 | |
|---|
| 27 | 29 | private DomainTargetConnectionAnchor () |
|---|
| … | … | |
| 47 | 49 | { |
|---|
| 48 | 50 | super (owner); |
|---|
| | 51 | System.out.println("Create DomainTargetConnectionAnchor for figure: " + owner.toString()); |
|---|
| 49 | 52 | } |
|---|
| 50 | 53 | |
|---|
| 51 | 54 | public void ancestorMoved (IFigure figure) |
|---|
| 52 | 55 | { |
|---|
| 53 | | System.out.println("Target Ancestor Moved - owner " + getOwner()); |
|---|
| 54 | | // super.ancestorMoved (figure); |
|---|
| | 56 | // if (figure.getBounds().equals(m_figBounds)) |
|---|
| | 57 | // return; |
|---|
| | 58 | |
|---|
| | 59 | System.out.println("Target Ancestor Moved - owner " + getOwner() + " figure: " + figure); |
|---|
| | 60 | // m_figBounds = figure.getBounds().getCopy(); |
|---|
| | 61 | |
|---|
| | 62 | super.ancestorMoved (figure); |
|---|
| 55 | 63 | } |
|---|
| 56 | 64 | |
|---|
| … | … | |
| 68 | 76 | if (!fixedLoc.equals(oldLoc)) |
|---|
| 69 | 77 | { |
|---|
| 70 | | if (oldLoc == null) |
|---|
| 71 | | oldLoc = new Point (-1, -1); |
|---|
| 72 | | System.out.println("Target Anchor - owner " + getOwner () + " Moved was: " + oldLoc.toString() + " now: " + fixedLoc.toString()); |
|---|
| 73 | | anchorMoved(this); |
|---|
| | 78 | // if (oldLoc == null) |
|---|
| | 79 | // oldLoc = new Point (-1, -1); |
|---|
| | 80 | |
|---|
| | 81 | System.out.println("Target Anchor - owner " + getOwner () + " Moved was: " + oldLoc + " now: " + fixedLoc); |
|---|
| | 82 | |
|---|
| | 83 | if (oldLoc != null) |
|---|
| | 84 | { |
|---|
| | 85 | int nDistance = fixedLoc.getDistanceOrthogonal(oldLoc); |
|---|
| | 86 | System.out.println(" Orthogonal Distance: " + nDistance); |
|---|
| | 87 | if (nDistance < 5) |
|---|
| | 88 | return fixedLoc; |
|---|
| | 89 | } |
|---|
| | 90 | |
|---|
| | 91 | // anchorMoved(this); |
|---|
| 74 | 92 | } |
|---|
| 75 | 93 | |
|---|
| r1475 |
r1476 |
|
| 14 | 14 | import org.eclipse.draw2d.ConnectionAnchor; |
|---|
| 15 | 15 | import org.eclipse.draw2d.ConnectionLayer; |
|---|
| | 16 | import org.eclipse.draw2d.FreeformLayer; |
|---|
| 16 | 17 | import org.eclipse.draw2d.FreeformLayout; |
|---|
| 17 | 18 | import org.eclipse.draw2d.FreeformViewport; |
|---|
| 18 | 19 | import org.eclipse.draw2d.IFigure; |
|---|
| | 20 | import org.eclipse.draw2d.LayeredPane; |
|---|
| 19 | 21 | import org.eclipse.draw2d.ScalableFreeformLayeredPane; |
|---|
| | 22 | import org.eclipse.draw2d.ScalableLayeredPane; |
|---|
| 20 | 23 | import org.eclipse.draw2d.ScrollPane; |
|---|
| 21 | 24 | import org.eclipse.draw2d.ShortestPathConnectionRouter; |
|---|
| 22 | 25 | import org.eclipse.draw2d.StackLayout; |
|---|
| | 26 | import org.eclipse.draw2d.Viewport; |
|---|
| | 27 | import org.eclipse.draw2d.XYLayout; |
|---|
| 23 | 28 | import org.eclipse.gef.ConnectionEditPart; |
|---|
| 24 | 29 | import org.eclipse.gef.EditPolicy; |
|---|
| … | … | |
| 30 | 35 | import com.tresys.framework.compiler.policy.Enter; |
|---|
| 31 | 36 | import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainFigure; |
|---|
| | 37 | import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainPane; |
|---|
| 32 | 38 | import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainSourceConnectionAnchor; |
|---|
| 33 | 39 | import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainTargetConnectionAnchor; |
|---|
| … | … | |
| 47 | 53 | |
|---|
| 48 | 54 | private ConnectionLayer m_connectionLayer = null; |
|---|
| 49 | | private ScalableFreeformLayeredPane pane = null; |
|---|
| | 55 | private IFigure pane = null; |
|---|
| 50 | 56 | |
|---|
| 51 | 57 | public DomainEditPart () |
|---|
| … | … | |
| 89 | 95 | super.createEditPolicies(); |
|---|
| 90 | 96 | |
|---|
| | 97 | // handles constraint changes (e.g. moving and/or resizing) of model elements |
|---|
| | 98 | // and creation of new model elements |
|---|
| | 99 | PolicyXYLayoutEditPolicy layout = new DomainXYLayoutEditPolicy((XYLayout)getContentPane().getLayoutManager()); |
|---|
| | 100 | |
|---|
| | 101 | installEditPolicy(EditPolicy.LAYOUT_ROLE, layout); |
|---|
| | 102 | |
|---|
| 91 | 103 | // allow removal of the associated model element |
|---|
| 92 | 104 | installEditPolicy(EditPolicy.COMPONENT_ROLE, new ShapeComponentEditPolicy()); |
|---|
| … | … | |
| 103 | 115 | && !getChildren().isEmpty()) |
|---|
| 104 | 116 | { |
|---|
| 105 | | setFilterEditPart (this); |
|---|
| | 117 | // setFilterEditPart (this); |
|---|
| 106 | 118 | } |
|---|
| 107 | 119 | } |
|---|
| … | … | |
| 118 | 130 | return null; |
|---|
| 119 | 131 | |
|---|
| 120 | | ScrollPane scrollPane = new ScrollPane (); |
|---|
| 121 | | |
|---|
| 122 | 132 | if (pane == null) |
|---|
| 123 | 133 | { |
|---|
| … | … | |
| 125 | 135 | pane.setLayoutManager (new FreeformLayout ()); |
|---|
| 126 | 136 | // pane.setScale(0.75); |
|---|
| 127 | | |
|---|
| | 137 | /* |
|---|
| | 138 | ScrollPane scrollPane = new ScrollPane (); |
|---|
| | 139 | scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER); |
|---|
| | 140 | scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER); |
|---|
| | 141 | scrollPane. |
|---|
| 128 | 142 | fig.setLayoutManager(new StackLayout ()); // XYLayout ()); |
|---|
| 129 | 143 | fig.add (scrollPane); |
|---|
| 130 | 144 | scrollPane.setViewport(new FreeformViewport ()); |
|---|
| 131 | 145 | scrollPane.setContents(pane); |
|---|
| | 146 | // fig. |
|---|
| | 147 | // fig.add(pane); |
|---|
| | 148 | */ |
|---|
| | 149 | DomainPane domainPane = new DomainPane (pane); |
|---|
| | 150 | fig.setLayoutManager(new StackLayout ()); // XYLayout ()); |
|---|
| | 151 | fig.add (domainPane); |
|---|
| 132 | 152 | |
|---|
| 133 | 153 | ConnectionLayer connLayer = (ConnectionLayer)getLayer(LayerConstants.CONNECTION_LAYER); |
|---|
| 134 | | connLayer.setConnectionRouter(new ShortestPathConnectionRouter (pane)); |
|---|
| | 154 | connLayer.setConnectionRouter (new ShortestPathConnectionRouter (pane)); |
|---|
| 135 | 155 | |
|---|
| 136 | 156 | pane.add(connLayer, LayerConstants.CONNECTION_LAYER); |
|---|
| 137 | | |
|---|
| 138 | | } |
|---|
| 139 | | |
|---|
| | 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 | */ |
|---|
| 140 | 168 | return pane; |
|---|
| 141 | 169 | } |
|---|
| r1442 |
r1476 |
|
| 54 | 54 | protected void createEditPolicies () |
|---|
| 55 | 55 | { |
|---|
| 56 | | // handles constraint changes (e.g. moving and/or resizing) of model elements |
|---|
| 57 | | // and creation of new model elements |
|---|
| 58 | | PolicyXYLayoutEditPolicy layout = new PolicyXYLayoutEditPolicy((XYLayout)getContentPane().getLayoutManager()); |
|---|
| 59 | | |
|---|
| 60 | | installEditPolicy(EditPolicy.LAYOUT_ROLE, layout); |
|---|
| 61 | 56 | installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new PolicyContainerHighlightEditPolicy()); |
|---|
| 62 | 57 | } |
|---|
| r1253 |
r1476 |
|
| 20 | 20 | import org.eclipse.draw2d.MarginBorder; |
|---|
| 21 | 21 | import org.eclipse.draw2d.ShortestPathConnectionRouter; |
|---|
| | 22 | import org.eclipse.draw2d.XYLayout; |
|---|
| 22 | 23 | import org.eclipse.gef.EditPolicy; |
|---|
| 23 | 24 | import org.eclipse.gef.LayerConstants; |
|---|
| … | … | |
| 44 | 45 | { |
|---|
| 45 | 46 | super.createEditPolicies(); |
|---|
| | 47 | |
|---|
| | 48 | // handles constraint changes (e.g. moving and/or resizing) of model elements |
|---|
| | 49 | // and creation of new model elements |
|---|
| | 50 | PolicyXYLayoutEditPolicy layout = new PolicyXYLayoutEditPolicy((XYLayout)getContentPane().getLayoutManager()); |
|---|
| | 51 | |
|---|
| | 52 | installEditPolicy(EditPolicy.LAYOUT_ROLE, layout); |
|---|
| | 53 | |
|---|
| 46 | 54 | // disallows the removal of this edit part from its parent |
|---|
| 47 | 55 | installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); |
|---|
Download in other formats:
* Generating other formats may take time.