public class ControlPanel extends ModelComponentBase implements PropertyWindow, java.awt.event.ActionListener
ModelComponent.NavpanelVisibility
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
Constructor and Description |
---|
ControlPanel() |
ControlPanel(java.lang.String name) |
ControlPanel(java.lang.String name,
java.lang.String options) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
addGlobalValueChangeListener(ValueChangeListener l)
Add a value change listener to all property widgets in this window and its
owned windows.
|
javax.swing.JLabel |
addLabel(java.lang.String text) |
java.awt.Component |
addWidget(java.awt.Component comp) |
LabeledComponentBase |
addWidget(HasProperties host,
java.lang.String name) |
LabeledComponentBase |
addWidget(HasProperties host,
java.lang.String name,
double min,
double max) |
LabeledComponentBase |
addWidget(Property prop) |
LabeledComponentBase |
addWidget(Property prop,
double min,
double max) |
LabeledComponentBase |
addWidget(java.lang.String propPath,
double min,
double max,
HasProperties... hosts)
Create and add a labeled widget that controls a specified property in one
or more hosts.
|
LabeledComponentBase |
addWidget(java.lang.String propPath,
HasProperties... hosts)
Create and add a labeled widget that controls a specified property in one
or more hosts.
|
LabeledComponentBase |
addWidget(java.lang.String labelText,
HasProperties host,
java.lang.String name) |
LabeledComponentBase |
addWidget(java.lang.String labelText,
HasProperties host,
java.lang.String name,
double min,
double max) |
LabeledComponentBase |
addWidget(java.lang.String labelText,
java.lang.String propPath,
double min,
double max,
HasProperties... hosts)
Create and add a slider widget that controls a specified scalar property
in one or more hosts.
|
LabeledComponentBase |
addWidget(java.lang.String labelText,
java.lang.String propPath,
HasProperties... hosts)
Create and add a labeled widget that controls a specified property in one
or more hosts.
|
void |
addWidgets(HasProperties host) |
void |
connectToHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is added to the component hierarchy (i.e., added as
a child of another CompositeComponent).
|
void |
disconnectFromHierarchy(CompositeComponent hcomp)
Called by the system after this component, or an ancestor of this
component, is removed from the component hierarchy (i.e., removed as a
child of its parent).
|
void |
dispose()
Dispose of all resources used by this object.
|
void |
enableLiveUpdating(boolean enable) |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
PropertyFrame |
getFrame() |
ValueChangeListener[] |
getGlobalValueChangeListeners()
Get an array of all the global value change listeners defined for this
window.
|
int |
getHeight() |
java.awt.Point |
getLocation() |
PropertyPanel |
getPropertyPanel() |
java.awt.Dimension |
getSize() |
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list.
|
java.lang.Object |
getSynchronizeObject()
Gets the object (if any) with which property widget value changes are
synchronized.
|
int |
getWidth() |
boolean |
isLiveUpdatingEnabled()
If true, then the workspace should continuously update the property values
whenever the model is rerendered.
|
boolean |
isScrollable() |
boolean |
isVisible() |
void |
locateRight(java.awt.Component comp) |
int |
numWidgets() |
void |
pack() |
void |
postscanWidget(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor) |
void |
removeGlobalValueChangeListener(ValueChangeListener l)
Remove a value change listener from all property widgets in this window
and its owned windows.
|
boolean |
removeStalePropertyWidgets() |
boolean |
scanItem(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens) |
void |
scanWidget(java.lang.String classNameOrAlias,
ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens) |
void |
setDefaultValues()
Sets the attributes of this component to their default values.
|
void |
setFocusableWindowState(boolean enable) |
void |
setLocation(int x,
int y) |
void |
setLocation(java.awt.Point dim) |
void |
setName(java.lang.String name)
Sets the name of this component.
|
void |
setScrollable(boolean scrollable) |
void |
setSize(java.awt.Dimension dim) |
void |
setSize(int w,
int h) |
void |
setSynchronizeObject(java.lang.Object syncObj)
Sets an object with which property widget value changes are synchronized.
|
void |
setVisible(boolean visible) |
void |
updateReferences(boolean undo,
java.util.Deque<java.lang.Object> undoInfo)
May be called by the system if any of the soft references for
this component are removed from the the component hierarchy.
|
void |
updateWidgetValues()
Update the value of all property widgets in this window and its owned
windows.
|
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a text description of this element to a PrintWriter.
|
void |
writeWidget(java.io.PrintWriter pw,
java.awt.Component comp,
NumberFormat fmt,
CompositeComponent ancestor) |
checkFlag, 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, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable
public static PropertyList myProps
public ControlPanel()
public ControlPanel(java.lang.String name)
public ControlPanel(java.lang.String name, java.lang.String options)
public void setName(java.lang.String name)
ModelComponentBase
notifyParentOfChange
with a NameChangeEvent
so that it's
parent can update the name map entry and other ancestors can adjust for
the new name.
Component names can be specified as null. However, if not null, they
should have non-zero length and should not begin with a digit or contain
the characters '.' or '/'. Implementations can use ModelComponentBase.checkName()
to determine if a proposed name is valid.
setName
in interface ModelComponent
setName
in class ModelComponentBase
name
- new component namepublic void setDefaultValues()
ModelComponentBase
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public int numWidgets()
public void setScrollable(boolean scrollable)
public boolean isScrollable()
public java.awt.Component addWidget(java.awt.Component comp)
public LabeledComponentBase addWidget(Property prop)
public LabeledComponentBase addWidget(Property prop, double min, double max)
public LabeledComponentBase addWidget(HasProperties host, java.lang.String name)
public LabeledComponentBase addWidget(HasProperties host, java.lang.String name, double min, double max)
public LabeledComponentBase addWidget(java.lang.String labelText, HasProperties host, java.lang.String name)
public LabeledComponentBase addWidget(java.lang.String labelText, HasProperties host, java.lang.String name, double min, double max)
public LabeledComponentBase addWidget(java.lang.String propPath, HasProperties... hosts)
propPath
- path of the property with respect to each hosthosts
- one or more hosts of the specified propertynull
if the specified
property was not found in all hostsjava.lang.IllegalArgumentException
- if no hosts are specifiedpublic LabeledComponentBase addWidget(java.lang.String propPath, double min, double max, HasProperties... hosts)
propPath
- path of the property with respect to each hosthosts
- one or more hosts of the specified propertynull
if the specified
property was not found in all hostsjava.lang.IllegalArgumentException
- if no hosts are specifiedpublic LabeledComponentBase addWidget(java.lang.String labelText, java.lang.String propPath, HasProperties... hosts)
labelText
- label text for the widgetpropPath
- path of the property with respect to each hosthosts
- one or more hosts of the specified propertynull
if the specified
property was not found in all hostsjava.lang.IllegalArgumentException
- if no hosts are specifiedpublic LabeledComponentBase addWidget(java.lang.String labelText, java.lang.String propPath, double min, double max, HasProperties... hosts)
labelText
- label text for the widgetpropPath
- path of the property with respect to each hostmin
- initial minimum value for the slidermax
- initial maximum value for the sliderhosts
- one or more hosts of the specified propertynull
if the specified property is
not a scalar property found in all hostsjava.lang.IllegalArgumentException
- if no hosts are specifiedpublic void addWidgets(HasProperties host)
public javax.swing.JLabel addLabel(java.lang.String text)
public PropertyPanel getPropertyPanel()
public PropertyFrame getFrame()
public void dispose()
PropertyWindow
dispose
in interface Disposable
dispose
in interface PropertyWindow
public void updateWidgetValues()
PropertyWindow
updateWidgetValues
in interface PropertyWindow
public void addGlobalValueChangeListener(ValueChangeListener l)
PropertyWindow
addGlobalValueChangeListener
in interface PropertyWindow
public void removeGlobalValueChangeListener(ValueChangeListener l)
PropertyWindow
removeGlobalValueChangeListener
in interface PropertyWindow
public ValueChangeListener[] getGlobalValueChangeListeners()
PropertyWindow
getGlobalValueChangeListeners
in interface PropertyWindow
public void setSynchronizeObject(java.lang.Object syncObj)
PropertyWindow
setSynchronizeObject
in interface PropertyWindow
syncObj
- new synchronization object for this windowpublic java.lang.Object getSynchronizeObject()
PropertyWindow
getSynchronizeObject
in interface PropertyWindow
public void locateRight(java.awt.Component comp)
public boolean isLiveUpdatingEnabled()
PropertyWindow
isLiveUpdatingEnabled
in interface PropertyWindow
public void enableLiveUpdating(boolean enable)
public void writeWidget(java.io.PrintWriter pw, java.awt.Component comp, NumberFormat fmt, CompositeComponent ancestor) throws java.io.IOException
java.io.IOException
public void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
ModelComponentBase
scan
and complete
enough to allow full reconstruction of the element.write
in interface Scannable
write
in class ModelComponentBase
pw
- stream for writing the elementfmt
- numeric formating informationref
- optional reference object which can be used for producing references to
other objectsjava.io.IOException
- if an I/O error occuredpublic void scanWidget(java.lang.String classNameOrAlias, ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
java.io.IOException
public void postscanWidget(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
java.io.IOException
public boolean scanItem(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
java.io.IOException
public void pack()
public void setFocusableWindowState(boolean enable)
public void setVisible(boolean visible)
public boolean isVisible()
public void setSize(java.awt.Dimension dim)
public void setSize(int w, int h)
public java.awt.Dimension getSize()
public void setLocation(java.awt.Point dim)
public void setLocation(int x, int y)
public int getHeight()
public int getWidth()
public java.awt.Point getLocation()
public boolean removeStalePropertyWidgets()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void getSoftReferences(java.util.List<ModelComponent> refs)
ModelComponentBase
updateReferences()
method will
be called to update its internal reference information.getSoftReferences
in interface ModelComponent
getSoftReferences
in class ModelComponentBase
refs
- list to which soft references are appendedpublic void updateReferences(boolean undo, java.util.Deque<java.lang.Object> undoInfo)
ModelComponentBase
undo
equal to false
,
this component should then examine its soft references and
use ComponentUtils.areConnected()
to determine which of them have been disconnected from the hierarchy.
Disconnected references should be removed, and sufficient information
should be appended to undoInfo
to allow this update
to be undone if this method is called later with undo
equal to true
. When undoing an update, the undo
information should be removed from the front of undoInfo
.updateReferences
in interface ModelComponent
updateReferences
in class ModelComponentBase
undo
- if true
, indicates that the most
recent reference update should be undone, using the supplied
undo information.undoInfo
- if undo
is false
, should be used
to store information allowing the reference update to be undone.
Otherwise, if undo
is true
, then this
supplied information to undo the most recent update.public void connectToHierarchy(CompositeComponent hcomp)
ModelComponentBase
When this method is called, ModelComponent.getParent()
will return the new
parent component; the system will have set this beforehand.
connectToHierarchy
in interface ModelComponent
connectToHierarchy
in class ModelComponentBase
hcomp
- hierarchy component to which this component,
or its ancestor, was attachedpublic void disconnectFromHierarchy(CompositeComponent hcomp)
ModelComponentBase
When this method is called, ModelComponent.getParent()
will still return this
original parent component; the system will set this to null
after.
disconnectFromHierarchy
in interface ModelComponent
disconnectFromHierarchy
in class ModelComponentBase
hcomp
- hierarchy component from which this component,
or its ancestor, was detached