com.nwoods.jgo.instruments
Class Phase

java.lang.Object
  extended bycom.nwoods.jgo.instruments.Phase
All Implemented Interfaces:
JGoXMLSaveRestore, java.io.Serializable

public class Phase
extends java.lang.Object
implements java.io.Serializable, JGoXMLSaveRestore

Contains the information needed to paint a phase of an IndicatorBar.

See Also:
Serialized Form

Constructor Summary
Phase()
          Creates a Phase with indeterminate values.
Phase(double min, double max, java.awt.Color color)
          Creates a Phase with properties set by the parameters.
 
Method Summary
 boolean equals(java.lang.Object o)
          Equality is defined by the equality of each of the fields.
 java.awt.Color getColor()
          Gets the Color used to paint the phase.
 double getMax()
          Gets the maximum value of the phase.
 double getMin()
          Gets the minimum value of the phase.
 void setColor(java.awt.Color value)
          Sets the Color used to paint the phase.
 void setMax(double value)
          Sets the maximum value of the phase.
 void setMin(double value)
          Sets the minimum value of the phase.
 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 java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Phase

public Phase()
Creates a Phase with indeterminate values.


Phase

public Phase(double min,
             double max,
             java.awt.Color color)
Creates a Phase with properties set by the parameters.

Parameters:
min - a double-float value
max - a double-float value, at least as large as the Min value
color - the Color used to paint the interior of the phase; a null value results in no fill
Method Detail

getMin

public double getMin()
Gets the minimum value of the phase.


setMin

public void setMin(double value)
Sets the minimum value of the phase.

Parameters:
value - a double-float value that should be at most as large as the Max value

getMax

public double getMax()
Gets the maximum value of the phase.


setMax

public void setMax(double value)
Sets the maximum value of the phase.

Parameters:
value - a double-float value that should be at least as large as the Min value

getColor

public java.awt.Color getColor()
Gets the Color used to paint the phase.


setColor

public void setColor(java.awt.Color value)
Sets the Color used to paint the phase.

Parameters:
value - a null value results in no painting of the interior of the phase

equals

public boolean equals(java.lang.Object o)
Equality is defined by the equality of each of the fields.


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
Parameters:
svgDoc - the DomDoc in which to construct the SVG representation of this object
jGoElementGroup - the DomElement to which to attach this object
See Also:
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

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
Parameters:
svgDoc - the DomDoc containing the SVG representation of this object
jGoDoc - the JGoDocument in which this object was created
svgElement - the element being read (typically the <g> element containing the JGoObject definition)
jGoChildElement - the current <JGoClass> element being read withing the <g>
See Also:
JGoObject.SVGWriteObject(com.nwoods.jgo.DomDoc, 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