K
- the type of key to distinguish between groups of Dockablespublic abstract class GroupedSelectableDockAction<K> extends GroupedDropDownItemAction<K,SimpleSelectableAction> implements SelectableDockAction
Modifier and Type | Class and Description |
---|---|
static class |
GroupedSelectableDockAction.Check<K>
An action intended to use as type
ActionType.CHECK |
static class |
GroupedSelectableDockAction.Radio<K>
An action intended to use as type
ActionType.RADIO |
BUTTON_CONTENT_FILTER
Constructor and Description |
---|
GroupedSelectableDockAction(GroupKeyGenerator<? extends K> generator,
ActionType<SelectableDockAction> type)
Creates a new action.
|
Modifier and Type | Method and Description |
---|---|
void |
addSelectableListener(SelectableDockActionListener listener)
Adds a listener to this action.
|
protected SimpleSelectableAction |
createGroup(K key)
Creates a new group.
|
protected abstract SimpleSelectableAction |
createGroup(SelectableDockActionListener listener)
Creates a new group and adds a listener to the group.
|
<V> V |
createView(ViewTarget<V> target,
ActionViewConverter converter,
Dockable dockable)
Creates a view for this action, for the platform
target and
with help of converter . |
protected void |
fireSelectedChanged(Dockable dockable)
Fires a change-event on all known listeners.
|
protected void |
fireSelectedChanged(Set<Dockable> dockables)
Fires a change-event on all known listeners.
|
Icon |
getDisabledSelectedIcon(Object key)
Gets the icon that is shown when the group
key
is selected and disabled. |
Icon |
getSelectedIcon(Object key)
Gets the icon that is shown when the group named
key
is in the selected-state. |
boolean |
isSelected(Dockable dockable)
Tells whether this DockAction is selected or not (in respect
to the given
dockable ). |
boolean |
isSelected(Object key)
Gets the selected-state property of the group
key . |
void |
removeSelectableListener(SelectableDockActionListener listener)
Removes a listener from this action.
|
void |
setDisabledSelectedIcon(K key,
Icon icon)
Sets the
icon that will be shown when the group
key is disabled and selected. |
void |
setGroup(K key,
Dockable dockable)
Assigns the
dockable/code> to the group with the given |
void |
setSelected(Dockable dockable,
boolean selected)
Sets the selected state for
dockable . |
void |
setSelected(K key,
boolean selected)
Sets the selected-state of the group
key . |
void |
setSelectedIcon(K key,
Icon icon)
Sets the
icon that will be shown when the group
named key is selected. |
isDropDownSelectable, isDropDownSelectable, isDropDownTriggerable, isDropDownTriggerable, setDropDownSelectable, setDropDownTriggerableNotSelected, setDropDownTriggerableSelected
bound, createGroupKey, ensureGroup, getAccelerator, getDisabledIcon, getDisabledIcon, getDockableRepresentation, getDockableRepresentation, getGenerator, getGroup, getGroup, getIcon, getIcon, getIcon, getIconContexts, getText, getText, getTooltip, getTooltipText, getTooltipText, groupExists, isEnabled, isEnabled, isKnown, isRemoveEmptyGroups, removeGroup, setAccelerator, setDisabledIcon, setDockableRepresentation, setEnabled, setGenerator, setIcon, setIcon, setRemoveEmptyGroups, setText, setTooltip, trigger, unbound
addDockActionListener, bind, fireActionEnabledChanged, fireActionIconChanged, fireActionRepresentativeChanged, fireActionTextChanged, fireActionTooltipTextChanged, getBoundDockables, isBound, removeDockActionListener, unbind
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isDropDownSelectable, isDropDownTriggerable
addDockActionListener, getDockableRepresentation, getIcon, getIconContexts, getText, getTooltipText, isEnabled, removeDockActionListener
bind, trigger, unbind
public GroupedSelectableDockAction(GroupKeyGenerator<? extends K> generator, ActionType<SelectableDockAction> type)
generator
- a generator to create keys for Dockables which are not
yet in a group.type
- the type of this actionpublic void setGroup(K key, Dockable dockable)
GroupedDockAction
dockable/code> to the group with the given key
.
setGroup
in class GroupedDockAction<K,SimpleSelectableAction>
key
- The name of the new groupdockable
- The Dockable
whose membership will be changed.
The dockable must already be in a group of this action.GroupedDockAction.createGroupKey(Dockable)
public <V> V createView(ViewTarget<V> target, ActionViewConverter converter, Dockable dockable)
DockAction
target
and
with help of converter
. Clients might use their own
code to create a new view, but the preferred way is to call
ActionViewConverter.createView(ActionType, DockAction, ViewTarget, Dockable)
with an ActionType
that fits to this DockAction.createView
in interface DockAction
V
- the type of view requestedtarget
- The platform on which the view will be usedconverter
- A set of methods that can be used to create a viewdockable
- The Dockable for which the view will be shown. Note that
this action may not yet be bound
to this action.public void addSelectableListener(SelectableDockActionListener listener)
SelectableDockAction
Dockable
changes.addSelectableListener
in interface SelectableDockAction
listener
- the new listenerpublic void removeSelectableListener(SelectableDockActionListener listener)
SelectableDockAction
removeSelectableListener
in interface SelectableDockAction
listener
- the listener to removeprotected SimpleSelectableAction createGroup(K key)
GroupedDockAction
createGroup
in class GroupedDockAction<K,SimpleSelectableAction>
key
- the key of the new groupprotected abstract SimpleSelectableAction createGroup(SelectableDockActionListener listener)
listener
- the listener to addprotected void fireSelectedChanged(Dockable dockable)
dockable
- the Dockable whose state has changedprotected void fireSelectedChanged(Set<Dockable> dockables)
dockables
- the Dockables whose state has been changedpublic boolean isSelected(Dockable dockable)
SelectableDockAction
dockable
).isSelected
in interface SelectableDockAction
dockable
- The Dockable
for which this action may be selected
or not selectedtrue
if this DockAction is selcted, false
otherwisepublic void setSelected(Dockable dockable, boolean selected)
SelectableDockAction
dockable
.setSelected
in interface SelectableDockAction
dockable
- the affected dockableselected
- the new statepublic void setSelected(K key, boolean selected)
key
.
If the group does not exist, it will be created.key
- The name of the groupselected
- The new state of the grouppublic boolean isSelected(Object key)
key
.key
- The name of the groupIllegalArgumentException
- If the group does not existsetSelected(Object, boolean)
public void setSelectedIcon(K key, Icon icon)
icon
that will be shown when the group
named key
is selected. If the group does not
exist, it will be created.key
- The name of the groupicon
- The selected-icon, may be null
public Icon getSelectedIcon(Object key)
key
is in the selected-state.key
- The name of the groupnull
IllegalArgumentException
- if the group does not existGroupedDockAction.setDisabledIcon(Object, Icon)
public void setDisabledSelectedIcon(K key, Icon icon)
icon
that will be shown when the group
key
is disabled and selected. If the group
does not exist, it will be created.key
- The name of the groupicon
- The icon to display, when the group is
selected and disabled, may be null
public Icon getDisabledSelectedIcon(Object key)
key
is selected and disabled.key
- The name of the groupnull
IllegalArgumentException
- if the group does not existsetDisabledSelectedIcon(Object, Icon)