|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmesquite.lib.MenuOwner
mesquite.lib.EmployerEmployee
mesquite.lib.MesquiteModule
The Mesquite system operates around a tree of modules (subclasses of MesquiteModule), with the class containing the "main" method being the trunk module, and the other modules like branches that are attached to the trunk.
When Mesquite starts up, the trunk starts up and surveys the mesquite folder to acquire information about all of the available modules (i.e., all of the available subclasses of MesquiteModule). To be found, a module must be in a folder (directory) of the same name as itself; that is, a module whose class file is "MyModule.class" must be in a directory named "MyModule". Mesquite remembers the modules in a vector of MesquiteModuleInfo objects. Later, when modules need to be "hired" to perform certain tasks, this vector of information can be used to help choose which module to hire. To be hired, a module is instantiated and linked to its employer module. Thus, a new branch sprouts in the Mesquite bureacratic hierarchy.
Modules are chosen for hire by other modules according to their talents. What talents a module has is implicit in its superclass. For instance, a module that subclasses the NumberForTree class (itself a subclass of MesquiteModule) calculates a number for a tree. Any module that wants numbers calculated for trees can therefore hire a module that is an instance of the NumberForTree class. The basic talent-defining classes are part of the Mesquite Class LIbrary, in the subpackage duties. There is in addition a system to determine whether a module is compatible with a particular condition (e.g. operating on continuous-valued data.)
The only types of module that the trunk knows of directly are the FileCoordinator and FileInterpreter classes. Each instance of the File Coordinator is associated with one file, and it is responsible for using employee modules to read and write the file, and to hire tree windows and data windows. The trunk is a specific subclass of MesquiteModule, a MesquiteTrunk
Because menus are composed hierarchically along the employee tree, menu composition is most easily done where there is easy access to employee-employer relations. For this reason, it is most convenient to have the menu composition embedded within the module code. In order not to burden the MesquiteModule class with numerous methods to handle employee-employer relations, the MesquiteModule class was split into three: its superclass, EmployeeEmployer (which handles employee-employer relations), MenuOwner (which handles all menu issues) and MesquiteModule itself, which handles its basic functions. EmployeeEmployer and MenuOwner are intended to be used ONLY as superclasses to MesquiteModule
The MesquiteModule class is more or less equivalent to the MacClade proto4 ModuleRecord, while its instantiated objects are more or less equivalent to the MacClade proto4 Tasks. Hence, "task" is sometimes used in names for MesquiteModule objects.
| Field Summary | |
static Author |
author
The default author for this machine and user account |
protected static java.lang.String |
browserString
the file path to the web browser for showing web pages |
static boolean |
checkMethodsAtStartup
true if does extra check for module compatibility at startup. |
boolean |
hiredAsDefaultInScripting
This module was hired as a default choice in scripting |
static LogWindow |
logWindow
The window, created by mesquiteTrunk, that displays the log. |
static java.io.File |
mesquiteDirectory
The root of the mesquite classpath. |
static java.lang.String |
mesquiteDirectoryPath
The root of the mesquite classpath. |
static MesquiteTrunk |
mesquiteTrunk
Static storage so that everyone can find the trunk MesquiteModule object |
protected MesquiteModuleInfo |
moduleInfo
the MesquiteModuleInfo that refers to the module |
static java.io.File |
prefsDirectory
The directory that includes all the preference files. |
protected MesquiteProject |
proj
The project that the module was hired under. |
static int |
textEdgeCompensationHeight
|
static int |
textEdgeCompensationWidth
|
static int |
totalFinalized
|
static java.io.File |
userDirectory
The user's directory. |
| Fields inherited from class mesquite.lib.EmployerEmployee |
employees, employer, startupBailOut, stringPos, suppressHireQueries, totalCreated, totalDisposed, useOtherChoices |
| Fields inherited from interface mesquite.lib.MesquiteListener |
ANNOTATION_ADDED, ANNOTATION_CHANGED, ANNOTATION_DELETED, ASSOCIATED_CHANGED, BRANCHES_REARRANGED, BRANCHLENGTHS_CHANGED, COMMAND_CANCELLED, DATA_CHANGED, ELEMENT_CHANGED, ITEMS_ADDED, NAMES_CHANGED, OBJECT_DESTROYED, PARTS_ADDED, PARTS_CHANGED, PARTS_DELETED, PARTS_MOVED, SELECTION_CHANGED, TAXA_SUBSTITUTED, UNKNOWN, VALUE_CHANGED |
| Fields inherited from interface mesquite.lib.HNode |
MOUSEDOWN, MOUSEEXIT, MOUSEMOVE |
| Constructor Summary | |
MesquiteModule()
The constructor in general is to be avoided, because modules are instantiated momentarily on startup to gather information. |
|
| Method Summary | |
java.lang.String |
accumulateParameters(java.lang.String spacer)
|
void |
addNEXUSBlock(NexusBlock nb)
Adds NEXUS block to the file. |
void |
alert(java.lang.String s)
Displays an alert in log; also in dialog if flag is set. |
void |
alert(java.lang.String s,
java.lang.String windowTitle,
java.lang.String logTitle)
Displays an alert in log; also in dialog if flag is set. |
boolean |
anySubstantivePrereleases()
returns whether this or employee modules are substantive and prerelease |
void |
broadCastAssignedID(MesquiteModule module,
java.lang.String assignedID,
CommandRecord commandRec)
Broadcasts that an id has been assigned to a module. |
void |
changed(java.lang.Object caller,
java.lang.Object obj,
Notification notification,
CommandRecord commandRec)
passes which object changed, along with optional integer (e.g. |
void |
classFieldChanged(java.lang.Class c,
java.lang.String fieldName,
CommandRecord commandRec)
Notifies all employees that a class field has changed. |
boolean |
compatibleWithSystem()
returns whether the module is compatible with the current OS, Mesquite system, Java VM, and so on. |
java.awt.Frame |
containerOfModule()
Returns the window of the MesquiteModule, or if none, the window of the nearest employer with a window. |
java.lang.String |
createSupportDirectory()
|
void |
deleteSupportDirectory()
|
void |
discreetAlert(boolean beDiscreet,
java.lang.String s)
If scripting, puts alert in log; otherwise puts up alert dialog. |
void |
discreetAlert(CommandRecord commandRec,
java.lang.String s)
If scripting, puts alert in log; otherwise puts up alert dialog. |
protected void |
dispose()
dispose is called automatically when an employee is fired. |
void |
disposing(java.lang.Object obj)
passes which object is being disposed (from MesquiteListener interface) |
java.lang.Object |
doCommand(java.lang.String commandName,
java.lang.String arguments,
CommandRecord commandRec,
CommandChecker checker)
A request for the MesquiteModule to perform a command. |
void |
echoStringToFile(java.lang.String s,
java.lang.StringBuffer sb)
|
void |
employeeOutputInvalid(MesquiteModule employee,
MesquiteModule source,
CommandRecord commandRec)
Generated by an employee calling its outputInvalide method. |
void |
employeeParametersChanged(MesquiteModule employee,
MesquiteModule source,
Notification notification,
CommandRecord commandRec)
Generated by an employee calling its parametersChanged method. |
void |
employeeQuit(MesquiteModule employee)
Generated by an employee who quit. |
MesquiteModule |
employerWithWindow()
Returns the employer with a window |
void |
endJob()
endJob is called as a module is quitting; modules should put their clean up code here. |
void |
fileAboutToBeWritten(MesquiteFile f)
A method called immediately before a file is to be saved. |
void |
fileDirtiedByCommand(MesquiteCommand command)
for FileDirtier interface |
void |
fileElementAdded(FileElement element)
A method called when a FileElement added to the project; module can respond as needed (e.g., InitializeParsimony can add default model set to a CharacterData. |
void |
fileReadIn(MesquiteFile f)
A method called immediately after the file has been read in or completely set up (if a new file). |
void |
finalize()
|
NexusBlock |
findNEXUSBlock(FileElement e)
Finds the NEXUS block containing the given FileElement. |
java.lang.String |
getAppletInfo()
|
java.lang.String |
getAuthors()
Returns the authors of the module. |
boolean |
getAutoSaveMacros()
Returns whether module has requested to enable auto-save of macros. |
java.lang.String |
getBrowserManualPath()
returns path to manual. |
HPanel |
getBrowserPanel()
Asks for hierarchy browser panel (File coordinator or trunk should override to return. |
static java.lang.String |
getBuildDate()
returns build date of the Mesquite system (e.g., "22 September 2003") |
static java.lang.String |
getBuildVersion()
returns build number of the Mesquite system (e.g., "e58") |
java.lang.String |
getCitation()
Returns the citation of the module. |
java.lang.String |
getCommandPagePath()
returns path to page showing the commands. |
CompatibilityTest |
getCompatibilityTest()
Returns CompatibilityTest so other modules know if this is compatible with some object. |
java.lang.String |
getDateReleased()
returns the year released, as a string. |
java.lang.String[] |
getDefaultModule()
Returns name of default module for superclass. |
static java.lang.String |
getDocsPath()
returns path to the root directory of the documentation of Mesquite |
abstract java.lang.Class |
getDutyClass()
Returns duty Class the module belongs to; should be defined not by module itself but by abstract class representing duty |
java.lang.String |
getDutyName()
Returns the name of the duty; set by the duty-defining library classes. |
java.lang.String |
getExpectedPath()
returns a local file path expected by the module. |
java.lang.String |
getExplanation()
returns an explanation of what the module does. |
java.lang.Class |
getHireSubchoice()
Returns duty Class that module would like to hire immediately upon hiring. |
long |
getID()
instantiations of modules are numbered sequentially so they can be referred to by number |
boolean |
getIfLastEmployee()
Returns whether this module is to remain one of the last employees of its employers. |
java.lang.String |
getManualPath()
returns path to manual. |
static java.lang.String |
getMesquiteVersion()
returns version of the Mesquite system |
MesquiteModuleInfo |
getModuleInfo()
Returns module info for module |
abstract java.lang.String |
getName()
Returns the name of the module |
java.lang.String |
getNameAndParameters()
returns name plus current parameters, for logging etc.. |
java.lang.String |
getNameForMenuItem()
Returns the name of the module for menu items. |
NexusBlockTest |
getNexusBlockTest()
Returns NexusBlockTest so interpreter knows if this module can interpret a block. |
java.lang.String |
getNexusCommands(MesquiteFile file,
java.lang.String blockName)
Return any nexus commands belonging to block in file. |
NexusCommandTest |
getNexusCommandTest()
Returns NexusCommandTest so interpreter knows if this module can interpret a command. |
java.lang.String |
getPackageImagesPath()
returns path to the image directory for this module's images |
MesquiteModuleInfo |
getPackageIntroModule()
Returns the name of the module introducing package of modules (e.g., "#aParsimonyIntro") |
java.lang.String |
getPackagePath()
returns path to this module's package directory |
java.lang.String |
getParameters()
returns current parameters, for logging etc.. |
java.lang.String |
getPath()
returns path to this module's directory |
java.lang.String |
getPermanentIDString()
A string that uniquely refers to this module (unique even across runs of Mesquite) |
MesquiteProject |
getProject()
Returns the project of the MesquiteModule |
static java.lang.String |
getRootImageDirectoryPath()
returns path to the root directory of Mesquite images |
static java.lang.String |
getRootPath()
returns path to the root directory of Mesquite (i.e., above mesquite, images, etc.) |
java.lang.String |
getShortClassName()
returns short (not full package) name of class |
static java.lang.String |
getShortClassName(java.lang.Class classToShow)
returns short (not full package) name of class |
static java.lang.String |
getSizedRootImageFilePath(int s,
java.lang.String imageFileName)
|
Snapshot |
getSnapshot(MesquiteFile file)
Return Mesquite commands that will put the module (approximately) back into its current state. |
java.lang.String |
getURLString()
Returns a String containing the URL for this module |
boolean |
getUserChooseable()
Returns true if the module is to appear in menus and other places in which users can choose, and if can be selected in any way other than by direct request |
java.lang.String |
getVersion()
returns the version number string of the module. |
int |
getVersionInt()
returns the version number string of the module as an integer. |
int |
getVersionOfFirstRelease()
returns the version number at which this module was first released. |
java.lang.String |
getVeryShortName()
Returns the name of the module in very short form. |
int |
getXMLPrefsVersion()
|
void |
iQuit()
To be called by a module to close down on its own (as opposed to being fired). |
void |
iQuit(boolean giveMessage)
|
boolean |
isPrerelease()
returns whether this module is a prerelease version. |
boolean |
isSubstantive()
returns whether this module does substantive calculations affecting analysis results, or only a graphical/UI/input-output module |
java.lang.String |
listEmployeeParameters(java.lang.String spacer)
Lists the parameters of all employees of this MesquiteModule. |
void |
loadPreferences()
This causes the file "prefs" in the module's directory to be read, and the contents are then sent to "processPreferencesFromFile". |
void |
log(java.lang.String s)
Places string in log AND in System.out.println. |
void |
log(java.lang.String s,
CommandRecord commandRec,
boolean echoToDetails)
Places string in log AND in System.out.println. |
void |
logln(java.lang.String s)
Places string and newline character in log AND in System.out.println. |
void |
logln(java.lang.String s,
CommandRecord commandRec)
Places string and newline character in log AND in System.out.println. |
void |
logln(java.lang.String s,
CommandRecord commandRec,
boolean echoToDetails)
Places string and newline character in log AND in System.out.println. |
void |
loglnNoEcho(java.lang.String s)
Places string and newline character in log. |
void |
logNoEcho(java.lang.String s)
Places string in log. |
static MesquiteCommand |
makeCommand(java.lang.String commandName,
Commandable ownerObject)
Commands are created here. |
void |
mesquiteStartup()
Called during Mesquite startup when the list of available modules is being constructed. |
static boolean |
nameIsInstanceOf(java.lang.String n,
java.lang.Class c)
returns whether the passed class, or a superclass or interface of it, has the passed name |
boolean |
nameMatches(java.lang.String s)
returns whether name of Module matches passed String. |
void |
offHold()
Called typically by employer to turn off hold, therefore don't update graphics. |
boolean |
okToDispose(java.lang.Object obj,
int queryUser)
passes which object is being disposed (from MesquiteListener interface) |
void |
onHold()
Called typically by employer to indicate that will be called soon, therefore don't update graphics. |
void |
outputInvalid(CommandRecord commandRec)
This passes an employeeOutputInvalid call to the employer, and so on, until some employer overrides it to do something about it. |
void |
pageModule(MesquiteModule fromModule,
boolean persistent)
for the paging system (may be defunct) |
void |
parametersChanged(CommandRecord commandRec)
|
void |
parametersChanged(Notification notification,
CommandRecord commandRec)
A generic call to tell employer that the module's parameters have changed sufficiently that its basic calculations are no longer valid, and a recalculation should be requested. |
boolean |
permanentIDExists(java.lang.String id)
|
java.lang.String[] |
preparePreferencesForFile()
This is called following a "storePreferences" call by a module. |
java.lang.String |
preparePreferencesForXML()
This is called following a "storePreferences" call by a module. |
void |
processPreferencesFromFile(java.lang.String[] prefs)
This is called following a "loadPreferences" call by a module. |
void |
processPreferencesFromXML(java.lang.String prefsXML)
This is called following a "loadPreferences" call by a module. |
void |
processSingleXMLPreference(java.lang.String tag,
java.lang.String content)
This is called following a "processPreferencesFromXML" call by a module. |
void |
projectEstablished()
A method called immediately after the file has been established but not yet read in. |
boolean |
quittingConditions()
Query module as to whether conditions are such that it will have to quit soon -- e.g. |
NexusBlock |
readNexusBlock(MesquiteFile file,
java.lang.String name,
FileBlock block,
java.lang.StringBuffer blockComments,
java.lang.String fileReadingArguments,
CommandRecord commandRec)
Read the nexus block passed (passed only to modules claiming they can read it). |
boolean |
readNexusCommand(MesquiteFile file,
NexusBlock nBlock,
java.lang.String blockName,
java.lang.String command,
MesquiteString comment)
Read the nexus command in the given block (passed only to modules claiming they can read it). |
void |
readUnrecognizedCommand(MesquiteFile file,
NexusBlock nBlock,
java.lang.String blockName,
FileBlock block,
java.lang.String commandName,
java.lang.String command,
java.lang.StringBuffer blockComments,
MesquiteString comment)
Read the unrecognized command, first by looking for a module reading it, second by storing it as unrecognized within the nexus block. |
void |
removeNEXUSBlock(NexusBlock nb)
Remove NEXUS block from the file. |
void |
removePaging(MesquiteModule fromModule)
for the paging system (may be defunct) |
void |
reportProfiling()
Requests modules to report profiling. |
boolean |
requestPrimaryChoice()
returns whether this module is requesting to appear as a primary choice |
protected void |
respondToPaging()
for the paging system (may be defunct) |
protected void |
returningPage(MesquiteModule pagedModule)
for the paging system (may be defunct) |
void |
setAutoSaveMacros(boolean aut)
Sets whether module has requested to enable auto-save of macros. |
void |
setProject(MesquiteProject proj)
sets the file of the MesquiteModule |
void |
setToLastEmployee(boolean last)
Sets this module to remain one of the last employees of its employers. |
boolean |
showCitation()
Returns whether or not the module does substantive calculations and thus should be cited. |
static void |
showLogWindow()
Shows the log window. |
static void |
showLogWindow(boolean bringToFront)
Shows the log window. |
void |
showManual()
shows manual for module |
void |
showMe()
In some way shows the module, either by showing its window or its place in hierarchy |
static void |
showWebPage(java.lang.String path,
boolean autoCompose)
|
static void |
showWebPage(java.lang.String path,
boolean autoCompose,
boolean removePastNumberSign)
|
boolean |
sorry(CommandRecord commandRec,
java.lang.String s)
Displays a message and returns false. |
abstract boolean |
startJob(java.lang.String arguments,
java.lang.Object condition,
CommandRecord commandRec,
boolean hiredByName)
startJob is called automatically when an employee is hired. |
void |
startProfiling()
Requests modules to start profiling. |
void |
storePreferences()
This causes the file "prefs" in the module's directory to be written, using contents returned by the module via "preparePreferencesForFile" |
boolean |
superStartJob(java.lang.String arguments,
java.lang.Object condition,
CommandRecord commandRec,
boolean hiredByName)
superStartJob is called automatically when an employee is hired. |
java.lang.String |
supportDirectoryPath()
|
java.lang.String |
toString()
|
void |
windowGoAway(MesquiteWindow whichWindow)
Requests a window to close. |
boolean |
writeNexusCommands(MesquiteFile file,
java.lang.String blockName,
MesquiteString pending)
Writes any nexus commands to file. |
boolean |
xmlPrefsVersionMustMatch()
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static MesquiteTrunk mesquiteTrunk
public static java.io.File mesquiteDirectory
public static java.lang.String mesquiteDirectoryPath
public static java.io.File prefsDirectory
public static java.io.File userDirectory
public static LogWindow logWindow
protected static java.lang.String browserString
public static boolean checkMethodsAtStartup
public static Author author
public boolean hiredAsDefaultInScripting
public static int totalFinalized
protected MesquiteModuleInfo moduleInfo
protected MesquiteProject proj
public static int textEdgeCompensationHeight
public static int textEdgeCompensationWidth
| Constructor Detail |
public MesquiteModule()
| Method Detail |
public long getID()
getID in interface Identifiablepublic java.lang.String getPermanentIDString()
public void broadCastAssignedID(MesquiteModule module,
java.lang.String assignedID,
CommandRecord commandRec)
public boolean superStartJob(java.lang.String arguments,
java.lang.Object condition,
CommandRecord commandRec,
boolean hiredByName)
public abstract boolean startJob(java.lang.String arguments,
java.lang.Object condition,
CommandRecord commandRec,
boolean hiredByName)
The MesquiteModule should override this method, to add code to initialize things it needs, and to hire relevant necessary employees. startJob must return true if the module was successfully started; false otherwise. Thus, if the module needs a data matrix but the file has none, it returns false and the hiring process is undone.
Most modules will ignore the arguments and condition.
public void endJob()
public void finalize()
throws java.lang.Throwable
java.lang.Throwableprotected void dispose()
public final void iQuit()