harmonic.mz.gui
Class ValueEntry

java.lang.Object
  |
  +--HWPanel
        |
        +--harmonic.mz.gui.ValueEntry
All Implemented Interfaces:
java.awt.event.ComponentListener, Documentable, java.util.EventListener, NodeListener, harmonic.viewer3D.Task
Direct Known Subclasses:
AngleEntry, AxisEntry, BooleanEntry, ColorEntry, CoordSystemEntry, ExclusiveIntEntry, FileEntry, FontEntry, IntEntry, MaterialEntry, NodeSetEntry, PointEntry, PointSetEntry, ScalarEntry, StringEntry, VectorEntry

public abstract class ValueEntry
extends HWPanel
implements harmonic.viewer3D.Task, Documentable, NodeListener, java.awt.event.ComponentListener

This is an abstract data entry widget. It provides the convienence of implementing Task. Subclasses of these are often used to set the values of special sub classes of of DataNode's. ValueEntry also has some hooks for association with ModelNodes, however it is not a requirement that ValueEntrys effect ModelNodes. Some might, others dont, some can effect model nodes optionally.

See Also:
Serialized Form

Constructor Summary
ValueEntry()
           
 
Method Summary
 void _notifyListeners_(EntryEvent event)
           
 java.awt.Component add(java.awt.Component cmp)
           
 void addEntryListener(EntryListener listener)
          Add an entry listener.
 void aquireInput(harmonic.viewer3D.Task parentTask)
          A convienience that does:
 void assignFromReadout()
          Override to assign value from readout.
 void beginEntry(harmonic.viewer3D.Task parentTask)
          Override to begin collecting input from user.
 void beginTask(harmonic.viewer3D.Task parentTask)
          Implements Task by calling beginEntry(), and sending events
 void cancelEntry()
          Called when entry or thing owning entry is canceled, as the elements of the task tree are canceled.
 void cancelTask()
          Implements Task by calling cancelEntry(), and sending events
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void contract()
          Shrink to small size.
 javax.swing.ImageIcon contractIcon()
           
 void echoFieldChange(ModelNode value)
          Does nothing.
 void expand()
          Expand to full size.
 HWCheck expandCheck()
           
 javax.swing.ImageIcon expandIcon()
           
 void finishEntry()
          Called when entry is properly finished.
 void finishTask()
          Implements Task by calling finishEntry(), and sending events
 java.awt.Dimension getEntrySize()
          Override to return the size of the specialized value entry controls.
 ModelNode getField()
          Returns ModelNode field associated with this value entry if there is one.
 java.lang.String getInstanceURL()
          This implements the Documentable interface.
 java.awt.Dimension getPreferredSize()
          This either calles refPanel.getPreferredSize() or getEntrySize() depending on what is showing.
 java.lang.String getTaskName()
          Implements Task.
 java.lang.String getTypeURL()
          This implements the Documentable interface.
 void highlight(boolean b)
          Highlight or unhiglight this entry to show user what has the input focus
 void init()
          Called when entry is posted for the first time
 void initReadout()
          Override to assign readout from value.
 boolean innerChange()
           
 boolean isActive()
           
 boolean isDoingTask()
           
 boolean isExpanded()
           
 void monologFinished()
          This is called by Monolog when it is finished.
 void mousePressed(java.awt.event.MouseEvent event)
           
 void nodeChanged(NodeEvent event)
          Node has changed
 void notifyListeners_ValueChanged(int when)
          This calles notifyListeners(new EntryEvent(this, EntryEvent.VALUE_CHANGED, when))
 void notifyListeners(EntryEvent event)
          Notify listener that the value of this data entry widget has changed.
 void onSettingsButton(java.awt.event.ItemEvent e)
           
 void removeEntryListener(EntryListener listener)
          Remove an entry listener.
 void savePrev(ModelNode node)
           
 void setDocURL(java.lang.String s)
           
 void setField(ModelNode node)
           
 void setInnerChange()
           
 void setValue(ModelNode value)
          Override to set value of corisponding data node.
 void transferListener(ModelNode node)
          Transfer ValueEntry listener from model node to this.
 void unlinkField()
           
 void updateField()
          This is called by notifyListeners we have a EntryEvent.VALUE_CHANGED.
 void validateUISettings()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface harmonic.viewer3D.Task
cleanTask
 

Constructor Detail

ValueEntry

public ValueEntry()
Method Detail

add

public java.awt.Component add(java.awt.Component cmp)

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)

addEntryListener

public void addEntryListener(EntryListener listener)
Add an entry listener. Listeners are updated when the value of the data entry widget has changed.


removeEntryListener

public void removeEntryListener(EntryListener listener)
Remove an entry listener.


_notifyListeners_

public void _notifyListeners_(EntryEvent event)

notifyListeners

public void notifyListeners(EntryEvent event)
Notify listener that the value of this data entry widget has changed. Thie does the update after removing this from the fields listeners, and puting itself back after the notification. Often a ValueEntry is controling a field - in this case we dont want the field telling the value entry when it has chaged if the was the value entry that change it.


