|
||||||||||
| 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.JGoArea
com.nwoods.jgo.instruments.Meter
A JGoArea designed to maintain a AbstractGraduatedScale, an AbstractIndicator, a JGoObject background, and a JGoText label.
| Field Summary | |
static int |
ChangedBackground
This is a JGoObject update subhint. |
static int |
ChangedIndicator
This is a JGoObject update subhint. |
static int |
ChangedInsets
This is a JGoObject update subhint. |
static int |
ChangedLabel
This is a JGoObject update subhint. |
static int |
ChangedLabelRelativeSpot
This is a JGoObject update subhint. |
static int |
ChangedLabelSpot
This is a JGoObject update subhint. |
static int |
ChangedOrientation
This is a JGoObject update subhint. |
static int |
ChangedScale
This is a JGoObject update subhint. |
static int |
OrientationHorizontal
A value for the Orientation property. |
static int |
OrientationVertical
A value for the Orientation property. |
| Fields inherited from class com.nwoods.jgo.JGoArea |
ChangedPickableBackground |
| 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 | |
Meter()
Creates an empty Meter -- call initialize() before using! |
|
| Method Summary | |
void |
changeValue(JGoDocumentChangedEdit e,
boolean undo)
Handle undo and redo changes. |
protected void |
copyChildren(JGoArea newarea,
JGoCopyEnvironment env)
Make sure fields referring to children are updated to refer to the newly copied objects. |
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 |
protected JGoObject |
createBackground()
Method for creating an instance of the meter's standard background. |
protected AbstractIndicator |
createIndicator()
Method for creating an instance of the meter's standard indicator. |
protected JGoText |
createLabel()
Method for creating an instance of the meter's standard label. |
protected AbstractGraduatedScale |
createScale()
Method for creating an instance of the meter's standard scale. |
JGoObject |
getBackground()
Gets the background object of the Meter. |
AbstractIndicator |
getIndicator()
Gets the AbstractIndicator associated with the Meter. |
java.awt.Insets |
getInsets()
Gets the margin between the top-left corner of the Background and the top-left corner of the Scale (and AbstractIndicator). |
JGoText |
getLabel()
Gets the label object of the Meter. |
int |
getLabelRelativeSpot()
Gets the Label's position compared to the spot specified by the LabelSpot. |
int |
getLabelSpot()
Gets the position of Label compared to the Background. |
double |
getMaximum()
AbstractGraduatedScale's Maximum property exposed from this Meter's Scale. |
double |
getMinimum()
AbstractGraduatedScale's Minimum property exposed from this Meter's Scale. |
int |
getOrientation()
Some meters may find it useful to be oriented along either a horizontal or vertical direction; others may ignore this. |
double |
getQuantizeBase()
The AbstractIndicator.QuantizeBase property exposed from the Meter's AbstractIndicator. |
double |
getQuantizeUnit()
The AbstractIndicator.QuantizeUnit property exposed from the Meter's AbstractIndicator. |
AbstractGraduatedScale |
getScale()
Gets the AbstractGraduatedScale associated with the Meter. |
int |
getScaleLabelDistance()
AbstractGraduatedScale's LabelDistance property exposed from this Meter's Scale. |
java.lang.String |
getScaleLabelFormat()
AbstractGraduatedScale's LabelFormat property exposed from this Meter's Scale. |
int |
getScaleLabelFrequency()
AbstractGraduatedScale's LabelFrequency property exposed from this Meter's Scale. |
int |
getScaleLabelStyle()
AbstractGraduatedScale's LabelStyle property exposed from this Meter's Scale. |
double |
getTickBase()
AbstractGraduatedScale's TickBase property exposed from this Meter's Scale. |
java.awt.Color |
getTickColor()
AbstractGraduatedScale's TickColor property exposed from this Meter's Scale. |
float |
getTickLengthLeft()
AbstractGraduatedScale's TickLengthLeft property exposed from this Meter's Scale. |
float |
getTickLengthRight()
AbstractGraduatedScale's TickLengthRight property exposed from this Meter's Scale. |
int |
getTickMajorFrequency()
AbstractGraduatedScale's TickMajorFrequency property exposed from this Meter's Scale. |
float |
getTickMajorLengthRatio()
AbstractGraduatedScale's TickMajorLengthRatio property exposed from this Meter's Scale. |
int |
getTickMajorWidth()
AbstractGraduatedScale's TickMajorWidth property exposed from this Meter's Scale. |
double |
getTickUnit()
AbstractGraduatedScale's TickUnit property exposed from this Meter's Scale. |
int |
getTickWidth()
AbstractGraduatedScale's TickWidth property exposed from this Meter's Scale. |
double |
getValue()
The AbstractIndicator.Value property exposed from the Meter's AbstractIndicator. |
void |
initialize()
This calls createBackground(), createLabel(), createScale(), and createIndicator(), adds all the resulting objects to this area, and sets the AbstractIndicator's Scale to the created scale. |
boolean |
isControllable()
Gets whether the value of the meter can be manipulated by the user. |
boolean |
isQuantized()
The AbstractIndicator.Quantized property exposed from the Meter's AbstractIndicator. |
boolean |
isTickLabels()
AbstractGraduatedScale's TickLabels property exposed from this Meter's Scale. |
void |
layoutChildren(JGoObject childchanged)
Have the Scale and AbstractIndicator have the same bounds smaller than and within the Background, as determined by TopLeftMargin and BottomRightMargin. |
JGoObject |
removeObjectAtPos(JGoListPosition pos)
If any part is removed from this group, be sure to remove any references in local fields. |
void |
setBackground(JGoObject value)
Sets the background object of the Meter. |
void |
setControllable(boolean value)
Sets whether the value of the meter can be manipulated by the user. |
void |
setIndicator(AbstractIndicator value)
Sets the AbstractIndicator associated with the Meter. |
void |
setInsets(java.awt.Insets x)
Sets the margin between the top-left corner of the Background and the top-left corner of the Scale (and AbstractIndicator). |
void |
setLabel(JGoText value)
Sets the label object of the Meter. |
void |
setLabelRelativeSpot(int value)
Sets the Label's position compared to the spot specified by the LabelSpot. |
void |
setLabelSpot(int value)
Sets the position of Label compared to the Background. |
void |
setMaximum(double value)
AbstractGraduatedScale's Maximum property exposed from this Meter's Scale. |
void |
setMinimum(double value)
AbstractGraduatedScale's Minimum property exposed from this Meter's Scale. |
void |
setOrientation(int value)
Some meters may find it useful to be oriented along either a horizontal or vertical direction; others may ignore this. |
void |
setQuantizeBase(double value)
The AbstractIndicator.QuantizeBase property exposed from the Meter's AbstractIndicator. |
void |
setQuantized(boolean value)
The AbstractIndicator.Quantized property exposed from the Meter's AbstractIndicator. |
void |
setQuantizeUnit(double value)
The AbstractIndicator.QuantizeUnit property exposed from the Meter's AbstractIndicator. |
void |
setScale(AbstractGraduatedScale value)
Sets the AbstractGraduatedScale associated with the Meter. |
void |
setScaleLabelDistance(int value)
AbstractGraduatedScale's LabelDistance property exposed from this Meter's Scale. |
void |
setScaleLabelFormat(java.lang.String value)
AbstractGraduatedScale's LabelFormat property exposed from this Meter's Scale. |
void |
setScaleLabelFrequency(int value)
AbstractGraduatedScale's LabelFrequency property exposed from this Meter's Scale. |
void |
setScaleLabelStyle(int value)
AbstractGraduatedScale's LabelStyle property exposed from this Meter's Scale. |
void |
setTickBase(double value)
AbstractGraduatedScale's TickBase property exposed from this Meter's Scale. |
void |
setTickColor(java.awt.Color value)
AbstractGraduatedScale's TickColor property exposed from this Meter's Scale. |
void |
setTickLabels(boolean value)
AbstractGraduatedScale's TickLabels property exposed from this Meter's Scale. |
void |
setTickLengthLeft(float value)
AbstractGraduatedScale's TickLengthLeft property exposed from this Meter's Scale. |
void |
setTickLengthRight(float value)
AbstractGraduatedScale's TickLengthRight property exposed from this Meter's Scale. |
void |
setTickMajorFrequency(int value)
AbstractGraduatedScale's TickMajorFrequency property exposed from this Meter's Scale. |
void |
setTickMajorLengthRatio(float value)
AbstractGraduatedScale's TickMajorLengthRatio property exposed from this Meter's Scale. |
void |
setTickMajorWidth(int value)
AbstractGraduatedScale's TickMajorWidth property exposed from this Meter's Scale. |
void |
setTickUnit(double value)
AbstractGraduatedScale's TickUnit property exposed from this Meter's Scale. |
void |
setTickWidth(int value)
AbstractGraduatedScale's TickWidth property exposed from this Meter's Scale. |
void |
setValue(double value)
The AbstractIndicator.Value property exposed from the Meter's AbstractIndicator. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int OrientationHorizontal
public static final int OrientationVertical
public static final int ChangedBackground
public static final int ChangedLabel
public static final int ChangedIndicator
public static final int ChangedScale
public static final int ChangedInsets
public static final int ChangedOrientation
public static final int ChangedLabelSpot
public static final int ChangedLabelRelativeSpot
| Constructor Detail |
public Meter()
| Method Detail |
public void initialize()
Be sure to call this method after constructing a new Meter. Subclasses of Meter should override this method to do any initialization after calling super.initialize().
public AbstractGraduatedScale getScale()
public void setScale(AbstractGraduatedScale value)
This removes any old scale from this meter and adds the new one. This meter's AbstractIndicator's Scale is also set to be the new scale.
public AbstractIndicator getIndicator()
public void setIndicator(AbstractIndicator value)
This removes any old indicator from this meter and adds the new one. The AbstractIndicator's Scale is also set to be this meter's scale.
public JGoObject getBackground()
public void setBackground(JGoObject value)
This removes any old background object from this meter and adds the new one.
public JGoText getLabel()
public void setLabel(JGoText value)
This removes any old label from this meter and adds the new one.
protected JGoObject createBackground()
protected JGoText createLabel()
protected AbstractGraduatedScale createScale()
By default this returns null--each subclass should this to actually allocate and return some kind of AbstractGraduatedScale.
protected AbstractIndicator createIndicator()
By default this returns null--each subclass should this to actually allocate and return some kind of AbstractIndicator.
public JGoObject copyObject(JGoCopyEnvironment env)
copyObject in class JGoAreaenv - the environment for the copy operation - keeps track of copied objects.
protected void copyChildren(JGoArea newarea,
JGoCopyEnvironment env)
copyChildren in class JGoAreanewarea - env - public JGoObject removeObjectAtPos(JGoListPosition pos)
removeObjectAtPos in interface JGoObjectCollectionremoveObjectAtPos in class JGoAreapos - a JGoListPosition in this areapublic void layoutChildren(JGoObject childchanged)
layoutChildren in class JGoAreachildchanged - JGoArea.geometryChange(java.awt.Rectangle),
JGoArea.geometryChangeChild(com.nwoods.jgo.JGoObject, java.awt.Rectangle)public int getOrientation()
The default value is Meter.OrientationHorizontal.
public void setOrientation(int value)
value - one of: OrientationHorizontal or OrientationVerticalpublic java.awt.Insets getInsets()
public void setInsets(java.awt.Insets x)
public int getLabelSpot()
This defaults to JGoObject.MiddleBottom
public void setLabelSpot(int value)
value - a label spot (one of the JGoObject constants)public int getLabelRelativeSpot()
This defaults to JGoObject.MiddleBottom, thereby placing the label inside the Background.
public void setLabelRelativeSpot(int value)
value - a label spot (one of the JGoObject constants)public double getMinimum()
public void setMinimum(double value)
public double getMaximum()
public void setMaximum(double value)
public double getTickUnit()
public void setTickUnit(double value)
public double getTickBase()
public void setTickBase(double value)
public java.awt.Color getTickColor()
public void setTickColor(java.awt.Color value)
public int getTickWidth()
public void setTickWidth(int value)
public float getTickLengthLeft()
public void setTickLengthLeft(float value)
public float getTickLengthRight()
public void setTickLengthRight(float value)
public int getTickMajorFrequency()
public void setTickMajorFrequency(int value)
public int getTickMajorWidth()
public void setTickMajorWidth(int value)
public float getTickMajorLengthRatio()
public void setTickMajorLengthRatio(float value)
public boolean isTickLabels()
public void setTickLabels(boolean value)
public int getScaleLabelStyle()
public void setScaleLabelStyle(int value)
public int getScaleLabelFrequency()
public void setScaleLabelFrequency(int value)
public int getScaleLabelDistance()
public void setScaleLabelDistance(int value)
public java.lang.String getScaleLabelFormat()
public void setScaleLabelFormat(java.lang.String value)
public double getValue()
public void setValue(double value)
public boolean isControllable()
Directly checks and changes the Meter's AbstractIndicator's AbstractIndicator.ActionEnabled property.
public void setControllable(boolean value)
Directly checks and changes the Meter's AbstractIndicator's AbstractIndicator.ActionEnabled property.
public boolean isQuantized()
public void setQuantized(boolean value)
public double getQuantizeBase()
public void setQuantizeBase(double value)
public double getQuantizeUnit()
public void setQuantizeUnit(double value)
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 JGoArea
public void changeValue(JGoDocumentChangedEdit e,
boolean undo)
changeValue in class JGoAreae - 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 JGoArea
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 JGoArea
public void SVGUpdateReference(java.lang.String attr,
java.lang.Object referencedObject)
JGoObjectThis 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.
SVGUpdateReference in class JGoObjectattr - the attribute name specified by SVGReadDoc() in DomDoc.registerReferencingObject()referencedObject - the object being referencedJGoObject.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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||