net.clackrouter.gui
Class ClackBarFactory

java.lang.Object
  extended by net.clackrouter.gui.ClackBarFactory
All Implemented Interfaces:
TranslatorConstants

public class ClackBarFactory
extends java.lang.Object
implements TranslatorConstants

The bar factory creates the menubars and the toolbars seen at the top of a clack window. (This class if based on JGraph code)


Field Summary
protected static java.util.Hashtable barEntries
          Vector with Bar entries
static java.lang.String GRAPH_POPUP
          Main key for the graph popup menu
protected  ClackFramework graphpad
          a reference to the joint graphpad
static java.lang.String MENUBAR
          Main key for the menu bar
static java.lang.String TOOLBARS
          Main key for the toolbars
 
Fields inherited from interface net.clackrouter.jgraph.pad.resources.TranslatorConstants
PREFIX_COMPONENT, PREFIX_MESSAGE_ERROR, PREFIX_MESSAGE_INFORMATION, PREFIX_MESSAGE_WARING, SUFFIX_ACCELERATOR, SUFFIX_ACTION, SUFFIX_ICON, SUFFIX_IMAGE, SUFFIX_LABEL, SUFFIX_MENU, SUFFIX_MNEMONIC, SUFFIX_TEXT, SUFFIX_TITLE, SUFFIX_TOOL_TIP_TEXT
 
Constructor Summary
ClackBarFactory(ClackFramework graphpad)
          creates an instance and memorizes the gaphpad
 
Method Summary
static void addBarEntry(GPBarEntry entry)
          Here you can add your own bar entries.
protected  javax.swing.JMenu createClackAddMenu()
          Creates the Component Add menu based on the contents of the Clack.properties file.
 javax.swing.JPopupMenu createGraphPopupMenu(ComponentCell cell)
          creates the Graph popup.
protected  javax.swing.JMenu createMenu(java.lang.String key)
          creates a menu for the specified key
protected  javax.swing.JMenu createMenu(java.lang.String key, java.lang.String[] itemKeys)
          Create a menu for the app.
 javax.swing.JMenuBar createMenubar()
          Create the menubar for the app.
protected  java.awt.Component[] createMenuItem(java.lang.String cmd)
          This is the hook through which all menu items are created.
protected  java.awt.Component[] createTool(java.lang.String key)
          Hook through which every toolbar item is created.
protected  java.awt.Component createToolbar(java.lang.String key, java.lang.String label)
          Create the toolbar.
protected  java.awt.Component[] createToolbarButton(java.lang.String key)
          Create a button to go inside of the toolbar.
 javax.swing.JPanel createToolBars(javax.swing.JPanel toolBarMainPanel)
          creates a panel with the toolbars into.
static javax.swing.AbstractButton fillAbstractButton(javax.swing.AbstractButton button, java.lang.String key, java.lang.String actionCommand)
          The method fills the AbstractButton with the localized label, the image, the accelerator and the mnemonic.
static javax.swing.AbstractButton fillMenuButton(javax.swing.AbstractButton button, java.lang.String key, java.lang.String actionCommand)
          fills the abstract button with values from the properties files.
static javax.swing.AbstractButton fillToolbarButton(javax.swing.AbstractButton button, java.lang.String key, java.lang.String actionCommand)
          fills the abstract button with values from the properties files.
protected  javax.swing.Action getAction(java.lang.String cmd)
          returns the action for the cmd key.
protected  java.lang.String[] integrateBarEntries(java.lang.String key, java.lang.String[] values)
          Integrates bar entries, if available, for the key.
static void removeBarEntry(GPBarEntry entry)
          Here you can remove your own bar entries.
protected  java.lang.String[] tokenize(java.lang.String key, java.lang.String value)
          Tokenizes the value for the key and integrates bar entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MENUBAR

public static final java.lang.String MENUBAR
Main key for the menu bar

See Also:
Constant Field Values

TOOLBARS

public static final java.lang.String TOOLBARS
Main key for the toolbars

See Also:
Constant Field Values

GRAPH_POPUP

