com.softwareag.cis.plugin.command
Class AbstractCommand

java.lang.Object
  extended by com.softwareag.cis.plugin.command.AbstractCommand
All Implemented Interfaces:
Command, com.softwareag.cis.plugin.interfaces.Component
Direct Known Subclasses:
InstallPlugInCommand, StartApplicationDesignerCommand, UninstallPlugInCommand

public abstract class AbstractCommand
extends java.lang.Object
implements Command

An abstract class describing a command which may be rendered in a menu or toolbar


Field Summary
static java.lang.String rcs_id
           
 
Fields inherited from interface com.softwareag.cis.plugin.command.Command
CATEGORY_APPLICATION_HIGH_PRIO, CATEGORY_APPLICATION_LOW_PRIO, CATEGORY_COPY, CATEGORY_DELETE, CATEGORY_DOCUMENT, CATEGORY_EDIT, CATEGORY_EXECUTE, CATEGORY_FAVORITES, CATEGORY_IMPORT_EXPORT, CATEGORY_LCM, CATEGORY_LINK, CATEGORY_MIN, CATEGORY_MISC, CATEGORY_NEW, CATEGORY_OBJECT, CATEGORY_OPEN, CATEGORY_PREFERENCES, CATEGORY_SAVE, CATEGORY_SEARCH, CATEGORY_SHOW, CATEGORY_UPDATE, CATEGORY_UPDATE_EXT, CATEGORY_VIEW, COMMAND_ACTIVATE_DEACTIVATE, COMMAND_ADD_CATEGORY, COMMAND_ADD_COPY, COMMAND_ADD_DOCUMENT, COMMAND_ADD_FOLDER, COMMAND_ADD_TO_FAVORITES, COMMAND_ADD_TO_LIST, COMMAND_ADD_TYPE, COMMAND_ADD_VERSION, COMMAND_ATTACH_WS_POLICY, COMMAND_ATTACH_WSDL, COMMAND_CHANGE_LIFEC_STATE, COMMAND_CHANGE_PROVIDING_ORG, COMMAND_CHECK_CONN, COMMAND_COMPARE, COMMAND_COPY_SHORTCUT, COMMAND_DELETE, COMMAND_DOCUMENTATION, COMMAND_DOWNLOAD, COMMAND_DOWNLOAD_BPEL, COMMAND_DOWNLOAD_WSDL, COMMAND_DOWNLOAD_XMLSCHEMA, COMMAND_EDIT_DETAILS, COMMAND_EXPORT, COMMAND_EXPORT_CONTENTS, COMMAND_EXPORT_FAVORITE, COMMAND_GENERATE_REPORT, COMMAND_IMPACT_ANALYSIS, COMMAND_IMPORT_ASSET, COMMAND_LC_CREATE_NEW_VERS, COMMAND_NOTIFY_ME, COMMAND_PERMISSIONS, COMMAND_REGISTER_AS_CONSUMER, COMMAND_REGISTER_CONS, COMMAND_REMOVE_FROM_FAVORITES, COMMAND_RENAME, COMMAND_RENAME_LIST, COMMAND_SHOW_DETAILS, COMMAND_VIRTUALIZE
 
Constructor Summary
AbstractCommand()
           
 
Method Summary
 void execute()
          Execute command
abstract  void execute(CommandContext commandContext)
          Execute command for given CommandContext
 void executeWrapped(CommandContext commandContext)
          Execute command for given ActionContext.
abstract  int getCategory()
          The value returned by this command may be used for command ordering and grouping (for example in a context menu)
static java.util.Comparator getComparator()
          Comparator on basis respective command category
 java.lang.String getId()
           
abstract  java.lang.String getImageURL()
          Get URL of icon to be used for rendering of command.
 java.util.Locale getLocale()
          Obtain Locale for this command
