|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jgraph.editor.JGraphEditorFactory
Class that creates the UI elements of a JGraph editor. It uses the actions
and tools from the kit to create menu bars, toolbars, toolboxes and
popup menus.
| Nested Class Summary | |
protected class |
JGraphEditorFactory.ActionChangedListener
Updates button based on property change events. |
| Field Summary | |
protected Map |
factoryMethods
Holds the (name, factory method) pairs |
protected static int |
ITEMTYPE_MENUBAR
Constant for menubar creation. |
protected static int |
ITEMTYPE_TOOLBAR
Constant for toolbar creation. |
protected JGraphEditorKit |
kit
References the editor kit. |
static String |
NODENAME_GROUP
Defines the nodename for groups. |
static String |
NODENAME_ITEM
Defines the nodename for items. |
static String |
NODENAME_MENU
Defines the nodename for menus. |
static String |
NODENAME_SEPARATOR
Defines the nodename for separators. |
protected static Component |
SEPARATOR
Shared separator instance. |
static String |
SUFFIX_ACTION
Defines the suffix for actionname resources. |
static String |
SUFFIX_ICON
Defines the suffix for icon resources, eg. |
static String |
SUFFIX_LABEL
Defines the suffix for label resources, eg. |
static String |
SUFFIX_MNEMONIC
Defines the suffix for mnemonic resources, eg. |
static String |
SUFFIX_SHORTCUT
Defines the suffix for shortcut resources, eg. |
static String |
SUFFIX_TOOL
Defines the suffix for toolname resources. |
static String |
SUFFIX_TOOLTIP
Defines the suffix for tooltip resources, eg. |
| Constructor Summary | |
JGraphEditorFactory()
Constructs an empty factory. |
|
JGraphEditorFactory(JGraphEditorKit kit)
Constructs a factory for the specified kit. |
|
| Method Summary | |
Object |
addMethod(JGraphEditorFactoryMethod method)
Adds the specified factory method. |
protected void |
configureAbstractButton(AbstractButton button,
String name)
Hook for subclassers to configure a toolbox button for tool. |
void |
configureActionItem(AbstractButton button,
JGraphEditorAction action)
Hook for subclassers to configure an action item for action. |
protected void |
configureMenuBar(Container menu,
Node configuration)
Hook for subclassers to configure a new menu based on configuration. |
protected void |
configureToolBar(Container toolBar,
Node configuration)
Hook for subclassers to configure a toolbar with configuration. |
protected void |
configureToolbox(JGraphEditorToolbox toolbox,
Node configuration)
Hook for subclassers to configure a new toolbox based on configuration. |
PropertyChangeListener |
createActionChangeListener(AbstractButton button)
Returns a new property change listener that updates button
according to property change events. |
JGraphEditorDiagramPane |
createDiagramPane(JGraphEditorDiagram diagram)
Returns a new diagram pane for the specified diagram by creating a new graph using the createGraph(GraphLayoutCache) method and
wrapping it up in a JGraphEditorDiagramPane. |
org.jgraph.JGraph |
createGraph(org.jgraph.graph.GraphLayoutCache cache)
Returns a new graph for the specified cache. |
protected Container |
createMenu(Node configuration)
Hook for subclassers to create a new menu. |
JMenuBar |
createMenuBar(Node configuration)
Returns a new JMenuBar configured using
configureMenuBar(Container, Node). |
AbstractButton |
createMenuItem(Node configuration,
boolean radio)
Returns a new JCheckBoxMenuItem or JMenuItem configured
using configureActionItem(AbstractButton, JGraphEditorAction). |
JPopupMenu |
createPopupMenu(Node configuration)
Returns a new JPopupMenu configured using
configureMenuBar(Container, Node). |
JScrollPane |
createScrollPane(Component component)
Returns a new JScrollPane containing the specified component. |
JSplitPane |
createSplitPane(Component first,
Component second,
int orientation)
Returns a new JSplitPane containing the specified component with
the specified orientation. |
JTabbedPane |
createTabbedPane(int tabPlacement)
Returns a new empty JTabbedPane. |
JToolBar |
createToolBar(Node configuration)
Returns a new JToolBar configured using
configureToolBar(Container, Node). |
protected AbstractButton |
createToolBarButton(Node configuration)
Returns a new JToggleButton or JButton configured using
configureActionItem(AbstractButton, JGraphEditorAction) and
configureAbstractButton(AbstractButton, String) (in this order). |
JGraphEditorToolbox |
createToolbox(Node configuration)
Returns a new JGraphEditorToolbox configured using
configureToolbox(JGraphEditorToolbox, Node). |
protected AbstractButton |
createToolboxButton(JGraphEditorTool tool)
Returns a new JToggleButton button configured for
tool by calling
configureAbstractButton(AbstractButton, String). |
Component |
executeMethod(String factoryMethod)
Shortcut method to executeMethod(String, Node) with a null
configuration. |
Component |
executeMethod(String factoryMethod,
Node configuration)
Executes JGraphEditorFactoryMethod.createInstance(Node) on the
factory method under factoryMethod passing
configuration along as an argument and returns the return
value of the invoked method. |
JGraphEditorAction |
getAction(String key)
Returns the action for the resource under key+SUFFIX_ACTION
from the editor kit. |
protected String |
getKey(Node node)
Shortcut method to JGraphEditorSettings.getKeyAttributeValue(Node). |
JGraphEditorKit |
getKit()
Returns the editor kit. |
JGraphEditorFactoryMethod |
getMethod(String name)
Returns the factory method for the specified name or null
if no such factory method can be found. |
protected String |
getString(String key)
Shortcut method to JGraphEditorResources.getString(String). |
JGraphEditorTool |
getTool(String key)
Returns the tool for the resource under key+SUFFIX_TOOL
from the editor kit. |
void |
setKit(JGraphEditorKit kit)
Sets the editor kit to provide actions and tools. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String NODENAME_SEPARATOR
public static final String NODENAME_ITEM
public static final String NODENAME_MENU
public static final String NODENAME_GROUP
public static final String SUFFIX_ACTION
openFile.label=Open....
public static final String SUFFIX_TOOL
openFile.label=Open....
public static final String SUFFIX_LABEL
open.label=Open....
public static final String SUFFIX_ICON
open.icon=/com/jgraph/pad/images/open.gif.
public static final String SUFFIX_MNEMONIC
open.mnemonic=o.
public static final String SUFFIX_SHORTCUT
open.shortcut=control O.
public static final String SUFFIX_TOOLTIP
open.tooltip=Open a file.
protected static final int ITEMTYPE_MENUBAR
protected static final int ITEMTYPE_TOOLBAR
protected static final Component SEPARATOR
protected Map factoryMethods
protected JGraphEditorKit kit
| Constructor Detail |
public JGraphEditorFactory()
public JGraphEditorFactory(JGraphEditorKit kit)
| Method Detail |
public JGraphEditorKit getKit()
public void setKit(JGraphEditorKit kit)
kit - The kit to set.public Object addMethod(JGraphEditorFactoryMethod method)
method - The factory method to add.
name.public JGraphEditorFactoryMethod getMethod(String name)
null
if no such factory method can be found.
name - The name that identifies the factory method.
name or
null.public Component executeMethod(String factoryMethod)
executeMethod(String, Node) with a null
configuration.
factoryMethod - The name of the factory method to executed.
JGraphEditorFactoryMethod.createInstance(Node) on
factoryMethod.
public Component executeMethod(String factoryMethod,
Node configuration)
JGraphEditorFactoryMethod.createInstance(Node) on the
factory method under factoryMethod passing
configuration along as an argument and returns the return
value of the invoked method.
factoryMethod - The name of the factory method to executed.configuration - The configuration to pass to
JGraphEditorFactoryMethod.createInstance(Node).
JGraphEditorFactoryMethod.createInstance(Node) on
factoryMethod.getMethod(String)protected String getString(String key)
JGraphEditorResources.getString(String).
key.protected String getKey(Node node)
JGraphEditorSettings.getKeyAttributeValue(Node).
public JGraphEditorAction getAction(String key)
key+SUFFIX_ACTION
from the editor kit. If no such resource exists then the action for
key is returned or null if no action can be
found.
key+SUFFIX_ACTION
resource or the action for key.getString(String),
JGraphEditorKit.getAction(String)public JGraphEditorTool getTool(String key)
key+SUFFIX_TOOL
from the editor kit. If no such resource exists then the tool for
key is returned or null if no tool can be
found.
key+SUFFIX_TOOL resource
or the tool for key.getString(String),
JGraphEditorKit.getTool(String)public JGraphEditorDiagramPane createDiagramPane(JGraphEditorDiagram diagram)
createGraph(GraphLayoutCache) method and
wrapping it up in a JGraphEditorDiagramPane.
diagram - The diagram that contains the graph to be used.
diagram.public org.jgraph.JGraph createGraph(org.jgraph.graph.GraphLayoutCache cache)
cache. This
implementation creates a new graph using
JGraph.JGraph(GraphLayoutCache).
cache - The layout cache that defines the graph.
cache.public JScrollPane createScrollPane(Component component)
JScrollPane containing the specified component.
public JSplitPane createSplitPane(Component first,
Component second,
int orientation)
JSplitPane containing the specified component with
the specified orientation.
public JTabbedPane createTabbedPane(int tabPlacement)
JTabbedPane.
public JGraphEditorToolbox createToolbox(Node configuration)
JGraphEditorToolbox configured using
configureToolbox(JGraphEditorToolbox, Node).
configuration - The configuration to create the toolbox with.
protected void configureToolbox(JGraphEditorToolbox toolbox,
Node configuration)
configuration.
toolbox - The toolbox to be configured.configuration - The configuration to configure the toolbox with.createToolboxButton(JGraphEditorTool)protected AbstractButton createToolboxButton(JGraphEditorTool tool)
JToggleButton button configured for
tool by calling
configureAbstractButton(AbstractButton, String).
tool - The tool to create the toolbox button for.
protected void configureAbstractButton(AbstractButton button,
String name)
tool.
button - The button to be configured.name - The name of the tool or action to configure the button for.public JMenuBar createMenuBar(Node configuration)
JMenuBar configured using
configureMenuBar(Container, Node).
configuration - The configuration to create the menubar with.
public JPopupMenu createPopupMenu(Node configuration)
JPopupMenu configured using
configureMenuBar(Container, Node).
configuration - The configuration to create the popup menu with.
protected void configureMenuBar(Container menu,
Node configuration)
configuration. This is used for menubars and submenus.
menu - The menu to be configured.configuration - The configuration to configure the menubar with.createMenuItem(Node, boolean)protected Container createMenu(Node configuration)
JMenuBar.
configuration - The configuration to create the menu with.
public AbstractButton createMenuItem(Node configuration,
boolean radio)
JCheckBoxMenuItem or JMenuItem configured
using configureActionItem(AbstractButton, JGraphEditorAction).
configuration - The configuration to create the menu item with.radio - Whether the created item should be a
JRadioButtonMenuItem.
public void configureActionItem(AbstractButton button,
JGraphEditorAction action)
action.
Valid action items are toolbar buttons and menu items, but not toolbox
buttons.
button - The button to be configured.action - The action to configure the button for.public JToolBar createToolBar(Node configuration)
JToolBar configured using
configureToolBar(Container, Node).
configuration - The configuration to create the toolbar with.
protected void configureToolBar(Container toolBar,
Node configuration)
configuration.
toolBar - The toolBar to be configured.configuration - The configuration to configure the toolbar with.protected AbstractButton createToolBarButton(Node configuration)
JToggleButton or JButton configured using
configureActionItem(AbstractButton, JGraphEditorAction) and
configureAbstractButton(AbstractButton, String) (in this order).
configuration - The configuration to create the toolbar with.
public PropertyChangeListener createActionChangeListener(AbstractButton button)
button
according to property change events.
button - The button to create the listener for.
|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||