|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nwoods.jgo.JGoObject
com.nwoods.jgo.JGoDrawable
com.nwoods.jgo.instruments.AbstractIndicator
com.nwoods.jgo.instruments.IndicatorNeedle
An indicator that displays the current value by drawing a straight line from a PivotPoint.
| Field Summary | |
static int |
ChangedConstantLength
This is a JGoObject update subhint. |
static int |
ChangedLength
This is a JGoObject update subhint. |
static int |
ChangedPivotPoint
This is a JGoObject update subhint. |
static int |
ChangedStyle
This is a JGoObject update subhint. |
static int |
ChangedThickness
This is a JGoObject update subhint. |
static int |
StyleBar
The IndicatorNeedle appears as a rectangle |
static int |
StyleKite
The IndicatorNeedle appears as a kite |
static int |
StyleLine
The IndicatorNeedle appears as a line between its pivot and end point |
| Fields inherited from class com.nwoods.jgo.instruments.AbstractIndicator |
ChangedActionEnabled, ChangedQuantBase, ChangedQuantized, ChangedQuantUnit, ChangedScale, ChangedValue |
| 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 | |
IndicatorNeedle()
This constructor creates an IndicatorNeedle with all default properties. |
|
| Method Summary | |
void |
changeValue(JGoDocumentChangedEdit e,
boolean undo)
Handle undo and redo changes. |
protected void |
computePath(java.awt.geom.GeneralPath path)
Initializes a GeneralPath used to paint this AbstractIndicator. |
void |
copyNewValueForRedo(JGoDocumentChangedEdit e)
This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed. |
JGoObject |
copyObject(JGoCopyEnvironment env)
Copy the field values and the internal data structures to avoid sharing references |
protected void |
geometryChange(java.awt.Rectangle old)
Update the PivotPoint proportionately. |
float |
getLength()
Gets whether the length to which the IndicatorNeedle will be drawn, if IndicatorNeedle.ConstantLength is true. |
java.awt.Point |
getPivotPoint()
Gets a fixed point which the needle will rotate around. |
int |
getStyle()
Gets or sets the style used to draw the IndicatorNeedle. |
float |
getThickness()
Used when drawing needles with the Kite or Bar style. |
double |
getValueForPoint(java.awt.Point dc)
This method is called by onActionAdjusted and onAction to get the proposed new value for the given mouse point. |
boolean |
isConstantLength()
Gets whether the needle will maintain a set length. |
boolean |
isPointInObj(java.awt.Point p)
Determine if a given point is inside and on this object. |
void |
setConstantLength(boolean value)
Sets whether the needle will maintain a set length. |
void |
setLength(float value)
Sets whether the length to which the IndicatorNeedle will be drawn, if IndicatorNeedle.ConstantLength is true. |
void |
setPivotPoint(java.awt.Point value)
Sets a fixed point which the needle will rotate around. |
void |
setStyle(int value)
Sets the style used to draw the IndicatorNeedle. |
void |
setThickness(float value)
Used when drawing needles with the Kite or Bar style. |
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 |
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.instruments.AbstractIndicator |
doUncapturedMouseMove, expandRectByPenWidth, generateSVGOutput, getPartner, getPath, getQuantizeBase, getQuantizeUnit, getScale, getValue, isActionActivated, isActionEnabled, isQuantized, makePath, onAction, onActionAdjusted, onActionCancelled, paint, quantizeValue, resetPath, setActionActivated, setActionEnabled, setPartner, setQuantizeBase, setQuantized, setQuantizeUnit, setScale, setValue, SVGUpdateReference, validValue |
| Methods inherited from class com.nwoods.jgo.JGoDrawable |
draw3DRect, draw3DRect, drawEllipse, drawEllipse, drawEllipse, drawLine, drawLine, drawPath, drawPolygon, drawPolygon, drawRect, drawRect, drawRect, drawRoundRect, drawRoundRect, getBrush, getNearestIntersectionPoint, getPen, setBrush, setPen, SVGAddPathArgs, SVGReadAttributes, SVGWriteAttributes |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int StyleLine
public static final int StyleKite
public static final int StyleBar
public static final int ChangedPivotPoint
public static final int ChangedConstantLength
public static final int ChangedLength
public static final int ChangedThickness
public static final int ChangedStyle
| Constructor Detail |
public IndicatorNeedle()
| Method Detail |
public JGoObject copyObject(JGoCopyEnvironment env)
copyObject in class AbstractIndicatorenv - the environment for the copy operation - keeps track of copied objects.
public java.awt.Point getPivotPoint()
When you change the bounding rectangle for this object, you will also need to update this property.
public void setPivotPoint(java.awt.Point value)
When you change the bounding rectangle for this object, you will also need to update this property.
value - the value must be a point within the BoundingRect of this IndicatorNeedle.public boolean isConstantLength()
If ConstantLength is false, the needle will be drawn the length of the line between PivotPoint and the Point returned by GraduatedScale.getPointForValue. If it is true, the needle will be drawn according to the Length property, along the line connecting PivotPoint and the Point returned by GraduatedScale.getPointForValue.
public void setConstantLength(boolean value)
If ConstantLength is false, the needle will be drawn the length of the line between PivotPoint and the Point returned by GraduatedScale.getPointForValue. If it is true, the needle will be drawn according to the Length property, along the line connecting PivotPoint and the Point returned by GraduatedScale.getPointForValue.
public float getLength()
public void setLength(float value)
value - must a positive distance in document coordinatespublic float getThickness()
public void setThickness(float value)
value - a positive distance in document coordinatespublic int getStyle()
public void setStyle(int value)
value - one of: StyleLine, StyleKite, StyleBarprotected void geometryChange(java.awt.Rectangle old)
geometryChange in class AbstractIndicatorold - protected void computePath(java.awt.geom.GeneralPath path)
The default method for painting Indicators relies on this function for a definition of the shape. However, AbstractIndicator.Paint can be overriden to not require this function.
computePath in class AbstractIndicatorpath - a GeneralPath that is modifiedpublic boolean isPointInObj(java.awt.Point p)
isPointInObj in class JGoObjectp -
public double getValueForPoint(java.awt.Point dc)
AbstractIndicator
getValueForPoint in class AbstractIndicatordc - a Point in document coordinates
public void copyNewValueForRedo(JGoDocumentChangedEdit e)
JGoObjectJust as the previous/old value/state information is stored as one or both of an integer and an Object, the new value/state information may be stored as either or both of an integer or an Object.
The responsibility for copying rests with the document event listener rather than the code calling JGoObject.update for efficiency when there is no undo/redo manager.
copyNewValueForRedo in class AbstractIndicator
public void changeValue(JGoDocumentChangedEdit e,
boolean undo)
changeValue in class AbstractIndicatore - undo -
public void SVGWriteObject(DomDoc svgDoc,
DomElement jGoElementGroup)
JGoXMLSaveRestoreThis 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.
SVGWriteObject in interface JGoXMLSaveRestoreSVGWriteObject in class AbstractIndicator
public DomNode SVGReadObject(DomDoc svgDoc,
JGoDocument jGoDoc,
DomElement svgElement,
DomElement jGoChildElement)
JGoXMLSaveRestoreThis 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.
SVGReadObject in interface JGoXMLSaveRestoreSVGReadObject in class AbstractIndicator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||