All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class mesquite.lib.CommandChecker

java.lang.Object
   |
   +----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.


Variable Index

 o defaultChecker
 o documentationComposed
 o registeredClasses
 o representingClasses

Constructor Index

 o CommandChecker()

Method Index

 o accumulate(Commandable, CommandChecker)
Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
 o accumulateOnlyFrom(Class)
Sets what exact class the checker is to accumulate commands from (will not accumulate from super or subclasses).
 o addString(String)
Adds a string to the vector of strings being accumulated by the checker.
 o commandsFromRegisteredClasses()
Returns a vector of strings showing the classes that were registered with registerClass and their available commands.
 o compare(Class, String, String, String, String)
 o 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.
 o composeDocumentation()
Composes documentation about modules and scripting.
 o getAccumulatedCommands()
returns the vector of strings for commands accumulated by the checker when in accumulateMode
 o getAccumulatedExplanations()
returns the vector of strings for commands accumulated by the checker when in accumulateMode
 o getAccumulatedMenus()
returns the vector of strings for menus accumulated by the checker when in accumulateMode
 o getAccumulateMode()
Returns whether the checker is an accumulator (or comparer).
 o getCommandExplanation(MesquiteCommand, CommandChecker, boolean)
Accumulates (menus and ) commands from the given commandable and passes back a vector of strings describing the (menus and ) commands.
 o 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.
 o getFile()
Returns the file of the script being executed via this checker.
 o 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
 o 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).
 o registerMenuItem(MesquiteModule, String, MesquiteCommand)
 o 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
 o setFile(MesquiteFile)
Sets the file of the script being executed via this checker.
 o setHTMLMode(boolean)
Sets whether an accumulating checker is to put HTML codes in the explanations of commands.
 o setLIMode(boolean)
Sets whether an accumulating checker is to put '
  • ' at the start of each line of the accumulated commands.
     o showExplanations(Component, MenuBar, String)
    Shows the explanations of menu items and controls (Explainable Components including tools of tool palettes) for a window.
  • Variables

     o registeredClasses
     public static java.util.Vector registeredClasses
    
     o representingClasses
     public static java.util.Vector representingClasses
    
     o defaultChecker
     public static mesquite.lib.CommandChecker defaultChecker
    
     o documentationComposed
     public static boolean documentationComposed
    

    Constructors

     o CommandChecker
     public CommandChecker()
    

    Methods

     o setFile
     public void setFile(mesquite.lib.MesquiteFile f)
    
    Sets the file of the script being executed via this checker.

     o getFile
     public mesquite.lib.MesquiteFile getFile()
    
    Returns the file of the script being executed via this checker.

     o 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

     o getAccumulateMode
     public boolean getAccumulateMode()
    
    Returns whether the checker is an accumulator (or comparer).

     o setLIMode
     public void setLIMode(boolean mode)
    
    Sets whether an accumulating checker is to put '
  • ' at the start of each line of the accumulated commands.

  •  o setHTMLMode
     public void setHTMLMode(boolean mode)
    
    Sets whether an accumulating checker is to put HTML codes in the explanations of commands.

     o 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).

     o 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.

     o 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

     o 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.

     o 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.

     o addString
     public void addString(java.lang.String s)
    
    Adds a string to the vector of strings being accumulated by the checker.

     o registerMenuItem
     public void registerMenuItem(mesquite.lib.MesquiteModule ownerModule,
                                  java.lang.String itemName,
                                  mesquite.lib.MesquiteCommand command)
    
     o compare
     public boolean compare(java.lang.Class classCommanded,
                            java.lang.String explanation,
                            java.lang.String parameters,
                            java.lang.String command,
                            java.lang.String targetCommand)
    
     o 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.

     o getAccumulatedCommands
     public java.util.Vector getAccumulatedCommands()
    
    returns the vector of strings for commands accumulated by the checker when in accumulateMode

     o getAccumulatedExplanations
     public java.util.Vector getAccumulatedExplanations()
    
    returns the vector of strings for commands accumulated by the checker when in accumulateMode

     o getAccumulatedMenus
     public java.util.Vector getAccumulatedMenus()
    
    returns the vector of strings for menus accumulated by the checker when in accumulateMode

     o 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.

     o 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.

     o 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.

     o 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