com.nwoods.jgo
Class JGoLinkLabel

java.lang.Object
  extended bycom.nwoods.jgo.JGoObject
      extended bycom.nwoods.jgo.JGoText
          extended bycom.nwoods.jgo.JGoLinkLabel
All Implemented Interfaces:
JGoXMLSaveRestore, java.io.Serializable

public class JGoLinkLabel
extends JGoText

JGoLinkLabel is a JGoText used as a label on a JGoLabeledLink.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.nwoods.jgo.JGoText
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, Changed2DScale, ChangedAlignment, ChangedAutoResize, ChangedBetterPainting, ChangedBkColor, ChangedBold, ChangedClipping, ChangedEditable, ChangedEditOnSingleClick, ChangedFaceName, ChangedFontSize, ChangedItalic, ChangedMultiline, ChangedSelectBackground, ChangedStrikeThrough, ChangedText, ChangedTextColor, ChangedTransparent, ChangedUnderline, ChangedWrapping, ChangedWrappingWidth
 
Fields inherited from class com.nwoods.jgo.JGoObject
Bottom, BottomCenter, BottomLeft, BottomMiddle, BottomRight, Center, CenterLeft, CenterRight, Changed4ResizeHandles, ChangedAutoRescale, ChangedBrush, ChangedDraggable, ChangedDragsNode, ChangedGeometry, ChangedGrabChildSelection, ChangedInitializing, ChangedPen, ChangedResizable, ChangedSelectable, ChangedUpdatePartner, ChangedVisible, ChangedZOrder, LastChangedHint, Left, LeftCenter, NoHandle, NoSpot, NumReservedHandles, RepaintAll, Right, RightCenter, SideLeft, SideRight, Top, TopCenter, TopLeft, TopMiddle, TopRight
 
Constructor Summary
JGoLinkLabel()
          Create an empty label with no particular geometry
JGoLinkLabel(org.eclipse.swt.graphics.Point location, int fontSize, java.lang.String text, java.lang.String fontName, boolean bold, boolean underline, boolean italic, int alignment, boolean multiline, boolean editable)
          Create a text object with the given attributes.
JGoLinkLabel(java.lang.String text)
          Create a text object given an initial string value.
 
Method Summary
protected  void geometryChange(org.eclipse.swt.graphics.Rectangle prevRect)
          If this object's geometry has changed, notify the "parent", namely the JGoLabeledLink, that one of its "children", namely this JGoLinkLabel, has been changed.
 JGoLabeledLink getLabeledLink()
          Return the labeled link that this text label is associated with.
 JGoObject getPartner()
          Sometimes it is convenient to be able to associate an object with another object, without any predetermined knowledge about the class.
 JGoObject redirectSelection()
          If the user tries to select this object, the labeled link gets selected instead, unless the labeled link's GrabChildSelection property is false.
 void setPartner(JGoObject obj)
          Sometimes it is convenient to be able to associate an object with another object, without any predetermined knowledge about the class.
 DomNode SVGReadObject(DomDoc svgDoc, JGoDocument jGoDoc, DomElement svgElement, DomElement jGoChildElement)
          Read this object in from a DomDoc representing a Scalable Vector Graphics (SVG) XML document.
 void SVGUpdateReference(java.lang.String attr, java.lang.Object referencedObject)
          This method will be called to fill in object references.
 void SVGWriteObject(DomDoc svgDoc, DomElement jGoElementGroup)
          Write this object out to a DomDoc representing a Scalable Vector Graphics (SVG) XML document.
 
Methods inherited from class com.nwoods.jgo.JGoText
changeValue, computeEdit, copyNewValueForRedo, copyObject, doEdit, doEndEdit, doMouseClick, doMouseDblClick, doStartEdit, expandRectByPenWidth, gainedSelection, getAlignment, getBkColor, getDefaultFontFaceName, getDefaultFontSize, getDefaultPaintGreekScale, getDefaultPaintNothingScale, getDefaultWrappingWidth, getFaceName, getFontSize, getLocation, getText, getTextColor, getTextFlags, getWrappingWidth, handleResize, is2DScale, isAutoResize, isBetterPainting, isBold, isClipping, isDefaultBetterPainting, isEditable, isEditOnSingleClick, isItalic, isMultiline, isSelectBackground, isStrikeThrough, isTransparent, isUnderline, isWrapping, lostSelection, paint, paintGreek, set2DScale, setAlignment, setAutoResize, setBetterPainting, setBkColor, setBold, setClipping, setDefaultBetterPainting, setDefaultFontFaceName, setDefaultFontSize, setDefaultPaintGreekScale, setDefaultPaintNothingScale, setDefaultWrappingWidth, setEditable, setEditOnSingleClick, setFaceName, setFontSize, setItalic, setLocation, setMultiline, setSelectBackground, setSizeKeepingLocation, setStrikeThrough, setText, setTextColor, setTextFlags, setTransparent, setUnderline, setWrapping, setWrappingWidth, SVGReadAttributes, SVGWriteAttributes
 