public static final java.lang.String GRAPH_POPUP
Main key for the graph popup menu

See Also:
Constant Field Values

barEntries

protected static java.util.Hashtable barEntries
Vector with Bar entries


graphpad

protected ClackFramework graphpad
a reference to the joint graphpad

Constructor Detail

ClackBarFactory

public ClackBarFactory(ClackFramework graphpad)
creates an instance and memorizes the gaphpad

Method Detail

createMenuItem

protected java.awt.Component[] createMenuItem(java.lang.String cmd)
This is the hook through which all menu items are created. It registers the result with the menuitem hashtable so that it can be fetched with getMenuItem().


createMenubar

public javax.swing.JMenuBar createMenubar()
Create the menubar for the app. By default this pulls the definition of the menu from the associated resource file.


createClackAddMenu

protected javax.swing.JMenu createClackAddMenu()
Creates the Component Add menu based on the contents of the Clack.properties file.


createGraphPopupMenu

public javax.swing.JPopupMenu createGraphPopupMenu(ComponentCell cell)
creates the Graph popup.

Parameters:
cell - the ComponentCell that this popup is being created for, or null

createMenu

protected javax.swing.JMenu createMenu(java.lang.String key)
creates a menu for the specified key


createMenu

protected javax.swing.JMenu createMenu(java.lang.String key,
                                       java.lang.String[] itemKeys)
Create a menu for the app. By default this pulls the definition of the menu from the associated resource file.


createToolBars

public javax.swing.JPanel createToolBars(javax.swing.JPanel toolBarMainPanel)
creates a panel with the toolbars into. For each toolbar a panel was created. The inner panel is the return value. The outside panel is the parameter.

Parameters:
toolBarMainPanel - The outside panel.
Returns:
The inner panel

createToolbar

protected java.awt.Component createToolbar(java.lang.String key,
                                           java.lang.String label)
Create the toolbar. By default this reads the resource file for the definition of the toolbar.


createTool

protected java.awt.Component[] createTool(java.lang.String key)
Hook through which every toolbar item is created.


createToolbarButton

protected java.awt.Component[] createToolbarButton(java.lang.String key)
Create a button to go inside of the toolbar. By default this will load an image resource. The image filename is relative to the classpath (including the '.' directory if its a part of the classpath), and may either be in a JAR file or a separate file.

Parameters:
key - The key in the resource file to serve as the basis of lookups.

getAction

protected javax.swing.Action getAction(java.lang.String cmd)
returns the action for the cmd key. The method inspects the action map at the graph pad to get the correct action.


fillMenuButton

public static javax.swing.AbstractButton fillMenuButton(javax.swing.AbstractButton button,
                                                        java.lang.String key,
                                                        java.lang.String actionCommand)
fills the abstract button with values from the properties files.


fillToolbarButton

public static javax.swing.AbstractButton fillToolbarButton(javax.swing.AbstractButton button,
                                                           java.lang.String key,
                                                           java.lang.String actionCommand)
fills the abstract button with values from the properties files.


fillAbstractButton

public static javax.swing.AbstractButton fillAbstractButton(javax.swing.AbstractButton button,
                                                            java.lang.String key,
                                                            java.lang.String actionCommand)
The method fills the AbstractButton with the localized label, the image, the accelerator and the mnemonic.


tokenize

protected java.lang.String[] tokenize(java.lang.String key,
                                      java.lang.String value)
Tokenizes the value for the key and integrates bar entries.

See Also:
integrateBarEntries(String, String[])

integrateBarEntries

protected java.lang.String[] integrateBarEntries(java.lang.String key,
                                                 java.lang.String[] values)
Integrates bar entries, if available, for the key. If the position is out of the array the method ignores the bar entry.

Parameters:
key - Current key for the values
values - The tokenized values for the key.
See Also:
addBarEntry(net.clackrouter.jgraph.pad.GPBarEntry)

addBarEntry

public static void addBarEntry(GPBarEntry entry)
Here you can add your own bar entries.


removeBarEntry

public static void removeBarEntry(GPBarEntry entry)
Here you can remove your own bar entries.