bibliothek.gui.dock.themes.basic.action
Class BasicDropDownButtonHandler

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.AbstractBasicHandler<DropDownAction,BasicDropDownButtonModel>
      extended by bibliothek.gui.dock.themes.basic.action.BasicDropDownButtonHandler
All Implemented Interfaces:
ViewItem<JComponent>, BasicDropDownButtonTrigger, BasicResourceInitializer, BasicTitleViewItem<JComponent>, BasicTrigger

public class BasicDropDownButtonHandler
extends AbstractBasicHandler<DropDownAction,BasicDropDownButtonModel>
implements BasicDropDownButtonTrigger, BasicTitleViewItem<JComponent>

A handler connecting a DropDownAction with a BasicDropDownButtonModel and its view. Clients should call the method AbstractBasicHandler.setModel(BasicButtonModel) to connect model and handler.

Author:
Benjamin Sigg

Nested Class Summary
protected  class BasicDropDownButtonHandler.ButtonView
          A view that sends all values directly to the button.
protected  class BasicDropDownButtonHandler.SelectionView
          A set of properties which can be set by the selected action.
 
Constructor Summary
BasicDropDownButtonHandler(DropDownAction action, Dockable dockable)
          Creates a new handler.
 
Method Summary
 void bind()
          Binds this item to its action
protected  BasicDropDownButtonHandler.ButtonView getButtonView()
          Gets the view which contains information about the currently selected action.
 Icon getDisabledDropDownIcon()
          Gets a disabled version of getDropDownIcon().
 Icon getDropDownIcon()
          Gets an icon that can be used to represent an area that opens the popup menu when clicked.
 JComponent getItem()
          Gets this item as component.
 void popupTriggered()
          Shows the popup menu
protected  void reset()
          Sets all values of the filter to null.
 void setBackground(Color background)
          Called by the title that shows this item to tell this item what the background color of the title is.
 void setForeground(Color foreground)
          Called by the title that shows this item to tell this item what the foreground color of the title is.
 void setOrientation(DockTitle.Orientation orientation)
          Informs the item about the orientation of the title that uses this item.
 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
protected  void update()
          Updates the filter.
 void updateUI()
          Update the look and feel of the menu
 
Methods inherited from class bibliothek.gui.dock.themes.basic.action.AbstractBasicHandler
addBorder, ensureBorder, getAction, getDockable, getModel, isBound, setModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.themes.basic.action.BasicTrigger
getAction, getDockable
 
Methods inherited from interface bibliothek.gui.dock.action.view.ViewItem
getAction
 

Constructor Detail

BasicDropDownButtonHandler

public BasicDropDownButtonHandler(DropDownAction action,
                                  Dockable dockable)
Creates a new handler.

Parameters:
action - the action to observe
dockable - the element for which the action is shown
Method Detail

bind

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

Specified by:
bind in interface ViewItem<JComponent>
Overrides:
bind in class AbstractBasicHandler<DropDownAction,BasicDropDownButtonModel>

unbind

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

Specified by:
unbind in interface ViewItem<JComponent>
Overrides:
unbind in class AbstractBasicHandler<DropDownAction,BasicDropDownButtonModel>

getDropDownIcon

public Icon getDropDownIcon()
Gets an icon that can be used to represent an area that opens the popup menu when clicked.

Returns:
an icon, not null

getDisabledDropDownIcon

public Icon getDisabledDropDownIcon()
Gets a disabled version of getDropDownIcon().

Returns:
the icon, not null

setBackground

public void setBackground(Color background)
Description copied from interface: BasicTitleViewItem
Called by the title that shows this item to tell this item what the background color of the title is.

Specified by:
setBackground in interface BasicTitleViewItem<JComponent>
Parameters:
background - the background color of the title

setForeground

public void setForeground(Color foreground)
Description copied from interface: BasicTitleViewItem
Called by the title that shows this item to tell this item what the foreground color of the title is.

Specified by:
setForeground in interface BasicTitleViewItem<JComponent>
Parameters:
foreground - the foreground color of the title

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<JComponent>
Parameters:
orientation - the orientation

getItem

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

Specified by:
getItem in interface ViewItem<JComponent>
Returns:
this item, depending on the subclass this may or may not be null

triggered

public 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

popupTriggered

public void popupTriggered()
Shows the popup menu

Specified by:
popupTriggered in interface BasicDropDownButtonTrigger

updateUI

public void updateUI()
Update the look and feel of the menu


getButtonView

protected BasicDropDownButtonHandler.ButtonView getButtonView()
Gets the view which contains information about the currently selected action.

Returns:
the information

reset

protected void reset()
Sets all values of the filter to null.


update

protected void update()
Updates the filter. This might change some contents of the button.