Changeset 1476

Show
Ignore:
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
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/AbstractAccessConnectionCommand.java

    r1453 r1476  
    8383                Access access = null; 
    8484                if (resource instanceof BaseResource) 
     85                { 
    8586                        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                        { 
    8892                                access = new AccessResource (domain, (Resource) resource, m_nVerb, tok, null, null); 
    89                         } catch(UnrevokableException ue) { 
     93                        } 
     94                        catch(UnrevokableException ue)  
     95                        { 
    9096                                tok.Error("This type of Rdef AccessDefn cannot be wrapped inside a boolean", ErrorHandler.ERROR_BOOLEAN_WRAP, access.toString()); 
    9197                                return null; 
    9298                        } 
    9399                } 
    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); 
    95103                if (m_NewConnections == null) 
    96104                        m_NewConnections = new Vector (); 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainSourceConnectionAnchor.java

    r1474 r1476  
    1919 
    2020public class DomainSourceConnectionAnchor 
    21         extends ChopboxAnchor//extends AbstractConnectionAnchor 
    22       implements AnchorListener 
     21        extends ChopboxAnchor //extends AbstractConnectionAnchor 
     22//    implements AnchorListener 
    2323{ 
    2424        DomainTargetConnectionAnchor m_peer = null; 
     25//      Rectangle       m_figBounds = null; 
    2526        Point           m_prevRefPoint = null; 
    2627         
     
    3334        { 
    3435                super (owner); 
     36                System.out.println("Create DomainSourceConnectionAnchor for figure: " + owner.toString() + " peer: " + i_peer.toString()); 
     37 
    3538                m_peer = i_peer; 
    36               i_peer.addAnchorListener(this); 
    37               addAnchorListener(i_peer); 
     39//            i_peer.addAnchorListener(this); 
     40//            addAnchorListener(i_peer); 
    3841        } 
    3942 
     
    6467        public void ancestorMoved (IFigure figure) 
    6568        { 
    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                 
    6875                super.ancestorMoved (figure); 
    69               getOwner().repaint(); 
     76//            getOwner().repaint(); 
    7077        } 
    7178 
    7279        public void anchorMoved (ConnectionAnchor anchor) 
    7380        { 
    74               getOwner().repaint(); 
     81//            getOwner().repaint(); 
    7582/*       
    7683                if (m_prevRefPoint == null) 
     
    8491*/ 
    8592                System.out.println("Source Anchor Moved - owner " + getOwner()); 
     93/* 
    8694                for (Iterator itr = listeners.iterator(); itr.hasNext (); ) 
    8795                { 
     
    9199                        listener.anchorMoved(this); 
    92100                } 
    93  
     101*/ 
    94102        } 
    95103         
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainTargetConnectionAnchor.java

    r1474 r1476  
    1616import org.eclipse.draw2d.IFigure; 
    1717import org.eclipse.draw2d.geometry.Point; 
     18import org.eclipse.draw2d.geometry.Rectangle; 
    1819 
    1920public class DomainTargetConnectionAnchor 
    2021        extends ChopboxAnchor 
    21       implements AnchorListener 
     22//    implements AnchorListener 
    2223{ 
    2324         
    2425        Point   fixedLoc = null; 
    2526        Point   m_prevRefPoint = null; 
     27//      Rectangle       m_figBounds = null; 
    2628         
    2729        private DomainTargetConnectionAnchor () 
     
    4749        { 
    4850                super (owner); 
     51                System.out.println("Create DomainTargetConnectionAnchor for figure: " + owner.toString()); 
    4952        } 
    5053 
    5154        public void ancestorMoved (IFigure figure) 
    5255        { 
    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); 
    5563        } 
    5664 
     
    6876                if (!fixedLoc.equals(oldLoc)) 
    6977                { 
    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); 
    7492                } 
    7593                 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainEditPart.java

    r1475 r1476  
    1414import org.eclipse.draw2d.ConnectionAnchor; 
    1515import org.eclipse.draw2d.ConnectionLayer; 
     16import org.eclipse.draw2d.FreeformLayer; 
    1617import org.eclipse.draw2d.FreeformLayout; 
    1718import org.eclipse.draw2d.FreeformViewport; 
    1819import org.eclipse.draw2d.IFigure; 
     20import org.eclipse.draw2d.LayeredPane; 
    1921import org.eclipse.draw2d.ScalableFreeformLayeredPane; 
     22import org.eclipse.draw2d.ScalableLayeredPane; 
    2023import org.eclipse.draw2d.ScrollPane; 
    2124import org.eclipse.draw2d.ShortestPathConnectionRouter; 
    2225import org.eclipse.draw2d.StackLayout; 
     26import org.eclipse.draw2d.Viewport; 
     27import org.eclipse.draw2d.XYLayout; 
    2328import org.eclipse.gef.ConnectionEditPart; 
    2429import org.eclipse.gef.EditPolicy; 
     
    3035import com.tresys.framework.compiler.policy.Enter; 
    3136import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainFigure; 
     37import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainPane; 
    3238import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainSourceConnectionAnchor; 
    3339import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainTargetConnectionAnchor; 
     
    4753 
    4854        private ConnectionLayer m_connectionLayer = null; 
    49         private ScalableFreeformLayeredPane pane = null; 
     55        private IFigure pane = null; 
    5056 
    5157        public DomainEditPart () 
     
    8995                super.createEditPolicies(); 
    9096                 
     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 
    91103                // allow removal of the associated model element 
    92104                installEditPolicy(EditPolicy.COMPONENT_ROLE, new ShapeComponentEditPolicy()); 
     
    103115                        && !getChildren().isEmpty()) 
    104116                {                        
    105                       setFilterEditPart (this); 
     117//                    setFilterEditPart (this); 
    106118                } 
    107119        } 
     
    118130                        return null; 
    119131 
    120                 ScrollPane scrollPane = new ScrollPane (); 
    121                  
    122132                if (pane == null) 
    123133                { 
     
    125135                        pane.setLayoutManager (new FreeformLayout ()); 
    126136//                      pane.setScale(0.75); 
    127  
     137/* 
     138                        ScrollPane scrollPane = new ScrollPane (); 
     139                        scrollPane.setHorizontalScrollBarVisibility(ScrollPane.NEVER); 
     140                        scrollPane.setVerticalScrollBarVisibility(ScrollPane.NEVER); 
     141                        scrollPane. 
    128142                        fig.setLayoutManager(new StackLayout ()); // XYLayout ()); 
    129143                        fig.add (scrollPane); 
    130144                        scrollPane.setViewport(new FreeformViewport ()); 
    131145                        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); 
    132152 
    133153                        ConnectionLayer connLayer = (ConnectionLayer)getLayer(LayerConstants.CONNECTION_LAYER); 
    134                         connLayer.setConnectionRouter(new ShortestPathConnectionRouter (pane)); 
     154                        connLayer.setConnectionRouter (new ShortestPathConnectionRouter (pane)); 
    135155 
    136156                        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*/               
    140168                return pane; 
    141169        } 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyContainerEditPart.java

    r1442 r1476  
    5454        protected void createEditPolicies () 
    5555        { 
    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); 
    6156                installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new PolicyContainerHighlightEditPolicy()); 
    6257        } 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyDiagramEditPart.java

    r1253 r1476  
    2020import org.eclipse.draw2d.MarginBorder; 
    2121import org.eclipse.draw2d.ShortestPathConnectionRouter; 
     22import org.eclipse.draw2d.XYLayout; 
    2223import org.eclipse.gef.EditPolicy; 
    2324import org.eclipse.gef.LayerConstants; 
     
    4445        { 
    4546                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 
    4654                // disallows the removal of this edit part from its parent 
    4755                installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());