public class CoordinatePanel extends ControlPanel implements ValueChangeListener
ControlPanel with support for widgets that control
joint coordinate values. These widgets are instances of CoordinateWidget, which are subclassed of DoubleFieldSlider.
A CoordinatePanel is associated with a MechModel, which is assumed to
contain the joints whose coordinates are represented by the panel. When
coordinate values are changed through the panel, the MechModel is asked to
update various components, including the wrap paths for MultiPointSprings and the positions of attached components.
| Modifier and Type | Class and Description |
|---|---|
static class |
CoordinatePanel.SettingsPanel |
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibility| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_USE_DEGREES |
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames| Constructor and Description |
|---|
CoordinatePanel()
No-args constructor required for write/scan.
|
CoordinatePanel(MechModel mech)
Creates a CoordinatePanel with a specified
MechModel. |
CoordinatePanel(java.lang.String name,
MechModel mech)
Creates a CoordinatePanel with a specified name and
MechModel. |
CoordinatePanel(java.lang.String name,
MechModel mech,
java.lang.String options)
Creates a CoordinatePanel with a specified name,
MechModel, and
options. |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
CoordinateWidget |
addCoordinateWidget(JointBase joint,
int cidx)
Creates and adds a widget to this panel for the
cidx-th
coordinate of a specified joint. |
CoordinateWidget |
addCoordinateWidget(JointBase joint,
java.lang.String cname)
Creates and adds a widget to this panel for the named coordinate of a
specified joint.
|
CoordinateWidget |
addCoordinateWidget(JointCoordinateHandle handle)
Creates and adds a widget to this panel for the coordinate specified by a
handle.
|
CoordinateWidget |
addCoordinateWidget(JointCoordinateHandle handle,
double min,
double max)
Creates and adds a widget to this panel for the coordinate specified by a
handle.
|
CoordinateWidget |
addCoordinateWidget(java.lang.String label,
JointBase joint,
int cidx)
Creates and adds a widget to this panel for the
cidx-th
coordinate of a specified joint. |
CoordinateWidget |
addCoordinateWidget(java.lang.String label,
JointCoordinateHandle handle)
Creates and adds a widget to this panel for the coordinate specified by a
handle.
|
CoordinateWidget |
addCoordinateWidget(java.lang.String label,
JointCoordinateHandle handle,
double min,
double max)
Creates and adds a widget to this panel for the coordinate specified by a
handle.
|
java.util.List<CoordinateWidget> |
addCoordinateWidgets(JointBase joint)
Creates and adds widgets to this panel for all the coordinate of a
specified joint.
|
void |
addSettingsPanel()
Adds a settings panel to this coordinate panel that exposes
various settings, including:
use degrees, controlling whether rotatary coordinates
values are expressed in degrees or radians;
multiset mode, allowing multiple coordinate values to
be set simultaneously.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
double |
getCoordinate(java.lang.String label)
Queries the coordinate associated with the specified widget label.
|
double |
getCoordinateDeg(java.lang.String label)
Queries the coordinate associated with the specified widget label.
|
CoordinateSetter |
getCoordinateSetter()
Returns the coordinate setter used by this panel.
|
CoordinateWidget |
getCoordinateWidget(java.lang.String label)
Gets the coordinate widget with the specified label, or
null if
no such widget is present. |
java.util.List<CoordinateWidget> |
getCoordinateWidgets()
Returns a list of all the coordinate widgets currently in this panel.
|
MechModel |
getMechModel()
Queries the
MechModel associated with this panel. |
boolean |
getUseDegrees()
Queries whether this coordinate panel uses degrees or radians
for rotary coordinate values.
|
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component.
|
boolean |
scanItem(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens) |
CoordinateSetter.SetStatus |
setCoordinate(java.lang.String label,
double value)
Sets the coordinate associated with the specified widget label to a given
value.
|
CoordinateSetter.SetStatus |
setCoordinateDeg(java.lang.String label,
double value)
Sets the coordinate associated with the specified widget label to a given
value.
|
CoordinateSetter.SetStatus |
setCoordinates()
Applies all outstanding coordinate set requests.
|
void |
setMechModel(MechModel mech)
Sets the
MechModel associated with this panel. |
void |
setRequest(java.lang.String label,
double value)
Queues a request to set the coordinate associated with the specified
widget label to a given value.
|
void |
setRequestDeg(java.lang.String label,
double value)
Queues a request to set the coordinate associated with the specified
widget label to a given value.
|
void |
setUseDegrees(boolean enable)
Sets whether this coordinate panel uses degrees or radians for rotary
coordinate values.
|
void |
updateComponentCaches() |
void |
updateCoordinateWidgetList() |
void |
updateWidgetValues()
Update the value of all property widgets in this window and its owned
windows.
|
void |
valueChange(ValueChangeEvent e) |
addGlobalValueChangeListener, addLabel, addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, addWidget, addWidgets, connectToHierarchy, disconnectFromHierarchy, dispose, enableLiveUpdating, getFrame, getGlobalValueChangeListeners, getHeight, getLocation, getPropertyPanel, getSize, getSoftReferences, getSynchronizeObject, getWidth, isLiveUpdatingEnabled, isScrollable, isVisible, locateRight, numWidgets, pack, postscanWidget, removeGlobalValueChangeListener, removeStalePropertyWidgets, scanWidget, setDefaultValues, setFocusableWindowState, setLocation, setLocation, setName, setScrollable, setSize, setSize, setSynchronizeObject, setVisible, updateReferences, write, writeWidgetcheckFlag, checkName, checkNameUniqueness, clearFlag, clone, copy, createTempFlag, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, hasChildren, hasState, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritablepublic static boolean DEFAULT_USE_DEGREES
public static PropertyList myProps
public CoordinatePanel()
public CoordinatePanel(MechModel mech)
MechModel.mech - MechModel associated with the panelpublic CoordinatePanel(java.lang.String name,
MechModel mech)
MechModel.name - name of the panelmech - MechModel associated with the panelpublic PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class ControlPanelpublic boolean getUseDegrees()
true if the panel uses degreespublic void setUseDegrees(boolean enable)
enable - if true, the panel will use degreespublic MechModel getMechModel()
MechModel associated with this panel.public void setMechModel(MechModel mech)
MechModel associated with this panel.mech - MechModel to associate with this panelpublic CoordinateWidget addCoordinateWidget(JointBase joint, java.lang.String cname)
joint - joint containing the coordinatecname - name of the coordinatepublic CoordinateWidget addCoordinateWidget(JointBase joint, int cidx)
cidx-th
coordinate of a specified joint. The widget's label is set to the
coordinate name.joint - joint containing the coordinatecidx - coordinate indexpublic CoordinateWidget addCoordinateWidget(java.lang.String label, JointBase joint, int cidx)
cidx-th
coordinate of a specified joint.label - label optional widget label; if null, the label is set
to the coordinate namejoint - joint containing the coordinatecidx - coordinate indexpublic CoordinateWidget addCoordinateWidget(JointCoordinateHandle handle)
handle - handle specifying the coordinate's joint and indexpublic CoordinateWidget addCoordinateWidget(java.lang.String label, JointCoordinateHandle handle)
label - optional widget label; if null, the label is set
to the coordinate namehandle - handle specifying the coordinate's joint and indexpublic CoordinateWidget addCoordinateWidget(JointCoordinateHandle handle, double min, double max)
handle - handle specifying the coordinate's joint and indexmin - minimum widget valuemax - maximum widget valuepublic CoordinateWidget addCoordinateWidget(java.lang.String label, JointCoordinateHandle handle, double min, double max)
label - optional widget label; if null, the label is set
to the coordinate namehandle - handle specifying the coordinate's joint and indexmin - minimum widget valuemax - maximum widget valuepublic java.util.List<CoordinateWidget> addCoordinateWidgets(JointBase joint)
joint - joint containing the coordinatespublic java.util.List<CoordinateWidget> getCoordinateWidgets()
public CoordinateWidget getCoordinateWidget(java.lang.String label)
null if
no such widget is present.label - label of the widget being soughtpublic CoordinateSetter.SetStatus setCoordinate(java.lang.String label, double value)
label - label of the widget associated with the coordinatevalue - desired coordinate valuepublic double getCoordinate(java.lang.String label)
label - label of the widget associated with the coordinatepublic CoordinateSetter.SetStatus setCoordinateDeg(java.lang.String label, double value)
label - label of the widget associated with the coordinatevalue - desired coordinate valuepublic double getCoordinateDeg(java.lang.String label)
label - label of the widget associated with the coordinatepublic void setRequest(java.lang.String label,
double value)
label - label of the widget associated with the coordinatevalue - desired coordinate valuepublic void setRequestDeg(java.lang.String label,
double value)
label - label of the widget associated with the coordinatevalue - desired coordinate valuepublic CoordinateSetter.SetStatus setCoordinates()
public void addSettingsPanel()
Set button is clicked, at which point all coordinates are
set at once.
public CoordinateSetter getCoordinateSetter()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListeneractionPerformed in class ControlPanelpublic void valueChange(ValueChangeEvent e)
valueChange in interface ValueChangeListenerpublic void updateComponentCaches()
public void updateCoordinateWidgetList()
public void updateWidgetValues()
PropertyWindowupdateWidgetValues in interface PropertyWindowupdateWidgetValues in class ControlPanelpublic boolean scanItem(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
scanItem in class ControlPaneljava.io.IOExceptionpublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
scan() method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan() call.postscan in interface PostScannablepostscan in class ModelComponentBasetokens - token information that was stored during
scan().ancestor - ancestor component with respect to which
reference component paths are defined.java.io.IOException - if an error is encountered (such as a reference to a
non-existent component)