All Packages Class Hierarchy This Package Previous Next Index
Class mesquite.lib.CommandChecker
mesquite.lib.CommandChecker
- public class CommandChecker
- extends java.lang.Object
An object designed primarily to allow Mesquite, at startup, to harvest a list of available commands.
In its default mode, it is nothing but a string comparer (using equalsIgnoresCase or startsWidth), in that its 'compare' and 'compareStart' methods are used in the doCommand methods of
Commandable objects to see what command was passed (it is also used in Puppeteer's sendCommands method). However, when in accumulateMode,
a CommandChecker always returns false to the query of whether the strings are the same, but in the process accumulates information on what
commands are being sought by the Commandable. This means that one call to the doCommand method of the Commandable, passing an accumulating checker,
will cause the checker to acquire a list of all the commands sought by the commandable. This system was designed so that the available commands
would be harvested automatically at startup, and wouldn't depend on the programmer keeping a separate manual page of commands up to date.
-
defaultChecker
-
-
documentationComposed
-
-
registeredClasses
-
-
representingClasses
-
-
CommandChecker()
-
-
accumulate(Commandable, CommandChecker)
- Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
-
accumulateOnlyFrom(Class)
- Sets what exact class the checker is to accumulate commands from (will not accumulate from super or subclasses).
-
addString(String)
- Adds a string to the vector of strings being accumulated by the checker.
-
commandsFromRegisteredClasses()
- Returns a vector of strings showing the classes that were registered with registerClass and their available commands.
-
compare(Class, String, String, String, String)
-
-
compareStart(Class, String, String, String, String)
- This method is the same as compare except that when in comparing mode (1) it returns true of the command starts with the targetCommand as a
substring.
-
composeDocumentation()
- Composes documentation about modules and scripting.
-
getAccumulatedCommands()
- returns the vector of strings for commands accumulated by the checker when in accumulateMode
-
getAccumulatedExplanations()
- returns the vector of strings for commands accumulated by the checker when in accumulateMode
-
getAccumulatedMenus()
- returns the vector of strings for menus accumulated by the checker when in accumulateMode
-
getAccumulateMode()
- Returns whether the checker is an accumulator (or comparer).
-
getCommandExplanation(MesquiteCommand, CommandChecker, boolean)
- Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
-
getCommandExplanation(MesquiteCommand, CommandChecker, boolean, boolean)
- Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
-
getFile()
- Returns the file of the script being executed via this checker.
-
getQueryModeString(String, MesquiteCommand, Object)
- Returns string explaining the operation of the widget (menu item, tool, button, etc.) that uses the given command;
for use in query mode and in commands pending list
-
registerClass(Class, Class)
- This static method registers a class for inclusion in the list of commands available (under 'other' in the Scripting Commands page available from the Help menu in Mesquite).
-
registerMenuItem(MesquiteModule, String, MesquiteCommand)
-
-
setAccumulateMode(boolean)
- Sets the mode of the checker: if true is passed, it accumulates a list of commands instead of comparing a commandname to a target
-
setFile(MesquiteFile)
- Sets the file of the script being executed via this checker.
-
setHTMLMode(boolean)
- Sets whether an accumulating checker is to put HTML codes in the explanations of commands.
-
setLIMode(boolean)
- Sets whether an accumulating checker is to put '
- ' at the start of each line of the accumulated commands.
-
setSparseMode()
- Sets checker as sparse in accumulated text.
-
showExplanations(Component, MenuBar, String)
- Shows the explanations of menu items and controls (Explainable Components including tools of tool palettes) for a window.
registeredClasses
public static java.util.Vector registeredClasses
representingClasses
public static java.util.Vector representingClasses
defaultChecker
public static mesquite.lib.CommandChecker defaultChecker
documentationComposed
public static boolean documentationComposed
CommandChecker
public CommandChecker()
setFile
public void setFile(mesquite.lib.MesquiteFile f)
- Sets the file of the script being executed via this checker.
getFile
public mesquite.lib.MesquiteFile getFile()
- Returns the file of the script being executed via this checker.
setAccumulateMode
public void setAccumulateMode(boolean mode)
- Sets the mode of the checker: if true is passed, it accumulates a list of commands instead of comparing a commandname to a target
getAccumulateMode
public boolean getAccumulateMode()
- Returns whether the checker is an accumulator (or comparer).
setLIMode
public void setLIMode(boolean mode)
- Sets whether an accumulating checker is to put '
- ' at the start of each line of the accumulated commands.
setHTMLMode
public void setHTMLMode(boolean mode)
- Sets whether an accumulating checker is to put HTML codes in the explanations of commands.
setSparseMode
public void setSparseMode()
- Sets checker as sparse in accumulated text.
accumulateOnlyFrom
public void accumulateOnlyFrom(java.lang.Class c)
- Sets what exact class the checker is to accumulate commands from (will not accumulate from super or subclasses).
accumulate
public static mesquite.lib.CommandChecker accumulate(mesquite.lib.Commandable c,
mesquite.lib.CommandChecker checker)
- Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
getQueryModeString
public static java.lang.String getQueryModeString(java.lang.String item,
mesquite.lib.MesquiteCommand command,
java.lang.Object widget)
- Returns string explaining the operation of the widget (menu item, tool, button, etc.) that uses the given command;
for use in query mode and in commands pending list
getCommandExplanation
public static java.lang.String getCommandExplanation(mesquite.lib.MesquiteCommand command,
mesquite.lib.CommandChecker checker,
boolean includeParameters)
- Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
getCommandExplanation
public static java.lang.String getCommandExplanation(mesquite.lib.MesquiteCommand command,
mesquite.lib.CommandChecker checker,
boolean includeParameters,
boolean useHTMLmode)
- Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
addString
public void addString(java.lang.String s)
- Adds a string to the vector of strings being accumulated by the checker.
registerMenuItem
public void registerMenuItem(mesquite.lib.MesquiteModule ownerModule,
java.lang.String itemName,
mesquite.lib.MesquiteCommand command)
compare
public boolean compare(java.lang.Class classCommanded,
java.lang.String explanation,
java.lang.String parameters,
java.lang.String command,
java.lang.String targetCommand)
compareStart
public boolean compareStart(java.lang.Class classCommanded,
java.lang.String explanation,
java.lang.String parameters,
java.lang.String command,
java.lang.String targetCommand)
- This method is the same as compare except that when in comparing mode (1) it returns true of the command starts with the targetCommand as a
substring.
getAccumulatedCommands
public java.util.Vector getAccumulatedCommands()
- returns the vector of strings for commands accumulated by the checker when in accumulateMode
getAccumulatedExplanations
public java.util.Vector getAccumulatedExplanations()
- returns the vector of strings for commands accumulated by the checker when in accumulateMode
getAccumulatedMenus
public java.util.Vector getAccumulatedMenus()
- returns the vector of strings for menus accumulated by the checker when in accumulateMode
registerClass
public static void registerClass(java.lang.Class c,
java.lang.Class representing)
- This static method registers a class for inclusion in the list of commands available (under 'other' in the Scripting Commands page available from the Help menu in Mesquite).
This must be done early in startup to be useful (e.g., in a module's mesquiteStartup() method). The first class passed must be instantiable (i.e. Not abstract)
and have at least one constructor without arguments. This first class is the class to be registered, or a subclass of it.
The second class passed is the actual class whose commands are to be documented.
(This second class may be abstract, which is the reason two classes need to be passed.) See the documentation for the method commandsFromRegisteredClasses
for information on how the two classes are used.
commandsFromRegisteredClasses
public static java.util.Vector commandsFromRegisteredClasses()
- Returns a vector of strings showing the classes that were registered with registerClass and their available commands.
As noted under the method registerClass, two classes are registered at a time: a first class (which must be instantiable) and a second class
(which may be abstract and must be the same as or a superclass of the first class). The method commandsFromRegisteredClasses makes an accumulating
CommandChecker and then examines each of the registered pair of classes. For each pair, the CommandChecker's accumulateOnlyFrom method is the second class,
(the 'representing' parameter in registerClass) to restrict the class from which commands are to be accumulated to the second (possibly abstract) class. Then, it
instantiates the first class passed, and (if it's appropriately a Commandable) passes it the CommandChecker to its doCommand method to accumulate
the commands.
composeDocumentation
public void composeDocumentation()
- Composes documentation about modules and scripting. This is done once per run of Mesquite, the first time a call is made to show a web page.
showExplanations
public static void showExplanations(java.awt.Component c,
java.awt.MenuBar mBar,
java.lang.String name)
- Shows the explanations of menu items and controls (Explainable Components including tools of tool palettes) for a window. Must be
passed the parental component (typically graphics[0] of the window) and the menu bar of the window
All Packages Class Hierarchy This Package Previous Next Index