SRJRCFrames
v0.1.296

de.schwarzrot.ui.action
Interface ActionHandler

All Known Subinterfaces:
ApplicationActionHandler
All Known Implementing Classes:
AbstractActionHandler, DesktopActionHandler

public interface ActionHandler

interface to access user actions and handle them in a global manner. The handling of user actions is based on enum definitions and the usage of the enum names. See ApplicationCommandFactory for details.

Author:
Reinhard Mantey
See Also:
ApplicationCommandFactory

Method Summary
 JPopupMenu createPopup(Object contextObj)
           
 JMenu createSubMenu(String cmd)
          will be called for any enum, that has the suffix '_sub'.
 void enableAction(String key)
          enable a single action
 void enableAction(String key, boolean enabled)
          enable/disable a single action.
 AbstractAction findAction(String composed)
          retrieve an action from the action pool.
 AbstractAction findAction(String name, Enum<?> cmd)
          retrieve an action from the action pool.
 AbstractAction findAction(String name, String key)
          retrieve an action from the action pool.
 AbstractAction getAction(String key)
          retrieve action for the key.
 Enum<?>[] getCommands()
          return the (sub-)set of action-enums, that should go into the menuebar.
 String getName()
          return the name of this handler - usually the same name as the surrounding application.
 Enum<?>[] getPopupCommands(Object context)
          return the (sub-)set of action-enums, that should form the popup context menue
 Enum<?>[] getToolBarCommands()
          return the (sub-)set of action-enums, that should be accessible by toolbar buttons
 void init()
          used to setup all handled actions
 void putAction(String key, AbstractAction action)
          save an action into the actions pool
 void setEnabled(boolean enable)
          enables/disables all actions managed by the related handler
 

Method Detail

createPopup

JPopupMenu createPopup(Object contextObj)

createSubMenu

JMenu createSubMenu(String cmd)
will be called for any enum, that has the suffix '_sub'. It's up to the handler, to create and return a menue for the given enum.

Parameters:
cmd - the string representation of the enum that triggered the submenu creation
Returns:
the created submenu or null in case of denied creation

enableAction

void enableAction(String key)
enable a single action

Parameters:
key - the action to enable

enableAction

void enableAction(String key,
                  boolean enabled)
enable/disable a single action.

Parameters:
key - the key to identify the action
enabled - true to enable, false to disable an action

findAction

AbstractAction findAction(String composed)
retrieve an action from the action pool. The composed string may be a construct of Handler.getName().Enum.name()

Parameters:
composed - the key to identify the action
Returns:
the found action or null

findAction

AbstractAction findAction(String name,
                          Enum<?> cmd)
retrieve an action from the action pool.

Parameters:
name - the handlers name
cmd - the action enum to search for
Returns:
the found action or null

findAction

AbstractAction findAction(String name,
                          String key)
retrieve an action from the action pool.

Parameters:
name - the handlers name
key - the action enum name
Returns:
the found action or null

getAction

AbstractAction getAction(String key)
retrieve action for the key. May return null, if the handler does not support the action.

Parameters:
key - - the identifier of the action
Returns:
- the related action, or null

getCommands

Enum<?>[] getCommands()
return the (sub-)set of action-enums, that should go into the menuebar.

Returns:
a set of action enums

getName

String getName()
return the name of this handler - usually the same name as the surrounding application.

Returns:
the handlers name

getPopupCommands

Enum<?>[] getPopupCommands(Object context)
return the (sub-)set of action-enums, that should form the popup context menue

Parameters:
context - the context object to create the popup for. May be null.
Returns:
a set of action enums

getToolBarCommands

Enum<?>[] getToolBarCommands()
return the (sub-)set of action-enums, that should be accessible by toolbar buttons

Returns:
a set of action enums

init

void init()
used to setup all handled actions


putAction

void putAction(String key,
               AbstractAction action)
save an action into the actions pool

Parameters:
key - - the identifier of the action
action - - the action itself

setEnabled

void setEnabled(boolean enable)
enables/disables all actions managed by the related handler

Parameters:
enable - - true to enable the actions, false to disable all actions

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.