public abstract class ALcyActionBar extends Object implements ILcyActionBar
ILcyActionBar
. Subclasses only have
to take care of:
getChildren(Container)
and getParent(Component)
To make debugging easier, you can turn on trace logging for the TLcyActionBarUtil
and ALcyActionBar
classes:
This will show blue borders around each of the action bars, adjust the tooltips of the action bars and their items
Trace logging for those classes can be enabled by adding the following lines to your logging properties file:
com.luciad.lucy.gui.TLcyActionBarUtil.level = FINEST
com.luciad.lucy.gui.ALcyActionBar.level = FINEST
Constructor and Description |
---|
ALcyActionBar()
Creates a new
ALcyActionBarSW . |
ALcyActionBar(ALcyHelpManager aHelpManager)
Creates a new
ALcyActionBarSW with the given help manager. |
Modifier and Type | Method and Description |
---|---|
void |
addActionBarListener(ILcyActionBarListener aActionBarListener)
Adds an
ILcyActionBarListener . |
protected abstract Component |
createItem(ILcdAction aAction,
TLcyGroupDescriptor aGroupDescriptor,
String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors)
Creates a gui widget to represent the given action.
|
protected abstract Component |
createItem(ILcyActiveSettable aActiveSettable,
TLcyGroupDescriptor aGroupDescriptor,
String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors,
boolean aDeactivatePossible)
Creates a gui widget to represent the given active settable.
|
protected abstract Container |
createItemContainer(String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors)
Creates a new container for the given (sub)menus.
|
Object |
getActionBarItem(int aIndex)
Returns the action or active settable at the given index.
|
Comparator |
getActionBarItemComparator()
Deprecated.
Use
getProperties() instead.
As documented in the setActionBarItemComparator(Comparator) method, the
comparator is derived from the properties.
Extensions of this class which want to obtain the comparator should derive
it from the properties. |
int |
getActionBarItemCount()
Returns the number of
ILcdAction s and
ILcyActiveSettable s in the ILcyActionBar . |
protected Component[] |
getChildren(Container aParent)
Returns all children of a given parent, including separators etc.
|
Comparator |
getGroupDescriptorComparator()
Deprecated.
Use
getProperties() instead.
As documented in the setGroupDescriptorComparator(Comparator) method, the
comparator is derived from the properties.
Extensions of this class which want to obtain the comparator should derive
it from the properties. |
ALcyHelpManager |
getHelpManager()
Returns the help manager.
|
protected abstract Container |
getItemContainer(String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors)
Retrieves the (sub)menu container that contains the actions or active
settables at the given (sub)menus.
|
protected Container |
getParent(Component aComponent)
Returns the parent of a given component.
|
protected ALcyProperties |
getProperties()
Returns the
ALcyProperties instance containing the settings for this action bar. |
void |
insertAction(ILcdAction aAction,
TLcyGroupDescriptor aGroupDescriptor)
Same result as insertAction( aAction, aGroupDescriptor, null, null )
|
void |
insertAction(ILcdAction aAction,
TLcyGroupDescriptor aGroupDescriptor,
String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors)
Adds the given action in the
ILcyActionBar . |
void |
insertActiveSettable(ILcyActiveSettable aAction,
TLcyGroupDescriptor aGroupDescriptor)
Same result as insertActiveSettable( aActiveSettable, aGroupDescriptor, null, null )
|
void |
insertActiveSettable(ILcyActiveSettable aAction,
TLcyGroupDescriptor aGroupDescriptor,
String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors)
Same result as insertActiveSettable( aActiveSettable, aGroupDescriptor, aMenus, aMenuGroupDescriptors, true )
|
void |
insertActiveSettable(ILcyActiveSettable aAction,
TLcyGroupDescriptor aGroupDescriptor,
String[] aMenus,
TLcyGroupDescriptor[] aMenuGroupDescriptors,
boolean aDeactivatePossible)
Adds the given active settable in the
ILcyActionBar . |
protected void |
insertChildInParent(Component aChild,
TLcyGroupDescriptor aGroupDescriptor,
int aIndex,
Container aParentSFCT)
Adds the given child to the given parent, but it respects the
TLcyGroupDescriptor and the index. |
void |
insertComponent(Component aComponent,
TLcyGroupDescriptor aGroupDescriptor)
Adds a Component to this
ILcyActionBar |
protected abstract void |
insertSeparator(int aIndex,
Container aContainerSFCT)
Inserts a separator at the given index into the given component.
|
boolean |
isAutoHide()
Returns the autoHide property of the action bar.
|
void |
removeAction(ILcdAction aAction)
Removes the given action from the ILcyActionBar.
|
void |
removeActionBarListener(ILcyActionBarListener aActionBarListener)
Removes the given
ILcyActionBarListener . |
void |
removeActiveSettable(ILcyActiveSettable aActiveSettable)
Removes the given ILcyActiveSettable from the ILcyActionBar.
|
protected void |
removeChildFromParent(Component aChild,
Container aParentSFCT)
Removes the given child from the given parent.
|
void |
removeComponent(Component aComponent)
Remove the given Component from this
ILcyActionBar |
protected abstract void |
removeSeparator(int aIndex,
Container aContainerSFCT)
Removes the separator at the given index from the given component.
|
boolean |
retrieveDeactivatePossible(ILcyActiveSettable aActiveSettable)
Returns true if the given
ILcyActiveSettable can be deactivated. |
TLcyGroupDescriptor |
retrieveGroupDescriptor(ILcdAction aAction)
Returns the group descriptor that was used to add the given action to this
ILcyActionBar . |
TLcyGroupDescriptor |
retrieveGroupDescriptor(ILcyActiveSettable aActiveSettable)
Returns the group descriptor that was used to add the given active
settable to this
ILcyActionBar . |
String |
retrieveHelpIDString(ILcdAction aAction)
Returns the set help id string for the given action.
|
String |
retrieveHelpIDString(ILcyActiveSettable aActiveSettable)
Returns the set help id string for the given active settable.
|
TLcyGroupDescriptor[] |
retrieveMenuGroupDescriptors(ILcdAction aAction)
Returns the menus group descriptors that were used to add the given active
settable to this
ILcyActionBar . |
TLcyGroupDescriptor[] |
retrieveMenuGroupDescriptors(ILcyActiveSettable aActiveSettable)
Returns the menus group descriptors that were used to add the given active
settable to this
ILcyActionBar . |
String[] |
retrieveMenus(ILcdAction aAction)
Returns the menus that were used to add the given active
settable to this
ILcyActionBar . |
String[] |
retrieveMenus(ILcyActiveSettable aActiveSettable)
Returns the menus that were used to add the given active
settable to this
ILcyActionBar . |
void |
setActionBarItemComparator(Comparator aActionBarItemComparator)
Deprecated.
Use
setProperties(ALcyProperties) instead, which will
derive the action bar item comparator from the properties |
void |
setAutoHide(boolean aAutoHide)
Set the autoHide property of the action bar.
|
void |
setGroupDescriptorComparator(Comparator aGroupDescriptorComparator)
Deprecated.
Use
setProperties(ALcyProperties) instead, which
will derive the group descriptor comparator from the properties |
void |
setHelpIDString(ILcdAction aAction,
String aHelpIDString)
Associates the given help id string to the gui representation corresponding to the
given action.
|
void |
setHelpIDString(ILcyActiveSettable aActiveSettable,
String aHelpIDString)
Associates the given help id string to the gui representation corresponding to the
given ILcyActiveSettable.
|
void |
setHelpManager(ALcyHelpManager aHelpManager)
Sets the help manager.
|
void |
setProperties(ALcyProperties aProperties)
Sets the
ALcyProperties instance containing the settings for this action bar. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getComponent
public ALcyActionBar()
ALcyActionBarSW
.public ALcyActionBar(ALcyHelpManager aHelpManager)
ALcyActionBarSW
with the given help manager.aHelpManager
- The help manager.setHelpManager(com.luciad.lucy.ALcyHelpManager)
public ALcyHelpManager getHelpManager()
setHelpManager(com.luciad.lucy.ALcyHelpManager)
public void setHelpManager(ALcyHelpManager aHelpManager)
aHelpManager
- The help manager.public void addActionBarListener(ILcyActionBarListener aActionBarListener)
ILcyActionBar
ILcyActionBarListener
. This listener is informed when
this ILcyActionBar
is modified.addActionBarListener
in interface ILcyActionBar
aActionBarListener
- The listener to add.ILcyActionBar.removeActionBarListener(com.luciad.lucy.gui.ILcyActionBarListener)
public void removeActionBarListener(ILcyActionBarListener aActionBarListener)
ILcyActionBar
ILcyActionBarListener
. If the listener was never added
or was already removed, nothing will happen.removeActionBarListener
in interface ILcyActionBar
aActionBarListener
- The listener to remove.ILcyActionBar.addActionBarListener(com.luciad.lucy.gui.ILcyActionBarListener)
public final void setProperties(ALcyProperties aProperties)
Sets the ALcyProperties
instance containing the settings for this action bar.
Typically those properties are obtained from parsing the configuration file of an add-on. If for example the configuration contains the following key-value pairs:
TLcyDrawingAddOn.drawingToolBar.groupPriorities=LayerGroup, PersistenceGroup
TLcyDrawingAddOn.drawingToolBar.menu.Edit.showActionName = false
TLcyDrawingAddOn.drawingToolBar.menu.Edit.smallIcon = edit
you would call this method as follows:
ALcyProperties addOnProperties = drawingAddOn.getPreferences();
//the addOnProperties contain keys which have the wrong prefix for this method
//we need to strip the "TLcyDrawingAddOn.drawingToolBar." part
//for this, we use the subset method
ALcyProperties propertiesWithoutPrefix = addOnProperties.subset( "TLcyDrawingAddOn.drawingToolBar." );
//set the properties on the tool bar
drawingToolBar.setProperties( propertiesWithoutPrefix );
The following list describes which key-value pairs are currently supported, and what this method will do when the key is available. Note that support for new key-value pairs can be added in future releases.
groupPriorities
: this key has a String[]
as value.
It defines the ordering of the different group descriptors, and the order of the different items in
the same group. For example:
groupPriorities=ControlsGroup, ProjectionsGroup, ScaleGroup
See the Lucy developer guide for more information on the allowed values.action bar item comparator
and group descriptor comparator
.
menu.xxx.smallIcon
: this key has a String
as value,
and defines the icon for an item container
.
All strings which are accepted by TLcdIconFactory.create(String)
are considered valid.xxx
part in the key must be replaced by a dot-separated list of the (sub)menus identifying the
item container.Map | Data
, you would use the following key-value pair:
menu.Map.Data.smallIcon = path/to/the/icon.png
These keys are not used directly.
It is up to the implementation of createItemContainer(String[], TLcyGroupDescriptor[])
to use those icons
(all the default ALyActionBar
implementations do this).
menu.xxx.showActionName
: this key has a Boolean
as value,
and defines whether the textual name for an item container
should be shown.xxx
part in the key must be replaced by a dot-separated list of the (sub)menus identifying the
item container.Map | Data
, you would use the following key-value pair:
menu.Map.Data.showActionName = false
These keys are not used directly.
It is up to the implementation of createItemContainer(String[], TLcyGroupDescriptor[])
to respect these values
(all the default ALyActionBar
implementations do this).
menu.xxx.shortDescription
: this key has a String
as value,
and defines the short description for an item container
, which is
typically used as its tool tip.xxx
part in the key must be replaced by a dot-separated list of the (sub)menus identifying the
item container.
menu.More.shortDescription = Provides additional, less frequently used operations such union and difference.
These keys are not used directly.
It is up to the implementation of createItemContainer(String[], TLcyGroupDescriptor[])
to respect these values
(all the default ALyActionBar
implementations do this). Please refer to
TLcyLang
for information about translating these descriptions.
All other key-value pairs present in the aProperties
instance will be ignored.
aProperties
- The propertiesprotected final ALcyProperties getProperties()
Returns the ALcyProperties
instance containing the settings for this action bar.
ALcyProperties
instance containing the settings for this action bar,
possibly null
setProperties(ALcyProperties)
public void insertAction(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor)
ILcyActionBar
insertAction
in interface ILcyActionBar
ILcyActionBar.insertAction(com.luciad.gui.ILcdAction, com.luciad.lucy.gui.TLcyGroupDescriptor)
public void insertAction(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors)
ILcyActionBar
ILcyActionBar
. The action (or
actually its visual representation, e.g. a button) will be grouped
together with other actions with the same TLcyGroupDescriptor
.
The action will be inserted considering the given menus (and submenus). If
these menus don't exist yet, they will be created. When they are created, they
are grouped together with other actions or menus with the same group descriptor as
the given group descriptors.insertAction
in interface ILcyActionBar
aAction
- The action to add. Must not be null.aGroupDescriptor
- The TLcyGroupDescriptor
of the action
to add. Actions are grouped together based on their
TLcyGroupDescriptor
. Use null for default behaviour. Typical
implementations of ILcyActionBar
will visually separate the
groups. E.g. a menu bar will add horizontal lines inbetween the groups, a
toolbar will add vertical lines, or leave some open space.aMenus
- The menus to put the action in. If the menus do not exist,
they will be created. Use null when you don't want submenus.aMenuGroupDescriptors
- A group descriptor for every menu. When menus
or submenus are created, they are grouped together with existing actions
and submenus based on their TLcyGroupDescriptor
s. You can use
null for default behaviour, but if you want the items to be correctly
grouped and ordened, you might have to set this parameter to a correct
value. Please refer to 'lucy.cfg' for some examples. Typical
implementations of ILcyActionBar
will visually separate the
groups. E.g. a menu bar will add horizontal lines inbetween the groups, a
toolbar will add vertical lines, or leave some open space.public void removeAction(ILcdAction aAction)
ILcyActionBar
TLcyGroupDescriptor
the action belongs. Has no effect if the given action was never added to this ILcyActionBar.removeAction
in interface ILcyActionBar
aAction
- The action to remove.public void insertActiveSettable(ILcyActiveSettable aAction, TLcyGroupDescriptor aGroupDescriptor)
ILcyActionBar
insertActiveSettable
in interface ILcyActionBar
ILcyActionBar.insertActiveSettable(com.luciad.lucy.gui.ILcyActiveSettable, com.luciad.lucy.gui.TLcyGroupDescriptor)
public void insertActiveSettable(ILcyActiveSettable aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors)
ILcyActionBar
insertActiveSettable
in interface ILcyActionBar
ILcyActionBar.insertActiveSettable(com.luciad.lucy.gui.ILcyActiveSettable, com.luciad.lucy.gui.TLcyGroupDescriptor)
public void insertActiveSettable(ILcyActiveSettable aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors, boolean aDeactivatePossible)
ILcyActionBar
ILcyActionBar
. The
active settable (or actually its visual representation, e.g. a button)
will be grouped together with other actions or active settables with the
same TLcyGroupDescriptor
. The active settable will be
inserted considering the given menus (and submenus). If these menus don't
exist yet, they will be created. When they are created, they are grouped
together with other actions or menus with the same group descriptor as the
given group descriptors.insertActiveSettable
in interface ILcyActionBar
aAction
- The active settable to add. Must not be null.aGroupDescriptor
- The TLcyGroupDescriptor
of the active
settable to add. Active settables are grouped together based on their
TLcyGroupDescriptor
. Use null for default behaviour. Typical
implementations of ILcyActionBar
will visually separate the
groups. E.g. a menu bar will add horizontal lines inbetween the groups, a
toolbar will add vertical lines, or leave some open space.aMenus
- The menus to put the action in. If the menus do not exist,
they will be created. Use null when you don't want submenus.aMenuGroupDescriptors
- A group descriptor for every menu. When menus
or submenus are created, they are grouped together with existing actions
and submenus based on their TLcyGroupDescriptor
s. You can use
null for default behaviour, but if you want the items to be correctly
grouped and ordened, you might have to set this parameter to a correct
value. Please refer to 'lucy.cfg' for some examples. Typical
implementations of ILcyActionBar
will visually separate the
groups. E.g. a menu bar will add horizontal lines inbetween the groups, a
toolbar will add vertical lines, or leave some open space.aDeactivatePossible
- True if the active settable can be set unactive
through the action bar, false otherwise. A typical implementation of
ILcyActionBar
might represent an active settable that can be
deactivated as a checkbox, and an active settable that cannot be
deactivated as a radio button.public void removeActiveSettable(ILcyActiveSettable aActiveSettable)
ILcyActionBar
TLcyGroupDescriptor
the ILcyActiveSettable belongs. Has no effect if
the given ILcyActiveSettable was never added to this ILcyActionBar.removeActiveSettable
in interface ILcyActionBar
aActiveSettable
- The ILcyActiveSettable to remove.public void setHelpIDString(ILcyActiveSettable aActiveSettable, String aHelpIDString)
ILcyActionBar
setHelpIDString
in interface ILcyActionBar
aActiveSettable
- The ILcyActiveSettable whose gui representation will be associated
with the help id stringaHelpIDString
- The help id string that allows for context sensitive helpILcyActionBar.retrieveHelpIDString(com.luciad.gui.ILcdAction)
,
ALcyHelpManager
public void setHelpIDString(ILcdAction aAction, String aHelpIDString)
ILcyActionBar
setHelpIDString
in interface ILcyActionBar
aAction
- The action whose gui representation will be associated
with the help id stringaHelpIDString
- The help id string that allows for context sensitive helpILcyActionBar.retrieveHelpIDString(com.luciad.gui.ILcdAction)
,
ALcyHelpManager
public void insertComponent(Component aComponent, TLcyGroupDescriptor aGroupDescriptor)
ILcyActionBar
aComponent
- The component to add. It will be added at the top level.aGroupDescriptor
- The group descriptor of the component to add.removeComponent(Component)
,
TLcyAlwaysFitJToolBar.createToolBarPanel(Component)
public void removeComponent(Component aComponent)
ILcyActionBar
aComponent
- The component to remove.insertComponent(Component, TLcyGroupDescriptor)
public int getActionBarItemCount()
ILcyActionBar
ILcdAction
s and
ILcyActiveSettable
s in the ILcyActionBar
.getActionBarItemCount
in interface ILcyActionBar
ILcdAction
s and
ILcyActiveSettable
s in the ILcyActionBar
.ILcyActionBar.getActionBarItem(int)
public Object getActionBarItem(int aIndex)
ILcyActionBar
getActionBarItem
in interface ILcyActionBar
aIndex
- The index of the action or active settable to return.
0 <= aIndex < getActionBarItemCount()ILcdAction
or ILcyActiveSettable
at the given index.ILcyActionBar.getActionBarItemCount()
public String retrieveHelpIDString(ILcdAction aAction)
ILcyActionBar
retrieveHelpIDString
in interface ILcyActionBar
aAction
- The action to retrieve the help id for.ILcyActionBar.setHelpIDString(com.luciad.gui.ILcdAction, java.lang.String)
public String retrieveHelpIDString(ILcyActiveSettable aActiveSettable)
ILcyActionBar
retrieveHelpIDString
in interface ILcyActionBar
aActiveSettable
- The active settable to retrieve the help id for.public TLcyGroupDescriptor retrieveGroupDescriptor(ILcdAction aAction)
ILcyActionBar
ILcyActionBar
.retrieveGroupDescriptor
in interface ILcyActionBar
aAction
- The action to retrieve the group descriptor for.ILcyActionBar
.ILcyActionBar.insertAction(com.luciad.gui.ILcdAction, com.luciad.lucy.gui.TLcyGroupDescriptor)
public TLcyGroupDescriptor retrieveGroupDescriptor(ILcyActiveSettable aActiveSettable)
ILcyActionBar
ILcyActionBar
.retrieveGroupDescriptor
in interface ILcyActionBar
aActiveSettable
- The active settable to retrieve the group descriptor for.ILcyActionBar
.ILcyActionBar.insertActiveSettable(com.luciad.lucy.gui.ILcyActiveSettable, com.luciad.lucy.gui.TLcyGroupDescriptor)
public String[] retrieveMenus(ILcdAction aAction)
ILcyActionBar
ILcyActionBar
.retrieveMenus
in interface ILcyActionBar
aAction
- The action to retrieve the menus for.ILcyActionBar
.ILcyActionBar.insertAction(com.luciad.gui.ILcdAction, com.luciad.lucy.gui.TLcyGroupDescriptor)
public String[] retrieveMenus(ILcyActiveSettable aActiveSettable)
ILcyActionBar
ILcyActionBar
.retrieveMenus
in interface ILcyActionBar
aActiveSettable
- The active settable to retrieve the menus for.ILcyActionBar
.ILcyActionBar.insertActiveSettable(com.luciad.lucy.gui.ILcyActiveSettable, com.luciad.lucy.gui.TLcyGroupDescriptor)
public TLcyGroupDescriptor[] retrieveMenuGroupDescriptors(ILcdAction aAction)
ILcyActionBar
ILcyActionBar
.retrieveMenuGroupDescriptors
in interface ILcyActionBar
aAction
- The action to retrieve the menu group descriptors for.ILcyActionBar
.ILcyActionBar.insertAction(com.luciad.gui.ILcdAction, com.luciad.lucy.gui.TLcyGroupDescriptor)
public TLcyGroupDescriptor[] retrieveMenuGroupDescriptors(ILcyActiveSettable aActiveSettable)
ILcyActionBar
ILcyActionBar
.retrieveMenuGroupDescriptors
in interface ILcyActionBar
aActiveSettable
- The active settable to retrieve the menu group descriptors for.ILcyActionBar
.ILcyActionBar.insertActiveSettable(com.luciad.lucy.gui.ILcyActiveSettable, com.luciad.lucy.gui.TLcyGroupDescriptor)
public boolean retrieveDeactivatePossible(ILcyActiveSettable aActiveSettable)
ILcyActionBar
ILcyActiveSettable
can be deactivated.retrieveDeactivatePossible
in interface ILcyActionBar
aActiveSettable
- True if theILcyActiveSettable
can be deactivated.protected Component[] getChildren(Container aParent)
This implementation returns
aParent.getComponents()
, but subclasses using for instance
JMenu
s should be aware that they should return ( ( JMenu
) aParent ).getMenuComponents()
when the given parent is a
JMenu
.
aParent
- The parent to retrieve the children from.protected Container getParent(Component aComponent)
This implementation returns
aComponent.getParent()
, but subclasses using for instance
JPopupMenu
s (these are used for example by
JMenu
s) must return ( ( JPopupMenu ) aComponent
).getInvoker()
when the given component is a
JPopupMenu
.
aComponent
- The component to retrieve the parent for.@Deprecated public Comparator getGroupDescriptorComparator()
getProperties()
instead.
As documented in the setGroupDescriptorComparator(Comparator)
method, the
comparator is derived from the properties.
Extensions of this class which want to obtain the comparator should derive
it from the properties.setProperties(ALcyProperties)
@Deprecated public void setGroupDescriptorComparator(Comparator aGroupDescriptorComparator)
setProperties(ALcyProperties)
instead, which
will derive the group descriptor comparator from the propertiesThe action bar loops over all existing groups and asks the comparator if the new group belongs before or after the current group. The default comparator is null. This means new groups are always added at the end.
aGroupDescriptorComparator
- The new group comparator. It will be passed
two instances of TLcyGroupDescriptor to compare.setProperties(ALcyProperties)
,
getGroupDescriptorComparator()
@Deprecated public Comparator getActionBarItemComparator()
getProperties()
instead.
As documented in the setActionBarItemComparator(Comparator)
method, the
comparator is derived from the properties.
Extensions of this class which want to obtain the comparator should derive
it from the properties.Comparator
for action bar items.Comparator
for action bar items.setProperties(ALcyProperties)
@Deprecated public void setActionBarItemComparator(Comparator aActionBarItemComparator)
setProperties(ALcyProperties)
instead, which will
derive the action bar item comparator from the propertiesComparator
to order the items within a single
TLcyGroupDescriptor
. Those items can be actions or active settables, but
also components inserted using insertComponent
or sub-menus. This comparator
must be set before adding items.aActionBarItemComparator
- The new TLcyActionBarItemComparator
to use.setProperties(ALcyProperties)
,
setGroupDescriptorComparator(Comparator)
protected void insertChildInParent(Component aChild, TLcyGroupDescriptor aGroupDescriptor, int aIndex, Container aParentSFCT)
TLcyGroupDescriptor
and the index. All items having the same
TLcyGroupDescriptor
are grouped together. The given index is
relative in the group that belongs to the TLcyGroupDescriptor
.
Also takes care of adding the separators.aChild
- The child to add.aGroupDescriptor
- The group descriptor of the child to add.aIndex
- The index in the group that belongs to the given TLcyGroupDescriptor
. -1 Means insert at the end.aParentSFCT
- The parent to add the child to, this parent is changed as a side effect.protected void removeChildFromParent(Component aChild, Container aParentSFCT)
aChild
- The child to remove.aParentSFCT
- The parent to remove the child from, this parent is
changed as a side effect.protected abstract void insertSeparator(int aIndex, Container aContainerSFCT)
Implementation can be left empty, but if and only if implementation of
removeSeparator(int, java.awt.Container)
is left empty as well.
aIndex
- The index of where to insert the separator. -1 means insert it at the end.aContainerSFCT
- The container to insert the separator into.protected abstract void removeSeparator(int aIndex, Container aContainerSFCT)
Implementation can be left empty, but if and only if implementation of
insertSeparator(int, java.awt.Container)
is left empty as well.
aIndex
- The index where to remove the separator from the given component.aContainerSFCT
- The container to remove the separator from.protected abstract Component createItem(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors)
JMenuItem
to represent the given action. A toolbar
could create a JButton
to represent the given action.aAction
- The action to create a gui widget for.aGroupDescriptor
- The group descriptor, for information only.aMenus
- The menus, for information only.aMenuGroupDescriptors
- The menu group descriptors, for information only.protected abstract Component createItem(ILcyActiveSettable aActiveSettable, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors, boolean aDeactivatePossible)
JCheckBoxMenuItem
to represent the given
action or a JRadioButtonMenuItem
when
aDeactivatePossible
is false. A toolbar could create a
JToggleButton
to represent the given active settable.aActiveSettable
- The active settable to create a gui widget for.aGroupDescriptor
- The group descriptor, for information only.aMenus
- The menus, for information only.aMenuGroupDescriptors
- The menu group descriptors, for information only.aDeactivatePossible
- True means the active settable can be
deactivated using the created gui widget (e.g. a checkbox), false means it
cannot be deactivated by the created gui widget, probably only by another
widget (e.g. radio button).protected abstract Container getItemContainer(String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors)
aMenus
- The (sub)menus to retrieve the container for. If null or an
empty array, the top level container should be returned.aMenuGroupDescriptors
- The menu group descriptors, just for
information. Could be null, or the length of the array can possibly
mismatch the length of the menus.protected abstract Container createItemContainer(String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors)
An example implemention could look like this:
return new JMenu( aMenus[ aMenus.length - 1 ] )
aMenus
- The (sub)menus to create the menu item container for. Is
never null and length of array is at least 1.aMenuGroupDescriptors
- The menu group descriptors for the menus.
Could be null, or the length of the array can possibly mismatch the
length of the menus.public boolean isAutoHide()
Returns the autoHide property of the action bar.
When the autoHide property is true
, the component of the action bar will become
invisible when it is empty.
setAutoHide(boolean)
public void setAutoHide(boolean aAutoHide)
Set the autoHide property of the action bar.
When set to true
, the component of the action bar will become invisible when the action bar
is empty.
The default implementation of this method considers an action bar empty when the component
representing the action bar is a Container
without any visible child components.
aAutoHide
- true
when the an empty action bar must be invisible, false
otherwise.isAutoHide()