bibliothek.gui.dock.common.intern.action
Class CDecorateableAction<A extends CommonDecoratableDockAction>

java.lang.Object
  extended by bibliothek.gui.dock.common.action.CAction
      extended by bibliothek.gui.dock.common.intern.action.CDecorateableAction<A>
Type Parameters:
A - the kind of action managed by this CAction
Direct Known Subclasses:
CDropDownButton, CDropDownItem, CMenu, CPanelPopup

public class CDecorateableAction<A extends CommonDecoratableDockAction>
extends CAction

An action which has text, icons and other decorations.

Author:
Benjamin Sigg

Constructor Summary
CDecorateableAction(A action)
          Creates a new action.
 
Method Summary
 void addDecorateableActionListener(CDecorateableActionListener listener)
          Adds the observer listener to this action.
 KeyStroke getAccelerator()
          Gets the combination of keys that will trigger this action.
 Icon getDisabledHoverIcon()
          Gets the icon which is used if the mouse is hovering over a button that represents this action and if this action is disabled.
 Icon getDisabledIcon()
          Gets the disabled icon.
 Icon getDisabledPressedIcon()
          Gets the icon which is used if the mouse is pressed over a button that represents this action and if this action is disabled.
 Icon getHoverIcon()
          Gets the icon which is used if the mouse is hovering over a button that represents this action.
 Icon getIcon()
          Gest the icon of this action.
 Icon getPressedIcon()
          Gets the icon which is used if the mouse is pressed over a button that represents this action.
 String getText()
          Gets the text of this action.
 String getTooltip()
          Gets the long description of this action.
protected  void init(A action)
          Initializes this action, this method can be called only once.
 A intern()
          Gets the internal representation of the action.
 boolean isEnabled()
          Tells whether this action can be triggered by the user or not.
 boolean isShowTextOnButtons()
          Tells whether the text of this action is shown on buttons.
 void removeDecorateableActionListener(CDecorateableActionListener listener)
          Removes the observer listener from this action.
 void setAccelerator(KeyStroke accelerator)
          Sets the combination of keys that will trigger this action if the user presses them.
 void setDisabledHoverIcon(Icon icon)
          Sets the icon which is used if the mouse is hovering over a button that represents this action and if this action is disabled.
 void setDisabledIcon(Icon icon)
          Sets the icon of this action.
 void setDisabledPressedIcon(Icon icon)
          Sets the icon which is used if the mouse is pressed over a button that represents this action and if this action is disabled.
 void setEnabled(boolean enabled)
          Enables or disables this action, a disabled action can't be triggered by the user.
 void setHoverIcon(Icon icon)
          Sets the icon which is used if the mouse is hovering over a button that represents this action.
 void setIcon(Icon icon)
          Sets the icon of this action.
 void setPressedIcon(Icon icon)
          Sets the icon which is used if the mouse is pressed over a button that represents this action.
 void setShowTextOnButtons(boolean showTextOnButtons)
          Sets whether the text of this action should be shown if this action is shown as a button.
 void setText(String text)
          Sets the text of this action, the text will be visible when this action is shown in a menu.
 void setTooltip(String tooltip)
          Sets a tooltip for this action.
 
Methods inherited from class bibliothek.gui.dock.common.action.CAction
init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDecorateableAction

public CDecorateableAction(A action)
Creates a new action.

Parameters:
action - the internal representation, can be null if init(CommonDecoratableDockAction) is called later
Method Detail

init

protected void init(A action)
Initializes this action, this method can be called only once.

Parameters:
action - the internal representation

addDecorateableActionListener

public void addDecorateableActionListener(CDecorateableActionListener listener)
Adds the observer listener to this action. The observer will be informed when properties of this CDecorateableAction changed.

Parameters:
listener - the new observer

removeDecorateableActionListener

public void removeDecorateableActionListener(CDecorateableActionListener listener)
Removes the observer listener from this action.

Parameters:
listener - the listener to remove
See Also:
addDecorateableActionListener(CDecorateableActionListener)

setText

public void setText(String text)
Sets the text of this action, the text will be visible when this action is shown in a menu. The text is a small description telling the user, for what this action is good for.

Parameters:
text - the text

getText

public String getText()
Gets the text of this action.

Returns:
the text

setShowTextOnButtons

public void setShowTextOnButtons(boolean showTextOnButtons)
Sets whether the text of this action should be shown if this action is shown as a button.

Parameters:
showTextOnButtons - true if the text should be shown, false otherwise

isShowTextOnButtons

public boolean isShowTextOnButtons()
Tells whether the text of this action is shown on buttons.

Returns:
true if the text is shown, false otherwise
See Also:
setShowTextOnButtons(boolean)

setTooltip

public void setTooltip(String tooltip)
Sets a tooltip for this action. The tooltip is a long description of this action.

Parameters:
tooltip - the tooltip

getTooltip

public String getTooltip()
Gets the long description of this action.

Returns:
the description

setIcon

public void setIcon(Icon icon)
Sets the icon of this action.

Parameters:
icon - the icon, can be null

getIcon

public Icon getIcon()
Gest the icon of this action.

Returns:
the icon

setHoverIcon

public void setHoverIcon(Icon icon)
Sets the icon which is used if the mouse is hovering over a button that represents this action.

Parameters:
icon - the icon or null

getHoverIcon

public Icon getHoverIcon()
Gets the icon which is used if the mouse is hovering over a button that represents this action.

Returns:
the icon or null

setPressedIcon

public void setPressedIcon(Icon icon)
Sets the icon which is used if the mouse is pressed over a button that represents this action.

Parameters:
icon - the icon or null

getPressedIcon

public Icon getPressedIcon()
Gets the icon which is used if the mouse is pressed over a button that represents this action.

Returns:
the icon, can be null

setDisabledIcon

public void setDisabledIcon(Icon icon)
Sets the icon of this action. The disabled-icon will only be visible when this action is disabled.

Parameters:
icon - the disabled icon
See Also:
setEnabled(boolean)

getDisabledIcon

public Icon getDisabledIcon()
Gets the disabled icon. This icon is only visible when this action is disabled.

Returns:
the disabled icon

setDisabledHoverIcon

public void setDisabledHoverIcon(Icon icon)
Sets the icon which is used if the mouse is hovering over a button that represents this action and if this action is disabled.

Parameters:
icon - the icon or null

getDisabledHoverIcon

public Icon getDisabledHoverIcon()
Gets the icon which is used if the mouse is hovering over a button that represents this action and if this action is disabled.

Returns:
the icon or null

setDisabledPressedIcon

public void setDisabledPressedIcon(Icon icon)
Sets the icon which is used if the mouse is pressed over a button that represents this action and if this action is disabled.

Parameters:
icon - the icon or null

getDisabledPressedIcon

public Icon getDisabledPressedIcon()
Gets the icon which is used if the mouse is pressed over a button that represents this action and if this action is disabled.

Returns:
the icon, can be null

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this action, a disabled action can't be triggered by the user.

Parameters:
enabled - true if this action should be triggerable by the user.

isEnabled

public boolean isEnabled()
Tells whether this action can be triggered by the user or not.

Returns:
true if this action can be triggered

setAccelerator

public void setAccelerator(KeyStroke accelerator)
Sets the combination of keys that will trigger this action if the user presses them.

Parameters:
accelerator - the combination of keys, or null

getAccelerator

public KeyStroke getAccelerator()
Gets the combination of keys that will trigger this action.

Returns:
the combination or null

intern

public A intern()
Description copied from class: CAction
Gets the internal representation of the action.

Overrides:
intern in class CAction
Returns:
the representation