|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.action.actions.AbstractStandardDockAction bibliothek.gui.dock.action.actions.GroupedDockAction<K,D>
K
- the type of the key used to distinguish between groupsD
- the internal representation of one grouppublic abstract class GroupedDockAction<K,D extends SimpleDockAction>
A DockAction
which classifies its Dockables
in groups. Every Dockable
must be in one group. The groups
itself are completely independent, except that they all must have
the same ActionType
.
A Dockable
may change its group at any time.
The method setGroup
is used for that.
If a new Dockable
is bound
to this
action, the createGroupKey
-method
determines the group where the Dockable
will be added.
When a group is completely empty, it is removed. This behavior can
be changed by the method setRemoveEmptyGroups
.
createGroupKey(Dockable)
,
setRemoveEmptyGroups(boolean)
Field Summary |
---|
Fields inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction |
---|
listeners |
Fields inherited from interface bibliothek.gui.dock.action.DockAction |
---|
BUTTON_CONTENT_FILTER |
Constructor Summary | |
---|---|
GroupedDockAction(GroupKeyGenerator<? extends K> generator)
Creates a new action. |
Method Summary | |
---|---|
void |
bound(Dockable dockable)
Invoked by this AbstractStandardDockAction when a Dockable
was bound to this action the first time. |
protected abstract D |
createGroup(K key)
Creates a new group. |
protected K |
createGroupKey(Dockable dockable)
Calculates the name of the group to which the dockable
should be added.Every Dockable is member of one group. |
protected D |
ensureGroup(K key)
Ensures that there exist a group with the name key . |
KeyStroke |
getAccelerator(K key)
Gets the type of KeyEvent that will
trigger an action. |
Icon |
getDisabledIcon(Dockable dockable)
|
Icon |
getDisabledIcon(Object key)
Gets the icon that is shown, when the group key
is disabled. |
Dockable |
getDockableRepresentation(Dockable dockable)
Tells whether this DockAction represents a Dockable . |
Dockable |
getDockableRepresentation(K key)
Gets the Dockable which is represented by this DockAction . |
GroupKeyGenerator<? extends K> |
getGenerator()
Gets the generator that is used to create keys for unknown Dockables. |
protected D |
getGroup(Dockable dockable)
Gets the group in which dockable is. |
protected D |
getGroup(Object key)
Gets the group with the given key. |
Icon |
getIcon(Dockable dockable,
ActionContentModifier modifier)
Gets the Icon of this DockAction, when this DockAction is shown together with dockable . |
Icon |
getIcon(Object key)
Gets the icon of the group named key . |
Icon |
getIcon(Object key,
ActionContentModifier modifier)
Gets the icon of the group named key . |
ActionContentModifier[] |
getIconContexts(Dockable dockable)
Gets all the ActionContentModifier s for which StandardDockAction.getIcon(Dockable, ActionContentModifier) would
return a value other than null . |
String |
getText(Dockable dockable)
Gets the text of this DockActon, when this DockAction is shown together with dockable . |
String |
getText(Object key)
Gets the text of the the group key . |
String |
getTooltip(Object key)
Gets the tooltip of the group key . |
String |
getTooltipText(Dockable dockable)
Gets a tooltip for this DockActon, when this DockAction is shown together with dockable . |
String |
getTooltipText(Object key)
Gets the tooltip text of the group key . |
boolean |
groupExists(Object key)
Returns true if a group with the name of key
exists, return false otherwise. |
boolean |
isEnabled(Dockable dockable)
This method chooses the result according to the current DisablingStrategy . |
boolean |
isEnabled(Object key)
Gets the enabled-state of the group key . |
boolean |
isKnown(Dockable dockable)
Tells whether the dockable is bound
to this action, or not. |
boolean |
isRemoveEmptyGroups()
If true , groups with no Dockable associated
to, will be deleted automatically. |
boolean |
removeGroup(Object key)
Removes a group but only if the group is empty (no Dockables
are registered in that group). |
void |
setAccelerator(K key,
KeyStroke accelerator)
Set the type of KeyEvent that will trigger
an action. |
void |
setDisabledIcon(K key,
Icon icon)
Sets the icon which will be shown, when the group
named key is disabled. |
void |
setDockableRepresentation(K key,
Dockable dockable)
Sets the Dockable that is represented by this group. |
void |
setEnabled(K key,
boolean enabled)
Sets the enabled-state of the group key . |
void |
setGenerator(GroupKeyGenerator<? extends K> generator)
Sets the generator that is used to create keys for unknown Dockables. |
void |
setGroup(K key,
Dockable dockable)
Assigns the dockable/code> to the group with the given |
void |
setIcon(K key,
ActionContentModifier modifier,
Icon icon)
Sets the icon of the group named key . |
void |
setIcon(K key,
Icon icon)
Sets the icon of the group named key . |
void |
setRemoveEmptyGroups(boolean removeEmptyGroups)
Sets whether empty groups should be removed automatically. A group is a set of Dockables . |
void |
setText(K key,
String text)
Sets the text for group key . |
void |
setTooltip(K key,
String text)
Sets the tooltip of the group key . |
boolean |
trigger(Dockable dockable)
Does the appropriate action that can be done respecting the current state of this action. |
void |
unbound(Dockable dockable)
Called by this AbstractStandardDockAction when the Dockable
dockable will not be used in any means by this
action. |
Methods inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction |
---|
addDockActionListener, bind, fireActionEnabledChanged, fireActionIconChanged, fireActionRepresentativeChanged, fireActionTextChanged, fireActionTooltipTextChanged, getBoundDockables, isBound, removeDockActionListener, unbind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bibliothek.gui.dock.action.DockAction |
---|
createView |
Constructor Detail |
---|
public GroupedDockAction(GroupKeyGenerator<? extends K> generator)
generator
- the generator that will be used to get a key for
Dockables which do not yet have a key. The generator can be null
and set later through the method setGenerator(GroupKeyGenerator)
Method Detail |
---|
public void setGenerator(GroupKeyGenerator<? extends K> generator)
generator
- the generatorcreateGroupKey(Dockable)
public GroupKeyGenerator<? extends K> getGenerator()
createGroupKey(Dockable)
public boolean isRemoveEmptyGroups()
true
, groups with no Dockable
associated
to, will be deleted automatically.
true
if empty groups are deletedpublic void setRemoveEmptyGroups(boolean removeEmptyGroups)
Dockables
. A group can become
empty if all it's Dockables
are transfered
to another group, or removed through an unbound
.
removeEmptyGroups
- true
if empty groups should
be deleted, false
if the should remain in memory and
be used again.public Icon getIcon(Dockable dockable, ActionContentModifier modifier)
StandardDockAction
dockable
. This method must ignore the
backup property
of modifier
.
dockable
- The Dockable
for which the action-icon
should be chosen.modifier
- how the icon will be used
dockable
, or null
.public ActionContentModifier[] getIconContexts(Dockable dockable)
StandardDockAction
ActionContentModifier
s for which StandardDockAction.getIcon(Dockable, ActionContentModifier)
would
return a value other than null
.
dockable
- the Dockable
for which the action-icons may be chosen.
public String getText(Dockable dockable)
StandardDockAction
dockable
.
dockable
- The Dockable
for which the action-text
should be chosen.
dockable
, or null
.public String getTooltipText(Dockable dockable)
StandardDockAction
dockable
.
dockable
- The Dockable
for which the action-tooltip
should be chosen.
dockable
, or null
.public boolean isEnabled(Dockable dockable)
AbstractStandardDockAction
DisablingStrategy
.
isEnabled
in interface StandardDockAction
isEnabled
in class AbstractStandardDockAction
dockable
- The Dockable
for which this action maybe
triggered.
true
if the user should be able to trigger
this action, false
otherwisepublic void bound(Dockable dockable)
AbstractStandardDockAction
AbstractStandardDockAction
when a Dockable
was bound to this action the first time.
bound
in class AbstractStandardDockAction
dockable
- The Dockable that was not known to this action
before the method was invokedpublic void unbound(Dockable dockable)
AbstractStandardDockAction
AbstractStandardDockAction
when the Dockable
dockable
will not be used in any means by this
action. Note that the AbstractStandardDockAction.bound(Dockable)
-method can be
invoked again with the dockable
.
unbound
in class AbstractStandardDockAction
dockable
- The Dockable which will not by used in any way.public void setIcon(K key, Icon icon)
icon
of the group named key
.
If this group does not exist, it will be created.
key
- the name of the groupicon
- the new icon of the group, may be null
public Icon getIcon(Object key)
key
.
key
- The name of the group
null
IllegalArgumentException
- If the group does not existsetIcon(Object, Icon)
public void setIcon(K key, ActionContentModifier modifier, Icon icon)
icon
of the group named key
.
If this group does not exist, it will be created.
key
- the name of the groupmodifier
- tells in which context the icon is usedicon
- the new icon of the group, may be null
public Icon getIcon(Object key, ActionContentModifier modifier)
key
.
key
- The name of the groupmodifier
- tells in which context the icon is used
null
IllegalArgumentException
- If the group does not existsetIcon(Object, Icon)
public void setDisabledIcon(K key, Icon icon)
icon
which will be shown, when the group
named key
is disabled. If the group key
does not exist, it will be created.
key
- The name of the groupicon
- The new icon for the disabled-state of the group,
may be null
public Icon getDisabledIcon(Dockable dockable)
public Icon getDisabledIcon(Object key)
key
is disabled.
key
- The name of the group
null
IllegalArgumentException
- If the group does not existsetDisabledIcon(Object, Icon)
public void setText(K key, String text)
text
for group key
. If the
group does not exist, it will be created.
key
- The name of the grouptext
- The text of the grouppublic String getText(Object key)
key
.
key
- the key of the group
IllegalArgumentException
- if the group does not existsetText(Object, String)
public void setTooltip(K key, String text)
key
. If the
group does not exist, it will be created. The tooltip is the first
part of the tooltip text. The whole tooltip text may contain additional
information like the accelerator
.
key
- The name of the grouptext
- The tooltip of the grouppublic String getTooltipText(Object key)
key
. The tooltip text is
the text which is really shown on the tooltip.
key
- The name of the group
IllegalArgumentException
- If the group does not existsetTooltip(Object, String)
,
getTooltip(Object)
public String getTooltip(Object key)
key
. The tooltip if the
first part of the tooltip text.
key
- The name of the group
IllegalArgumentException
- If the group does not existsetTooltip(Object, String)
public void setEnabled(K key, boolean enabled)
key
. This action
can only be triggered, if the associated Dockable
is
in a group with true
enable-state. If the group
does not exist, it will be created.
key
- The name of the groupenabled
- The state of the grouppublic boolean isEnabled(Object key)
key
.
key
- The name of the group
IllegalArgumentException
- If the group does not existsetEnabled(Object, boolean)
public Dockable getDockableRepresentation(Dockable dockable)
StandardDockAction
DockAction
represents a Dockable
. If so, the framework
may register views for this action as DockElementRepresentative
.
dockable
- The Dockable
for which this action may be triggered
Dockable
which is represented by this action, can be null
.
Normally dockable
should not be the result.public Dockable getDockableRepresentation(K key)
Dockable
which is represented by this DockAction
.
key
- the name of the group
null
IllegalArgumentException
- if the group does not existpublic void setDockableRepresentation(K key, Dockable dockable)
Dockable
that is represented by this group.
key
- the name of the groupdockable
- the new represented Dockable
, can be null
public void setAccelerator(K key, KeyStroke accelerator)
KeyEvent
that will trigger
an action.
key
- the group of actions whose trigger might be affectedaccelerator
- the new key-trigger or null
public KeyStroke getAccelerator(K key)
KeyEvent
that will
trigger an action.
key
- the affected group
null
IllegalArgumentException
- if key
is unknownprotected D ensureGroup(K key)
key
.
key
- The name of the group
key
. This may be
a newly created group, or a group that already existed.protected D getGroup(Dockable dockable)
dockable
is.
dockable
- the Dockable whose group is searched
null
protected D getGroup(Object key)
key
- the key of the group
null
protected abstract D createGroup(K key)
key
- the key of the new group
public boolean groupExists(Object key)
true
if a group with the name of key
exists, return false
otherwise.
key
- The group that is searched
true
if key
was found, false
otherwisepublic boolean removeGroup(Object key)
Dockables
are registered in that group).
key
- The name of the group
true
if there is no longer a group with name
key
(also true
if there never existed
a group with that name), or false
if the group
was not deleted because it was not empty.protected K createGroupKey(Dockable dockable)
dockable
should be added.Dockable
is member of one group. The membership
determines text, icon, etc. for the dockable. Whenever a
dockable is bound
to this action,
the group will be determined by this method. Later on, the group
can be changed by the method setGroup
.generator
of
this action.
dockable
- The Dockable
whose group has to be
found
null
is not a valid result.public void setGroup(K key, Dockable dockable)
dockable/code> to the group with the given key
.
- Parameters:
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.
- Throws:
IllegalArgumentException
- if the Dockable
is not
in a group, or if key
is null
- See Also:
createGroupKey(Dockable)
public boolean isKnown(Dockable dockable)
dockable
is bound
to this action, or not. If the dockable
was unbound
,
then this method will return false
.
dockable
- the Dockable
to search
true
if the Dockable
is boundpublic boolean trigger(Dockable dockable)
DockAction
dockable
- the element for which this action is called
true
if this action could do anything, false
if this action was not able to react in any way to the event.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |