Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nwoods.jgo.instruments
Class IndicatorBar

    java.lang.Object
      com.nwoods.jgo.JGoObject
          com.nwoods.jgo.JGoDrawable
              com.nwoods.jgo.instruments.AbstractIndicator
                  com.nwoods.jgo.instruments.IndicatorBar

All Implemented Interfaces:
  JGoActionObject, JGoXMLSaveRestore, java.io.Serializable

Direct Known Subclasses:
  IndicatorBarElliptical

public class IndicatorBar
extends AbstractIndicator

An AbstractIndicator that represents its value as a bar beginning at a set start point and extending to an end point which represents a specific value.

See Also:
  Serialized Form

Field Summary
`static int` | `ChangedStartOffset` This is a JGoObject update subhint.
`static int` | `ChangedThickness` This is a JGoObject update subhint.
`static int` | `InsertedPhase` This is a JGoObject update subhint.
`static int` | `RemovedPhase` This is a JGoObject update subhint.
`static int` | `ReplacedPhase` This is a JGoObject update subhint.

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
`IndicatorBar()` This constructor creates an IndicatorBar with all default properties.

Method Summary
`void` | `addPhase(Phase p)` Add a Phase to the IndicatorBar's phase collection.
`void` | `changeValue(JGoDocumentChangedEdit e, boolean undo)` Handle undo and redo changes.
`protected void` | `computePath(java.awt.geom.GeneralPath path)` Returns 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
`void` | `generateSVGOutput(DomDoc svgDoc, DomElement jGoElementGroup)`
`Phase` | `getPhase(int i)` Returns the phase located at the given index of the IndicatorBar's phase collection.
`int` | `getPhaseCount()` Gets the number of phases currently in the IndicatorBar's phase collection.
`void` | `getPhasePath(java.awt.geom.GeneralPath path, double min, double max)` Compute a GeneralPath corresponding to a specific phase of the IndicatorBar.
`java.awt.Dimension` | `getStartOffset()` Gets the offset of this bar's starting point relative to the scale's point for the minimum value.
`float` | `getThickness()` Gets the thickness of the IndicatorBar.
`void` | `insertPhase(int i, Phase p)` Insert a phase to a specific index of the phase collection.
`boolean` | `isPointInObj(java.awt.Point p)` Returns true if the point is close to the end of the bar.
`void` | `paint(java.awt.Graphics2D g, JGoView view)` Render this object to a Graphics object.
`void` | `paintPhase(java.awt.Graphics2D g, JGoView view, Phase phase, java.awt.geom.GeneralPath path)` Used to paint a given Phase.
`void` | `removePhase(int i)` Remove a Phase from the IndicatorBar's phase collection.
`void` | `removePhase(Phase p)` Remove a Phase from the IndicatorBar's phase collection.
`void` | `setPhase(int i, Phase p)` Replace a phase at a specific index of the phase collection.
`void` | `setStartOffset(java.awt.Dimension value)` Sets the offset of this bar's starting point relative to the scale's point for the minimum value.
`void` | `setThickness(float value)` Sets the thickness of the IndicatorBar.
`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.instruments.AbstractIndicator
`doUncapturedMouseMove, expandRectByPenWidth, geometryChange, getPartner, getPath, getQuantizeBase, getQuantizeUnit, getScale, getValue, getValueForPoint, isActionActivated, isActionEnabled, isQuantized, makePath, onAction, onActionAdjusted, onActionCancelled, quantizeValue, resetPath, setActionActivated, setActionEnabled, setPartner, setQuantizeBase, setQuantized, setQuantizeUnit, setScale, setValue, 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 com.nwoods.jgo.JGoObject
`canView, computeBoundingRect, computeMove, computeResize, copy, copyObjectDelayed, copyOldValueForUndo, copyRect, doMouseClick, doMouseDblClick, findCommonParent, foredate, gainedSelection, geometryChangeChild, getBoundingRect, getDocument, getDraggingObject, getFlags, getHeight, getLayer, getLeft, getLocation, getLocation, getParent, getParentJGoNode, getParentNode, getRectangleSpotLocation, getSize, getSize, getSpotLocation, getSpotLocation, getToolTipText, getTop, getTopLeft, getTopLeft, getTopLevelObject, getView, getWidth, growRect, handleMove, handleResize, hideSelectionHandles, is4ResizeHandles, isAutoRescale, isBoundingRectInvalid, isChildOf, isDraggable, isDragsNode, isInitializing, isResizable, isSelectable, isSkipsUndoManager, isSuspendChildUpdates, isSuspendUpdates, isTopLevel, isUpdatePartner, isVisible, lostSelection, ownerChange, partnerUpdate, pick, redirectSelection, remove, set4ResizeHandles, setAutoRescale, setBoundingRect, setBoundingRect, setBoundingRect, setBoundingRectForce, setBoundingRectForce, setBoundingRectInvalid, setBoundsRect, setDraggable, setDragsNode, setFlags, setHeight, setInitializing, setLeft, setLocation, setLocation, setLocationOffset, setLocationOffset, setParent, setRectangleSpotLocation, setResizable, setSelectable, setSize, setSize, setSizeKeepingLocation, setSkipsUndoManager, setSpotLocation, setSpotLocation, setSpotLocation, setSpotLocationOffset, setSuspendChildUpdates, 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`

Field Detail

### ChangedThickness

    public static final int ChangedThickness

  This is a JGoObject update subhint.

  See Also:
    Constant Field Values

### ChangedStartOffset

    public static final int ChangedStartOffset

  This is a JGoObject update subhint.

  See Also:
    Constant Field Values

### InsertedPhase

    public static final int InsertedPhase

  This is a JGoObject update subhint.

  See Also:
    Constant Field Values

### RemovedPhase

    public static final int RemovedPhase

  This is a JGoObject update subhint.

  See Also:
    Constant Field Values

### ReplacedPhase

    public static final int ReplacedPhase

  This is a JGoObject update subhint.

  See Also:
    Constant Field Values

Constructor Detail

### IndicatorBar

    public IndicatorBar()

  This constructor creates an IndicatorBar with all default properties.

Method Detail

### copyObject

    public JGoObject copyObject(JGoCopyEnvironment env)

  Copy the field values and the internal data structures to avoid sharing references

  Overrides:
    `copyObject` in class `AbstractIndicator`
  Parameters:
    `env` - the environment for the copy operation - keeps track of copied objects.
  Returns:
    the new IndicatorBar

### getThickness

    public float getThickness()

  Gets the thickness of the IndicatorBar.

  The thickness is the width of the bar. As the value changes, the length of the IndicatorBar changes.

### setThickness

    public void setThickness(float value)

  Sets the thickness of the IndicatorBar.

  The thickness is the width of the bar. As the value changes, the length of the IndicatorBar changes.

  Parameters:
    `value` - a floating point value in document coordinates; the value must be positive

### getStartOffset

    public java.awt.Dimension getStartOffset()

  Gets the offset of this bar's starting point relative to the scale's point for the minimum value.

  The drawing of IndicatorBar relies on this offset to the point associated with AbstractIndicator.Scale's minimum value.

  Returns:
    a Dimension in document coordinates, that defaults to zero/zero; the Dimension must not be modified

### setStartOffset

    public void setStartOffset(java.awt.Dimension value)

  Sets the offset of this bar's starting point relative to the scale's point for the minimum value.

  The drawing of IndicatorBar relies on this offset to the point associated with AbstractIndicator.Scale's minimum value.

  Parameters:
    `value` - a Dimension in document coordinates, with positive values for width and height.

### isPointInObj

    public boolean isPointInObj(java.awt.Point p)

  Returns true if the point is close to the end of the bar.

  Overrides:
    `isPointInObj` in class `JGoObject`
  Parameters:
    `p` - a Point in document coordinates
  Returns:
    true if the point is near the end of the bar; false elsewhere, including in most of the length of the bar from the start to near the end

### getPhasePath

    public void getPhasePath(java.awt.geom.GeneralPath path,
                             double min,
                             double max)

  Compute a GeneralPath corresponding to a specific phase of the IndicatorBar.

  The default method for painting Indicators relies on this function for a definition of the shape. However, paint can be overridden to not require this function.

  Parameters:
    `path` - a GeneralPath that is modified
    `min` - a double value used to get a point on the scale
    `max` - a double value used to get another point on the scale

### computePath

    protected void computePath(java.awt.geom.GeneralPath path)

  Returns a GeneralPath used to paint this AbstractIndicator.

  Because this function simply calls getPhasePath for a phase that ranges from the GraduatedScale's Minimum value to the AbstractIndicator's Value, this function does not have to be overridden for basic changes in desired shape. Most likely, it will only require that getPhasePath be overridden. The default method for painting Indicators relies on this function for a definition of the shape. However, Paint can be overridden to not require this function.

  Overrides:
    `computePath` in class `AbstractIndicator`
  Parameters:
    `path` - a GeneralPath that is modified

### paint

    public void paint(java.awt.Graphics2D g,
                      JGoView view)

  Render this object to a Graphics object.

  Overrides:
    `paint` in class `AbstractIndicator`
  Parameters:
    `g` - the Graphics2D object with which to draw
    `view` - the JGoView provides additional context for this painting operation

### paintPhase

    public void paintPhase(java.awt.Graphics2D g,
                           JGoView view,
                           Phase phase,
                           java.awt.geom.GeneralPath path)

  Used to paint a given Phase.

  Parameters:
    `g` - the Graphics2D object with which to draw
    `view` - the JGoView provides additional context for this painting operation
    `phase` - the phase to be drawn, specifying minimum value, maximum value and Color
    `path` - the GeneralPath to be filled and/or drawn

### addPhase

    public void addPhase(Phase p)

  Add a Phase to the IndicatorBar's phase collection.

  Parameters:
    `p` - a Phase

### removePhase

    public void removePhase(Phase p)

  Remove a Phase from the IndicatorBar's phase collection.

  Parameters:
    `p` - a Phase

### removePhase

    public void removePhase(int i)

  Remove a Phase from the IndicatorBar's phase collection.

  Parameters:
    `i` - a non-negative index which must be less than getPhaseCount()

### insertPhase

    public void insertPhase(int i,
                            Phase p)

  Insert a phase to a specific index of the phase collection.

  Parameters:
    `i` - a non-negative index; if greater than or equal to getPhaseCount(), the Phase is added at the end
    `p` - a Phase

### setPhase

    public void setPhase(int i,
                         Phase p)

  Replace a phase at a specific index of the phase collection.

  Parameters:
    `i` - a non-negative index which must be less than getPhaseCount()
    `p` - a Phase

### getPhase

    public Phase getPhase(int i)

  Returns the phase located at the given index of the IndicatorBar's phase collection.

  Parameters:
    `i` - a non-negative index which must be less than getPhaseCount()
  Returns:
    the zero-based i'th Phase

### getPhaseCount

    public int getPhaseCount()

  Gets the number of phases currently in the IndicatorBar's phase collection.

### copyNewValueForRedo

    public void copyNewValueForRedo(JGoDocumentChangedEdit e)

  Description copied from class: `JGoObject`
  This method is called when a JGoDocumentChangedEdit is created for a JGoDocumentEvent.CHANGED event, when a JGoObject has been changed. In order for the JGoDocumentChangedEdit to be able to perform a redo, it needs to remember the new property value or state. However, the JGoObject.update method does not provide such a new value. The value must be taken from this object and copied into the JGoDocumentChangedEdit by calling setNewValue and/or setNewValueInt.

  Just 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.

  Overrides:
    `copyNewValueForRedo` in class `AbstractIndicator`

### changeValue

    public void changeValue(JGoDocumentChangedEdit e,
                            boolean undo)

  Handle undo and redo changes.

  Overrides:
    `changeValue` in class `AbstractIndicator`
  Parameters:
    `e` -
    `undo` -

### 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 `AbstractIndicator`

### generateSVGOutput

    public void generateSVGOutput(DomDoc svgDoc,
                                  DomElement jGoElementGroup)

  Overrides:
    `generateSVGOutput` in class `AbstractIndicator`

### 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 `AbstractIndicator`

### 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 `AbstractIndicator`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD