|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmesquite.lib.CommandChecker
public class CommandChecker
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.
| Field Summary | |
|---|---|
static CommandChecker |
defaultChecker
|
static boolean |
documentationComposed
|
static java.util.Vector |
registeredClasses
|
static java.util.Vector |
representingClasses
|
| Constructor Summary | |
|---|---|
CommandChecker()
|
|
| Method Summary | |
|---|---|
static CommandChecker |
accumulate(Commandable c,
CommandChecker checker)
Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands. |
void |
accumulateOnlyFrom(java.lang.Class c)
Sets what exact class the checker is to accumulate commands from (will not accumulate from super or subclasses). |
void |
addString(java.lang.String s)
Adds a string to the vector of strings being accumulated by the checker. |
static java.util.Vector |
commandsFromRegisteredClasses()
Returns a vector of strings showing the classes that were registered with registerClass and their available commands. |
boolean |
compare(java.lang.Class classCommanded,
java.lang.String explanation,
java.lang.String parameters,
java.lang.String command,
java.lang.String targetCommand)
|
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. |
void |
composeDocumentation()
Composes documentation about modules and scripting. |
java.util.Vector |
getAccumulatedCommands()
returns the vector of strings for commands accumulated by the checker when in accumulateMode |
java.util.Vector |
getAccumulatedExplanations()
returns the vector of strings for commands accumulated by the checker when in accumulateMode |
java.util.Vector |
getAccumulatedMenus()
returns the vector of strings for menus accumulated by the checker when in accumulateMode |
boolean |
getAccumulateMode()
Returns whether the checker is an accumulator (or comparer). |
static java.lang.String |
getCommandExplanation(MesquiteCommand command,
CommandChecker checker,
boolean includeParameters)
Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands. |
static java.lang.String |
getCommandExplanation(MesquiteCommand command,
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. |
MesquiteFile |
getFile()
Returns the file of the script being executed via this checker. |
static java.lang.String |
getQueryModeString(java.lang.String item,
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 |
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). |
void |
registerMenuItem(MesquiteModule ownerModule,
java.lang.String itemName,
MesquiteCommand command)
|
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 |
void |
setFile(MesquiteFile f)
Sets the file of the script being executed via this checker. |
void |
setHTMLMode(boolean mode)
Sets whether an accumulating checker is to put HTML codes in the explanations of commands. |
void |
setLIMode(boolean mode)
Sets whether an accumulating checker is to put ' ' at the start of each line of the accumulated commands. |
void |
setSparseMode()
Sets checker as sparse in accumulated text. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.util.Vector registeredClasses
public static java.util.Vector representingClasses
public static CommandChecker defaultChecker
public static boolean documentationComposed
| Constructor Detail |
|---|
public CommandChecker()
| Method Detail |
|---|
public void setFile(MesquiteFile f)
public MesquiteFile getFile()
public void setAccumulateMode(boolean mode)
public boolean getAccumulateMode()
public void setLIMode(boolean mode)
public void setHTMLMode(boolean mode)
public void setSparseMode()
public void accumulateOnlyFrom(java.lang.Class c)
public static CommandChecker accumulate(Commandable c,
CommandChecker checker)
public static java.lang.String getQueryModeString(java.lang.String item,
MesquiteCommand command,
java.lang.Object widget)
public static java.lang.String getCommandExplanation(MesquiteCommand command,
CommandChecker checker,
boolean includeParameters)
public static java.lang.String getCommandExplanation(MesquiteCommand command,
CommandChecker checker,
boolean includeParameters,
boolean useHTMLmode)
public void addString(java.lang.String s)
public void registerMenuItem(MesquiteModule ownerModule,
java.lang.String itemName,
MesquiteCommand command)
public boolean compare(java.lang.Class classCommanded,
java.lang.String explanation,
java.lang.String parameters,
java.lang.String command,
java.lang.String targetCommand)
public boolean compareStart(java.lang.Class classCommanded,
java.lang.String explanation,
java.lang.String parameters,
java.lang.String command,
java.lang.String targetCommand)
public java.util.Vector getAccumulatedCommands()
public java.util.Vector getAccumulatedExplanations()
public java.util.Vector getAccumulatedMenus()
public static void registerClass(java.lang.Class c,
java.lang.Class representing)
public static java.util.Vector commandsFromRegisteredClasses()
public void composeDocumentation()
public static void showExplanations(java.awt.Component c,
java.awt.MenuBar mBar,
java.lang.String name)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||