0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s):
0025: *
0026: * The Original Software is NetBeans. The Initial Developer of the Original
0027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028: * Microsystems, Inc. All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: */
0041:
0042: package org.netbeans.modules.uml.ui.swing.drawingarea;
0043:
0044: import java.awt.Frame;
0045: import java.awt.Point;
0046: import java.awt.dnd.DropTargetDropEvent;
0047: import java.util.List;
0048: import javax.swing.JToolBar;
0049:
0050: import com.tomsawyer.editor.TSEGraph;
0051: import com.tomsawyer.editor.TSEObject;
0052: import com.tomsawyer.editor.TSEObjectUI;
0053: import com.tomsawyer.graph.TSEdge;
0054: import com.tomsawyer.graph.TSGraphManager;
0055: import com.tomsawyer.graph.TSGraphObject;
0056: import com.tomsawyer.graph.TSNode;
0057: import com.tomsawyer.util.TSObject;
0058:
0059: import org.netbeans.modules.uml.common.ETException;
0060: import org.netbeans.modules.uml.common.generics.ETPairT;
0061: import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
0062: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamedElement;
0063: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
0064: import org.netbeans.modules.uml.core.metamodel.core.foundation.IPresentationElement;
0065: import org.netbeans.modules.uml.core.metamodel.diagrams.IBroadcastAction;
0066: import org.netbeans.modules.uml.core.metamodel.diagrams.ICoreRelationshipDiscovery;
0067: import org.netbeans.modules.uml.core.metamodel.diagrams.IDelayedAction;
0068: import org.netbeans.modules.uml.core.metamodel.diagrams.IDiagram;
0069: import org.netbeans.modules.uml.core.metamodel.diagrams.IDiagramValidation;
0070: import org.netbeans.modules.uml.core.metamodel.diagrams.IDiagramValidationResult;
0071: import org.netbeans.modules.uml.core.metamodel.diagrams.IGraphicExportDetails;
0072: import org.netbeans.modules.uml.core.metamodel.diagrams.IProxyDiagram;
0073: import org.netbeans.modules.uml.core.metamodel.infrastructure.coreinfrastructure.IClassifier;
0074: import org.netbeans.modules.uml.core.metamodel.structure.IProject;
0075: import org.netbeans.modules.uml.core.support.umlsupport.IETPoint;
0076: import org.netbeans.modules.uml.core.support.umlsupport.IETRect;
0077: import org.netbeans.modules.uml.core.support.umlsupport.IResultCell;
0078: import org.netbeans.modules.uml.core.support.umlutils.ETList;
0079: import org.netbeans.modules.uml.core.support.umlutils.IPropertyElement;
0080: import org.netbeans.modules.uml.ui.controls.drawingarea.IDrawingAreaEventDispatcher;
0081: import org.netbeans.modules.uml.ui.products.ad.compartments.ETCompartment;
0082: import org.netbeans.modules.uml.ui.products.ad.graphobjects.ETEdge;
0083: import org.netbeans.modules.uml.ui.products.ad.graphobjects.ETNode;
0084: import org.netbeans.modules.uml.ui.support.applicationmanager.ILabelPresentation;
0085: import org.netbeans.modules.uml.ui.support.applicationmanager.IPresentationTypesMgr;
0086: import org.netbeans.modules.uml.ui.support.archivesupport.IProductArchive;
0087: import org.netbeans.modules.uml.ui.support.contextmenusupport.IProductContextMenu;
0088: import org.netbeans.modules.uml.ui.support.contextmenusupport.IProductContextMenuItem;
0089: import org.netbeans.modules.uml.ui.support.viewfactorysupport.ICompartment;
0090: import org.netbeans.modules.uml.ui.support.viewfactorysupport.IETGraphObject;
0091: import org.netbeans.modules.uml.ui.support.viewfactorysupport.IETLabel;
0092: import org.netbeans.modules.uml.ui.support.viewfactorysupport.INotificationTargets;
0093: import org.netbeans.modules.uml.ui.support.viewfactorysupport.ITSGraphObject;
0094: import org.netbeans.modules.uml.ui.support.viewfactorysupport.IToolTipData;
0095:
0096: public interface IDrawingAreaControl {
0097: public static int SOK_MOVEFORWARD = 0;
0098: public static int SOK_MOVETOFRONT = 1;
0099: public static int SOK_MOVEBACKWARD = 2;
0100: public static int SOK_MOVETOBACK = 3;
0101:
0102: public void onMoveForward();
0103:
0104: public void onMoveToFront();
0105:
0106: public void onMoveBackward();
0107:
0108: public void onMoveToBack();
0109:
0110: /**
0111: * Returns the IDiagram that represents this ActiveX control
0112: */
0113: public IDiagram getDiagram();
0114:
0115: /**
0116: * Is this IDiagram representing this IAxDrawingAreaControl?
0117: */
0118: public boolean isSame(IDiagram pDiagram);
0119:
0120: /**
0121: * Handles keystrokes, including VK_DELETE which does deletions from the GET.
0122: */
0123: public boolean handleKeyDown(int nKeyCode, int nShift,
0124: boolean bAskUserAboutDelete);
0125:
0126: /**
0127: * Returns the DiagramEngine that controls this diagram
0128: */
0129: public IDiagramEngine getDiagramEngine();
0130:
0131: /**
0132: * Returns the IAxTrackBar, if this diagram has one
0133: */
0134: public Object getTrackBar();
0135:
0136: /**
0137: * Returns the IProxyDiagram that represents this ActiveX control
0138: */
0139: public IProxyDiagram getProxyDiagram();
0140:
0141: /**
0142: * Save this diagram.
0143: */
0144: public void save();
0145:
0146: /**
0147: * Allows the drawing area control to perform some cleanup before the diagram
0148: * is actually closed.
0149: */
0150: public void preClose();
0151:
0152: /**
0153: * Is this diagram readonly?
0154: */
0155: public boolean getReadOnly();
0156:
0157: /**
0158: * Is this diagram readonly?
0159: */
0160: public void setReadOnly(boolean value);
0161:
0162: /**
0163: * Saves the diagram as a BMP, EMF or JPG file. Use pMap to get the details of the graphic.
0164: */
0165: public boolean saveAsGraphic(String sFilename, /* SaveAsGraphicKind */
0166: int nKind);
0167:
0168: /**
0169: * Saves the diagram as a BMP, EMF or JPG file.
0170: */
0171: public IGraphicExportDetails saveAsGraphic2(String sFilename, /* SaveAsGraphicKind */
0172: int nKind);
0173:
0174: public IGraphicExportDetails saveAsGraphic2(String sFilename, /* SaveAsGraphicKind */
0175: int nKind, double scale);
0176:
0177: /**
0178: * Get the filename that this view is saved to
0179: */
0180: public String getFilename();
0181:
0182: /**
0183: * Get/Set the name of this drawing.
0184: */
0185: public String getName();
0186:
0187: /**
0188: * Get/Set the name of this drawing.
0189: */
0190: public void setName(String value);
0191:
0192: /**
0193: * Get/Set the alias of this drawing.
0194: */
0195: public String getAlias();
0196:
0197: /**
0198: * Get/Set the alias of this drawing.
0199: */
0200: public void setAlias(String value);
0201:
0202: /**
0203: * Sets / Gets the name or alias of this element.
0204: */
0205: public String getNameWithAlias();
0206:
0207: /**
0208: * Sets / Gets the name or alias of this element.
0209: */
0210: public void setNameWithAlias(String value);
0211:
0212: /**
0213: * Retrieves the fully qualified name of the element. This will be in the form 'A::B::C'.
0214: */
0215: public String getQualifiedName();
0216:
0217: /**
0218: * Gets the drawing area namespace
0219: */
0220: public INamespace getNamespace();
0221:
0222: /**
0223: * Gets the drawing area namespace
0224: */
0225: public void setNamespace(INamespace value);
0226:
0227: /**
0228: * Returns the the namespace to use when elements are created on the diagram. Usually this is the same as the namespace of the diagram
0229: */
0230: public INamespace getNamespaceForCreatedElements();
0231:
0232: /**
0233: * Sets / Gets the documentation for this diagram.
0234: */
0235: public String getDocumentation();
0236:
0237: /**
0238: * Sets / Gets the documentation for this diagram.
0239: */
0240: public void setDocumentation(String value);
0241:
0242: /**
0243: * Sets the ModelElement member responsible for hooking up a newly created node/edge to the meta data
0244: */
0245: public IElement getModelElement();
0246:
0247: /**
0248: * Sets the ModelElement member responsible for hooking up a newly created node/edge to the meta data
0249: */
0250: public void setModelElement(IElement value);
0251:
0252: /**
0253: * Gets the drawing area toplevel project
0254: */
0255: public IProject getProject();
0256:
0257: /**
0258: * Load this diagram from a .etl file.
0259: */
0260: public int load(String sFilename, boolean fitToZoom);
0261:
0262: /**
0263: * Set the view description. This will determine the type of node that gets created.
0264: */
0265: public String getNodeDescription();
0266:
0267: /**
0268: * Set the view description. This will determine the type of node that gets created.
0269: */
0270: public void setNodeDescription(String value);
0271:
0272: // /**
0273: // * Changes the node description without changing the current tool.
0274: // */
0275: // public void changeNodeDescription( String newVal );
0276:
0277: /**
0278: * Set the view description for edges. This will determine the type of node that gets created.
0279: */
0280: public String getEdgeDescription();
0281:
0282: /**
0283: * Set the view description for edges. This will determine the type of node that gets created.
0284: */
0285: public void setEdgeDescription(String value);
0286:
0287: /**
0288: * Changes the edge description without changing the current tool.
0289: */
0290: public void changeEdgeDescription(String newVal);
0291:
0292: /**
0293: * Puts the drawing area into a certain mouse mode
0294: */
0295: public void enterMode( /* DrawingToolKind */int nDrawingToolKind);
0296:
0297: /**
0298: * Get/Set the locked state for the current mode.
0299: */
0300: public boolean getModeLocked();
0301:
0302: /**
0303: * Get/Set the locked state for the current mode.
0304: */
0305: public void setModeLocked(boolean value);
0306:
0307: /**
0308: * Used to set sticky buttons. The user of the diagram can set/get this to determine when to lock/unlock the current tool.
0309: */
0310: public int getLastSelectedButton();
0311:
0312: /**
0313: * Used to set sticky buttons. The user of the diagram can set/get this to determine when to lock/unlock the current tool.
0314: */
0315: public void setLastSelectedButton(int value);
0316:
0317: /**
0318: * Puts the drawing area into a specific mode based on the sButtonID. sButtonID is a key in the PresentationTypes.etc file.
0319: */
0320: public void enterModeFromButton(String sButtonID);
0321:
0322: /**
0323: * Set/Get the current layout style.
0324: */
0325: public void setLayoutStyle( /* LayoutKind */int value);
0326:
0327: /**
0328: * Set/Get the current layout style.
0329: */
0330: public int getLayoutStyle();
0331:
0332: /**
0333: * Set/Get the current layout style - this one does the layout without asking the user if its ok.
0334: */
0335: public void setLayoutStyleSilently( /* LayoutKind */int value);
0336:
0337: /**
0338: * Use a delayed action to perform the layout style, possibly ignoring containment
0339: */
0340: public void delayedLayoutStyle( /* LayoutKind */int nLayoutStyle,
0341: boolean bIgnoreContainment);
0342:
0343: /**
0344: * Immediately sets the layout style. It bypasses the delayed actions.
0345: */
0346: public void immediatelySetLayoutStyle(
0347: /* LayoutKind */int nLayoutStyle, boolean bSilent);
0348:
0349: /**
0350: * Is the layout properties window open.
0351: */
0352: public boolean getIsLayoutPropertiesDialogOpen();
0353:
0354: /**
0355: * Show/Close the layout property window.
0356: */
0357: public void layoutPropertiesDialog(boolean bShow);
0358:
0359: /**
0360: * Is the graph preferences window open.
0361: */
0362: public boolean getIsGraphPreferencesDialogOpen();
0363:
0364: /**
0365: * Show/Close the graph preferences window.
0366: */
0367: public void graphPreferencesDialog(boolean bShow);
0368:
0369: /**
0370: * Is the overview window open.
0371: */
0372: public boolean getIsOverviewWindowOpen();
0373:
0374: /**
0375: * Show/Hide the overview window.
0376: */
0377: public void overviewWindow(boolean bShowIt);
0378:
0379: /**
0380: * Returns the window rect of the overview window, if it is open.
0381: */
0382: public IETRect getOverviewWindowRect();
0383:
0384: /**
0385: * Sets the window rect of the overview window, if it is open.
0386: */
0387: public void setOverviewWindowRect(int nLeft, int nTop, int nWidth,
0388: int nHeight);
0389:
0390: /**
0391: * Show/Close the image dialog..
0392: */
0393: public void showImageDialog();
0394:
0395: /**
0396: * Print preview this window
0397: */
0398: public void printPreview(String sTitle, boolean bCanMoveParent);
0399:
0400: /**
0401: * During draw the edges/links override the zoom - this happens during print preview and the overview window.
0402: */
0403: public void setOnDrawZoom(double nOnDrawZoom);
0404:
0405: /**
0406: * Tells the drawing area that on draw has ended.
0407: */
0408: public void endOnDrawZoom();
0409:
0410: /**
0411: * Shows the print setup dialog
0412: */
0413: public void loadPrintSetupDialog();
0414:
0415: /**
0416: * Prints this control
0417: */
0418: public void printGraph(boolean bShowDialog);
0419:
0420: /**
0421: * Is the diagram currently undergoing layout.
0422: */
0423: public boolean getLayoutRunning();
0424:
0425: /**
0426: * What is the current zoom of the diagram.
0427: */
0428: public double getCurrentZoom();
0429:
0430: /**
0431: * Get the extreme values for the zoom.
0432: */
0433: public ETPairT<Double, Double> getExtremeZoomValues();
0434:
0435: /**
0436: * Zoom the diagram.
0437: */
0438: public void zoom(double nScaleFactor);
0439:
0440: /**
0441: * Zoom in.
0442: */
0443: public void zoomIn();
0444:
0445: /**
0446: * Zoom out.
0447: */
0448: public void zoomOut();
0449:
0450: /**
0451: * Fit the current diagram to the window.
0452: */
0453: public void fitInWindow();
0454:
0455: /**
0456: * Go to the parent graph
0457: */
0458: public void goToParentGraph();
0459:
0460: /**
0461: * Do we have a parent graph?
0462: */
0463: public boolean getHasParentGraph();
0464:
0465: /**
0466: * Bring up the custom zoom dialog
0467: */
0468: public void onCustomZoom();
0469:
0470: /**
0471: * Does this diagram have selected nodes?
0472: */
0473: public boolean getHasSelected(boolean bDeep);
0474:
0475: /**
0476: * Does this diagram have selected edges?
0477: */
0478: public boolean getHasSelectedEdges(boolean bDeep);
0479:
0480: /**
0481: * Does this diagram have selected labels?
0482: */
0483: public boolean getHasSelectedLabels(boolean bDeep);
0484:
0485: /**
0486: * Does this diagram have selected nodes?
0487: */
0488: public boolean getHasSelectedNodes(boolean bDeep);
0489:
0490: /**
0491: * Get the raw TS graph editor
0492: */
0493: //public TSGraphEditor getGraphEditor();
0494: /**
0495: * Go to the child graph
0496: */
0497: public void goToChildGraph(TSNode pNode);
0498:
0499: /**
0500: * Go to the child graph
0501: */
0502: public void deleteChildGraph(TSGraphObject pGraphObject);
0503:
0504: /**
0505: * Do we have a child graph?
0506: */
0507: public boolean getHasChildGraph(TSNode pNode);
0508:
0509: /**
0510: * Unfolds the specified node
0511: */
0512: public void unfoldNode(TSNode pCurrentNode);
0513:
0514: /**
0515: * Hide/Show the grid
0516: */
0517: public boolean getShowGrid();
0518:
0519: /**
0520: * Hide/Show the grid
0521: */
0522: public void setShowGrid(boolean value);
0523:
0524: /**
0525: * Sets/Gets the current grid size
0526: */
0527: public int getGridSize();
0528:
0529: /**
0530: * Sets/Gets the current grid size
0531: */
0532: public void setGridSize(int value);
0533:
0534: /**
0535: * Sets/Gets the type of grid this is being displayed
0536: */
0537: public int getGridType();
0538:
0539: /**
0540: * Sets/Gets the type of grid this is being displayed
0541: */
0542: public void setGridType( /* GridKind */int value);
0543:
0544: /**
0545: * Invalidates the drawing area
0546: */
0547: public void refresh(boolean bPostMessage);
0548:
0549: /**
0550: * Invalidates a portion of the drawing area
0551: */
0552: public void refreshRect(IETRect pRefreshRect);
0553:
0554: /**
0555: * Posts an invalidate event on the drawing area
0556: */
0557: public void postInvalidate(IPresentationElement pPresentationElement);
0558:
0559: /**
0560: * Cut the selected objects
0561: */
0562: public void cut();
0563:
0564: /**
0565: * Copy the selected objects
0566: */
0567: public void copy();
0568:
0569: /**
0570: * Paste the selected objects
0571: */
0572: public void paste();
0573:
0574: /**
0575: * Do a cross diagram paste
0576: */
0577: public void crossDiagramPaste(java.awt.Point location);
0578:
0579: /**
0580: * Is this element type allowed on this diagram?
0581: */
0582: public boolean isAllowedOnDiagram(IElement pElement);
0583:
0584: /**
0585: * Clears the clipboard of selected objects
0586: */
0587: public void clearClipboard();
0588:
0589: /**
0590: * Deletes the selected objects
0591: */
0592: public void deleteSelected(boolean bAskUser);
0593:
0594: /**
0595: * Are there items on the clipbaord
0596: */
0597: public boolean itemsOnClipboard();
0598:
0599: /**
0600: * Select all nodes,labels and edges
0601: */
0602: public void selectAll(boolean bSelect);
0603:
0604: /**
0605: * Select all similar presentation elements
0606: */
0607: public void selectAllSimilar();
0608:
0609: /**
0610: * Does this graph have nodes?
0611: */
0612: public long hasNodes(boolean bHasNodes);
0613:
0614: /**
0615: * Does this graph have labels?
0616: */
0617: public long hasLabels(boolean bHasLabels);
0618:
0619: /**
0620: * Does this graph have edges?
0621: */
0622: public long hasEdges(boolean bHasEdges);
0623:
0624: /**
0625: * Does this graph have edges, labels or nodes?
0626: */
0627: public long hasGraphObjects(boolean bHasObjects);
0628:
0629: /**
0630: * Get/Set the type of this drawing.
0631: */
0632: public int getDiagramKind();
0633:
0634: /**
0635: * Get/Set the type of this drawing.
0636: */
0637: public void setDiagramKind( /* DiagramKind */int value);
0638:
0639: /**
0640: * Get/Set the type of this drawing.
0641: */
0642: public String getDiagramKind2();
0643:
0644: /**
0645: * Get/Set the type of this drawing.
0646: */
0647: public void setDiagramKind2(String value);
0648:
0649: /**
0650: * Initialize a newly created diagram. This adds the diagram to the current IWorkspace.
0651: */
0652: public void initializeNewDiagram(INamespace pNamespace,
0653: String sName, /* DiagramKind */int pKind);
0654:
0655: /**
0656: * Alerts the nodes attached to this model element of changes.
0657: */
0658: public void elementModified(INotificationTargets pTargets);
0659:
0660: /**
0661: * Alerts the nodes attached to this model element of changes.
0662: */
0663: public void elementDeleted(INotificationTargets pTargets);
0664:
0665: /**
0666: * Alerts the nodes attached to this model element of the transformation.
0667: */
0668: public void elementTransformed(IClassifier classifier);
0669:
0670: /**
0671: * Returns the HWND to the GET.
0672: */
0673: public int getWindowHandle();
0674:
0675: /**
0676: * Returns the HWND to the drawing area.
0677: */
0678: public int getDiagramWindowHandle();
0679:
0680: public ADGraphWindow getGraphWindow();
0681:
0682: /**
0683: * Inverts the selected objects.
0684: */
0685: public void invertSelection();
0686:
0687: /**
0688: * Returns a list of the selected items.
0689: */
0690: public ETList<IPresentationElement> getSelected();
0691:
0692: /**
0693: * Returns a list of the selected items (nodes and edges).
0694: */
0695: public ETList<IETGraphObject> getSelected2();
0696:
0697: /**
0698: * Returns a list of the selected items (nodes, edges and labels).
0699: */
0700: public ETList<IETGraphObject> getSelected3();
0701:
0702: /**
0703: * Returns a list of the selected items as IETElements.
0704: */
0705: public ETList<IElement> getSelected4();
0706:
0707: /**
0708: * Returns a list of the selected items that are of the indicated type (ie Class).
0709: */
0710: public ETList<IPresentationElement> getSelectedByType(String sType);
0711:
0712: /**
0713: * Returns a list of the selected labels.
0714: */
0715: public ETList<IETLabel> getSelectedLabels();
0716:
0717: /**
0718: * Sorts the nodes left to right. Edges are ignored.
0719: */
0720: public ETList<IPresentationElement> sortNodesLeftToRight(
0721: ETList<IPresentationElement> pUnsortedList);
0722:
0723: /**
0724: * Returns a list of all the node presentation elements that represent the IElement.
0725: */
0726: public ETList<IPresentationElement> getAllNodeItems(
0727: IElement pModelElement);
0728:
0729: /**
0730: * Returns a list of all the items.
0731: */
0732: public ETList<IPresentationElement> getAllItems();
0733:
0734: /**
0735: * Returns a list of all the items that represent the IElement.
0736: */
0737: public ETList<IPresentationElement> getAllItems2(
0738: IElement pModelElement);
0739:
0740: /**
0741: * Returns a list of all the model elements on the diagram.
0742: */
0743: public ETList<IElement> getAllItems3();
0744:
0745: /**
0746: * Returns a list of all the product elements on the diagram.
0747: */
0748: public ETList<IETGraphObject> getAllItems4();
0749:
0750: /**
0751: * Returns a list of all the product labels on the diagram.
0752: */
0753: public ETList<IETLabel> getAllItems5();
0754:
0755: /**
0756: * Returns a list of all the product graph objects on the diagram.
0757: */
0758: public ETList<IETGraphObject> getAllItems6();
0759:
0760: public ETList<IPresentationElement> getAllItems(String topLevelId,
0761: String meid);
0762:
0763: /**
0764: * Select all the objects on the diagram that are of the indicated type (ie Class)
0765: */
0766: public ETList<IPresentationElement> getAllByType(String sType);
0767:
0768: /**
0769: * Select all the objects on the diagram that are of the indicated type (ie Class)
0770: */
0771: public ETList<IElement> getAllElementsByType(String sType);
0772:
0773: /**
0774: * Select all the objects on the diagram that are of the indicated draw engine type (ie ClassDrawEngine)
0775: */
0776: public ETList<IPresentationElement> getAllElementsByDrawEngineType(
0777: String sType);
0778:
0779: /**
0780: * Returns all the graph objects.
0781: */
0782: public ETList<TSObject> getAllGraphObjects();
0783:
0784: /**
0785: * Returns all the node presentation elements contained in or touching the input rectangle.
0786: */
0787: public ETList<IPresentationElement> getAllNodesViaRect(
0788: IETRect pRect, boolean bTouchingRect);
0789:
0790: /**
0791: * Returns all the edge presentation elements contained in or touching the input rectangle.
0792: */
0793: public ETList<IPresentationElement> getAllEdgesViaRect(
0794: IETRect pRect, boolean bTouchingRect);
0795:
0796: /**
0797: * Returns true if the model element is displayed in the diagram.
0798: */
0799: public boolean getIsDisplayed(IElement pModelElement);
0800:
0801: /**
0802: * Transforms a rect from logical coordinates to device coordinates.
0803: */
0804: public IETRect logicalToDeviceRect(IETRect pLogical);
0805:
0806: /**
0807: * Transforms a rect from logical coordinates to device coordinates.
0808: */
0809: public IETRect logicalToDeviceRect(double left, double top,
0810: double right, double bottom);
0811:
0812: /**
0813: * Transforms a point from logical coordinates to device coordinates.
0814: */
0815: public IETPoint logicalToDevicePoint(IETPoint pLogical);
0816:
0817: /**
0818: * Transforms a point from logical coordinates to device coordinates.
0819: */
0820: public IETPoint logicalToDevicePoint(double x, double y);
0821:
0822: /**
0823: * Transforms a rect from device coordinates to logical coordinates.
0824: */
0825: public IETRect deviceToLogicalRect(IETRect pDevice);
0826:
0827: /**
0828: * Transforms a rect from device coordinates to logical coordinates.
0829: */
0830: public IETRect deviceToLogicalRect(double left, double top,
0831: double width, double height);
0832:
0833: /**
0834: * Transforms a point from device coordinates to logical coordinates.
0835: */
0836: public IETPoint deviceToLogicalPoint(IETPoint pDevice);
0837:
0838: /**
0839: * Transforms a point from device coordinates to logical coordinates.
0840: */
0841: public IETPoint deviceToLogicalPoint(int x, int y);
0842:
0843: /**
0844: * Centers the drawing area on the presentation element.
0845: */
0846: public void centerPresentationElement(
0847: IPresentationElement pPresentationElement,
0848: boolean bSelectIt, boolean bDeselectAllOthers);
0849:
0850: /**
0851: * Centers the drawing area on the presentation element with this XMIID.
0852: */
0853: public void centerPresentationElement2(String sXMIID,
0854: boolean bSelectIt, boolean bDeselectAllOthers);
0855:
0856: /**
0857: * Does the stacking command nStackingCommand make sense? Used for update of stacking order buttons.
0858: */
0859: public boolean isStackingCommandAllowed(int pStackingCommand);
0860:
0861: /**
0862: * Execute this stacking command.
0863: */
0864: public void executeStackingCommand(int pStackingCommand,
0865: boolean pRedraw);
0866:
0867: /**
0868: * Execute this stacking command on just this object.
0869: */
0870: public void executeStackingCommand(
0871: IPresentationElement pPresentationElement,
0872: int pStackingCommand, boolean pRedraw);
0873:
0874: /**
0875: * Execute this stacking command on this list of objects.
0876: */
0877: public void executeStackingCommand(
0878: ETList<IPresentationElement> pPresentationElements,
0879: int pStackingCommand, boolean pRedraw);
0880:
0881: /**
0882: * Executes the Relationship Disovery Command.
0883: */
0884: public void executeRelationshipDiscovery();
0885:
0886: /**
0887: * IsDirty is true when there is data that needs to be saved
0888: */
0889: public boolean getIsDirty();
0890:
0891: /**
0892: * IsDirty is true when there is data that needs to be saved
0893: */
0894: public void setIsDirty(boolean value);
0895:
0896: /**
0897: * Returns the presentation element on the drawing area control with the specified xml id
0898: */
0899: public IPresentationElement findPresentationElement(String sXMLID);
0900:
0901: /**
0902: * Creates a Tom Sawyer drawing tool
0903: */
0904: //public TSTool createTool( String sTool );
0905: /**
0906: * Sets / Gets the current Tom Sawyer drawing tool
0907: */
0908: //public TSTool getRootTool();
0909: /**
0910: * Sets / Gets the current Tom Sawyer drawing tool
0911: */
0912: //public void setRootTool( TSTool value );
0913: /**
0914: * Returns the presentation types mgr
0915: */
0916: public IPresentationTypesMgr getPresentationTypesMgr();
0917:
0918: /**
0919: * Get the current graph object at the mouse location
0920: */
0921: public TSGraphObject getGraphObjectAtMouse(int logicalX,
0922: int logicalY);
0923:
0924: /**
0925: * Are the tooltips enabled?
0926: */
0927: public boolean getAreTooltipsEnabled();
0928:
0929: /**
0930: * Enable/Disable tooltips.
0931: */
0932: public void setEnableTooltips(boolean bEnable);
0933:
0934: /**
0935: * Tells the product element to reinitialize the draw engine based on the init string. Used for IInterface going from lollypop to class.
0936: */
0937: public void resetDrawEngine(IETGraphObject pETElement,
0938: String sNewInitString);
0939:
0940: /**
0941: * Tells the product element to reinitialize the draw engine. The init string is pulled from the presentationtypesmgr
0942: */
0943: public void resetDrawEngine2(IETGraphObject pETElement);
0944:
0945: /**
0946: * Removes these presentation elements.
0947: */
0948: public void removeElements(
0949: ETList<IPresentationElement> pItemsToRemove);
0950:
0951: /**
0952: * Selects the graph object and fires the events. Normal select routines don't fire the events.
0953: */
0954: public void selectAndFireEvents(TSGraphObject pGraphObject,
0955: boolean bSelect, boolean bDeselectAllOthers);
0956:
0957: /**
0958: * Posts the select event
0959: */
0960: public void postSelectEvent();
0961:
0962: /**
0963: * Validates the diagram. If pDiagramValidation is null then a default will get created. pResult may also be null if no results are wanted.
0964: */
0965: public IDiagramValidationResult validateDiagram(
0966: boolean bOnlySelectedElements,
0967: IDiagramValidation pDiagramValidation);
0968:
0969: /**
0970: * Sync the selected (or all) elements.
0971: */
0972: public void syncElements(boolean bOnlySelectedElements);
0973:
0974: /**
0975: * Causes the diagram to take focus.
0976: */
0977: public void setFocus();
0978:
0979: /**
0980: * Returns true if the diagram is the focus owner; false otherwise.
0981: */
0982: public boolean isFocused();
0983:
0984: /**
0985: * Try to reconnect the link from pOldNode to pNewNode.
0986: */
0987: public boolean reconnectLink(IPresentationElement pLink,
0988: IPresentationElement pOldNode, IPresentationElement pNewNode);
0989:
0990: /**
0991: * Transforms the IETElement. Use this call to post the event if you happen to be on the IETElement that is to be transformed.
0992: */
0993: public void transform(IETGraphObject pETElement, String sToElement);
0994:
0995: /**
0996: * Posts a simple action type
0997: */
0998: public void postSimpleDelayedAction(
0999: /* _SimpleActionKind */int nKind);
1000:
1001: /**
1002: * Posts a simple presentation action type
1003: */
1004: public void postSimplePresentationDelayedAction(
1005: IPresentationElement pPE, /* _SimplePresentationActionKind */
1006: int nKind);
1007:
1008: /**
1009: * Posts a simple presentation action type
1010: */
1011: public void postSimplePresentationDelayedAction(
1012: ETList<IPresentationElement> pPEs, /* _SimplePresentationActionKind */
1013: int nKind);
1014:
1015: /**
1016: * Posts a delayed action to the diagram. Use when you may be in a dangerous callstack to perform the necessary action
1017: */
1018: public void postDelayedAction(IDelayedAction pAction);
1019:
1020: public void postAddObject(ITSGraphObject graphObj, boolean resize);
1021:
1022: /**
1023: * Receives notification of a broadcast. Used by the IProxyDiagramManager to broadcast functions to all open views.
1024: */
1025: public void receiveBroadcast(IBroadcastAction pAction);
1026:
1027: /**
1028: * Resizes elements with custom dimensions.
1029: */
1030: public boolean resizeDimensions();
1031:
1032: /**
1033: * Align selected elements to the left position of the first selected element.
1034: */
1035: public boolean alignLeft();
1036:
1037: /**
1038: * Align selected elements horizontally to the center position of the first selected element.
1039: */
1040: public boolean alignHorizontalCenter();
1041:
1042: /**
1043: * Align selected elements to the right position of the first selected element.
1044: */
1045: public boolean alignRight();
1046:
1047: /**
1048: * Align selected elements to the top position of the first selected element.
1049: */
1050: public boolean alignTop();
1051:
1052: /**
1053: * Align selected elements vertically to the cener position of the first selected element.
1054: */
1055: public boolean alignVerticalCenter();
1056:
1057: /**
1058: * Align selected elements to the bottom position of the first selected element.
1059: */
1060: public boolean alignBottom();
1061:
1062: // disabled - feature to be added with Meteora
1063: // /**
1064: // * Distribute selected elements horizontally based on the left edge position
1065: // * of the left and right-most selected elements.
1066: // */
1067: // public boolean distributeLeftEdge();
1068: //
1069: // /**
1070: // * Distribute selected elements horizontally based on the center position
1071: // * of the left and right-most selected elements.
1072: // */
1073: // public boolean distributeHorizontalCenter();
1074: //
1075: // /**
1076: // * Distribute selected elements horizontally based on the right edge position
1077: // * of the left and right-most selected elements.
1078: // */
1079: // public boolean distributeRightEdge();
1080: //
1081: // /**
1082: // * Distribute selected elements vertically based on the top edge position
1083: // * of the top and bottom-most selected elements.
1084: // */
1085: // public boolean distributeTopEdge();
1086: //
1087: // /**
1088: // * Distribute selected elements vertically based on the center position
1089: // * of the top and bottom-most selected elements.
1090: // */
1091: // public boolean distributeVerticalCenter();
1092: //
1093: // /**
1094: // * Distribute selected elements vertically based on the bottom edge position
1095: // * of the top and bottom-most selected elements.
1096: // */
1097: // public boolean distributeBottomEdge();
1098:
1099: /**
1100: * Resizes the elements (selected or all) to their contents.
1101: */
1102: public void sizeToContents(boolean bJustSelectedElements);
1103:
1104: /**
1105: * Gets the mid point of the edge.
1106: */
1107: public IETPoint getMidPoint(TSEdge pEdge);
1108:
1109: /**
1110: * Adds a node to the diagram.
1111: *
1112: * @param nodeInitString The initialization string for the node.
1113: * @param location The center location for the node.
1114: * @param bSelect Should we select this new graph object?
1115: * @param bDeselectAllOthers Should we deselect all other objects?
1116: * @param pElementToAssignToNode The element to assign the node to
1117: * @return The created node. NULL if no node is created.
1118: */
1119: public ETNode addNode(IElement element, IETPoint pt)
1120: throws ETException;
1121:
1122: /**
1123: * Adds a node to the diagram. The type of the node is specified by the
1124: * metatype name.
1125: *
1126: * @param metaDataType The type of node to create.
1127: * @param location The location of the new node.
1128: * @param bSelect <code>true</code> if the diagram is to be selected.
1129: * @param bDeselectAllOthers <code>true</code> if all selected nodes are to
1130: * be deselected.
1131: * @return The new node.
1132: */
1133: public ETNode addNodeForType(String metaDataType,
1134: IETPoint location, boolean bSelect,
1135: boolean bDeselectAllOthers) throws ETException;
1136:
1137: /**
1138: * Adds a node to the diagram.
1139: */
1140: public TSNode addNode(String nodeInitString, IETPoint location,
1141: boolean bSelect, boolean bDeselectAllOthers)
1142: throws ETException;
1143:
1144: /**
1145: * Adds a node to the diagram and assigns that node to the incoming IElement.
1146: */
1147: public TSNode addNode(String nodeInitString, IETPoint location,
1148: boolean bSelect, boolean bDeselectAllOthers,
1149: IElement pElementToAssignToNode) throws ETException;
1150:
1151: /**
1152: * Adds an edge to the diagram. The type of the edge is specified by the
1153: * metatype name.
1154: *
1155: * @param metaType The type of node to create.
1156: * @param sourceNode The node that starts the edge.
1157: * @param targetNode The node that ends the edge.
1158: * @param bSelect <code>true</code> if the diagram is to be selected.
1159: * @param bDeselectAllOthers <code>true</code> if all selected nodes are to
1160: * be deselected.
1161: * @return The new node.
1162: */
1163: public ETEdge addEdgeForType(String metaType, ETNode sourceNode,
1164: ETNode targetNode, boolean bSelected,
1165: boolean bDeselectAllOthers) throws ETException;
1166:
1167: /**
1168: * Adds an edge to the diagram.
1169: */
1170: public TSEdge addEdge(String edgeInitString, TSNode pSourceNode,
1171: TSNode pTargetNode, boolean bSelect,
1172: boolean bDeselectAllOthers) throws ETException;
1173:
1174: /**
1175: * Adds an edge to the diagram.
1176: *
1177: * @param edgeInitString The initialization string for the edge.
1178: * @param pSourceNode The source for the edge.
1179: * @param pTargetNode The target for the edge.
1180: * @param bSelect Should we select this new graph object?
1181: * @param bDeselectAllOthers Should we deselect all other objects?
1182: * @param pElementToAssignToEdge The element to assign to the edge
1183: * @return The created edge. <code>null</code> if no edge is created.
1184: */
1185: public TSEdge addEdge(String edgeInitString, TSNode pSourceNode,
1186: TSNode pTargetNode, boolean bSelect,
1187: boolean bDeselectAllOthers, IElement elementToAssignToEdge)
1188: throws ETException;
1189:
1190: /**
1191: * Posts a message to delete this IPresentationElement.
1192: */
1193: public void postDeletePresentationElement(IPresentationElement pPE);
1194:
1195: /**
1196: * Posts a message to delete this graph object.
1197: */
1198: public void postDeletePresentationElement(TSGraphObject pGraphObject);
1199:
1200: /**
1201: * Returns the current graph.
1202: */
1203: public TSEGraph getCurrentGraph();
1204:
1205: /**
1206: * Returns the current graph manager.
1207: */
1208: public TSGraphManager getCurrentGraphManager();
1209:
1210: /**
1211: * Begins dragging all selected elements on the graphObject, or all selected elements on all selected graphObjects if NULL.
1212: */
1213: public void beginOLEDrag(TSGraphObject graphObject);
1214:
1215: /**
1216: * Adds an item to the ETL read/write list.
1217: */
1218: public void addReadWriteItem(IETGraphObject pItem);
1219:
1220: /**
1221: * Unhide 'num' number of parent levels for the input node. If -1 then we ask the user.
1222: */
1223: public void unhide(IPresentationElement pPE, int numLevels,
1224: boolean bChildren);
1225:
1226: /**
1227: * Hide 'num' number of children levels for the input node. If -1 then we ask the user.
1228: */
1229: public void hide(IPresentationElement pPE, int numLevels,
1230: boolean bChildren);
1231:
1232: /**
1233: * Does this node have children?
1234: */
1235: public boolean hasChildren(IPresentationElement pPE, boolean bHidden);
1236:
1237: /**
1238: * Does this node have parents?
1239: */
1240: public boolean hasParents(IPresentationElement pPE, boolean bHidden);
1241:
1242: /**
1243: * Let folks know that tooltips are about to be displayed.
1244: */
1245: public void fireTooltipEvent(IPresentationElement pPE,
1246: IToolTipData pTooltip);
1247:
1248: /**
1249: * Begins edit on a specific label
1250: */
1251: public void postEditLabel(ILabelPresentation pPE);
1252:
1253: /**
1254: * Begins edit on a specific label
1255: */
1256: public void pumpMessages(boolean bJustDrawingMessages);
1257:
1258: /**
1259: * Fires an event out the interface saying that a context menu button has been selected.
1260: */
1261: public void fireDrawingAreaContextMenuSelected(
1262: IProductContextMenu contextMenu,
1263: IProductContextMenuItem selectedItem);
1264:
1265: /**
1266: * The drawing area can cache up preferences. Call this to get a cached value (fast) or hit the preference manager if not cached(slower).
1267: */
1268: public String getPreferenceValue(String sPath, String sName);
1269:
1270: /**
1271: * One or more drawing preferences has been changed, update the diagram with the new preference values.
1272: */
1273: public boolean preferencesChanged(IPropertyElement[] pProperties);
1274:
1275: /**
1276: * Allows the diagram engines the ability to change the element being dropped or created
1277: */
1278: public IElement processOnDropElement(IElement pElementBeingDropped);
1279:
1280: /**
1281: * Sizes the presentation element, and its track bar car
1282: */
1283: public void sizeToContentsWithTrackBar(IPresentationElement pElement);
1284:
1285: /**
1286: * Adds a presentation element to the track bar
1287: */
1288: public void addPresentationElementToTrackBar(
1289: IPresentationElement pElement);
1290:
1291: /**
1292: * Returns the relationship discovery object that's appropriate for this diagram
1293: */
1294: public ICoreRelationshipDiscovery getRelationshipDiscovery();
1295:
1296: /**
1297: * Kills the tooltip if it happens to be up. Used during the edit control.
1298: */
1299: public void killTooltip();
1300:
1301: /**
1302: * Begin edit context
1303: */
1304: public void beginEditContext(ICompartment pCompartment);
1305:
1306: /**
1307: * End edit context
1308: */
1309: public void endEditContext();
1310:
1311: /**
1312: * Ask the user what to do about a name collision
1313: */
1314: public void questionUserAboutNameCollision(
1315: ICompartment pCompartmentBeingEdited,
1316: INamedElement pElement, String sProposedName,
1317: ETList<INamedElement> pCollidingElements, IResultCell pCell);
1318:
1319: /**
1320: * Forces a deep sync on these elements
1321: */
1322: public void handleDeepSyncBroadcast(IElement[] pElements,
1323: boolean bSizeToContents);
1324:
1325: /**
1326: * Adds an associated diagram
1327: */
1328: public void addAssociatedDiagram(String sDiagramXMIID);
1329:
1330: /**
1331: * Adds an associated diagram
1332: */
1333: public void addAssociatedDiagram2(IProxyDiagram pDiagram);
1334:
1335: /**
1336: * Removes an associated diagram
1337: */
1338: public void removeAssociatedDiagram(String sDiagramXMIID);
1339:
1340: /**
1341: * Removes an associated diagram
1342: */
1343: public void removeAssociatedDiagram2(IProxyDiagram pDiagram);
1344:
1345: /**
1346: * Returns the associated diagrams
1347: */
1348: public ETList<IProxyDiagram> getAssociatedDiagrams();
1349:
1350: /**
1351: * Is this an associated diagram?
1352: */
1353: public boolean isAssociatedDiagram(String sDiagramXMIID);
1354:
1355: /**
1356: * Is this an associated diagram?
1357: */
1358: public boolean isAssociatedDiagram2(IProxyDiagram pDiagram);
1359:
1360: /**
1361: * Adds an associated model element
1362: */
1363: public void addAssociatedElement(String sTopLevelElementXMIID,
1364: String sModelElementXMIID);
1365:
1366: /**
1367: * Adds an associated model element
1368: */
1369: public void addAssociatedElement2(IElement pElement);
1370:
1371: /**
1372: * Removes an associated model element
1373: */
1374: public void removeAssociatedElement(String sTopLevelElementXMIID,
1375: String sModelElementXMIID);
1376:
1377: /**
1378: * Removes an associated model element
1379: */
1380: public void removeAssociatedElement2(IElement pElement);
1381:
1382: /**
1383: * Returns the associated model elements
1384: */
1385: public ETList<IElement> getAssociatedElements();
1386:
1387: /**
1388: * Is this an associated element?
1389: */
1390: public boolean isAssociatedElement(String sModelElementXMIID);
1391:
1392: /**
1393: * Is this an associated element?
1394: */
1395: public boolean isAssociatedElement2(IElement pElement);
1396:
1397: /**
1398: * This method just fires the selection notification it doesn't change the state of the graph object.
1399: */
1400: public void fireSelectEvent(TSGraphObject pGraphObject);
1401:
1402: /**
1403: * This method just fires the deslection notification it doesn't change the state of the graph object.
1404: */
1405: public void fireUnselectEvent(TSGraphObject pGraphObject);
1406:
1407: public Frame getOwnerFrame();
1408:
1409: public void onGraphEvent(int pGraphEventKind, IETPoint pStartPoint,
1410: IETPoint pEndPoint, ETList<IETGraphObject> affectedObjects);
1411:
1412: public void setEditCompartment(ETCompartment editCtrl);
1413:
1414: public IProductArchive getProductArchive();
1415:
1416: public ADDrawingAreaResourceBundle getResources();
1417:
1418: public boolean isAutoFitInWindow();
1419:
1420: public void switchToDefaultState();
1421:
1422: public void onInteractiveObjCreated(TSEObjectUI ui);
1423:
1424: public void onDrop(DropTargetDropEvent event, TSEObject graphObject);
1425:
1426: public void fireSelectEvent(List pSelectedGraphObjs);
1427:
1428: public IDrawingAreaEventDispatcher getDrawingAreaDispatcher();
1429:
1430: public JToolBar getToolbar();
1431:
1432: public void setShowDefaultToolbar(boolean bShow);
1433:
1434: public void updateSecondaryWindows();
1435:
1436: /*
1437: * Set when the diagrma is creating itself from selected elements.
1438: */
1439: public void setPopulating(boolean busy);
1440:
1441: /*
1442: * Returns if the is busy populating
1443: */
1444: public boolean getPopulating();
1445:
1446: /** Adds listener to listen when drawing area changes to 'select' state. */
1447: public void addDrawingAreaToolSelectionSink(
1448: IDrawingAreaSelectStateEnteredSink drawingAreaSelectStateEnteredListener);
1449:
1450: /*
1451: * Allows the palette code to set users' selected button on the palette
1452: */
1453: public void setSelectedPaletteButton(String buttonId);
1454:
1455: /*
1456: * Returns the selected button on the palette
1457: */
1458: public String getSelectedPaletteButton();
1459: }
|