bibliothek.gui.dock.common.intern.action
Class CDecorateableAction

java.lang.Object
  extended by bibliothek.gui.dock.common.action.CAction
      extended by bibliothek.gui.dock.common.intern.action.CDecorateableAction
Direct Known Subclasses:
CDropDownButton, CDropDownItem, CMenu, CPanelPopup

public class CDecorateableAction
extends CAction

An action which has text, icons and other decorations.

Author:
Benjamin Sigg

Constructor Summary
CDecorateableAction(SimpleDockAction action)
          Creates a new action.
 
Method Summary
 javax.swing.KeyStroke getAccelerator()
          Gets the combination of keys that will trigger this action.
 javax.swing.Icon getDisabledIcon()
          Gets the disabled icon.
 javax.swing.Icon getIcon()
          Gest the icon of this action.
 java.lang.String getText()
          Gets the text of this action.
 java.lang.String getTooltip()
          Gets the long description of this action.
protected  void init(SimpleDockAction action)
          Initializes this action, this method can be called only once.
 boolean isEnabled()
          Tells whether this action can be triggered by the user or not.
 void setAccelerator(javax.swing.KeyStroke accelerator)
          Sets the combination of keys that will trigger this action if the user presses them.
 void setDisabledIcon(javax.swing.Icon icon)
          Sets the icon of this action.
 void setEnabled(boolean enabled)
          Enables or disables this action, a disabled action can't be triggered by the user.
 void setIcon(javax.swing.Icon icon)
          Sets the icon of this action.
 void setText(java.lang.String text)
          Sets the text of this action, the text will be visible when this action is shown in a menu.
 void setTooltip(java.lang.String tooltip)
          Sets a tooltip for this action.
 
Methods inherited from class bibliothek.gui.dock.common.action.CAction
init, intern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDecorateableAction

public CDecorateableAction(SimpleDockAction action)
Creates a new action.

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

init

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

Parameters:
action - the internal representation

setText

public void setText(java.lang.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 java.lang.String getText()
Gets the text of this action.

Returns:
the text

setTooltip

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

Parameters:
tooltip - the tooltip

getTooltip

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

Returns:
the description

setIcon

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

Parameters:
icon - the icon, can be null

getIcon

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

Returns:
the icon

setDisabledIcon

public void setDisabledIcon(javax.swing.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 javax.swing.Icon getDisabledIcon()
Gets the disabled icon. This icon is only visible when this action is disabled.

Returns:
the disabled icon

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(javax.swing.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 javax.swing.KeyStroke getAccelerator()
Gets the combination of keys that will trigger this action.

Returns:
the combination or null