bibliothek.gui.dock.themes.basic.action.dropdown
Class DropDownIcon

java.lang.Object
  extended by bibliothek.gui.dock.themes.basic.action.dropdown.DropDownIcon
All Implemented Interfaces:
Icon

@ColorCodes(value="action.dropdown.arrow")
public class DropDownIcon
extends Object
implements Icon

This Icon is painted on buttons for DropDownActions. Usually this icon looks like a small arrow pointing down, and clicking onto this icon should open a drop down menu.

Author:
Benjamin Sigg

Field Summary
static String ICON_KEY
           
 
Constructor Summary
DropDownIcon()
          Creates a new icon.
 
Method Summary
 DropDownAction getAction()
          Gets the action for which this icon is used.
 Icon getDisabledIcon()
          Gets a disabled version of this icon.
 int getIconHeight()
           
 int getIconWidth()
           
 JComponent getParent()
          Gets the Component on which this icon is painted.
 void init(Dockable dockable, DropDownAction action, ViewItem<? extends JComponent> parent)
          Initializes this icon by setting missing properties.
 boolean isInitialized()
          Tells whether init(Dockable, DropDownAction, ViewItem) has already been called.
 void paintIcon(Component c, Graphics g, int x, int y)
           
protected  void resetIcon()
          Recalculates what icon should be shown
 void setController(DockController controller)
          Links this icon with controller, this icon may change is appearance due to the properties stored in controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_KEY

public static final String ICON_KEY
See Also:
Constant Field Values
Constructor Detail

DropDownIcon

public DropDownIcon()
Creates a new icon. The caller should call init(Dockable, DropDownAction, ViewItem) to fully utilize this icon.

Method Detail

init

public void init(Dockable dockable,
                 DropDownAction action,
                 ViewItem<? extends JComponent> parent)
Initializes this icon by setting missing properties.

Parameters:
dockable - the owner of action, not null
action - the action for which this icon is used, must not be null
parent - the JComponent on which this icon is painted, not null. Please note that this component must not be cast into a subclass.

isInitialized

public boolean isInitialized()
Tells whether init(Dockable, DropDownAction, ViewItem) has already been called.

Returns:
true if this icon is initialized

getAction

public DropDownAction getAction()
Gets the action for which this icon is used.

Returns:
the owner of this icon, not null

getParent

public JComponent getParent()
Gets the Component on which this icon is painted.

Returns:
the component, not null

setController

public void setController(DockController controller)
Links this icon with controller, this icon may change is appearance due to the properties stored in controller.

Parameters:
controller - the properties to use or null

getDisabledIcon

public Icon getDisabledIcon()
Gets a disabled version of this icon. The returned icon is lazily updated if the properties of this icon changes.

Returns:
the icon, not null, has always the same size as this icon

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface Icon

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface Icon

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface Icon

resetIcon

protected void resetIcon()
Recalculates what icon should be shown