harmonic.mz.function
Class FunctionStarter

java.lang.Object
  |
  +--harmonic.mz.data.ModelNode
        |
        +--harmonic.mz.function.FunctionStarter
All Implemented Interfaces:
java.awt.event.ActionListener, DataNode, Documentable, java.util.EventListener, Interpolater, harmonic.meshGeom.math.MarkableObject, NodeListener

public class FunctionStarter
extends ModelNode
implements java.awt.event.ActionListener, Documentable

This class represents a user function, an application feature the user can invoke. FunctionStarters are added registered with Module.addFunction(). This class is only the starter of the function. We are not useing the approach of requireing the programmer subclass this class with the to implement the specific user feature, although thats not a bad one. Instead, one simply initializes this class with a pointer and callback name that is invoked when this function is started. The Task class resembles the first approach.

Typically there is at least one user interface device used to invoke the function, such as a menu item, toolbar tool, key combination, or an utterance. These devices tickle this class with the actionPerformed() function.

This class extends ModelNode to alow user function information to be stored in the application database. These nodes are not under a model subtree of cource, they are under the application wide section. Information about what points to this function is stored this class, for example the menu text.


Field Summary
 java.util.Vector args
           
 boolean bFunction
           
 boolean bInvokedByContextMenu
           
 int helpLoc
           
 FileField iconFile
           
 IntField imageId
           
 StringField keyMap
           
 StringField menuText
           
 Module mod
           
 int partialEchoLine
           
 
Fields inherited from class harmonic.mz.data.ModelNode
_fileRoot_, _thread_, ATTRIB_CONTROL_WIDGET, ATTRIB_LISTABLE, ATTRIB_PRESENTABLE, ATTRIB_PRIVATE, ATTRIB_REMOVEABLE, ATTRIB_RENAMEABLE, ATTRIB_SHOW_CONTEXT_MENU, ATTRIB_TYPE_FILTER, ATTRIB_USERGROUP, ATTRIB_VALUE_GROUP, ATTRIB_VE_LISTENER, bCustomCS, bDebug, bValid, name
 
Constructor Summary
FunctionStarter()
           
FunctionStarter(Module module, java.lang.Object listener, java.lang.String callback)
          Constructs and FunctionStarter
FunctionStarter(Module module, java.lang.Object listener, java.lang.String callback, java.lang.String menuText)
          Constructs and FunctionStarter
 
Method Summary
 void actionPerformed()
           
 void actionPerformed(java.awt.event.ActionEvent e)
          Start the function!
 void actionPerformed(boolean b)
           
 void addPointer(FunctionPointer p)
          Add pointer to this function to update list.
 void contextInvoke()
           
 java.awt.Component createControlWidget()
          Returns an ActionMapDialog
 void echoFunction_Cancel()
           
 void echoFunction_Final()
           
 void echoFunction()
           
 void echoFunction(boolean b)
           
 ModelNode getField()
           
 java.lang.String getIconFilename()
          Returns the image icon filename, includeing modules support directory in front.
 javax.swing.ImageIcon getImageIcon()
          Returns the image for this function.
 int getImageId()
           
 java.lang.String getInstanceURL()
          Return a URL associated with this instance of the object.
 java.lang.String getKeyMap()
          Get key map string.
 java.lang.String getMenuText()
          Returns menu text of this function.
 Module getModule()
          Returns module that owns this function.
static FunctionStarter getPendingAction()
           
 java.awt.Image getTypeImage()
          Returns the image to be used for this node in list interfaces that may put an image by node
 java.lang.String getTypeURL()
          Return a URL associated with this objects type.
 java.lang.String getUndoName()
           
 void help()
           
 boolean invokedByContextMenu()
           
 void makeContextMenu(HWM_GroupData menu)
          May be overrideen to add functions pertaining to this node to context menu.
 void setField(ModelNode field)
           
 void setIconFilename(java.lang.String filename)
          Sets the image icon filename.
 void setKeyMap(java.lang.String keyMap)
          Set key map string.
 void setMenuText(java.lang.String menuText)
          Sets menu text of this function, and update any points to this function.
static void setPendingAction(FunctionStarter fs)
           
 void updatePointers()
          Update pointes to this if a setting was changed.
 
