artisynth.core.gui
Class ControlPanel

java.lang.Object
  extended by artisynth.core.modelbase.ModelComponentBase
      extended by artisynth.core.gui.ControlPanel
All Implemented Interfaces:
ModelComponent, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, HasProperties, HierarchyNode, Disposable, Scannable, PropertyWindow

public class ControlPanel
extends ModelComponentBase
implements PropertyWindow, java.awt.event.ActionListener


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
static PropertyList myProps
           
 
Fields inherited from class artisynth.core.modelbase.ModelComponentBase
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
 
Constructor Summary
ControlPanel()
           
ControlPanel(java.lang.String name)
           
ControlPanel(java.lang.String name, java.lang.String options)
           
 
Method Summary
 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.
 java.awt.Component 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 labelText, HasProperties host, java.lang.String name)
           
 LabeledComponentBase addWidget(java.lang.String labelText, HasProperties host, java.lang.String name, double min, double max)
           
 void connectToHierarchy()
          Called by the system after this component is added to the component hierarchy (i.e., when it is added as a child of another CompositeComponent).
 void disconnectFromHierarchy()
          Called by the system after this component is removed from the component hierarchy (i.e., when it is 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()
           
 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 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)
           
 
Methods inherited from class artisynth.core.modelbase.ModelComponentBase
checkFlag, checkName, checkNameUniqueness, clearFlag, clone, copy, createTempFlag, getChildren, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, hasChildren, hasState, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, scan, setFixed, setFlag, setMarked, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myProps

public static PropertyList myProps
Constructor Detail

ControlPanel

public ControlPanel()

ControlPanel

public ControlPanel(java.lang.String name)

ControlPanel

public ControlPanel(java.lang.String name,
                    java.lang.String options)
Method Detail

setName

public void setName(java.lang.String name)
Description copied from class: ModelComponentBase
Sets the name of this component. When the name is set, this method should call 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.

Specified by:
setName in interface ModelComponent
Overrides:
setName in class ModelComponentBase
Parameters:
name - new component name

setDefaultValues

public void setDefaultValues()
Description copied from class: ModelComponentBase
Sets the attributes of this component to their default values.


getAllPropertyInfo

public PropertyList getAllPropertyInfo()
Description copied from interface: HasProperties
Returns a list giving static information about all properties exported by this object.

Specified by:
getAllPropertyInfo in interface HasProperties
Overrides:
getAllPropertyInfo in class ModelComponentBase
Returns:
static information for all exported properties

numWidgets

public int numWidgets()

setScrollable

public void setScrollable(boolean scrollable)

isScrollable

public boolean isScrollable()

addWidget

public java.awt.Component addWidget(java.awt.Component comp)

addWidget

public LabeledComponentBase addWidget(Property prop)

addWidget

public LabeledComponentBase addWidget(Property prop,
                                      double min,
                                      double max)

addWidget

public LabeledComponentBase addWidget(HasProperties host,
                                      java.lang.String name)

addWidget

public LabeledComponentBase addWidget(HasProperties host,
                                      java.lang.String name,
                                      double min,
                                      double max)

addWidget

public LabeledComponentBase addWidget(java.lang.String labelText,
                                      HasProperties host,
                                      java.lang.String name)

addWidget

public LabeledComponentBase addWidget(java.lang.String labelText,
                                      HasProperties host,
                                      java.lang.String name,
                                      double min,
                                      double max)

addLabel

public java.awt.Component addLabel(java.lang.String text)

getPropertyPanel

public PropertyPanel getPropertyPanel()

getFrame

public PropertyFrame getFrame()

dispose

public void dispose()
Description copied from interface: PropertyWindow
Dispose of all resources used by this object.

Specified by:
dispose in interface Disposable
Specified by:
dispose in interface PropertyWindow

updateWidgetValues

public void updateWidgetValues()
Description copied from interface: PropertyWindow
Update the value of all property widgets in this window and its owned windows.

Specified by:
updateWidgetValues in interface PropertyWindow

addGlobalValueChangeListener

public void addGlobalValueChangeListener(ValueChangeListener l)
Description copied from interface: PropertyWindow
Add a value change listener to all property widgets in this window and its owned windows.

Specified by:
addGlobalValueChangeListener in interface PropertyWindow

removeGlobalValueChangeListener

public void removeGlobalValueChangeListener(ValueChangeListener l)
Description copied from interface: PropertyWindow
Remove a value change listener from all property widgets in this window and its owned windows.

