Changeset 1488

Show
Ignore:
Timestamp:
02/20/07 10:14:03 (2 years ago)
Author:
dsugar
Message:

Final fix (hopefully) for dealing with routing and arrows in sub-domains ticket:109
Major change is now there is an invisible figure which is used at the target of the arrow rather than the main figure.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/GraphicPolicyEditor.java

    r1474 r1488  
    2121import org.eclipse.core.resources.IWorkspaceRunnable; 
    2222import org.eclipse.core.runtime.CoreException; 
    23 import org.eclipse.core.runtime.IAdaptable; 
    2423import org.eclipse.core.runtime.IPath; 
    2524import org.eclipse.core.runtime.IProgressMonitor; 
     
    3332import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; 
    3433import org.eclipse.gef.editparts.ZoomManager; 
    35 //import org.eclipse.gef.editparts.ZoomManager; 
    3634import org.eclipse.gef.palette.PaletteRoot; 
    3735import org.eclipse.gef.requests.CreationFactory; 
     
    148146                m_rootEditPart = new ScalableFreeformRootEditPart (); 
    149147                ZoomManager mgr = m_rootEditPart.getZoomManager(); 
    150 //              mgr.setZoom(1); 
    151                  
     148 
    152149                List zoomLevels = new ArrayList(1); 
    153150                zoomLevels.add(ZoomManager.FIT_ALL); 
    154151                mgr.setZoomLevelContributions(zoomLevels); 
    155                  
     152 
    156153                IAction zoomIn = new ZoomInAction (mgr); 
    157154                IAction zoomOut = new ZoomOutAction (mgr); 
     
    160157                getSite().getKeyBindingService().registerAction(zoomIn); 
    161158                getSite().getKeyBindingService().registerAction(zoomOut); 
    162                  
     159 
    163160                GraphicalViewer viewer = getGraphicalViewer(); 
    164161                viewer.setEditPartFactory(new GraphicPolicyFactory ()); 
     
    374371                                } 
    375372                        }, null); 
    376                 } catch (CoreException e) { 
    377                 } 
    378  
     373                }  
     374                catch (CoreException e)  
     375                {} 
    379376 
    380377                // mark as 'saved' 
     
    384381        public void doSaveAs ()  
    385382        { 
    386  
    387383        } 
    388384 
     
    394390        protected void setDocumentProvider (IEditorInput input) 
    395391        { 
    396                  
    397392        } 
    398393         
     
    535530                 * @see IElementStateListener#elementDirtyStateChanged(Object, boolean) 
    536531                 */ 
    537                 public void elementDirtyStateChanged(Object element, boolean isDirty) { 
     532                public void elementDirtyStateChanged(Object element, boolean isDirty)  
     533                { 
    538534                } 
    539535 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/ConnectionFigure.java

    r1468 r1488  
     1/*\ 
     2|*| Copyright (C) 2006 Tresys Technology, LLC 
     3|*| License: refer to COPYING file for license information. 
     4|*| Author:     David Sugar <dsugar@tresys.com> 
     5|*|   
     6|*| Version: @version@ 
     7\*/ 
     8 
    19package com.tresys.framework.plugin.editor.policy.graphic.figure; 
    210 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainSourceConnectionAnchor.java

    r1479 r1488  
    2323{ 
    2424        DomainTargetConnectionAnchor m_peer = null; 
    25 //      Rectangle       m_figBounds = null; 
    26         Point           m_prevRefPoint = null; 
    2725         
    2826        private DomainSourceConnectionAnchor () 
     
    4644                Point loc = m_peer.getLocation().getCopy(); 
    4745 
    48                 Rectangle bounds = getOwner().getBounds()
     46                Rectangle bounds = getOwner().getBounds().getCopy()
    4947                getOwner ().translateToAbsolute(bounds); 
    5048 
     
    5250                { 
    5351                        if (loc.x <= bounds.x) 
    54                                 loc.x = bounds.x + 5
     52                                loc.x = bounds.x + 2
    5553                        if (loc.x >= bounds.x + bounds.width) 
    56                                 loc.x = bounds.x + bounds.width - 5
     54                                loc.x = bounds.x + bounds.width - 2
    5755                         
    5856                        if (loc.y <= bounds.y) 
    59                                 loc.y = bounds.y + 5
     57                                loc.y = bounds.y + 2
    6058                        if (loc.y >= bounds.y + bounds.height) 
    61                                 loc.y = bounds.y + bounds.height - 5
     59                                loc.y = bounds.y + bounds.height - 2
    6260                } 
    6361 
     
    6765        public void ancestorMoved (IFigure figure) 
    6866        { 
    69 //              if (figure.getBounds().equals(m_figBounds)) 
    70 //                      return; 
    71                  
    7267                System.out.println("Source Ancestor Moved - owner " + getOwner() + " figure: " + figure ); 
    73 //              m_figBounds = figure.getBounds().getCopy(); 
    7468                 
    7569                super.ancestorMoved (figure); 
     
    7973        public void anchorMoved (ConnectionAnchor anchor) 
    8074        { 
    81 //              getOwner().repaint(); 
    82 /*       
    83                 if (m_prevRefPoint == null) 
    84                         m_prevRefPoint = anchor.getReferencePoint().getCopy(); 
    85                 else 
    86                 { 
    87                         if (m_prevRefPoint.equals(anchor.getReferencePoint())) 
    88                                 return; 
    89                         m_prevRefPoint = anchor.getReferencePoint().getCopy(); 
    90                 } 
    91 */ 
    9275                System.out.println("Source Anchor Moved - owner " + getOwner()); 
    9376 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/DomainTargetConnectionAnchor.java

    r1479 r1488  
    2323         
    2424        Point   fixedLoc = null; 
    25         Point   m_prevRefPoint = null; 
    26 //      Rectangle       m_figBounds = null; 
    2725         
    2826        private DomainTargetConnectionAnchor () 
     
    3937         
    4038        } 
    41 /* 
    42         public void setLocation (Point i_Location) 
    43         { 
    44                 fixedLoc = i_Location; 
    45         } 
    46 */       
     39 
    4740        public DomainTargetConnectionAnchor (IFigure owner) 
    4841        { 
     
    5346        public void ancestorMoved (IFigure figure) 
    5447        { 
    55 //              if (figure.getBounds().equals(m_figBounds)) 
    56 //                      return; 
    57                  
    5848                System.out.println("Target Ancestor Moved - owner " + getOwner() + " figure: " + figure); 
    59 //              m_figBounds = figure.getBounds().getCopy(); 
    60                  
    6149                super.ancestorMoved (figure); 
    6250        } 
     
    6452        public Point getLocation (Point reference) 
    6553        { 
    66                 //if (fixedLoc != null) 
    67                 //      return fixedLoc; 
    68                  
    6954                Point oldLoc = null; 
    7055                if (fixedLoc != null) 
     
    7560                if (!fixedLoc.equals(oldLoc)) 
    7661                { 
    77 //                      if (oldLoc == null) 
    78 //                              oldLoc = new Point (-1, -1); 
    79                          
    8062                        System.out.println("Target Anchor - owner " + getOwner () + "  Moved was: " + oldLoc + " now: " + fixedLoc); 
    81                          
    82                         if (oldLoc != null) 
    83                         { 
    84                                 int nDistance = fixedLoc.getDistanceOrthogonal(oldLoc); 
    85                                 System.out.println("   Orthogonal Distance: " + nDistance); 
    86                                 if (nDistance < 5) 
    87                                         return fixedLoc; 
    88                         } 
    89                          
    9063                        anchorMoved(this); 
    9164                } 
     
    9770        public void anchorMoved (ConnectionAnchor anchor) 
    9871        { 
    99 //              fixedLoc = anchor.getReferencePoint(); 
    100 /* 
    101                 if (m_prevRefPoint == null) 
    102                         m_prevRefPoint = anchor.getReferencePoint().getCopy(); 
    103                 else 
    104                 { 
    105                         if (m_prevRefPoint.equals(anchor.getReferencePoint())) 
    106                                 return; 
    107                         m_prevRefPoint = anchor.getReferencePoint().getCopy(); 
    108                 } 
    109 */ 
    11072                System.out.println("Target Anchor Moved - owner " + getOwner()); 
    11173                 
     
    12385                return "Domain Target Connection Anchor: " + getOwner().toString(); //$NON-NLS-1$ 
    12486        } 
    125  
    12687} 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java

    r1456 r1488  
    11/*\ 
    2  * |*| Copyright (C) 2006 Tresys Technology, LLC 
     2|*| Copyright (C) 2006 Tresys Technology, LLC 
    33|*| License: refer to COPYING file for license information. 
    44|*| Author:     David Sugar <dsugar@tresys.com> 
     
    326326                        cr.setLocation (loc); 
    327327                } 
    328 
     328                 
     329                 
     330        } 
    329331         
    330332        void add (ControlResourceShape i_controlResource) 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainEditPart.java

    r1480 r1488  
    3131import com.tresys.framework.compiler.policy.Component; 
    3232import com.tresys.framework.compiler.policy.Enter; 
     33import com.tresys.framework.plugin.editor.policy.graphic.figure.ConnectionAnchorFigure; 
    3334import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainFigure; 
    3435import com.tresys.framework.plugin.editor.policy.graphic.figure.DomainSourceConnectionAnchor; 
     
    4950        private ScalableFreeformLayeredPane m_layers = null; 
    5051        private FreeformLayeredPane m_printableLayers = null; 
     52        private ConnectionAnchorFigure m_connectionAnchor = null; 
    5153         
    5254        public DomainEditPart () 
     
    6466                        ConnectionLayer connectionLayer = new ConnectionLayer (); 
    6567                        connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter (mainLayer)); 
    66  
     68                         
    6769                        m_printableLayers = new FreeformLayeredPane (); 
    6870                        m_printableLayers.setLayoutManager(new StackLayout ()); 
    6971                        m_printableLayers.add (connectionLayer, LayerConstants.CONNECTION_LAYER); 
    7072                        m_printableLayers.add (mainLayer, LayerConstants.PRIMARY_LAYER); 
     73 
     74                        mainLayer.add(m_connectionAnchor); 
    7175                } 
    7276 
     
    7478        } 
    7579 
     80         
     81         
    7682        protected LayeredPane getLayers () 
    7783        { 
     
    132138                else if (getModel() instanceof IDomainShape)  
    133139                { 
    134                         fig = new DomainFigure(); 
     140                        DomainFigure domFig = new DomainFigure(); 
     141                        m_connectionAnchor = new ConnectionAnchorFigure (domFig); 
     142                        fig = domFig; 
    135143                } 
    136144                 
     
    251259                if (connection instanceof AccessEditPart) 
    252260                { 
    253                       IFigure domFig = getFigure (); 
     261        //            IFigure domFig = getFigure (); 
    254262 
    255263                        //Get the accessConnection returned from the AccessEditPart's getModel method 
     
    268276                                //source anchors using the resource as the key 
    269277                                DomainTargetConnectionAnchor target = (DomainTargetConnectionAnchor) getTargetConnectionAnchor(connection); 
    270                                 anchor = new DomainSourceConnectionAnchor (domFig, target); 
     278                                anchor = new DomainSourceConnectionAnchor (m_connectionAnchor, target); 
    271279                                sourceAnchors.put (resource, anchor); 
    272280//                              target.addAnchorListener(anchor); 
     
    280288                else if (connection instanceof EntryEditPart) 
    281289                { 
    282                         IFigure domFig = getFigure (); 
    283   
    284290                        EntryConnection entryConnection = (EntryConnection) ((EntryEditPart) connection).getModel(); 
    285291                        Enter enter = entryConnection.getEnter(); 
     
    290296                        { 
    291297                                DomainTargetConnectionAnchor target = (DomainTargetConnectionAnchor) getTargetConnectionAnchor(connection); 
    292                                 anchor = new DomainSourceConnectionAnchor (domFig, target); 
    293                                 sourceAnchors.put(start_domain , anchor); 
     298                                anchor = new DomainSourceConnectionAnchor (m_connectionAnchor, target); 
     299                                sourceAnchors.put (start_domain, anchor); 
    294300                        } 
    295301 
    296302                        return anchor; 
    297                          
    298303                } 
    299304 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainXYLayoutEditPolicy.java

    r1479 r1488  
    2323         
    2424        /** 
    25          * constrain the rectnage to be contained in the parent domain 
     25         * constrain the rectangle to be contained in the parent domain 
    2626         */ 
    2727