Methods inherited from class harmonic.mz.data.ModelNode
addAll, addAlphaed, addField, addField, addField, addFields, addNetworkInput, addNetworkOutput, addNode, addNodeListener, addNodeListener, addNodes, addNodes, addToCurrent, addToGlobals, addToNetworkEditor, addToTemps, addWithUndo, allFieldsAreFinal, applyDataTransfer, areFieldsValid, assignFromMetaFields, assignFromXMLAttributes, assignFromXMLString, assignToMetaFields, assignToXMLAttributes, assignToXMLString, at, bind, canSelect, castSelection, checkFileRead, checkNetworkInput, childCount, clean, clearAttrib, clearNotified, compare, copyFrom, createCopy, createXMLElement, deepCopy, defeatNodeEvents, disableEvents, enableEvents, expectedValidationTime, fileRoot, finalize, findFieldElement, findNode, fromXMLNodes, getAttrib, getBound, getCatagory, getControlWidget, getCurrentNames, getDataTransfer, getDataTransferTypes, getDeleted, getDirectInputs, getDirectOutputs, getEffectors, getEntryListener, getErrorState, getFilterType, getFullName, getHandles, getInterpolater, getIsLeaf, getListable, getMark, getMetaFields, getName, getNodeChildren_V, getNodeChildren, getNodeID, getNodeParent, getObjectRep, getPresentable, getPrivate, getReferencePoolName, getRemoteOwner, getRemoveable, getRenameable, getSaveable, getSavedChildren, getSelect, getSeparateDirectInputs, getSeparateDirectOutputs, getSequenced, getSerialNo, getTags, getTentativeSelect, getTransformable, getTransformableParent, getTransient, getTreeName, getUnfoldedChildren, getUpdateTime, getUserGroup, getValidates, getValue, getXMLNodes, hasDependants, hasExternalRef, hashKey, hasValidationLock, hideControlWidget, indexOf, initControlWidget, insertNode, interpolate_Linear, interpolate_Quadratic, invalidate, isField, isFinal, isInSubtree, isInTree, isLinked, isNotified, isPurged, isSet, isTemporary, isValid, linkedTo, linksChildren, makeFixed, makePrototype, makeReferenced, makeUnreferenced, makeVisibleInGUI, markNotified, mayValidate, nodeChanged, notifyListeners, postAssignFromXMLElement, preAssignToXMLElement, printChildren, printTags, printTree, printTree, purge, purgeFinal, pythonString, remove, removeAll, removeAll, removeHandles, removeNetworkInput, removeNetworkOutput, removeNode, removeNode, removeNode, removeNodeListener, replace, selfNodeChanged, set, setActualName, setAttrib, setBound, setCatagory, setChildrenExcept, setCoordSystem, setCurrentControlWidget, setCurrentNames, setDeleted, setEntryListener, setErrorState, setFromPrototype, setIsField, setIsLeaf, setIsSet, setListable, setMark, setMetaFields, setName, setNodeParent, setPresentable, setPrivate, setRemoteOwner, setRemoveable, setRenameable, setSaveable, setSelect, setSelect, setSequenced, setSerialNo, setTentativeSelect, setTentativeSelect, setToLink, setTransient, setTransientChildren, setUpdateTime, setUserGroup, setValidates, setValidationLock, setValue, setValueGroup, showControlWidget, showControlWidget, showControlWidget, showHandles, startRename, tag, toString, unlinkListeners, unmarkNotified, untag, updateBindable, valChanged, valChanged, validate, valueString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

menuText

public StringField menuText

iconFile

public FileField iconFile

keyMap

public StringField keyMap

imageId

public IntField imageId

bFunction

public boolean bFunction

mod

public Module mod

helpLoc

public int helpLoc

bInvokedByContextMenu

public boolean bInvokedByContextMenu

args

public java.util.Vector args

partialEchoLine

public int partialEchoLine
Constructor Detail

FunctionStarter

public FunctionStarter()

FunctionStarter

public FunctionStarter(Module module,
                       java.lang.Object listener,
                       java.lang.String callback)
Constructs and FunctionStarter

Parameters:
module - Module that owns function
listener - Listener to invoke to start user function
callback - Callback function of listener

FunctionStarter

public FunctionStarter(Module module,
                       java.lang.Object listener,
                       java.lang.String callback,
                       java.lang.String menuText)
Constructs and FunctionStarter

Parameters:
module - Module that owns function
listener - Listener to invoke to start user function
callback - Callback function of listener
menuText - Menu text setting
Method Detail

getImageId

public int getImageId()

getPendingAction

public static FunctionStarter getPendingAction()

setPendingAction

public static void setPendingAction(FunctionStarter fs)

getTypeImage

public java.awt.Image getTypeImage()
Description copied from class: ModelNode
Returns the image to be used for this node in list interfaces that may put an image by node

Specified by:
getTypeImage in interface DataNode
Overrides:
getTypeImage in class ModelNode

getUndoName

public java.lang.String getUndoName()

makeContextMenu

public void makeContextMenu(HWM_GroupData menu)
Description copied from class: ModelNode
May be overrideen to add functions pertaining to this node to context menu. The default makes a small general menu.

Overrides:
makeContextMenu in class ModelNode

help

public void help()

createControlWidget

public java.awt.Component createControlWidget()
Returns an ActionMapDialog

Overrides:
createControlWidget in class ModelNode

setIconFilename

public void setIconFilename(java.lang.String filename)
Sets the image icon filename. Only the path and name after the modules support directory should be included.


getIconFilename

public java.lang.String getIconFilename()
Returns the image icon filename, includeing modules support directory in front.


getImageIcon

public javax.swing.ImageIcon getImageIcon()
Returns the image for this function. This is controled by the iconFile setting.


getModule

public Module getModule()
Returns module that owns this function.


getMenuText

public java.lang.String getMenuText()
Returns menu text of this function.


setMenuText

public void setMenuText(java.lang.String menuText)
Sets menu text of this function, and update any points to this function.


getField

public ModelNode getField()

setField

public void setField(ModelNode field)

getKeyMap

public java.lang.String getKeyMap()
Get key map string.


setKeyMap

public void setKeyMap(java.lang.String keyMap)
Set key map string.


addPointer

public void addPointer(FunctionPointer p)
Add pointer to this function to update list.


updatePointers

public void updatePointers()
Update pointes to this if a setting was changed.


actionPerformed

public void actionPerformed()

actionPerformed

public void actionPerformed(boolean b)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Start the function!

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class ModelNode

contextInvoke

public void contextInvoke()

invokedByContextMenu

public boolean invokedByContextMenu()

echoFunction

public void echoFunction(boolean b)

echoFunction

public void echoFunction()

echoFunction_Final

public void echoFunction_Final()

echoFunction_Cancel

public void echoFunction_Cancel()

getInstanceURL

public java.lang.String getInstanceURL()
Description copied from interface: Documentable
Return a URL associated with this instance of the object.

Specified by:
getInstanceURL in interface Documentable
Overrides:
getInstanceURL in class ModelNode

getTypeURL

public java.lang.String getTypeURL()
Description copied from interface: Documentable
Return a URL associated with this objects type.

Specified by:
getTypeURL in interface Documentable
Overrides:
getTypeURL in class ModelNode