notifyListeners_ValueChanged

public void notifyListeners_ValueChanged(int when)
This calles notifyListeners(new EntryEvent(this, EntryEvent.VALUE_CHANGED, when))


updateField

public void updateField()
This is called by notifyListeners we have a EntryEvent.VALUE_CHANGED. It is a good place to insert code that updates a data nodes value from this. The policy is to update the field if it is known, rather than expecting a field to update it self by adding itself as a EntryListener. The caller of this changes the transientness of the field to match the EntryEvent.FINAL/INCREMENTAL flag.


expandIcon

public javax.swing.ImageIcon expandIcon()

contractIcon

public javax.swing.ImageIcon contractIcon()

expandCheck

public HWCheck expandCheck()

nodeChanged

public void nodeChanged(NodeEvent event)
Description copied from interface: NodeListener
Node has changed

Specified by:
nodeChanged in interface NodeListener

getPreferredSize

public java.awt.Dimension getPreferredSize()
This either calles refPanel.getPreferredSize() or getEntrySize() depending on what is showing.


validateUISettings

public void validateUISettings()

getEntrySize

public java.awt.Dimension getEntrySize()
Override to return the size of the specialized value entry controls.


setField

public void setField(ModelNode node)

getField

public ModelNode getField()
Returns ModelNode field associated with this value entry if there is one.


innerChange

public boolean innerChange()

setInnerChange

public void setInnerChange()

unlinkField

public void unlinkField()

setValue

public void setValue(ModelNode value)
Override to set value of corisponding data node. This version uses getField().

Parameters:
value - to set to

transferListener

public void transferListener(ModelNode node)
Transfer ValueEntry listener from model node to this. This transfering system helps in systems where a set of ModelNodes to be built and added to a general system, that than creates the representing user interface.


aquireInput

public void aquireInput(harmonic.viewer3D.Task parentTask)
A convienience that does:

   ViewerCore.tasks().addSubtask(parentTask, this);
 


init

public void init()
Called when entry is posted for the first time


beginEntry

public void beginEntry(harmonic.viewer3D.Task parentTask)
Override to begin collecting input from user. This may simply set the keyboard focus to a inner window, or if could register a mouse listener with the viewports, or it may create a Selector and start selecting objects. Be sure to call super.aquireInput().


cancelEntry

public void cancelEntry()
Called when entry or thing owning entry is canceled, as the elements of the task tree are canceled. Do listener deregistration and remove any objects from viewport.


finishEntry

public void finishEntry()
Called when entry is properly finished. Do listener deregistration and remove any objects from viewport.


highlight

public void highlight(boolean b)
Highlight or unhiglight this entry to show user what has the input focus


isDoingTask

public boolean isDoingTask()

beginTask

public void beginTask(harmonic.viewer3D.Task parentTask)
Implements Task by calling beginEntry(), and sending events

Specified by:
beginTask in interface harmonic.viewer3D.Task

finishTask

public void finishTask()
Implements Task by calling finishEntry(), and sending events

Specified by:
finishTask in interface harmonic.viewer3D.Task

cancelTask

public void cancelTask()
Implements Task by calling cancelEntry(), and sending events

Specified by:
cancelTask in interface harmonic.viewer3D.Task

getTaskName

public java.lang.String getTaskName()
Implements Task.

Specified by:
getTaskName in interface harmonic.viewer3D.Task

onSettingsButton

public void onSettingsButton(java.awt.event.ItemEvent e)

isExpanded

public boolean isExpanded()

expand

public void expand()
Expand to full size. Default does nothing. There are no assumptions built into how the expand is accomplished, but a general pattern would be to add child components, calling reformat() when finished. These functions (expand() and contract()) provide users of ValueEntries to handle these ideas generally.


contract

public void contract()
Shrink to small size.


initReadout

public void initReadout()
Override to assign readout from value.


assignFromReadout

public void assignFromReadout()
Override to assign value from readout. Called by InputEntrySequence when next value is requested.


isActive

public boolean isActive()

monologFinished

public void monologFinished()
This is called by Monolog when it is finished. (ok'ed) By default this calles assignFromReadout(), to make is so user doent have to hit enter in the text boxes. Override this to change this behavour This system has proven better then calling assignFromReadout() when a value entry looses keyboard focus.


savePrev

public void savePrev(ModelNode node)

echoFieldChange

public void echoFieldChange(ModelNode value)
Does nothing. Will be removed


setDocURL

public void setDocURL(java.lang.String s)

getInstanceURL

public java.lang.String getInstanceURL()
This implements the Documentable interface. The main reason for separatly documenting a data entry field is that the framework may then prompt the user using the documentation text. This is implemented by asking the DataNode for the url, or it this is null, using the value set by setDocURL().

Specified by:
getInstanceURL in interface Documentable

getTypeURL

public java.lang.String getTypeURL()
This implements the Documentable interface.

Specified by:
getTypeURL in interface Documentable

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener