bibliothek.gui.dock.themes.basic.action
Class BasicHandler<D extends StandardDockAction>

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.BasicHandler<D>
Type Parameters:
D - The type of action observed by this model
All Implemented Interfaces:
ViewItem<javax.swing.JComponent>, BasicTitleViewItem<javax.swing.JComponent>, BasicTrigger
Direct Known Subclasses:
BasicButtonHandler, BasicMenuHandler, BasicSelectableHandler

public abstract class BasicHandler<D extends StandardDockAction>
extends java.lang.Object
implements BasicTrigger, BasicTitleViewItem<javax.swing.JComponent>

A class connecting a DockAction with a BasicButtonModel. The handler observes the action and reports all changed properties to the model.
Clients should call the method setModel(BasicButtonModel) to connect the handler with a model.
This class implements BasicTitleViewItem in order to allow clients to use instances as arguments for the put-methods of ActionViewConverter.

Author:
Benjamin Sigg

Nested Class Summary
protected  class BasicHandler.Listener
          A listener to the action of the enclosing handler.
 
Field Summary
private  D action
          the action which is observed
private  Dockable dockable
          the dockable for which the action is displayed
private  BasicHandler.Listener listener
          a listener to the action
private  BasicButtonModel model
          the model to which all readings from the action are sent
 
Constructor Summary
BasicHandler(D action, Dockable dockable)
          Creates a new handler.
 
Method Summary
 void bind()
          Binds this item to its action
protected  BasicHandler.Listener createListener()
           
 D getAction()
          Gest the action which is monitored by this handler.
 Dockable getDockable()
          Gets the Dockable for which the action is shown.
 javax.swing.JComponent getItem()
          Gets this item as component.
 BasicButtonModel getModel()
          Gets the model of this handler.
 void setModel(BasicButtonModel model)
          Sets the model to which all properties of the action are transfered.
 void setOrientation(DockTitle.Orientation orientation)
          Informs the item about the orientation of the title that uses this item.
abstract  void triggered()
          Invoked by a BasicButtonModel when the button, which is monitored by the model, is clicked.
 void unbind()
          Unbinds this item from its action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

action

private D extends StandardDockAction action
the action which is observed


model

private BasicButtonModel model
the model to which all readings from the action are sent


dockable

private Dockable dockable
the dockable for which the action is displayed


listener

private BasicHandler.Listener listener
a listener to the action

Constructor Detail

BasicHandler

public BasicHandler(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

setModel

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

Parameters:
model - the model

getModel

public BasicButtonModel getModel()
Gets the model of this handler.

Returns:
the model
See Also:
setModel(BasicButtonModel)

getAction

public D getAction()
Gest the action which is monitored by this handler.

Specified by:
getAction in interface ViewItem<javax.swing.JComponent>
Returns:
the observed action

getDockable

public Dockable getDockable()
Gets the Dockable for which the action is shown.

Returns:
the dockable

getItem

public javax.swing.JComponent getItem()
Description copied from interface: ViewItem
Gets this item as component.

Specified by:
getItem in interface ViewItem<javax.swing.JComponent>
Returns:
this item

setOrientation

public void setOrientation(DockTitle.Orientation orientation)
Description copied from interface: BasicTitleViewItem
Informs the item about the orientation of the title that uses this item.

Specified by:
setOrientation in interface BasicTitleViewItem<javax.swing.JComponent>
Parameters:
orientation - the orientation

triggered

public abstract void triggered()
Description copied from interface: BasicTrigger
Invoked by a BasicButtonModel when the button, which is monitored by the model, is clicked.

Specified by:
triggered in interface BasicTrigger

bind

public void bind()
Description copied from interface: ViewItem
Binds this item to its action

Specified by:
bind in interface ViewItem<javax.swing.JComponent>

unbind

public void unbind()
Description copied from interface: ViewItem
Unbinds this item from its action

Specified by:
unbind in interface ViewItem<javax.swing.JComponent>

createListener

protected BasicHandler.Listener createListener()