public abstract class Command extends Object implements com.bc.ceres.core.runtime.ConfigurableExtension
Command
is the base class for all BEAM GUI commands.Modifier and Type | Field and Description |
---|---|
static String |
ACTION_KEY_CONTEXT |
static String |
ACTION_KEY_LARGE_ICON
The key used for storing a large icon for the action, used for toolbar buttons.
|
static String |
ACTION_KEY_LOCATION |
static String |
ACTION_KEY_PARENT |
static String |
ACTION_KEY_PLACE_AFTER |
static String |
ACTION_KEY_PLACE_BEFORE |
static String |
ACTION_KEY_PLACE_CONTEXT_TOP |
static String |
ACTION_KEY_PLACE_FIRST |
static String |
ACTION_KEY_PLACE_LAST |
static String |
ACTION_KEY_POPUP_TEXT |
static String |
ACTION_KEY_SEPARATOR_AFTER |
static String |
ACTION_KEY_SEPARATOR_BEFORE |
static String |
ACTION_KEY_SORT_CHILDREN |
static String |
HELP_ID_KEY |
Modifier | Constructor and Description |
---|---|
protected |
Command() |
protected |
Command(String commandID) |
Modifier and Type | Method and Description |
---|---|
protected void |
addEventListener(Class t,
EventListener l)
Adds a command event listener.
|
void |
configure(com.bc.ceres.core.runtime.ConfigurationElement config) |
void |
configure(ResourceBundle resourceBundle)
Configures this command with the properties (if any) found in the given recource bundle.
|
boolean |
containsContext(String context) |
boolean |
containsLocation(String location) |
protected boolean |
containsProperty(String key,
Object testValue) |
protected boolean |
containsPropertyValue(String key,
Object value) |
protected abstract Action |
createAction()
Creates an appropriate action instance for this command.
|
abstract JMenuItem |
createMenuItem()
Creates an appropriate menu item for this command.
|
protected String |
createResourceKey(String commandPropertyName)
Gets the key for the given command command-ID and command property name name as used in the resource bundle for
this application.
|
abstract AbstractButton |
createToolBarButton()
Creates an appropriate tool bar button for this command.
|
protected void |
fireUpdateState()
Notify all listeners that have registered interest for notification on the 'update status' event type.
|
KeyStroke |
getAccelerator() |
Action |
getAction() |
String |
getCommandID() |
static CommandUIFactory |
getCommandUIFactory() |
protected Boolean |
getConfigBoolean(com.bc.ceres.core.runtime.ConfigurationElement config,
String elementName)
Gets the boolean resource value for the given command command-ID and command property name.
|
protected Icon |
getConfigIcon(com.bc.ceres.core.runtime.ConfigurationElement config,
String elementName) |
protected String |
getConfigString(com.bc.ceres.core.runtime.ConfigurationElement config,
String elementName)
Gets the resource string for the given command command-ID and command property name.
|
protected String[] |
getConfigStrings(com.bc.ceres.core.runtime.ConfigurationElement config,
String elementName)
Gets the resource strings for the given command command-ID and command property name.
|
String[] |
getContexts() |
protected EventListenerList |
getEventListenerList() |
String |
getHelpId() |
Icon |
getLargeIcon() |
String[] |
getLocations() |
String |
getLongDescription() |
int |
getMnemonic()
Returns the integer value of command's mnemonic character.
|
String |
getParent() |
String |
getPlaceAfter() |
String |
getPlaceBefore() |
boolean |
getPlaceFirst() |
boolean |
getPlaceLast() |
String |
getPopupText() |
protected Object |
getProperty(String key) |
protected boolean |
getProperty(String key,
boolean defaultValue) |
protected String |
getProperty(String key,
String defaultValue) |
protected String[] |
getProperty(String key,
String[] defaultValues) |
protected Boolean |
getResourceBoolean(ResourceBundle resourceBundle,
String commandPropertyName)
Gets the boolean resource value for the given command command-ID and command property name.
|
protected Icon |
getResourceIcon(ResourceBundle resourceBundle,
String commandPropertyName) |
protected String |
getResourceString(ResourceBundle resourceBundle,
String commandPropertyName)
Gets the resource string for the given command command-ID and command property name.
|
protected String[] |
getResourceStringArray(ResourceBundle resourceBundle,
String commandPropertyName)
Gets the resource strings for the given command command-ID and command property name.
|
protected String[] |
getResourceStrings(ResourceBundle resourceBundle,
String commandPropertyName)
Gets the resource strings for the given command command-ID and command property name.
|
String |
getShortDescription() |
Icon |
getSmallIcon() |
boolean |
getSortChildren() |
String |
getText() |
protected String |
getValue(com.bc.ceres.core.runtime.ConfigurationElement config,
String elementName,
String defaultValue) |
boolean |
isEnabled() |
boolean |
isPlaceAtContextTop() |
boolean |
isSeparatorAfter() |
boolean |
isSeparatorBefore() |
protected void |
removeEventListener(Class t,
EventListener l)
Removes a command event listener.
|
void |
setAccelerator(KeyStroke accelerator) |
void |
setCommandID(String commandId) |
static void |
setCommandUIFactory(CommandUIFactory commandUIFactory) |
void |
setContexts(String[] contexts) |
void |
setEnabled(boolean enabled) |
void |
setHelpId(String id) |
void |
setLargeIcon(Icon icon) |
void |
setLocations(String[] locations) |
void |
setLongDescription(String text) |
void |
setMnemonic(int mnemonic) |
void |
setParent(String value) |
void |
setPlaceAfter(String placeAfter) |
void |
setPlaceAtContextTop(boolean placeAtContextTop) |
void |
setPlaceBefore(String placeBefore) |
void |
setPlaceFirst(boolean value) |
void |
setPlaceLast(boolean value) |
void |
setPopupText(String value) |
protected void |
setProperty(String key,
boolean value) |
protected void |
setProperty(String key,
Object value) |
void |
setSeparatorAfter(boolean separatorAfter) |
void |
setSeparatorBefore(boolean separatorBefore) |
void |
setShortDescription(String text) |
void |
setSmallIcon(Icon icon) |
void |
setText(String value) |
String |
toString() |
void |
updateComponentTreeUI()
Lets an action update its component tree (if any) since the Java look-and-feel has changed.
|
void |
updateState()
Causes this command to fire the 'check status' event to all of its listeners.
|
void |
updateState(CommandEvent event)
Called when a command should update its state.
|
public static final String ACTION_KEY_LARGE_ICON
Note: Actually this key belongs in the javax.swing.Action interface, but Sun hasn't done this so far (why?).
public static final String ACTION_KEY_SEPARATOR_BEFORE
public static final String ACTION_KEY_SEPARATOR_AFTER
public static final String ACTION_KEY_PLACE_FIRST
public static final String ACTION_KEY_PLACE_LAST
public static final String ACTION_KEY_PLACE_BEFORE
public static final String ACTION_KEY_PLACE_AFTER
public static final String ACTION_KEY_PLACE_CONTEXT_TOP
public static final String ACTION_KEY_PARENT
public static final String ACTION_KEY_LOCATION
public static final String ACTION_KEY_CONTEXT
public static final String ACTION_KEY_POPUP_TEXT
public static final String ACTION_KEY_SORT_CHILDREN
public static final String HELP_ID_KEY
protected Command()
protected Command(String commandID)
public String getCommandID()
public void setCommandID(String commandId)
public Action getAction()
public boolean isEnabled()
public void setEnabled(boolean enabled)
public String getParent()
public void setParent(String value)
public String[] getLocations()
public void setLocations(String[] locations)
public boolean containsLocation(String location)
public String[] getContexts()
public void setContexts(String[] contexts)
public boolean containsContext(String context)
public String getText()
public void setText(String value)
public String getPopupText()
public void setPopupText(String value)
public boolean getSortChildren()
public int getMnemonic()
-1
if mnemonic property is
null
public void setMnemonic(int mnemonic)
public KeyStroke getAccelerator()
public void setAccelerator(KeyStroke accelerator)
public String getShortDescription()
public void setShortDescription(String text)
public String getLongDescription()
public void setLongDescription(String text)
public String getHelpId()
public void setHelpId(String id)
public Icon getSmallIcon()
public void setSmallIcon(Icon icon)
public Icon getLargeIcon()
public void setLargeIcon(Icon icon)
public boolean isSeparatorBefore()
public void setSeparatorBefore(boolean separatorBefore)
public boolean isSeparatorAfter()
public void setSeparatorAfter(boolean separatorAfter)
public boolean getPlaceFirst()
public void setPlaceFirst(boolean value)
public boolean getPlaceLast()
public void setPlaceLast(boolean value)
public String getPlaceAfter()
public void setPlaceAfter(String placeAfter)
public String getPlaceBefore()
public void setPlaceBefore(String placeBefore)
public boolean isPlaceAtContextTop()
public void setPlaceAtContextTop(boolean placeAtContextTop)
public void configure(ResourceBundle resourceBundle)
command.
command-ID.text = display text
command.
command-ID.popuptext = display text for popup menu
command.
command-ID.mnemonic = mnemonic key character
command.
command-ID.accelerator = accelerator
command.
command-ID.shortdescr = text
command.
command-ID.longdescr = text
command.
command-ID.smallicon = image-path
command.
command-ID.largeicon = image-path
command.
command-ID.parent = command-COMMAND_ID or main-menu-name
command.
command-ID.location = location-1, location-2, ...
command.
command-ID.context = context-1, context-2, ...
command.
command-COMMAND_ID.placeBefore = command-ID
command.
command-ID.placeAfter = command-COMMAND_ID
command.
command-ID.separatorBefore = true or false
command.
command-ID.separatorAfter = true or false
resourceBundle
- the resource bundle from which the properties are receivedIllegalArgumentException
- if the resource bundle is nullpublic void updateState()
public abstract JMenuItem createMenuItem()
public abstract AbstractButton createToolBarButton()
protected abstract Action createAction()
protected boolean getProperty(String key, boolean defaultValue)
protected void setProperty(String key, boolean value)
protected EventListenerList getEventListenerList()
protected void addEventListener(Class t, EventListener l)
t
- the type of the listener to be addedl
- the command listenerprotected void removeEventListener(Class t, EventListener l)
t
- the type of the listener to be removedl
- the command listenerprotected void fireUpdateState()
protected String createResourceKey(String commandPropertyName)
protected String getResourceString(ResourceBundle resourceBundle, String commandPropertyName)
protected String[] getResourceStrings(ResourceBundle resourceBundle, String commandPropertyName)
protected String[] getResourceStringArray(ResourceBundle resourceBundle, String commandPropertyName)
protected Boolean getResourceBoolean(ResourceBundle resourceBundle, String commandPropertyName)
protected Icon getResourceIcon(ResourceBundle resourceBundle, String commandPropertyName)
public static CommandUIFactory getCommandUIFactory()
public static void setCommandUIFactory(CommandUIFactory commandUIFactory)
public void updateComponentTreeUI()
If a plug-in uses top-level containers such as dialogs or frames, implementors of this method should invoke
SwingUtilities.updateComponentTreeUI()
on such containers.
The default implementation does nothing.
public void updateState(CommandEvent event)
This method can contain some code which analyzes the underlying element and makes a decision whether this item or group should be made visible/invisible or enabled/disabled etc.
event
- the command eventpublic void configure(com.bc.ceres.core.runtime.ConfigurationElement config) throws com.bc.ceres.core.CoreException
configure
in interface com.bc.ceres.core.runtime.ConfigurableExtension
com.bc.ceres.core.CoreException
protected String getValue(com.bc.ceres.core.runtime.ConfigurationElement config, String elementName, String defaultValue)
protected String getConfigString(com.bc.ceres.core.runtime.ConfigurationElement config, String elementName)
protected String[] getConfigStrings(com.bc.ceres.core.runtime.ConfigurationElement config, String elementName)
protected Boolean getConfigBoolean(com.bc.ceres.core.runtime.ConfigurationElement config, String elementName)
Copyright © 2002–2014 Brockmann Consult GmbH. All rights reserved.