bibliothek.gui.dock.themes.basic.action
Class AbstractBasicHandler<D extends DockAction,M extends BasicButtonModel>

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.AbstractBasicHandler<D,M>
All Implemented Interfaces:
BasicResourceInitializer
Direct Known Subclasses:
BasicDropDownButtonHandler, BasicHandler

public class AbstractBasicHandler<D extends DockAction,M extends BasicButtonModel>
extends Object
implements BasicResourceInitializer

Collection of methods that are interesting for classes that wrap around a BasicButtonModel.

Author:
Benjamin Sigg

Constructor Summary
AbstractBasicHandler(D action, Dockable dockable)
          Creates a new handler.
 
Method Summary
 void addBorder(String key)
          Adds a connection between the ThemeManager and the model of this handler which transfers the BorderModifier with identifier key to the model.
 void bind()
           
 void ensureBorder(BasicButtonModel model, String key)
          Ensures that the BorderModifier with the specified key is installed and ready to be accessed through BasicButtonModel.getBorder(String);
 D getAction()
          Gets the action which is read by this handler.
 Dockable getDockable()
          Gets the dockable whose action is handled.
 M getModel()
          Gets the model which is written by this handler.
 boolean isBound()
          Tells whether bind() was called.
 void setModel(M model)
          Sets the model to which all properties of the action are transfered.
 void unbind()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBasicHandler

public AbstractBasicHandler(D action,
                            Dockable dockable)
Creates a new handler.

Parameters:
action - the action which will be observed.
dockable - the dockable for which the action is shown
Method Detail

getDockable

public Dockable getDockable()
Gets the dockable whose action is handled.

Returns:
the dockable, not null

getAction

public D getAction()
Gets the action which is read by this handler.

Returns:
the action, not null

getModel

public M getModel()
Gets the model which is written by this handler.

Returns:
the model, not null

ensureBorder

public void ensureBorder(BasicButtonModel model,
                         String key)
Description copied from interface: BasicResourceInitializer
Ensures that the BorderModifier with the specified key is installed and ready to be accessed through BasicButtonModel.getBorder(String);

Specified by:
ensureBorder in interface BasicResourceInitializer
Parameters:
model - the caller of this initializer
key - the key of the border to check

addBorder

public void addBorder(String key)
Adds a connection between the ThemeManager and the model of this handler which transfers the BorderModifier with identifier key to the model. Nothing happens if such a connection already exists.

Parameters:
key - the identifier of the BorderModifier to transfer

setModel

public void setModel(M model)
Sets the model to which all properties of the action are transfered.

Parameters:
model - the model

bind

public void bind()

unbind

public void unbind()

isBound

public boolean isBound()
Tells whether bind() was called.

Returns:
true if this handler is in use, false otherwise