net.sf.doolin.gui.display
Class AbstractContextPropertyDisplayStateHandler<S>

java.lang.Object
  extended by net.sf.doolin.gui.display.AbstractDisplayStateHandler
      extended by net.sf.doolin.gui.display.AbstractContextPropertyDisplayStateHandler<S>
Type Parameters:
S - Type of the property to convert to a display state
All Implemented Interfaces:
DisplayStateHandler
Direct Known Subclasses:
AdaptedContextPropertyDisplayStateHandler

public abstract class AbstractContextPropertyDisplayStateHandler<S>
extends AbstractDisplayStateHandler

This display state handler is based on a property of the context. This property is adapted to a display state using an adapter.

Author:
Damien Coraboeuf

Constructor Summary
AbstractContextPropertyDisplayStateHandler()
          Default constructor
AbstractContextPropertyDisplayStateHandler(String propertyPath)
          Constructor.
 
Method Summary
 DisplayState getDisplayState(ActionContext actionContext)
          Gets the current DisplayState for the given action context
protected abstract  DisplayState getDisplayState(S property)
          Computes the display state from the given property value
 String getPropertyPath()
          Gets the property path.
 void setPropertyPath(String propertyPath)
          Sets the property path.
 void subscribe(ActionContext actionContext, Runnable task)
          Subscribes a task that is executed each time this display state handler changes its state.
 
Methods inherited from class net.sf.doolin.gui.display.AbstractDisplayStateHandler
connect, connect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContextPropertyDisplayStateHandler

public AbstractContextPropertyDisplayStateHandler()
Default constructor


AbstractContextPropertyDisplayStateHandler

public AbstractContextPropertyDisplayStateHandler(String propertyPath)
Constructor.

Parameters:
propertyPath - Path to the property of the context to take into account
Method Detail

getDisplayState

public DisplayState getDisplayState(ActionContext actionContext)
Description copied from interface: DisplayStateHandler
Gets the current DisplayState for the given action context

Parameters:
actionContext - Action context.
Returns:
Display state

getDisplayState

protected abstract DisplayState getDisplayState(S property)
Computes the display state from the given property value

Parameters:
property - Property value
Returns:
Display state

getPropertyPath

public String getPropertyPath()
Gets the property path.

Returns:
the property path

setPropertyPath

public void setPropertyPath(String propertyPath)
Sets the property path.

Parameters:
propertyPath - the new property path

subscribe

public void subscribe(ActionContext actionContext,
                      Runnable task)
Description copied from interface: DisplayStateHandler
Subscribes a task that is executed each time this display state handler changes its state.

Parameters:
actionContext - Action context for this display state handler
task - Task to run each time the state change


Copyright © 2011. All Rights Reserved.