SRJRCFrames
v0.1.296

de.schwarzrot.ui.action.support
Class AbstractActionHandler

java.lang.Object
  extended by de.schwarzrot.ui.action.support.AbstractActionHandler
All Implemented Interfaces:
ActionHandler
Direct Known Subclasses:
DesktopActionHandler

public abstract class AbstractActionHandler
extends Object
implements ActionHandler

class to handle user-actions and to allow access to defined actions. The class has a static repository, where all ActionHandler register their actions and so it is possible to find an Action from an unknown but active ActionHandler.

Author:
Reinhard Mantey

Field Summary
protected static CommandFactoryBuilder facBuilder
           
 
Constructor Summary
AbstractActionHandler(String name)
           
 
Method Summary
 JToolBar createExtraToolBar()
           
 JPopupMenu createPopup(Object context)
           
 JPopupMenu createPopup(Object context, Enum<?>[][] cmdList)
           
 JMenu createSubMenu(Enum<?> cmd)
           
 JMenu createSubMenu(String cmd)
          will be called for any enum, that has the suffix '_sub'.
 JToolBar createToolBar(Enum<?>[] commands, int orientation)
           
 void enableAction(String key)
          enable a single action by identifier
 void enableAction(String key, boolean enabled)
          enable/disable a single action by identifier
 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<?>[] getExtraToolBarCommands()
           
 String getName()
          return the name of this handler - usually the same name as the surrounding application.
 void init()
          used to setup all handled actions
 void init(Object context)
           
 void putAction(String key, AbstractAction action)
          save an action into the actions pool
 void setEnabled(boolean enable)
          enable/disable all actions related to the handler.
 void setName(String name)
           
 void setupAction(Application<?> app, Enum<?> cmd, AbstractActionCallback cb)
           
 void setupAction(Application<?> app, Enum<?> cmd, AbstractActionCallback cb, int mnemonic, AccessMode mode)
          the major reason for ActionHandler: have a central place to customize actions and action related components.
 void setupAction(String appID, Enum<?> cmd, AbstractActionCallback cb, int mnemonic)
           
 void setupAction(String appID, Enum<?> cmd, AbstractActionCallback cb, int mnemonic, AccessMode mode)
           
 void setupAction(String appID, String actionKey, AbstractActionCallback cb, int mnemonic, AccessMode mode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.schwarzrot.ui.action.ActionHandler
getCommands, getPopupCommands, getToolBarCommands
 

Field Detail

facBuilder

protected static CommandFactoryBuilder facBuilder
Constructor Detail

AbstractActionHandler

public AbstractActionHandler(String name)
Method Detail

createExtraToolBar

public JToolBar createExtraToolBar()

createPopup

public JPopupMenu createPopup(Object context)
Specified by:
createPopup in interface ActionHandler

createPopup

public JPopupMenu createPopup(Object context,
                              Enum<?>[][] cmdList)

createSubMenu

public final JMenu createSubMenu(Enum<?> cmd)

createSubMenu

public JMenu createSubMenu(String cmd)
Description copied from interface: ActionHandler
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.

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

createToolBar

public JToolBar createToolBar(Enum<?>[] commands,
                              int orientation)

enableAction

public void enableAction(String key)
enable a single action by identifier

Specified by:
enableAction in interface ActionHandler
Parameters:
key -

enableAction

public void enableAction(String key,
                         boolean enabled)
enable/disable a single action by identifier

Specified by:
enableAction in interface ActionHandler
Parameters:
key -
enabled -

findAction

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

Specified by:
findAction in interface ActionHandler
Parameters:
composed - the key to identify the action
Returns:
the found action or null

findAction

public AbstractAction findAction(String name,
                                 Enum<?> cmd)
Description copied from interface: ActionHandler
retrieve an action from the action pool.

Specified by:
findAction in interface ActionHandler
Parameters:
name - the handlers name
cmd - the action enum to search for
Returns:
the found action or null

findAction

public AbstractAction findAction(String name,
                                 String key)
Description copied from interface: ActionHandler
retrieve an action from the action pool.

Specified by:
findAction in interface ActionHandler
Parameters:
name - the handlers name
key - the action enum name
Returns:
the found action or null

getAction

public AbstractAction getAction(String key)
Description copied from interface: ActionHandler
retrieve action for the key. May return null, if the handler does not support the action.

Specified by:
getAction in interface ActionHandler
Parameters:
key - - the identifier of the action
Returns:
- the related action, or null

getExtraToolBarCommands

public Enum<?>[] getExtraToolBarCommands()

getName

public final String getName()
Description copied from interface: ActionHandler
return the name of this handler - usually the same name as the surrounding application.

Specified by:
getName in interface ActionHandler
Returns:
the handlers name

init

public void init()
Description copied from interface: ActionHandler
used to setup all handled actions

Specified by:
init in interface ActionHandler

init

public void init(Object context)

putAction

public void putAction(String key,
                      AbstractAction action)
Description copied from interface: ActionHandler
save an action into the actions pool

Specified by:
putAction in interface ActionHandler
Parameters:
key - - the identifier of the action
action - - the action itself

setEnabled

public void setEnabled(boolean enable)
enable/disable all actions related to the handler.

Specified by:
setEnabled in interface ActionHandler
Parameters:
enable -

setName

public final void setName(String name)

setupAction

public void setupAction(Application<?> app,
                        Enum<?> cmd,
                        AbstractActionCallback cb)

setupAction

public void setupAction(Application<?> app,
                        Enum<?> cmd,
                        AbstractActionCallback cb,
                        int mnemonic,
                        AccessMode mode)
the major reason for ActionHandler: have a central place to customize actions and action related components.

Parameters:
cmd - - the enum identifier for the action
cb - - the anonymous callback
mnemonic - - a mnemonic key

setupAction

public void setupAction(String appID,
                        Enum<?> cmd,
                        AbstractActionCallback cb,
                        int mnemonic)

setupAction

public void setupAction(String appID,
                        Enum<?> cmd,
                        AbstractActionCallback cb,
                        int mnemonic,
                        AccessMode mode)

setupAction

public void setupAction(String appID,
                        String actionKey,
                        AbstractActionCallback cb,
                        int mnemonic,
                        AccessMode mode)

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.