001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.metamodel.diagrams;
043:
044: import java.awt.Frame;
045: import java.awt.Rectangle;
046:
047: import org.netbeans.modules.uml.common.generics.ETPairT;
048: import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
049: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
050: import org.netbeans.modules.uml.core.metamodel.core.foundation.IPresentationElement;
051: import org.netbeans.modules.uml.core.support.umlsupport.IETPoint;
052: import org.netbeans.modules.uml.core.support.umlsupport.IETRect;
053: import org.netbeans.modules.uml.core.support.umlutils.ETList;
054: import org.netbeans.modules.uml.core.workspacemanagement.ITwoPhaseCommit;
055:
056: public interface IDiagram extends IPresentationElement {
057: public static final int DK_UNKNOWN = 0;
058: public static final int DK_DIAGRAM = 1;
059: public static final int DK_ACTIVITY_DIAGRAM = 2;
060: public static final int DK_CLASS_DIAGRAM = 4;
061: public static final int DK_COLLABORATION_DIAGRAM = 8;
062: public static final int DK_COMPONENT_DIAGRAM = 16;
063: public static final int DK_DEPLOYMENT_DIAGRAM = 32;
064: public static final int DK_SEQUENCE_DIAGRAM = 64;
065: public static final int DK_STATE_DIAGRAM = 128;
066: public static final int DK_USECASE_DIAGRAM = 256;
067: public static final int DK_ALL = 0xffff;
068:
069: /**
070: * Saves the diagram.
071: */
072: public void save();
073:
074: /**
075: * Allows the diagram to perform some cleanup before the diagram is actually
076: * closed.
077: */
078: public void preClose();
079:
080: /**
081: * Is this diagram readonly?
082: */
083: public boolean getReadOnly();
084:
085: /**
086: * Is this diagram readonly?
087: */
088: public void setReadOnly(boolean value);
089:
090: /**
091: * Saves the diagram as a BMP, EMF or JPG file.
092: */
093: public void saveAsGraphic(String sFilename, /* SaveAsGraphicKind */
094: int nKind);
095:
096: /**
097: * Saves the diagram as a BMP, EMF or JPG file. Use pMap to get the details of the graphic.
098: */
099: public IGraphicExportDetails saveAsGraphic2(String sFilename, /* SaveAsGraphicKind */
100: int nKind);
101:
102: public IGraphicExportDetails saveAsGraphic2(String sFilename, /* SaveAsGraphicKind */
103: int nKind, double scale);
104:
105: /**
106: * Get/Set the name of this drawing.
107: */
108: public String getName();
109:
110: /**
111: * Get/Set the name of this drawing.
112: */
113: public void setName(String value);
114:
115: /**
116: * Get/Set the alias of this drawing.
117: */
118: public String getAlias();
119:
120: /**
121: * Get/Set the alias of this drawing.
122: */
123: public void setAlias(String value);
124:
125: /**
126: * Sets / Gets the name or alias of this element.
127: */
128: public String getNameWithAlias();
129:
130: /**
131: * Sets / Gets the name or alias of this element.
132: */
133: public void setNameWithAlias(String value);
134:
135: /**
136: * Retrieves the fully qualified name of the element. This will be in the form 'A::B::C'.
137: */
138: public String getQualifiedName();
139:
140: /**
141: * Get the filename that this view is saved to
142: */
143: public String getFilename();
144:
145: /**
146: * Set/Get the current layout style.
147: */
148: public void setLayoutStyle( /* LayoutKind */int value);
149:
150: /**
151: * Set/Get the current layout style.
152: */
153: public int getLayoutStyle();
154:
155: /**
156: * Set/Get the current layout style.
157: */
158: public void setLayoutStyleSilently( /* LayoutKind */int value);
159:
160: /**
161: * Immediately sets the layout style. It bypasses the delayed actions.
162: */
163: public void immediatelySetLayoutStyle(
164: /* LayoutKind */int nLayoutStyle, boolean bSilent);
165:
166: /**
167: * Use a delayed action to perform the layout style, possibly ignoring containment
168: */
169: public void delayedLayoutStyle( /* LayoutKind */int nLayoutStyle,
170: boolean bIgnoreContainment);
171:
172: /**
173: * Show/Close the image dialog..
174: */
175: public void showImageDialog();
176:
177: /**
178: * Print preview this window
179: */
180: public void printPreview(String sTitle, boolean bCanMoveParent);
181:
182: /**
183: * Shows the print setup dialog
184: */
185: public void loadPrintSetupDialog();
186:
187: /**
188: * Prints this control
189: */
190: public void printGraph(boolean bShowDialog);
191:
192: /**
193: * Is the diagram currently undergoing layout.
194: */
195: public boolean getLayoutRunning();
196:
197: /**
198: * What is the current zoom of the diagram.
199: */
200: public double getCurrentZoom();
201:
202: /**
203: * Get the extreme values for the zoom.
204: */
205: public ETPairT<Double, Double> getExtremeZoomValues();
206:
207: /**
208: * Zoom the diagram.
209: */
210: public void zoom(double nScaleFactor);
211:
212: /**
213: * Zoom in.
214: */
215: public void zoomIn();
216:
217: /**
218: * Zoom out.
219: */
220: public void zoomOut();
221:
222: /**
223: * Fit the current diagram to the window.
224: */
225: public void fitInWindow();
226:
227: /**
228: * Show the custom zoom dialog.
229: */
230: public void onCustomZoom();
231:
232: /**
233: * Gets the drawing area namespace
234: */
235: public INamespace getNamespace();
236:
237: /**
238: * Gets the drawing area namespace
239: */
240: public void setNamespace(INamespace value);
241:
242: /**
243: * Returns the the namespace to use when elements are created on the diagram. Usually this is the same as the namespace of the diagram
244: */
245: public INamespace getNamespaceForCreatedElements();
246:
247: /**
248: * Load this diagram from a .etl file.
249: */
250: public int load(String sFilename, boolean fitToZoom);
251:
252: /**
253: * Puts the drawing area into a certain mouse mode
254: */
255: public void enterMode( /* DrawingToolKind */int nDrawingToolKind);
256:
257: /**
258: * Puts the drawing area into a specific mode based on the sButtonID. sButtonID is a key in the PresentationTypes.etc file.
259: */
260: public void enterModeFromButton(String sButtonID);
261:
262: /**
263: * Invalidates the drawing area
264: */
265: public void refresh(boolean bPostMessage /*=false*/);
266:
267: /**
268: * Cut the selected objects
269: */
270: public void cut();
271:
272: /**
273: * Copy the selected objects
274: */
275: public void copy();
276:
277: /**
278: * Paste the selected objects
279: */
280: public void paste();
281:
282: /**
283: * Clears the clipboard of selected objects
284: */
285: public void clearClipboard();
286:
287: /**
288: * Deletes the selected objects
289: */
290: public void deleteSelected(boolean bAskUser);
291:
292: /**
293: * Are there items on the clipbaord
294: */
295: public void itemsOnClipboard(boolean bItemsOnClipboard);
296:
297: /**
298: * Select all presentation elements
299: */
300: public void selectAll(boolean bSelect);
301:
302: /**
303: * Select all similar presentation elements
304: */
305: public void selectAllSimilar();
306:
307: /**
308: * Transforms a rect from logical coordinates to device coordinates.
309: */
310: public IETRect logicalToDeviceRect(IETRect rcLogical);
311:
312: /**
313: * Transforms a point from logical coordinates to device coordinates.
314: */
315: public IETPoint logicalToDevicePoint(IETPoint ptLogical);
316:
317: /**
318: * Transforms a rect from device coordinates to logical coordinates.
319: */
320: public IETRect deviceToLogicalRect(IETRect rcDevice);
321:
322: /**
323: * Transforms a point from device coordinates to logical coordinates.
324: */
325: public IETPoint deviceToLogicalPoint(IETPoint ptDevice);
326:
327: /**
328: * Transforms a point from device coordinates to logical coordinates.
329: */
330: public IETPoint deviceToLogicalPoint(int x, int y);
331:
332: /**
333: * Centers the drawing area on the presentation element.
334: */
335: public void centerPresentationElement(
336: IPresentationElement pPresentationElement,
337: boolean bSelectIt, boolean bDeselectAllOthers);
338:
339: /**
340: * Centers the drawing area on the presentation element.
341: */
342: public void centerPresentationElement2(String sXMIID,
343: boolean bSelectIt, boolean bDeselectAllOthers);
344:
345: /**
346: * Does the stacking command nStackingCommand make sense? Used for update of stacking order buttons.
347: */
348: public boolean isStackingCommandAllowed(
349: /* StackingOrderKind */int nStackingCommand);
350:
351: /**
352: * Execute this stacking command.
353: */
354: public void executeStackingCommand(
355: /* StackingOrderKind */int nStackingCommand);
356:
357: /**
358: * Does this graph have edges, labels or nodes?
359: */
360: public void hasGraphObjects(boolean bHasObjects);
361:
362: /**
363: * Get/Set the type of this drawing.
364: */
365: public int getDiagramKind();
366:
367: /**
368: * Get/Set the type of this drawing.
369: */
370: public void setDiagramKind( /* DiagramKind */int value);
371:
372: /**
373: * Get/Set the type of this drawing.
374: */
375: public String getDiagramKind2();
376:
377: /**
378: * Get/Set the type of this drawing.
379: */
380: public void setDiagramKind2(String value);
381:
382: /**
383: * Initialize a newly created diagram. This adds the diagram to the current IWorkspace.
384: */
385: public void initializeNewDiagram(INamespace pNamespace,
386: String sName, /* DiagramKind */int pKind);
387:
388: /**
389: * Inverts the selected objects.
390: */
391: public void invertSelection();
392:
393: /**
394: * Returns a list of the selected items.
395: */
396: public ETList<IPresentationElement> getSelected();
397:
398: /**
399: * Returns a list of the selected items that are of the indicated type (ie Class).
400: */
401: public ETList<IPresentationElement> getSelectedByType(
402: String bstrType);
403:
404: /**
405: * Returns the HWND to the drawing area.
406: */
407: public Frame getWindowHandle();
408:
409: /**
410: * Returns a list of all the items.
411: */
412: public ETList<IPresentationElement> getAllItems();
413:
414: /**
415: * Returns a list of all the items that represent the IElement.
416: */
417: public ETList<IPresentationElement> getAllItems2(
418: IElement pModelElement);
419:
420: /**
421: * Returns a list of all the model elements on the diagram.
422: */
423: public ETList<IElement> getAllItems3();
424:
425: /**
426: * Select all the objects on the diagram that are of the indicated type
427: */
428: public ETList<IPresentationElement> getAllByType(String bstrType);
429:
430: /**
431: * Is the layout properties window open.
432: */
433: public boolean getIsLayoutPropertiesDialogOpen();
434:
435: /**
436: * Show/Close the layout property window.
437: */
438: public void layoutPropertiesDialog(boolean bShow);
439:
440: /**
441: * Is the graph preferences window open.
442: */
443: public boolean getIsGraphPreferencesDialogOpen();
444:
445: /**
446: * Show/Close the graph preferences window.
447: */
448: public void graphPreferencesDialog(boolean bShow);
449:
450: /**
451: * Is the overview window open.
452: */
453: public boolean getIsOverviewWindowOpen();
454:
455: /**
456: * Show/Hide the overview window.
457: */
458: public void overviewWindow(boolean bShowIt);
459:
460: /**
461: * Returns the window rect of the overview window, if it is open.
462: */
463: public Rectangle getOverviewWindowRect(int pLeft, int pTop,
464: int pWidth, int pHeight);
465:
466: /**
467: * Sets the window rect of the overview window, if it is open.
468: */
469: public void setOverviewWindowRect(int nLeft, int nTop, int nWidth,
470: int nHeight);
471:
472: /**
473: * Are the tooltips enabled?
474: */
475: public boolean getAreTooltipsEnabled();
476:
477: /**
478: * Enable/Disable tooltips.
479: */
480: public void setEnableTooltips(boolean bEnable);
481:
482: /**
483: * Does this diagram have selected nodes?
484: */
485: public boolean getHasSelected(boolean bDeep);
486:
487: /**
488: * Does this diagram have selected nodes?
489: */
490: public boolean getHasSelectedNodes(boolean bDeep);
491:
492: /**
493: * Hide/Show the grid
494: */
495: public boolean getShowGrid();
496:
497: /**
498: * Hide/Show the grid
499: */
500: public void setShowGrid(boolean value);
501:
502: /**
503: * Sets/Gets the current grid size
504: */
505: public int getGridSize();
506:
507: /**
508: * Sets/Gets the current grid size
509: */
510: public void setGridSize(int value);
511:
512: /**
513: * Sets/Gets the type of grid this is being displayed
514: */
515: public int getGridType();
516:
517: /**
518: * Sets/Gets the type of grid this is being displayed
519: */
520: public void setGridType( /* GridKind */int value);
521:
522: /**
523: * Returns the two phase commit object for the diagram.
524: */
525: public ITwoPhaseCommit getTwoPhaseCommit();
526:
527: /**
528: * Get/Set the locked state for the current mode.
529: */
530: public boolean getModeLocked();
531:
532: /**
533: * Get/Set the locked state for the current mode.
534: */
535: public void setModeLocked(boolean value);
536:
537: /**
538: * Used to set sticky buttons. The user of the diagram can set/get this to determine when to lock/unlock the current tool.
539: */
540: public int getLastSelectedButton();
541:
542: /**
543: * Used to set sticky buttons. The user of the diagram can set/get this to determine when to lock/unlock the current tool.
544: */
545: public void setLastSelectedButton(int value);
546:
547: /**
548: * Validates the diagram.
549: */
550: public IDiagramValidationResult validateDiagram(
551: boolean bOnlySelectedElements,
552: IDiagramValidation pDiagramValidation);
553:
554: /**
555: * Sync the selected (or all) elements.
556: */
557: public void syncElements(boolean bOnlySelectedElements);
558:
559: /**
560: * Causes the diagram to take focus.
561: */
562: public void setFocus();
563:
564: /**
565: * Try to reconnect the link from pOldNode to pNewNode.
566: */
567: public boolean reconnectLink(IPresentationElement pLink,
568: IPresentationElement pFromNode, IPresentationElement pToNode);
569:
570: /**
571: * Resizes the elements (selected or all) to their contents.
572: */
573: public void sizeToContents(boolean bJustSelectedElements);
574:
575: /**
576: * Posts a delayed action to the diagram. Use when you may be in a dangerous callstack to perform the necessary action
577: */
578: public void postDelayedAction(IDelayedAction pAction);
579:
580: /**
581: * Receives notification of a broadcast. Used by the IProxyDiagramManager to broadcast functions to all open views.
582: */
583: public void receiveBroadcast(IBroadcastAction pAction);
584:
585: /**
586: * IsDirty is true when there is data that needs to be saved
587: */
588: public boolean getIsDirty();
589:
590: /**
591: * IsDirty is true when there is data that needs to be saved
592: */
593: public void setIsDirty(boolean value);
594:
595: /**
596: * Is this diagram the same diagram as the one passed in?
597: */
598: public boolean isSame(IDiagram pDiagram);
599:
600: /**
601: * Returns the presentation element on the diagram with the specified xml id
602: */
603: public IPresentationElement findPresentationElement(String sXMLID);
604:
605: /**
606: * Returns the relationship discovery object
607: */
608: public ICoreRelationshipDiscovery getRelationshipDiscovery();
609:
610: /**
611: * Processes all the diagram messages
612: */
613: public void pumpMessages(boolean bJustDrawingMessages);
614:
615: /**
616: * Adds an associated diagram
617: */
618: public void addAssociatedDiagram(String sDiagramXMIID);
619:
620: /**
621: * Adds an associated diagram
622: */
623: public void addAssociatedDiagram2(IProxyDiagram pDiagram);
624:
625: /**
626: * Removes an associated diagram
627: */
628: public void removeAssociatedDiagram(String sDiagramXMIID);
629:
630: /**
631: * Removes an associated diagram
632: */
633: public void removeAssociatedDiagram2(IProxyDiagram pDiagram);
634:
635: /**
636: * Returns the associated diagrams
637: */
638: public ETList<IProxyDiagram> getAssociatedDiagrams();
639:
640: /**
641: * Is this an associated diagram?
642: */
643: public boolean isAssociatedDiagram(String sDiagramXMIID);
644:
645: /**
646: * Is this an associated diagram?
647: */
648: public boolean isAssociatedDiagram2(IProxyDiagram pDiagram);
649:
650: /**
651: * Adds an associated model element
652: */
653: public void addAssociatedElement(String sTopLevelElementXMIID,
654: String sModelElementXMIID);
655:
656: /**
657: * Adds an associated model element
658: */
659: public void addAssociatedElement2(IElement pElement);
660:
661: /**
662: * Removes an associated model element
663: */
664: public void removeAssociatedElement(String sTopLevelElementXMIID,
665: String sModelElementXMIID);
666:
667: /**
668: * Removes an associated model element
669: */
670: public void removeAssociatedElement2(IElement pElement);
671:
672: /**
673: * Returns the associated model elements
674: */
675: public ETList<IElement> getAssociatedElements();
676:
677: /**
678: * Is this an associated element?
679: */
680: public boolean isAssociatedElement(String sModelElementXMIID);
681:
682: /**
683: * Is this an associated element?
684: */
685: public boolean isAssociatedElement2(IElement pElement);
686:
687: /**
688: * This method sets wheter the graph should be updated automatically or on
689: * request.
690: *
691: * @param value <code>true</code> if the boudns should update automatcially.
692: */
693: public void setAutoUpdateBounds(boolean value);
694:
695: /*
696: * Returns if the displaywindow should be allowed to redraw.
697: */
698: public boolean getAllowRedraw();
699:
700: /*
701: * Set if window should process draw events or ignore them.
702: */
703: public void setAllowRedraw(boolean allow);
704:
705: /*
706: * Set when the diagrma is creating itself from selected elements.
707: */
708: public void setPopulating(boolean busy);
709:
710: /*
711: * Returns if the is busy populating
712: */
713: public boolean getPopulating();
714: }
|