harmonic.mz.function
Class Module

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

public class Module
extends ModelNode

This is the base class for module intializers. Extension modules extend this class to override functions to add the module to the user interface and the database. The extension of this class is started via Class.forName(""), so it needs a public constructor with no arguments.


Field Summary
 boolean bBigImageBad
           
 java.awt.image.BufferedImage bigToolbarImage
           
 boolean bInterfaceSettingsInvalid
           
 boolean bPythonDone
           
 java.lang.String className
           
 ModelNode functionRoot
           
 java.util.Hashtable functionTable
           
 java.lang.String initFile
           
 HWM_GroupData menu
           
 ModelNode menuRoot
           
 java.lang.String publicName
           
 java.lang.String pyRef
           
 FileNode settings
           
 java.lang.String startCheck
           
 ModelNode toolbarRoot
           
 ModelNode vptoolRoot
           
 java.lang.String workingDir
           
 
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
Module()
          The base constructor.
 
Method Summary
 FunctionStarter addFSFunction(java.lang.String functionName, ModelNode field, java.lang.String catagory)
          This is a convenience function for addFunction(FunctionStarter) Adds a user function to invoke the setting of a field.
 void addFunction(FunctionStarter action, java.lang.String catagory)
          Registers the given user function.
 FunctionStarter addFunction(java.lang.Object listener, java.lang.String callback, java.lang.String catagory)
          This is a convenience function for addFunction(FunctionStarter)
 void createStandardLists(FileNode file)
          Override to create lists for new model.
 void execute()
          Run as a macro.
 FunctionStarter getFunction(java.lang.String functionName)
          Returns the registered function
 java.util.Hashtable getFunctionTable()
           
 java.lang.String getHelpDir()
          Override to change the help directoy.
 java.lang.String getHelpFile(Documentable helpMe)
          Some documentable objects defer this task to the module by default.
 java.lang.String getInstallDir()
           
 java.lang.String getResourceDir()
          Override to change the resource directoy.
 java.lang.String getWorkingDir()
          Override to append on module specific directory, like getInstallDir() + dir Default is getInstallDir().
 boolean hasStandardLists(FileNode file)
          Override to to return whether standard lists exsist for a model.
 void installInFramework()
          Module should override this to install itself in the framework.
 java.awt.Component macroGUI()
          Return a non null component to produce a gui for the macro.
 void modelLoaded(FileNode file)
          Called when a model is opened.
 void modelUnloaded(FileNode file)
          Called when a model is closed.
 void readSettings()
          Override to read this modules user settings from disk.
 void removeGUI()
          Override this to remove modules user interface.
 void writeSettings()
          Override to read this modules user settings to disk.
 
Methods inherited from class harmonic.mz.data.ModelNode
actionPerformed, 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, createControlWidget, 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, getInstanceURL, 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, getTypeImage, getTypeURL, 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, makeContextMenu, 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

className

public java.lang.String className

pyRef

public java.lang.String pyRef

publicName

public java.lang.String publicName

initFile

public java.lang.String initFile

startCheck

public java.lang.String startCheck

workingDir

public java.lang.String workingDir

settings

public FileNode settings

functionRoot

public ModelNode functionRoot

toolbarRoot

public ModelNode toolbarRoot

vptoolRoot

public ModelNode vptoolRoot

menuRoot

public ModelNode menuRoot

menu

public HWM_GroupData menu

bPythonDone

public boolean bPythonDone

bigToolbarImage

public java.awt.image.BufferedImage bigToolbarImage

bBigImageBad

public boolean bBigImageBad

bInterfaceSettingsInvalid

public boolean bInterfaceSettingsInvalid

functionTable

public java.util.Hashtable functionTable
Constructor Detail

Module

public Module()
The base constructor. The extension of this class is started via Class.forName(""), so subclasses needs a public constructor with no arguments.

Method Detail

execute

public void execute()
Run as a macro. This is called when a user interactively picks the "run macro" button. The module does not stay resident. Use macroGUI() to put up a gui to collect parameters.


macroGUI

public java.awt.Component macroGUI()
Return a non null component to produce a gui for the macro. The component is put in a box with an OK and Cancel button. Hitting OK will run Module.execute(). Cancel removes the gui. Returning null here (the default) means the marcro will run immediatly. ` * A simple way to build a gui is to the the NodeValuesDialog, NodeValueDialog or SequenceFunctionDialog in the mz.gui package.


getFunctionTable

public java.util.Hashtable getFunctionTable()

installInFramework

public void installInFramework()
Module should override this to install itself in the framework. This would include registering FunctionStarters, reading any settings files, and createing the user interface.


removeGUI

public void removeGUI()
Override this to remove modules user interface. The framework does what it can to remove element of the module when it is unloaded, by removing registered function starters, toolbars, the modules additions to the pull down menu. This function should do what cannot be generalized in the framework.


readSettings

public void readSettings()
Override to read this modules user settings from disk. The default calls uses the initFile setting to read settings with a ModuleSettingsReader. Call super.readSettings if overriding.


writeSettings

public void writeSettings()
Override to read this modules user settings to disk. The default calls uses the initFile setting to write settings with a ModuleSettingsReader. Call super.writeSettings if overriding.


modelLoaded

public void modelLoaded(FileNode file)
Called when a model is opened. Override to make any changes to a modules state to reflect the existance of the new model


modelUnloaded

public void modelUnloaded(FileNode file)
Called when a model is closed. Override to make any changes to a modules state to reflect the existance of the removed model


createStandardLists

public void createStandardLists(FileNode file)
Override to create lists for new model. Called when a new model is created.


hasStandardLists

public boolean hasStandardLists(FileNode file)
Override to to return whether standard lists exsist for a model.


addFunction

public FunctionStarter addFunction(java.lang.Object listener,
                                   java.lang.String callback,
                                   java.lang.String catagory)
This is a convenience function for addFunction(FunctionStarter)

Parameters:
listener - Object owning callback function
callback - Callback function, also name of user function

addFSFunction

public FunctionStarter addFSFunction(java.lang.String functionName,
                                     ModelNode field,
                                     java.lang.String catagory)
This is a convenience function for addFunction(FunctionStarter) Adds a user function to invoke the setting of a field. GUI devices will have cause a device to set the field's value to be posted when the function is invoked, or they may have the field setting device embeded in the directly (like a check box in a menu). No special call back is provided here.

Note on this: when the menu or toolbar invokes a field function, if it is a boolean they will change the fields value directly, and if the field has listeners that will be called.

Parameters:
functionName - Name of user function
field - Field set by the function

addFunction

public void addFunction(FunctionStarter action,
                        java.lang.String catagory)
Registers the given user function. User functions are supposed to be added by an extension modules addFunctions() function! This adds the user function to the loading modules set of functions. This is stored in the database under a node for that module.


getFunction

public FunctionStarter getFunction(java.lang.String functionName)
Returns the registered function


getResourceDir

public java.lang.String getResourceDir()
Override to change the resource directoy. (This is where things such as icon images are looked for.) The default returns Module.getWorkingDir().


getHelpDir

public java.lang.String getHelpDir()
Override to change the help directoy. (This is where user documentaion is looked for.) The default returns Module.getWorkingDir().


getWorkingDir

public java.lang.String getWorkingDir()
Override to append on module specific directory, like getInstallDir() + dir Default is getInstallDir().


getInstallDir

public java.lang.String getInstallDir()

getHelpFile

public java.lang.String getHelpFile(Documentable helpMe)
Some documentable objects defer this task to the module by default. Override to change where help is found.