Methods inherited from class com.nwoods.jgo.JGoObject
canView, computeBoundingRect, computeMove, computeResize, copy, copyObjectDelayed, copyOldValueForUndo, copyRect, doUncapturedMouseMove, findCommonParent, foredate, geometryChangeChild, getBoundingRect, getDocument, getDraggingObject, getFlags, getHeight, getLayer, getLeft, getLocation, getNearestIntersectionPoint, getParent, getParentJGoNode, getParentNode, getRectangleSpotLocation, getSize, getSize, getSpotLocation, getSpotLocation, getToolTipText, getTop, getTopLeft, getTopLeft, getTopLevelObject, getView, getWidth, growRect, handleMove, hideSelectionHandles, is4ResizeHandles, isAutoRescale, isBoundingRectInvalid, isChildOf, isDraggable, isDragsNode, isInitializing, isPointInObj, isResizable, isSelectable, isSkipsUndoManager, isSuspendUpdates, isTopLevel, isUpdatePartner, isVisible, ownerChange, partnerUpdate, pick, remove, set4ResizeHandles, setAutoRescale, setBoundingRect, setBoundingRect, setBoundingRect, setBoundingRectInvalid, setBoundsRect, setDraggable, setDragsNode, setFlags, setHeight, setInitializing, setLeft, setLocation, setLocationOffset, setLocationOffset, setParent, setRectangleSpotLocation, setResizable, setSelectable, setSize, setSize, setSkipsUndoManager, setSpotLocation, setSpotLocation, setSpotLocation, setSpotLocationOffset, setSuspendUpdates, setTop, setTopLeft, setTopLeft, setUpdatePartner, setVisible, setWidth, showSelectionHandles, spotOpposite, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JGoLinkLabel

public JGoLinkLabel()
Create an empty label with no particular geometry


JGoLinkLabel

public JGoLinkLabel(java.lang.String text)
Create a text object given an initial string value. By default the text will have a transparent background.

Parameters:
text - the initial string

JGoLinkLabel

public JGoLinkLabel(org.eclipse.swt.graphics.Point location,
                    int fontSize,
                    java.lang.String text,
                    java.lang.String fontName,
                    boolean bold,
                    boolean underline,
                    boolean italic,
                    int alignment,
                    boolean multiline,
                    boolean editable)
Create a text object with the given attributes. The bounding box will be set to be the smallest that surrounds the text. By default the text will have a transparent background.

Parameters:
location - the top-left, top-middle, or top-right corner of the text, depending on the alignment
fontSize - the size of the font to use
text - the text to display
fontName - the name of the font face to use
bold - display in bold if true
underline - display underline if true
italic - display in italic if true
alignment - the type of alignment
multiline - display more than one line of text if true
editable - permit in-place editing of text if true
Method Detail

redirectSelection

public JGoObject redirectSelection()
If the user tries to select this object, the labeled link gets selected instead, unless the labeled link's GrabChildSelection property is false.

Overrides:
redirectSelection in class JGoObject
Returns:
by default, returns this object

geometryChange

protected void geometryChange(org.eclipse.swt.graphics.Rectangle prevRect)
If this object's geometry has changed, notify the "parent", namely the JGoLabeledLink, that one of its "children", namely this JGoLinkLabel, has been changed.

Overrides:
geometryChange in class JGoText
Parameters:
prevRect - the previous bounding rectangle

SVGWriteObject

public void SVGWriteObject(DomDoc svgDoc,
                           DomElement jGoElementGroup)
Description copied from interface: JGoXMLSaveRestore
Write this object out to a DomDoc representing a Scalable Vector Graphics (SVG) XML document.

This method will be called by com.nwoods.jgo.svg.DefaultDocument.SVGWriteDoc() for every JGoObject contained within a JGoDocument. The following example uses a JGoRectangle to illustrate the format of a generated SVG JGoObject:

<g>
<JGoClass class="com.nwoods.jgo.JGoRectangle"\>
<rect height="75" style="stroke:black;stroke-width:1;fill:rgb(255,0,0);" width="75" x="65" y="71"/>
<JGoClass class="com.nwoods.jgo.JGoDrawable" drawablebrush="jgoid1" drawablepen="jgoid2" embeddedpenbrush="false"/>
<JGoClass class="com.nwoods.jgo.JGoObject" obj_flags="1054"/>
</g>

Note that the entire JGoObject is enclosed in a group (<g>). Each subclass of the JGoObject is described by a <JGoClass> element, starting with the most specific class and moving to the more general. Each <JGoClass> element has a "class" attribute which defines the class name. Each <JGoClass> element may also have several other attributes which uniquely describe that state of that class. Following the <JGoClass> element, each class may also genereate any other elements that are required, including representations of contained objects and standard SVG elements such as the <rect> element shown in the above example. The generation of SVG elements in the output makes it possible for the output to be read by SVG viewers and other SVG aware applications. The information contained in the <JGoClass> elements allows us to accurately save and restore all the information in a particular JGoObject subclass.

If this class contains a reference to another object, call DomDoc.registerReferencingNode() to register that reference. This will cause the element representing the referenced object to be identified with a unique id attribute, and cause the element representing the referring object to have a user defined attribute containing a reference to that id. See DomDoc.registerReferencingNode() for more information.

Typically, an implementation of this method will generate a <JGoClass> element using the DomDoc.createJGoClassElement() method, adding whatever attributes are necessary to describe the class. It will then call its superclass so that the superclass can add its own <JGoClass> element and other information to jGoElementGroup within the DomDoc.

Refer to com.nwoods.jgo.examples.flower.ActivityNode.SVGWriteObject() and com.nwoods.jgo.examples.SimpleNode.SVGWriteObject() for examples using this method.

Refer to the file com.nwoods.jgo.svg\xsvg.dtd for a formal description of JGo extensions to the SVG document type.

Specified by:
SVGWriteObject in interface JGoXMLSaveRestore
Overrides:
SVGWriteObject in class JGoText

SVGReadObject

public DomNode SVGReadObject(DomDoc svgDoc,
                             JGoDocument jGoDoc,
                             DomElement svgElement,
                             DomElement jGoChildElement)
Description copied from interface: JGoXMLSaveRestore
Read this object in from a DomDoc representing a Scalable Vector Graphics (SVG) XML document.

This method will be called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() for every <JGoClass> element encountered in a DomDoc. First, an object of the type specified by the class attribute will be created and then the SVGReadObject() method will be called on that newly created object. Refer to SVGWriteObject() for a description of the expected format of the SVG document.

This method may also be called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() when reading any SVG document, including those not generated by JGo and therefore not containing any <JGoClass> elements. In such cases, the DefaultDocument.SVGReadElement() method may be subclassed to examine the SVG element and cause the appropriate JGoObject to be created to represent that element and call SVGReadObject() on that newly created object. By default, standard JGoObjects such as JGoRectangles, JGoStrokes, etc will be created to represent these objects.

If this class contains a reference to another object, call DomDoc.registerReferencingObject() to register that reference. This will cause the JGoObject.SVGUpdateReference() to be called on the referencing object after all the objects have been created, passing in the object befing referenced. See DomDoc.registerReferencingObject() for more information.

Typically, an implementation of this method starts by verifying that the element being read is a <JGoClass> element (which will be true if jGoChildElement is not null). This will always be true unless you have subclassed the DefaultDocument.SVGReadElement() method as described above. It will then read the expected attributes of the <JGoClass> element (as written by SVGReadObject()), call SVGReadObject() on its superclass, and finally return the next element by calling svgElement.getNextSibling().

Refer to com.nwoods.jgo.examples.flower.ActivityNode.SVGReadObject() and com.nwoods.jgo.examples.SimpleNode.SVGReadObject() for examples using this method.

Specified by:
SVGReadObject in interface JGoXMLSaveRestore
Overrides:
SVGReadObject in class JGoText

SVGUpdateReference

public void SVGUpdateReference(java.lang.String attr,
                               java.lang.Object referencedObject)
Description copied from class: JGoObject
This method will be called to fill in object references.

This is called by com.nwoods.jgo.svg.DefaultDocument.SVGReadDoc() after all the objects have been created and if DomDoc.registerReferencingObject() has been previously called by SVGReadObject().

Typically, an implementation of this method will first call the superclass and then fill in the appropriate object reference based on the attr argument.

Refer to com.nwoods.jgo.examples.SimpleNode.SVGWriteObject() for an example using this method.

Overrides:
SVGUpdateReference in class JGoObject
Parameters:
attr - the attribute name specified by SVGReadDoc() in DomDoc.registerReferencingObject()
referencedObject - the object being referenced
See Also:
JGoObject.SVGWriteObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.DomElement), JGoObject.SVGReadObject(com.nwoods.jgo.DomDoc, com.nwoods.jgo.JGoDocument, com.nwoods.jgo.DomElement, com.nwoods.jgo.DomElement), JGoObject.SVGWriteAttributes(com.nwoods.jgo.DomElement), JGoObject.SVGReadAttributes(com.nwoods.jgo.DomElement), JGoObject.SVGUpdateReference(java.lang.String, java.lang.Object), DomDoc, DomNode, DomElement, DomText

getLabeledLink

public JGoLabeledLink getLabeledLink()
Return the labeled link that this text label is associated with.


getPartner

public JGoObject getPartner()
Description copied from class: JGoObject
Sometimes it is convenient to be able to associate an object with another object, without any predetermined knowledge about the class. Although JGoObject does not provide any storage for this "property", subclasses may decide to do so.

By default this returns null.

Overrides:
getPartner in class JGoObject

setPartner

public void setPartner(JGoObject obj)
Description copied from class: JGoObject
Sometimes it is convenient to be able to associate an object with another object, without any predetermined knowledge about the class. Although JGoObject does not provide any storage for this "property", subclasses may decide to do so.

By default this is a no-op.

Overrides:
setPartner in class JGoObject