net.sf.doolin.gui.action
Class AbstractGUIAction

java.lang.Object
  extended by net.sf.doolin.gui.action.AbstractGUIAction
All Implemented Interfaces:
GUIAction
Direct Known Subclasses:
AbstractSimpleGUIAction, AbstractTextAction, DelegateGUIAction, GUIEditAction, LFAction

public abstract class AbstractGUIAction
extends Object
implements GUIAction

Abstract action for a default controlled behaviour.

Author:
Damien Coraboeuf

Constructor Summary
AbstractGUIAction()
           
 
Method Summary
protected abstract  void doExecute(ActionContext context)
          Executes the action and throws any kind of error.
 boolean execute(ActionContext context)
          Executes the action and deals with errors.
protected  Object getActionContextData(ActionContext actionContext)
          Extracts the data to use from the action context.
 ActionContextDataExtractor getActionContextDataExtractor()
           
 DisplayStateHandler getDisplayStateHandler()
          Display state handler for this action
 Icon getIcon(String iconID, IconSize iconSize)
          Gets the icon according to its ID
 IconService getIconService()
          Gets the icon service.
 void setActionContextDataExtractor(ActionContextDataExtractor actionContextDataExtractor)
           
 void setDisplayStateHandler(DisplayStateHandler displayStateHandler)
          Sets the display state handler.
 void setIconService(IconService iconService)
          Sets the icon service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.doolin.gui.action.GUIAction
getIconIDExpression, getId, getShortcutExpression, getTextExpression, getTipExpression
 

Constructor Detail

AbstractGUIAction

public AbstractGUIAction()
Method Detail

doExecute

protected abstract void doExecute(ActionContext context)
                           throws Exception
Executes the action and throws any kind of error.

Parameters:
context - the context
Throws:
Exception - the exception

execute

public boolean execute(ActionContext context)
Executes the action and deals with errors. Executes the action.

Specified by:
execute in interface GUIAction
Parameters:
context - the context
Returns:
true if the action has been executed without error

getActionContextData

protected Object getActionContextData(ActionContext actionContext)
Extracts the data to use from the action context.

Parameters:
actionContext - Action context to get the data from
Returns:
Data
See Also:
setActionContextDataExtractor(ActionContextDataExtractor)

getActionContextDataExtractor

public ActionContextDataExtractor getActionContextDataExtractor()

getDisplayStateHandler

public DisplayStateHandler getDisplayStateHandler()
Display state handler for this action

Specified by:
getDisplayStateHandler in interface GUIAction
Returns:
Display state handler

getIcon

public Icon getIcon(String iconID,
                    IconSize iconSize)
Description copied from interface: GUIAction
Gets the icon according to its ID

Specified by:
getIcon in interface GUIAction
Parameters:
iconID - Icon ID
iconSize - Icon size
Returns:
The icon for this action or null if none is available.

getIconService

public IconService getIconService()
Gets the icon service.

Returns:
the icon service

setActionContextDataExtractor

public void setActionContextDataExtractor(ActionContextDataExtractor actionContextDataExtractor)

setDisplayStateHandler

public void setDisplayStateHandler(DisplayStateHandler displayStateHandler)
Sets the display state handler.

Parameters:
displayStateHandler - the new display state handler

setIconService

public void setIconService(IconService iconService)
Sets the icon service.

Parameters:
iconService - the new icon service


Copyright © 2011. All Rights Reserved.