Package ptolemy.vergil.basic
Class RelativeLocation
- java.lang.Object
- 
- ptolemy.kernel.util.NamedObj
- 
- ptolemy.kernel.util.Attribute
- 
- ptolemy.kernel.util.SingletonAttribute
- 
- ptolemy.kernel.util.Location
- 
- ptolemy.vergil.basic.RelativeLocation
 
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- Changeable,- Debuggable,- DebugListener,- Derivable,- Locatable,- ModelErrorHandler,- MoMLExportable,- Moveable,- Nameable,- Settable,- Singleton
 
 public class RelativeLocation extends Location An attribute used to store a relative visual location. The location is relative to an object specified by the relativeTo attribute, which gives the name of an object that is expected to be contained by the container of the container of this attribute. In addition, the relativeToElementName specifies what kind of object this is relative to (an "entity", "property" (attribute), "port", or "relation").- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Christian Motika, Miro Spoenemann
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Yellow (cxh)
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObjNamedObj.ContainedObjectsIterator
 - 
Nested classes/interfaces inherited from interface ptolemy.kernel.util.SettableSettable.Visibility
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static doubleBREAK_THRESHOLDThe maximal distance of the relative location.static doubleINITIAL_OFFSETThe initial offset for new relative locatable objects.StringAttributerelativeToThe name of the object this location is relative to.StringAttributerelativeToElementNameThe element name of the object this location is relative to.- 
Fields inherited from class ptolemy.kernel.util.NamedObj_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 - 
Fields inherited from interface ptolemy.kernel.util.SettableEXPERT, FULL, NONE, NOT_EDITABLE
 
- 
 - 
Constructor SummaryConstructors Constructor Description RelativeLocation(NamedObj container, java.lang.String name)Construct an instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]getLocation()Get the location in some cartesian coordinate system.double[]getRelativeLocation()Get the relative location, relative to the relativeTo object, if there is one, and otherwise return the absolute location.NamedObjgetRelativeToNamedObj()If the relativeTo object exists, return it.voidsetLocation(double[] location)Set the location in some cartesian coordinate system, and notify the container and any value listeners of the new location.- 
Methods inherited from class ptolemy.kernel.util.Location_propagateValue, addValueListener, clone, exportMoML, getDefaultExpression, getDisplayName, getExpression, getValueAsString, getVisibility, removeValueListener, setExpression, setVisibility, toString, validate
 - 
Methods inherited from class ptolemy.kernel.util.SingletonAttributesetContainer
 - 
Methods inherited from class ptolemy.kernel.util.Attribute_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 - 
Methods inherited from class ptolemy.kernel.util.NamedObj_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
 - 
Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface ptolemy.kernel.util.Nameabledescription, getContainer, getFullName, getName, getName, setName
 
- 
 
- 
- 
- 
Field Detail- 
relativeTopublic StringAttribute relativeTo The name of the object this location is relative to.
 - 
relativeToElementNamepublic StringAttribute relativeToElementName The element name of the object this location is relative to. This defaults to "entity".
 - 
INITIAL_OFFSETpublic static final double INITIAL_OFFSET The initial offset for new relative locatable objects.- See Also:
- Constant Field Values
 
 - 
BREAK_THRESHOLDpublic static final double BREAK_THRESHOLD The maximal distance of the relative location. If this is exceeded after moving the relative locatable, the link is broken (seeLocatableNodeDragInteractor.mouseReleased(diva.canvas.event.LayerEvent)).- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
RelativeLocationpublic RelativeLocation(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException Construct an instance.- Parameters:
- container- The container (the object to have a relative location).
- name- The name of this instance.
- Throws:
- IllegalActionException- If the superclass throws it.
- NameDuplicationException- If the superclass throws it.
 
 
- 
 - 
Method Detail- 
getLocationpublic double[] getLocation() Get the location in some cartesian coordinate system. This method returns the absolute location of the object. If the relative location was previously attached to an object referenced in therelativeToproperty and that object is gone, then the internally stored location is updated so it contains the correct absolute location.- Specified by:
- getLocationin interface- Locatable
- Overrides:
- getLocationin class- Location
- Returns:
- The location.
- See Also:
- setLocation(double[])
 
 - 
getRelativeLocationpublic double[] getRelativeLocation() Get the relative location, relative to the relativeTo object, if there is one, and otherwise return the absolute location.- Returns:
- The relative location.
- See Also:
- setLocation(double[])
 
 - 
getRelativeToNamedObjpublic NamedObj getRelativeToNamedObj() If the relativeTo object exists, return it. Otherwise, return null and clear the relativeTo parameter value.- Returns:
- The relativeTo object, or null if it does not exist.
 
 - 
setLocationpublic void setLocation(double[] location) throws IllegalActionExceptionSet the location in some cartesian coordinate system, and notify the container and any value listeners of the new location. Setting the location involves maintaining a local copy of the passed parameter. No notification is done if the location is the same as before. This method propagates the value to any derived objects. If the relative location is attached to an object referenced in therelativeToproperty, then only the relative location is stored internally.- Specified by:
- setLocationin interface- Locatable
- Overrides:
- setLocationin class- Location
- Parameters:
- location- The location.
- Throws:
- IllegalActionException- Thrown when attributeChanged() is called.
- See Also:
- getLocation()
 
 
- 
 
-