Class CDecorateableAction<A extends CommonDecoratableDockAction>

java.lang.Object
bibliothek.gui.dock.common.action.CAction
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 Details

    • CDecorateableAction

      public CDecorateableAction(A action)
      Creates a new action.
      Parameters:
      action - the internal representation, can be null if init(CommonDecoratableDockAction) is called later
  • Method Details

    • 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:
    • 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:
    • 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:
    • 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
    • setAcceleratorIsGlobal

      public void setAcceleratorIsGlobal(boolean global)
      Tells this action that the accelerator is global. A global action is executed whenever the accelerator keys are typed anywhere in the scope of DockingFrames (if for example the keys are typed on some random dialog, DockingFrames will not be informed about the event).
      Parameters:
      global - should this action be listening to global key events
    • isAcceleratorGlobal

      public boolean isAcceleratorGlobal()
      Whether this action is listening to global key events.
      Returns:
      true if global key events are supported
    • intern

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