abstract  java.lang.String getName()
          Get localized name of command - may be used e.g.
 boolean getSelectable()
          Get command selectable
 java.util.List getSubCommands()
          Example - if a command displayed in a context menu has sub-commands, they will be rendered as sub-context menu
 boolean isEnabled()
           
 boolean isEnabled(CommandContext context)
          Is this command enabled?
 boolean isSameGroup(Command other)
          Check whether this command belongs to same group as other
 boolean isToBeVisualized(CommandContext context)
          Deprecated. isVisible()
 boolean isVisible()
           
 void setEnabled(boolean enabled)
          Set command enabled
 void setLocale(java.util.Locale lc)
          Set Locale for this command
 void setSelectable(boolean value)
          Set command selectable
 void setVisible(boolean visible)
          Set whether this command is to be visualized
 java.lang.String toString()
          Obtain string representation of command for debugging
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rcs_id

public static final java.lang.String rcs_id
See Also:
Constant Field Values
Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

getName

public abstract java.lang.String getName()
Description copied from interface: Command
Get localized name of command - may be used e.g. for label in context menu or tooltip in toolbar

Specified by:
getName in interface Command
Returns:
the name

getImageURL

public abstract java.lang.String getImageURL()
Description copied from interface: Command
Get URL of icon to be used for rendering of command. May be null if no icon available or required.

Specified by:
getImageURL in interface Command
Returns:
the URL

toString

public java.lang.String toString()
Obtain string representation of command for debugging

Overrides:
toString in class java.lang.Object

getId

public java.lang.String getId()
Specified by:
getId in interface com.softwareag.cis.plugin.interfaces.Component
See Also:
Component.getId()

getCategory

public abstract int getCategory()
The value returned by this command may be used for command ordering and grouping (for example in a context menu)

Specified by:
getCategory in interface Command
Returns:
one of the CATEGORY_* values

isSameGroup

public boolean isSameGroup(Command other)
Check whether this command belongs to same group as other

Specified by:
isSameGroup in interface Command
Parameters:
other -
Returns:
true if same group; false otherwise

getComparator

public static java.util.Comparator getComparator()
Comparator on basis respective command category

Returns:
Comparator - used for comparing implementors of AbstractCommand

getSubCommands

public java.util.List getSubCommands()
Example - if a command displayed in a context menu has sub-commands, they will be rendered as sub-context menu

Specified by:
getSubCommands in interface Command
Returns:
List - of sub-commands of the given command

setLocale

public void setLocale(java.util.Locale lc)
Set Locale for this command

Specified by:
setLocale in interface Command
Parameters:
lc -

getLocale

public java.util.Locale getLocale()
Obtain Locale for this command

Specified by:
getLocale in interface Command
Returns:
the Locale used for this command

isEnabled

public boolean isEnabled(CommandContext context)
Is this command enabled? Default behavior is to return isEnabled(). Could be overridden to make decision based on provided context.

Specified by:
isEnabled in interface Command
Parameters:
context -
Returns:
true if enabled

setEnabled

public void setEnabled(boolean enabled)
Set command enabled

Specified by:
setEnabled in interface com.softwareag.cis.plugin.interfaces.Component
Parameters:
enabled -

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface com.softwareag.cis.plugin.interfaces.Component
See Also:
Component.isEnabled()

setSelectable

public void setSelectable(boolean value)
Set command selectable


getSelectable

public boolean getSelectable()
Get command selectable


isToBeVisualized

public boolean isToBeVisualized(CommandContext context)
Deprecated. isVisible()

Test whether this command is to be visualized in the current context

Specified by:
isToBeVisualized in interface Command
Parameters:
context -
Returns:
true if to be visualized, otherwise false

isVisible

public boolean isVisible()
Specified by:
isVisible in interface com.softwareag.cis.plugin.interfaces.Component
See Also:
Component.isVisible()

setVisible

public void setVisible(boolean visible)
Set whether this command is to be visualized

Specified by:
setVisible in interface com.softwareag.cis.plugin.interfaces.Component
Parameters:
visible - true if to be visualized, otherwise false

execute

public void execute()
Execute command


execute

public abstract void execute(CommandContext commandContext)
Execute command for given CommandContext

Specified by:
execute in interface Command
Parameters:
commandContext - the CommandContext

executeWrapped

public final void executeWrapped(CommandContext commandContext)
Execute command for given ActionContext. This method should be used by ToolBar, ContextMenu etc in order to allow for additional actions to be performed before/after command execution.

Specified by:
executeWrapped in interface Command
Parameters:
commandContext - the CommandContext