sbr.gui
Class Menus

java.lang.Object
  extended by sbr.gui.Menus

public class Menus
extends java.lang.Object

This class installs and updates the SurveyBuildR Menus. It is a modification of the menu class developed and written by Wayne Rashaband for ImageJ.

Version:
0.0.1

Field Summary
static char ABOUT_MENU
           
static int COMMAND_IN_USE
           
static int COMMAND_NOT_FOUND
           
static char EDIT_MENU
           
static char FILE_MENU
           
static int INVALID_SHORTCUT
           
static int NORMAL_RETURN
           
static int NOT_INSTALLED
           
static char PLUGINS_MENU
           
static char QUEST_MENU
           
static char SELECT_MENU
           
static int SHORTCUT_IN_USE
           
static int WINDOW_MENU_ITEMS
           
 
Constructor Summary
Menus(SFrame fr, boolean showFileMenu)
          Basic menu constructor
 
Method Summary
 java.lang.String addMenuBar()
          Method to create and add the menu bar to the frame passed in the constructor.
static boolean commandInUse(java.lang.String command)
           
static int convertShortcutToCode(java.lang.String shortcut)
           
static java.util.Hashtable getCommands()
          Returns the hashtable that associates commands with plugins.
static java.awt.MenuBar getMenuBar()
           
static java.lang.String[] getPlugins()
          Returns a list of the plugins in the plugins menu.
static java.lang.String getPlugInsPath()
          Returns the path to the user plugins directory or null if the plugins directory was not found.
static int installPlugin(java.lang.String plugin, char menuCode, java.lang.String command, java.lang.String shortcut)
          Adds a plugin based command to the end of a specified menu.
 void setQuestEnabled(boolean b)
          Set the enabled state of the Question type Menu
static int uninstallPlugin(java.lang.String command)
          Deletes a command installed by installPlugin.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_MENU

public static final char FILE_MENU
See Also:
Constant Field Values

EDIT_MENU

public static final char EDIT_MENU
See Also:
Constant Field Values

SELECT_MENU

public static final char SELECT_MENU
See Also:
Constant Field Values

QUEST_MENU

public static final char QUEST_MENU
See Also:
Constant Field Values

PLUGINS_MENU

public static final char PLUGINS_MENU
See Also:
Constant Field Values

ABOUT_MENU

public static final char ABOUT_MENU
See Also:
Constant Field Values

WINDOW_MENU_ITEMS

public static final int WINDOW_MENU_ITEMS
See Also:
Constant Field Values

NORMAL_RETURN

public static final int NORMAL_RETURN
See Also:
Constant Field Values

COMMAND_IN_USE

public static final int COMMAND_IN_USE
See Also:
Constant Field Values

INVALID_SHORTCUT

public static final int INVALID_SHORTCUT
See Also:
Constant Field Values

SHORTCUT_IN_USE

public static final int SHORTCUT_IN_USE
See Also:
Constant Field Values

NOT_INSTALLED

public static final int NOT_INSTALLED
See Also:
Constant Field Values

COMMAND_NOT_FOUND

public static final int COMMAND_NOT_FOUND
See Also:
Constant Field Values
Constructor Detail

Menus

public Menus(SFrame fr,
             boolean showFileMenu)
Basic menu constructor

Parameters:
fr - the frame to hold the menus. This frame must implement an action listener.
showFileMenu - boolean flag if the file menu is to be show. It should not be shown on applets
Method Detail

addMenuBar

public java.lang.String addMenuBar()
Method to create and add the menu bar to the frame passed in the constructor.

Returns:
String error state

getPlugins

public static java.lang.String[] getPlugins()
Returns a list of the plugins in the plugins menu.


getMenuBar

public static java.awt.MenuBar getMenuBar()

setQuestEnabled

public void setQuestEnabled(boolean b)
Set the enabled state of the Question type Menu

Parameters:
b - flag = true to enable, false to disenable

getPlugInsPath

public static java.lang.String getPlugInsPath()
Returns the path to the user plugins directory or null if the plugins directory was not found.


getCommands

public static java.util.Hashtable getCommands()
Returns the hashtable that associates commands with plugins.


installPlugin

public static int installPlugin(java.lang.String plugin,
                                char menuCode,
                                java.lang.String command,
                                java.lang.String shortcut)
Adds a plugin based command to the end of a specified menu.

Parameters:
plugin - the plugin (e.g. "Inverter_", "Inverter_("arg")")
menuCode - PLUGINS_MENU, IMPORT_MENU, SAVE_AS_MENU or HOT_KEYS
command - the menu item label (set to "" to uninstall)
shortcut - the keyboard shortcut (e.g. "y", "Y", "F1")
ij - ImageJ (the action listener)
Returns:
returns an error code(NORMAL_RETURN,COMMAND_IN_USE_ERROR, etc.)

uninstallPlugin

public static int uninstallPlugin(java.lang.String command)
Deletes a command installed by installPlugin.


commandInUse

public static boolean commandInUse(java.lang.String command)

convertShortcutToCode

public static int convertShortcutToCode(java.lang.String shortcut)