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

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.BasicButtonModel
      extended by bibliothek.gui.dock.themes.basic.action.BasicDropDownButtonModel

public abstract class BasicDropDownButtonModel
extends BasicButtonModel

An expanded BasicButtonModel that can handle the properties needed to represent a DropDownAction.

Author:
Benjamin Sigg

Nested Class Summary
private  class BasicDropDownButtonModel.Listener
          A listener ensuring that the mouseOverDropDown property has always the correct value.
 
Field Summary
private  boolean overDropDown
          whether the mouse is currently over the dropdown area
private  boolean selectionEnabled
          whether the selected action is currently enabled
 
Constructor Summary
BasicDropDownButtonModel(javax.swing.JComponent owner, BasicTrigger trigger)
          Creates a new model.
BasicDropDownButtonModel(javax.swing.JComponent owner, BasicTrigger trigger, boolean createListener)
          Creates a new model.
 
Method Summary
 javax.swing.Icon getPaintIcon()
          Gets the icon which should be painted on the view.
protected abstract  boolean inDropDownArea(int x, int y)
          Tells whether the location x/y is over the dropdown area of the view or not.
 boolean isMouseOverDropDown()
          Tells whether the mouse is currently over the dropdown area of the view or not.
 boolean isSelectionEnabled()
          Tells whether the selected child-action of the represented DropDownAction is currently enabled or not.
protected  void setMouseInside(boolean mouseInside)
          Changes the mouseInside property.
protected  void setMouseOverDropDown(boolean overDropDown)
          Sets whether the mouse is currently over the dropdown area of the view or not.
 void setSelectionEnabled(boolean selectionEnabled)
          Sets whether the selected child-action of the represented DropDownAction is currently enabled or not.
 
Methods inherited from class bibliothek.gui.dock.themes.basic.action.BasicButtonModel
changed, getMaxIconSize, getOrientation, getOwner, getPaintIcon, isEnabled, isMouseInside, isMousePressed, isSelected, setDisabledIcon, setEnabled, setIcon, setMousePressed, setOrientation, setSelected, setSelectedDisabledIcon, setSelectedIcon, setToolTipText, trigger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

overDropDown

private boolean overDropDown
whether the mouse is currently over the dropdown area


selectionEnabled

private boolean selectionEnabled
whether the selected action is currently enabled

Constructor Detail

BasicDropDownButtonModel

public BasicDropDownButtonModel(javax.swing.JComponent owner,
                                BasicTrigger trigger)
Creates a new model.

Parameters:
owner - the view of this model
trigger - the callback used when the user clicks on the view

BasicDropDownButtonModel

public BasicDropDownButtonModel(javax.swing.JComponent owner,
                                BasicTrigger trigger,
                                boolean createListener)
Creates a new model.

Parameters:
owner - the view of this model
trigger - the callback used when the user clicks on the view
createListener - whether the model should add a MouseListener and a MouseMotionListener to the view or not.
Method Detail

setMouseInside

protected void setMouseInside(boolean mouseInside)
Description copied from class: BasicButtonModel
Changes the mouseInside property. The property tells whether the mouse is currently inside the border of the owner or not. Clients should not call this method unless they handle all mouse events.

Overrides:
setMouseInside in class BasicButtonModel
Parameters:
mouseInside - whether the mouse is inside

setMouseOverDropDown

protected void setMouseOverDropDown(boolean overDropDown)
Sets whether the mouse is currently over the dropdown area of the view or not. Clients should not call this method unless the handle all mouse events.

Parameters:
overDropDown - whether the mouse is over the dropdown area

isMouseOverDropDown

public boolean isMouseOverDropDown()
Tells whether the mouse is currently over the dropdown area of the view or not.

Returns:
whether the mouse is over the dropdown area

setSelectionEnabled

public void setSelectionEnabled(boolean selectionEnabled)
Sets whether the selected child-action of the represented DropDownAction is currently enabled or not.

Parameters:
selectionEnabled - whether the action is enabled

isSelectionEnabled

public boolean isSelectionEnabled()
Tells whether the selected child-action of the represented DropDownAction is currently enabled or not.

Returns:
whether the action is enabled

getPaintIcon

public javax.swing.Icon getPaintIcon()
Description copied from class: BasicButtonModel
Gets the icon which should be painted on the view.

Overrides:
getPaintIcon in class BasicButtonModel
Returns:
the icon to paint, can be null

inDropDownArea

protected abstract boolean inDropDownArea(int x,
                                          int y)
Tells whether the location x/y is over the dropdown area of the view or not. The coordinates are in system of the owner's coordinate-system.

Parameters:
x - the x-coordinate
y - the y-coordinate
Returns:
true if a click with the mouse should open the selection-menu of the DropDownAction