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.ui.products.ad.viewfactory;
043:
044: import java.util.List;
045:
046: import org.netbeans.modules.uml.core.metamodel.core.foundation.IElement;
047: import org.netbeans.modules.uml.core.metamodel.core.foundation.INamespace;
048: import org.netbeans.modules.uml.core.metamodel.core.foundation.IPresentationElement;
049: import org.netbeans.modules.uml.core.support.umlsupport.IStrings;
050: import org.netbeans.modules.uml.ui.support.viewfactorysupport.IDrawEngine;
051: import org.netbeans.modules.uml.ui.support.viewfactorysupport.IDrawInfo;
052: import org.netbeans.modules.uml.ui.support.viewfactorysupport.ITSGraphObject;
053: import org.netbeans.modules.uml.ui.swing.drawingarea.IDrawingAreaControl;
054: import com.tomsawyer.editor.TSEColor;
055: import com.tomsawyer.editor.TSEObject;
056: import com.tomsawyer.editor.TSEObjectUI;
057: import com.tomsawyer.editor.graphics.TSEGraphics;
058: import com.tomsawyer.editor.inspector.TSEInspectorProperty;
059: import com.tomsawyer.editor.inspector.TSEInspectorPropertyID; //import com.tomsawyer.util.TSConstRect;
060: import com.tomsawyer.drawing.geometry.TSConstRect; //import com.tomsawyer.util.TSConstSize;
061: import com.tomsawyer.drawing.geometry.TSConstSize; //import com.tomsawyer.util.TSExpTransform;
062: import com.tomsawyer.drawing.geometry.TSExpTransform;
063: import com.tomsawyer.util.TSProperty; //import com.tomsawyer.util.TSTransform;
064: import com.tomsawyer.editor.TSTransform;
065:
066: /*
067: * @author KevinM
068: */
069: public interface IETGraphObjectUI {
070: public IDrawEngine getDrawEngine();
071:
072: public void setDrawEngine(IDrawEngine newDrawEngine);
073:
074: public IDrawingAreaControl getDrawingArea();
075:
076: public void setDrawingArea(IDrawingAreaControl control);
077:
078: public String getDrawEngineClass();
079:
080: public void setDrawEngineClass(String string);
081:
082: public IElement getModelElement();
083:
084: public void setModelElement(IElement element);
085:
086: public String getInitStringValue();
087:
088: public void setInitStringValue(String string);
089:
090: public ITSGraphObject getTSObject();
091:
092: // This method returns a clone of this object.
093: Object clone();
094:
095: //This method copies all properties of the specified UI to this UI.
096: void copy(TSEObjectUI sourceUI);
097:
098: //This method draws the object represented by this UI.
099: abstract void draw(TSEGraphics graphics);
100:
101: //This method draws the outline of the object represented by this UI.
102: abstract void drawOutline(TSEGraphics graphics);
103:
104: //This method draws the object represented by this UI in a selected state.
105: abstract void drawSelected(TSEGraphics graphics);
106:
107: //This method draws the outline of the object represented by this UI in a selected state.
108: abstract void drawSelectedOutline(TSEGraphics graphics);
109:
110: //This method returns the y coordinate of the bottom side of the bounding box of the owner object in local coordinate system.
111: abstract double getBottom();
112:
113: //This method returns the bounding box that fully encloses this object in local coordinate system.
114: TSConstRect getBounds();
115:
116: //This method returns the x coordinate of the bounding box that fully encloses this object in local coordinate system.
117: double getCenterX();
118:
119: //This method returns the y coordinate of the bounding box that fully encloses this object in local coordinate system.
120: double getCenterY();
121:
122: //This method returns a list of all properties not set to their default values.
123: List getChangedProperties();
124:
125: //This method returns the default color in which selected objects are to be drawn.
126: TSEColor getDefaultSelectedColor();
127:
128: //This method returns the height of the bounding box that fully encloses this object in local coordinate system.
129: double getHeight();
130:
131: //This method returns a TSEInspectorProperty with the specified ID.
132: TSEInspectorProperty getInspectorProperty(TSEInspectorPropertyID id);
133:
134: //This method adds inspector property IDs to the specified list.
135: void getInspectorPropertyIDs(List idList);
136:
137: //This method returns the extents of the region of the world that needs repainting when the owner of this UI gets modified.
138: abstract TSConstRect getInvalidRegion(TSTransform root2device,
139: TSExpTransform local2root);
140:
141: //This method returns the x coordinate of the left side of the bounding box of the owner object in local coordinate system.
142: abstract double getLeft();
143:
144: //This method returns the transform from the UI's owner's local coordinate system to it's main graph window's coordinate system.
145: TSTransform getLocalToMainGraphWindowTransform();
146:
147: //This method returns the owner of this UI.
148: abstract TSEObject getOwner();
149:
150: //This method returns a list of all properties associated with this object.
151: List getProperties();
152:
153: //This method returns the property with the specified name.
154: TSProperty getProperty(String name);
155:
156: //This method returns the x coordinate of the right side of the bounding box of the owner object in local coordinate system.
157: abstract double getRight();
158:
159: //This method returns the color in which selected objects are to be drawn.
160: TSEColor getSelectedColor();
161:
162: //This method returns the size of the bounding box that fully encloses this object in local coordinate system.
163: TSConstSize getSize();
164:
165: //This method returns the y coordinate of the top side of the bounding box of the owner object in local coordinate system.
166: abstract double getTop();
167:
168: //This method returns the width of the bounding box that fully encloses this object in local coordinate system.
169: double getWidth();
170:
171: //This method returns whether or not the specified rectangle intersects with the bounding box of this object.
172: abstract boolean intersects(double left, double bottom,
173: double right, double top);
174:
175: //This method returns whether or not the specified rectangle intersects with the bounding box of this object.
176: boolean intersects(TSConstRect rectangle);
177:
178: //This method is called just before this UI's owner object is discarded from a graph.
179: void onOwnerDiscarded();
180:
181: //This method is called just after this UI's owner object is inserted into a graph.
182: void onOwnerInserted();
183:
184: //This method is called just before this UI's owner object is removed from a graph.
185: void onOwnerRemoved();
186:
187: //This method resets the properties of this UI object to their default values.
188: void reset();
189:
190: //This method sets a property changed by the inspector.
191: int setInspectorProperty(TSEInspectorPropertyID id,
192: TSEInspectorProperty property);
193:
194: //This method sets the specified property of this UI.
195: void setProperty(TSProperty property);
196:
197: //This method sets the color in which selected objects are to be drawn.
198: void setSelectedColor(TSEColor selectedColor);
199:
200: /**
201: * Retrieves the graphics context for the node ui.
202: *
203: * @param graphics The TS graphics class.
204: * @return The graphics context.
205: */
206: public IDrawInfo getDrawInfo(TSEGraphics graphics);
207:
208: /**
209: * Retrieves the graphics context for the node ui.
210: *
211: * @param graphics The TS graphics class.
212: * @return The graphics context.
213: */
214: public IDrawInfo getDrawInfo();
215:
216: /// Returns the Model Element XMIID that was loaded from the file.
217: public String getReloadedModelElementXMIID();
218:
219: /// Sets the Model Element XMIID that will be persisted to the file.
220: public void setReloadedModelElementXMIID(String newVal);
221:
222: /// Returns the Toplevel Element XMIID that was loaded from the file.
223: public String getReloadedTopLevelXMIID();
224:
225: /// Sets the Toplevel Element XMIID that will be persisted to the file.
226: public void setReloadedTopLevelXMIID(String newVal);
227:
228: /// Returns the Toplevel Element XMIID that was loaded from the file.
229: public String getReloadedPresentationXMIID();
230:
231: /// Sets the Toplevel Element XMIID that will be persisted to the file.
232: public void setReloadedPresentationXMIID(String newVal);
233:
234: /// Returns the Toplevel Element XMIID that was loaded from the file.
235: public String getReloadedOwnerPresentationXMIID();
236:
237: /// Sets the Toplevel Element XMIID that will be persisted to the file.
238: public void setReloadedOwnerPresentationXMIID(String newVal);
239:
240: public IStrings getReferredElements();
241:
242: public void setReferredElements(IStrings newVal);
243:
244: public boolean getWasModelElementDeleted();
245:
246: public void setWasModelElementDeleted(boolean newVal);
247:
248: public boolean getFailedToCreateDrawEngine();
249:
250: public void setFailedToCreateDrawEngine(boolean newVal);
251:
252: public IPresentationElement createPresentationElement(IElement pElem);
253:
254: public IElement createNew(INamespace space, String initStr);
255:
256: public String getTopLevelMEIDValue();
257:
258: /// Returns true if any portion of this object is visbible on the screen.
259: public boolean isOnTheScreen(TSEGraphics g);
260: }
|