Specified by:
removeGlobalValueChangeListener in interface PropertyWindow

getGlobalValueChangeListeners

public ValueChangeListener[] getGlobalValueChangeListeners()
Description copied from interface: PropertyWindow
Get an array of all the global value change listeners defined for this window.

Specified by:
getGlobalValueChangeListeners in interface PropertyWindow

setSynchronizeObject

public void setSynchronizeObject(java.lang.Object syncObj)
Description copied from interface: PropertyWindow
Sets an object with which property widget value changes are synchronized. The synchronization is used for all property widgets in this window and its owned windows.

Specified by:
setSynchronizeObject in interface PropertyWindow
Parameters:
syncObj - new synchronization object for this window

getSynchronizeObject

public java.lang.Object getSynchronizeObject()
Description copied from interface: PropertyWindow
Gets the object (if any) with which property widget value changes are synchronized.

Specified by:
getSynchronizeObject in interface PropertyWindow
Returns:
synchronization object for this window

locateRight

public void locateRight(java.awt.Component comp)

isLiveUpdatingEnabled

public boolean isLiveUpdatingEnabled()
Description copied from interface: PropertyWindow
If true, then the workspace should continuously update the property values whenever the model is rerendered.

Specified by:
isLiveUpdatingEnabled in interface PropertyWindow

enableLiveUpdating

public void enableLiveUpdating(boolean enable)

writeWidget

public void writeWidget(java.io.PrintWriter pw,
                        java.awt.Component comp,
                        NumberFormat fmt,
                        CompositeComponent ancestor)
                 throws java.io.IOException
Throws:
java.io.IOException

write

public void write(java.io.PrintWriter pw,
                  NumberFormat fmt,
                  java.lang.Object ref)
           throws java.io.IOException
Description copied from class: ModelComponentBase
Writes a text description of this element to a PrintWriter. The text description should be compatable with scan and complete enough to allow full reconstruction of the element.

Specified by:
write in interface Scannable
Overrides:
write in class ModelComponentBase
Parameters:
pw - stream for writing the element
fmt - numeric formating information
ref - optional reference object which can be used for producing references to other objects
Throws:
java.io.IOException - if an I/O error occured

scanWidget

public void scanWidget(java.lang.String classNameOrAlias,
                       ReaderTokenizer rtok,
                       java.util.Deque<ScanToken> tokens)
                throws java.io.IOException
Throws:
java.io.IOException

postscanWidget

public void postscanWidget(java.util.Deque<ScanToken> tokens,
                           CompositeComponent ancestor)
                    throws java.io.IOException
Throws:
java.io.IOException

scanItem

public boolean scanItem(ReaderTokenizer rtok,
                        java.util.Deque<ScanToken> tokens)
                 throws java.io.IOException
Throws:
java.io.IOException

pack

public void pack()

setFocusableWindowState

public void setFocusableWindowState(boolean enable)

setVisible

public void setVisible(boolean visible)

isVisible

public boolean isVisible()

setSize

public void setSize(java.awt.Dimension dim)

setSize

public void setSize(int w,
                    int h)

getSize

public java.awt.Dimension getSize()

setLocation

public void setLocation(java.awt.Point dim)

setLocation

public void setLocation(int x,
                        int y)

getHeight

public int getHeight()

getWidth

public int getWidth()

getLocation

public java.awt.Point getLocation()

removeStalePropertyWidgets

public boolean removeStalePropertyWidgets()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

connectToHierarchy

public void connectToHierarchy()
Description copied from class: ModelComponentBase
Called by the system after this component is added to the component hierarchy (i.e., when it is added as a child of another CompositeComponent). This method is responsible for doing any required hierarchy-dependent initialization.

When this method is called, ModelComponent.getParent() will return the new parent component; the system will have set this beforehand.

Specified by:
connectToHierarchy in interface ModelComponent
Overrides:
connectToHierarchy in class ModelComponentBase

disconnectFromHierarchy

public void disconnectFromHierarchy()
Description copied from class: ModelComponentBase
Called by the system after this component is removed from the component hierarchy (i.e., when it is removed as a child of its parent). This method is responsible for any required hierarchy-dependent deinitialization.

When this method is called, ModelComponent.getParent() will still return this original parent component; the system will set this to null after.

Specified by:
disconnectFromHierarchy in interface ModelComponent
Overrides:
disconnectFromHierarchy in class ModelComponentBase