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 thisCAction
- Direct Known Subclasses:
CDropDownButton,CDropDownItem,CMenu,CPanelPopup
An action which has text, icons and other decorations.
- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the observerlistenerto this action.Gets the combination of keys that will trigger this action.Gets the icon which is used if the mouse is hovering over a button that represents this action and if this action is disabled.Gets the disabled icon.Gets the icon which is used if the mouse is pressed over a button that represents this action and if this action is disabled.Gets the icon which is used if the mouse is hovering over a button that represents this action.getIcon()Gest the icon of this action.Gets the icon which is used if the mouse is pressed over a button that represents this action.getText()Gets the text of this action.Gets the long description of this action.protected voidInitializes this action, this method can be called only once.intern()Gets the internal representation of the action.booleanWhether this action is listening to global key events.booleanTells whether this action can be triggered by the user or not.booleanTells whether the text of this action is shown on buttons.voidRemoves the observerlistenerfrom this action.voidsetAccelerator(KeyStroke accelerator) Sets the combination of keys that will trigger this action if the user presses them.voidsetAcceleratorIsGlobal(boolean global) Tells this action that theacceleratoris global.voidsetDisabledHoverIcon(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.voidsetDisabledIcon(Icon icon) Sets the icon of this action.voidsetDisabledPressedIcon(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.voidsetEnabled(boolean enabled) Enables or disables this action, a disabled action can't be triggered by the user.voidsetHoverIcon(Icon icon) Sets the icon which is used if the mouse is hovering over a button that represents this action.voidSets the icon of this action.voidsetPressedIcon(Icon icon) Sets the icon which is used if the mouse is pressed over a button that represents this action.voidsetShowTextOnButtons(boolean showTextOnButtons) Sets whether the text of this action should be shown if this action is shown as a button.voidSets the text of this action, the text will be visible when this action is shown in a menu.voidsetTooltip(String tooltip) Sets a tooltip for this action.
-
Constructor Details
-
CDecorateableAction
Creates a new action.- Parameters:
action- the internal representation, can benullifinit(CommonDecoratableDockAction)is called later
-
-
Method Details
-
init
Initializes this action, this method can be called only once.- Parameters:
action- the internal representation
-
addDecorateableActionListener
Adds the observerlistenerto this action. The observer will be informed when properties of thisCDecorateableActionchanged.- Parameters:
listener- the new observer
-
removeDecorateableActionListener
Removes the observerlistenerfrom this action.- Parameters:
listener- the listener to remove- See Also:
-
setText
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
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-trueif the text should be shown,falseotherwise
-
isShowTextOnButtons
public boolean isShowTextOnButtons()Tells whether the text of this action is shown on buttons.- Returns:
trueif the text is shown,falseotherwise- See Also:
-
setTooltip
Sets a tooltip for this action. The tooltip is a long description of this action.- Parameters:
tooltip- the tooltip
-
getTooltip
Gets the long description of this action.- Returns:
- the description
-
setIcon
Sets the icon of this action.- Parameters:
icon- the icon, can benull
-
getIcon
Gest the icon of this action.- Returns:
- the icon
-
setHoverIcon
Sets the icon which is used if the mouse is hovering over a button that represents this action.- Parameters:
icon- the icon ornull
-
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
Sets the icon which is used if the mouse is pressed over a button that represents this action.- Parameters:
icon- the icon ornull
-
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
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
Gets the disabled icon. This icon is only visible when this action is disabled.- Returns:
- the disabled icon
-
setDisabledHoverIcon
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 ornull
-
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
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 ornull
-
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-trueif 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:
trueif this action can be triggered
-
setAccelerator
Sets the combination of keys that will trigger this action if the user presses them.- Parameters:
accelerator- the combination of keys, ornull
-
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 theacceleratoris 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:
trueif global key events are supported
-
intern
Description copied from class:CActionGets the internal representation of the action.
-