Class ALcyActionBar
- All Implemented Interfaces:
ILcyActionBar
- Direct Known Subclasses:
TLcyComboBoxActionBar
,TLcyMenuBar
,TLcyPopupMenu
,TLcyToolBar
ILcyActionBar
. Subclasses only have
to take care of:
- Creating the main container (e.g. a JMenuBar)
- Creating the containers for the (sub)menus (e.g. JMenu).
- Creating the actual gui widgets representing actions or active settables (e.g. JMenuItem or JRadioButtonMenuItem or JCheckBoxMenuItem)
- Inserting / removing separators (e.g. horizontal lines, for example JSeparator)
- Providing a suitable implementation for
getChildren(Container)
andgetParent(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
- Show blue borders around the action bars
- Add a tooltip to the action bar showing debug information
- Replace the tooltip of the items in the action bar to display the group descriptors
- Right-clicking on an action bar item will show a pop-up menu containing info on how to insert an item in that specific action bar at that specfic location.
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 Summary
ConstructorDescriptionCreates a newALcyActionBarSW
.ALcyActionBar
(ALcyHelpManager aHelpManager) Creates a newALcyActionBarSW
with the given help manager. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionBarListener
(ILcyActionBarListener aActionBarListener) Adds anILcyActionBarListener
.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.getActionBarItem
(int aIndex) Returns the action or active settable at the given index.Deprecated.int
Returns the number ofILcdAction
s andILcyActiveSettable
s in theILcyActionBar
.protected Component[]
getChildren
(Container aParent) Returns all children of a given parent, including separators etc.Deprecated.UsegetProperties()
instead.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
Returns the parent of a given component.protected final ALcyProperties
Returns theALcyProperties
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 theILcyActionBar
.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 theILcyActionBar
.protected void
insertChildInParent
(Component aChild, TLcyGroupDescriptor aGroupDescriptor, int aIndex, Container aParentSFCT) Adds the given child to the given parent, but it respects theTLcyGroupDescriptor
and the index.void
insertComponent
(Component aComponent, TLcyGroupDescriptor aGroupDescriptor) Adds a Component to thisILcyActionBar
protected abstract void
insertSeparator
(int aIndex, Container aContainerSFCT) Inserts a separator at the given index into the given component.boolean
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 givenILcyActionBarListener
.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 thisILcyActionBar
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 givenILcyActiveSettable
can be deactivated.retrieveGroupDescriptor
(ILcdAction aAction) Returns the group descriptor that was used to add the given action to thisILcyActionBar
.retrieveGroupDescriptor
(ILcyActiveSettable aActiveSettable) Returns the group descriptor that was used to add the given active settable to thisILcyActionBar
.retrieveHelpIDString
(ILcdAction aAction) Returns the set help id string for the given action.retrieveHelpIDString
(ILcyActiveSettable aActiveSettable) Returns the set help id string for the given active settable.retrieveMenuGroupDescriptors
(ILcdAction aAction) Returns the menus group descriptors that were used to add the given active settable to thisILcyActionBar
.retrieveMenuGroupDescriptors
(ILcyActiveSettable aActiveSettable) Returns the menus group descriptors that were used to add the given active settable to thisILcyActionBar
.String[]
retrieveMenus
(ILcdAction aAction) Returns the menus that were used to add the given active settable to thisILcyActionBar
.String[]
retrieveMenus
(ILcyActiveSettable aActiveSettable) Returns the menus that were used to add the given active settable to thisILcyActionBar
.void
setActionBarItemComparator
(Comparator aActionBarItemComparator) Deprecated.UsesetProperties(ALcyProperties)
instead, which will derive the action bar item comparator from the propertiesvoid
setAutoHide
(boolean aAutoHide) Set the autoHide property of the action bar.void
setGroupDescriptorComparator
(Comparator aGroupDescriptorComparator) Deprecated.UsesetProperties(ALcyProperties)
instead, which will derive the group descriptor comparator from the propertiesvoid
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.final void
setProperties
(ALcyProperties aProperties) Sets theALcyProperties
instance containing the settings for this action bar.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.lucy.gui.ILcyActionBar
getComponent
-
Constructor Details
-
ALcyActionBar
public ALcyActionBar()Creates a newALcyActionBarSW
. -
ALcyActionBar
Creates a newALcyActionBarSW
with the given help manager.- Parameters:
aHelpManager
- The help manager.- See Also:
-
-
Method Details
-
getHelpManager
Returns the help manager.- Returns:
- the help manager.
- See Also:
-
setHelpManager
Sets the help manager. The help manager is used to associate the help id's of the actions and active settables with the components representing them (e.g. the button, menu item, ...) Therefore when the user needs context sensitive help about a button in this action bar (the button was added by added an action or an active settable), the help id associated with the action or active settable can be retrieved.- Parameters:
aHelpManager
- The help manager.
-
addActionBarListener
Description copied from interface:ILcyActionBar
Adds anILcyActionBarListener
. This listener is informed when thisILcyActionBar
is modified.- Specified by:
addActionBarListener
in interfaceILcyActionBar
- Parameters:
aActionBarListener
- The listener to add.- See Also:
-
removeActionBarListener
Description copied from interface:ILcyActionBar
Removes the givenILcyActionBarListener
. If the listener was never added or was already removed, nothing will happen.- Specified by:
removeActionBarListener
in interfaceILcyActionBar
- Parameters:
aActionBarListener
- The listener to remove.- See Also:
-
setProperties
Sets the
ALcyProperties
instance containing the settings for this action bar.Example usage
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 );
Supported key-value pairs
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 aString[]
as value. It defines the ordering of the different group descriptors, and the order of the different items in the same group. For example:
See the Lucy developer guide for more information on the allowed values.groupPriorities=ControlsGroup, ProjectionsGroup, ScaleGroup
When this property is specified, it will replace the currentaction bar item comparator
andgroup descriptor comparator
. -
menu.xxx.smallIcon
: this key has aString
as value, and defines the icon for anitem container
. All strings which are accepted byTLcdIconFactory.create(String)
are considered valid.
Thexxx
part in the key must be replaced by a dot-separated list of the (sub)menus identifying the item container.
For example, if you want to define an icon for the sub-menuMap | Data
, you would use the following key-value pair:
These keys are not used directly. It is up to the implementation ofmenu.Map.Data.smallIcon = path/to/the/icon.png
createItemContainer(String[], TLcyGroupDescriptor[])
to use those icons (all the defaultALyActionBar
implementations do this). -
menu.xxx.showActionName
: this key has aBoolean
as value, and defines whether the textual name for anitem container
should be shown.
Thexxx
part in the key must be replaced by a dot-separated list of the (sub)menus identifying the item container.
For example, if you do not want the text to show for the sub-menuMap | Data
, you would use the following key-value pair:
These keys are not used directly. It is up to the implementation ofmenu.Map.Data.showActionName = false
createItemContainer(String[], TLcyGroupDescriptor[])
to respect these values (all the defaultALyActionBar
implementations do this). -
menu.xxx.shortDescription
: this key has aString
as value, and defines the short description for anitem container
, which is typically used as its tool tip.
Thexxx
part in the key must be replaced by a dot-separated list of the (sub)menus identifying the item container.
For example, if you want to specify a tool tip for a 'More' sub-menu on a tool bar, you would use the following key-value pair:
These keys are not used directly. It is up to the implementation ofmenu.More.shortDescription = Provides additional, less frequently used operations such union and difference.
createItemContainer(String[], TLcyGroupDescriptor[])
to respect these values (all the defaultALyActionBar
implementations do this). Please refer toTLcyLang
for information about translating these descriptions.
All other key-value pairs present in the
aProperties
instance will be ignored.- Parameters:
aProperties
- The properties- Since:
- 2016.0
-
-
getProperties
Returns the
ALcyProperties
instance containing the settings for this action bar.- Returns:
- the
ALcyProperties
instance containing the settings for this action bar, possiblynull
- Since:
- 2016.0
- See Also:
-
insertAction
Description copied from interface:ILcyActionBar
Same result as insertAction( aAction, aGroupDescriptor, null, null )- Specified by:
insertAction
in interfaceILcyActionBar
- See Also:
-
insertAction
public void insertAction(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Description copied from interface:ILcyActionBar
Adds the given action in theILcyActionBar
. The action (or actually its visual representation, e.g. a button) will be grouped together with other actions with the sameTLcyGroupDescriptor
. 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.- Specified by:
insertAction
in interfaceILcyActionBar
- Parameters:
aAction
- The action to add. Must not be null.aGroupDescriptor
- TheTLcyGroupDescriptor
of the action to add. Actions are grouped together based on theirTLcyGroupDescriptor
. Use null for default behaviour. Typical implementations ofILcyActionBar
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 theirTLcyGroupDescriptor
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 ofILcyActionBar
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.
-
removeAction
Description copied from interface:ILcyActionBar
Removes the given action from the ILcyActionBar. No matter to whichTLcyGroupDescriptor
the action belongs. Has no effect if the given action was never added to this ILcyActionBar.- Specified by:
removeAction
in interfaceILcyActionBar
- Parameters:
aAction
- The action to remove.
-
insertActiveSettable
Description copied from interface:ILcyActionBar
Same result as insertActiveSettable( aActiveSettable, aGroupDescriptor, null, null )- Specified by:
insertActiveSettable
in interfaceILcyActionBar
- See Also:
-
insertActiveSettable
public void insertActiveSettable(ILcyActiveSettable aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Description copied from interface:ILcyActionBar
Same result as insertActiveSettable( aActiveSettable, aGroupDescriptor, aMenus, aMenuGroupDescriptors, true )- Specified by:
insertActiveSettable
in interfaceILcyActionBar
- See Also:
-
insertActiveSettable
public void insertActiveSettable(ILcyActiveSettable aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors, boolean aDeactivatePossible) Description copied from interface:ILcyActionBar
Adds the given active settable in theILcyActionBar
. The active settable (or actually its visual representation, e.g. a button) will be grouped together with other actions or active settables with the sameTLcyGroupDescriptor
. 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.- Specified by:
insertActiveSettable
in interfaceILcyActionBar
- Parameters:
aAction
- The active settable to add. Must not be null.aGroupDescriptor
- TheTLcyGroupDescriptor
of the active settable to add. Active settables are grouped together based on theirTLcyGroupDescriptor
. Use null for default behaviour. Typical implementations ofILcyActionBar
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 theirTLcyGroupDescriptor
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 ofILcyActionBar
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 ofILcyActionBar
might represent an active settable that can be deactivated as a checkbox, and an active settable that cannot be deactivated as a radio button.
-
removeActiveSettable
Description copied from interface:ILcyActionBar
Removes the given ILcyActiveSettable from the ILcyActionBar. No matter to whichTLcyGroupDescriptor
the ILcyActiveSettable belongs. Has no effect if the given ILcyActiveSettable was never added to this ILcyActionBar.- Specified by:
removeActiveSettable
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- The ILcyActiveSettable to remove.
-
setHelpIDString
Description copied from interface:ILcyActionBar
Associates the given help id string to the gui representation corresponding to the given ILcyActiveSettable. Note that this method should only be used for ILcyActiveSettables that have no help id associated to them. One can associate a help id to an ILcyActiveSettable by setting the value com.luciad.lucy.gui.help.ALcyHelpManager.HELP_ID_KEY.- Specified by:
setHelpIDString
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- The ILcyActiveSettable whose gui representation will be associated with the help id stringaHelpIDString
- The help id string that allows for context sensitive help- See Also:
-
setHelpIDString
Description copied from interface:ILcyActionBar
Associates the given help id string to the gui representation corresponding to the given action. Note that this method should only be used for actions that have no help id associated to them. One can associate a help id to an action by setting the value com.luciad.lucy.gui.help.ALcyHelpManager.HELP_ID_KEY.- Specified by:
setHelpIDString
in interfaceILcyActionBar
- Parameters:
aAction
- The action whose gui representation will be associated with the help id stringaHelpIDString
- The help id string that allows for context sensitive help- See Also:
-
insertComponent
Adds a Component to thisILcyActionBar
- Parameters:
aComponent
- The component to add. It will be added at the top level.aGroupDescriptor
- The group descriptor of the component to add.- See Also:
-
removeComponent
Remove the given Component from thisILcyActionBar
- Parameters:
aComponent
- The component to remove.- See Also:
-
getActionBarItemCount
public int getActionBarItemCount()Description copied from interface:ILcyActionBar
Returns the number ofILcdAction
s andILcyActiveSettable
s in theILcyActionBar
.- Specified by:
getActionBarItemCount
in interfaceILcyActionBar
- Returns:
- the number of
ILcdAction
s andILcyActiveSettable
s in theILcyActionBar
. - See Also:
-
getActionBarItem
Description copied from interface:ILcyActionBar
Returns the action or active settable at the given index.- Specified by:
getActionBarItem
in interfaceILcyActionBar
- Parameters:
aIndex
- The index of the action or active settable to return. 0 <= aIndex < getActionBarItemCount()- Returns:
- The
ILcdAction
orILcyActiveSettable
at the given index. - See Also:
-
retrieveHelpIDString
Description copied from interface:ILcyActionBar
Returns the set help id string for the given action.- Specified by:
retrieveHelpIDString
in interfaceILcyActionBar
- Parameters:
aAction
- The action to retrieve the help id for.- Returns:
- the set help id string for the given action.
- See Also:
-
retrieveHelpIDString
Description copied from interface:ILcyActionBar
Returns the set help id string for the given active settable.- Specified by:
retrieveHelpIDString
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- The active settable to retrieve the help id for.- Returns:
- the set help id string for the given active settable.
-
retrieveGroupDescriptor
Description copied from interface:ILcyActionBar
Returns the group descriptor that was used to add the given action to thisILcyActionBar
.- Specified by:
retrieveGroupDescriptor
in interfaceILcyActionBar
- Parameters:
aAction
- The action to retrieve the group descriptor for.- Returns:
- the group descriptor that was used to add the given action to this
ILcyActionBar
. - See Also:
-
retrieveGroupDescriptor
Description copied from interface:ILcyActionBar
Returns the group descriptor that was used to add the given active settable to thisILcyActionBar
.- Specified by:
retrieveGroupDescriptor
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- The active settable to retrieve the group descriptor for.- Returns:
- the group descriptor that was used to add the given active settable to this
ILcyActionBar
. - See Also:
-
retrieveMenus
Description copied from interface:ILcyActionBar
Returns the menus that were used to add the given active settable to thisILcyActionBar
.- Specified by:
retrieveMenus
in interfaceILcyActionBar
- Parameters:
aAction
- The action to retrieve the menus for.- Returns:
- the menus that were used to add the given action to this
ILcyActionBar
. - See Also:
-
retrieveMenus
Description copied from interface:ILcyActionBar
Returns the menus that were used to add the given active settable to thisILcyActionBar
.- Specified by:
retrieveMenus
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- The active settable to retrieve the menus for.- Returns:
- the menus that were used to add the given active settable to this
ILcyActionBar
. - See Also:
-
retrieveMenuGroupDescriptors
Description copied from interface:ILcyActionBar
Returns the menus group descriptors that were used to add the given active settable to thisILcyActionBar
.- Specified by:
retrieveMenuGroupDescriptors
in interfaceILcyActionBar
- Parameters:
aAction
- The action to retrieve the menu group descriptors for.- Returns:
- the menus group descriptors that were used to add the given active
settable to this
ILcyActionBar
. - See Also:
-
retrieveMenuGroupDescriptors
Description copied from interface:ILcyActionBar
Returns the menus group descriptors that were used to add the given active settable to thisILcyActionBar
.- Specified by:
retrieveMenuGroupDescriptors
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- The active settable to retrieve the menu group descriptors for.- Returns:
- the menus group descriptors that were used to add the given active
settable to this
ILcyActionBar
. - See Also:
-
retrieveDeactivatePossible
Description copied from interface:ILcyActionBar
Returns true if the givenILcyActiveSettable
can be deactivated.- Specified by:
retrieveDeactivatePossible
in interfaceILcyActionBar
- Parameters:
aActiveSettable
- True if the- Returns:
- true if the given
ILcyActiveSettable
can be deactivated.
-
getChildren
Returns all children of a given parent, including separators etc.This implementation returns
aParent.getComponents()
, but subclasses using for instanceJMenu
s should be aware that they should return( ( JMenu ) aParent ).getMenuComponents()
when the given parent is aJMenu
.- Parameters:
aParent
- The parent to retrieve the children from.- Returns:
- An array containing all children of the given parent.
-
getParent
Returns the parent of a given component.This implementation returns
aComponent.getParent()
, but subclasses using for instanceJPopupMenu
s (these are used for example byJMenu
s) must return( ( JPopupMenu ) aComponent ).getInvoker()
when the given component is aJPopupMenu
.- Parameters:
aComponent
- The component to retrieve the parent for.- Returns:
- The parent of the given component, or null.
-
getGroupDescriptorComparator
Deprecated.UsegetProperties()
instead. As documented in thesetGroupDescriptorComparator(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.Return the current group descriptor comparator. Default is null.- Returns:
- the current group descriptor comparator.
- See Also:
-
setGroupDescriptorComparator
Deprecated.UsesetProperties(ALcyProperties)
instead, which will derive the group descriptor comparator from the propertiesWhen a new group needs to be inserted in an action bar, the new group is compared to all existing groups to find out where it should be added.The 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.
- Parameters:
aGroupDescriptorComparator
- The new group comparator. It will be passed two instances of TLcyGroupDescriptor to compare.- See Also:
-
getActionBarItemComparator
Deprecated.UsegetProperties()
instead. As documented in thesetActionBarItemComparator(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.Returns theComparator
for action bar items.- Returns:
- the
Comparator
for action bar items. - See Also:
-
setActionBarItemComparator
Deprecated.UsesetProperties(ALcyProperties)
instead, which will derive the action bar item comparator from the propertiesSets the newComparator
to order the items within a singleTLcyGroupDescriptor
. Those items can be actions or active settables, but also components inserted usinginsertComponent
or sub-menus. This comparator must be set before adding items.- Parameters:
aActionBarItemComparator
- The newTLcyActionBarItemComparator
to use.- See Also:
-
insertChildInParent
protected void insertChildInParent(Component aChild, TLcyGroupDescriptor aGroupDescriptor, int aIndex, Container aParentSFCT) Adds the given child to the given parent, but it respects theTLcyGroupDescriptor
and the index. All items having the sameTLcyGroupDescriptor
are grouped together. The given index is relative in the group that belongs to theTLcyGroupDescriptor
. Also takes care of adding the separators.- Parameters:
aChild
- The child to add.aGroupDescriptor
- The group descriptor of the child to add.aIndex
- The index in the group that belongs to the givenTLcyGroupDescriptor
. -1 Means insert at the end.aParentSFCT
- The parent to add the child to, this parent is changed as a side effect.
-
removeChildFromParent
Removes the given child from the given parent. Also removes the parent from its parent (recursively) if it is empty. Also takes care of removing possible separators.- Parameters:
aChild
- The child to remove.aParentSFCT
- The parent to remove the child from, this parent is changed as a side effect.
-
insertSeparator
Inserts a separator at the given index into the given component.Implementation can be left empty, but if and only if implementation of
removeSeparator(int, java.awt.Container)
is left empty as well.- Parameters:
aIndex
- The index of where to insert the separator. -1 means insert it at the end.aContainerSFCT
- The container to insert the separator into.
-
removeSeparator
Removes the separator at the given index from the given component.Implementation can be left empty, but if and only if implementation of
insertSeparator(int, java.awt.Container)
is left empty as well.- Parameters:
aIndex
- The index where to remove the separator from the given component.aContainerSFCT
- The container to remove the separator from.
-
createItem
protected abstract Component createItem(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Creates a gui widget to represent the given action. E.g. a menu bar could create aJMenuItem
to represent the given action. A toolbar could create aJButton
to represent the given action.- Parameters:
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.- Returns:
- The created gui widget.
-
createItem
protected abstract Component createItem(ILcyActiveSettable aActiveSettable, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors, boolean aDeactivatePossible) Creates a gui widget to represent the given active settable. E.g. a menu bar could create aJCheckBoxMenuItem
to represent the given action or aJRadioButtonMenuItem
whenaDeactivatePossible
is false. A toolbar could create aJToggleButton
to represent the given active settable.- Parameters:
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).- Returns:
- The created gui widget.
-
getItemContainer
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. If no such container exists, null is returned. If the aMenus is null or an empty array, it shall not return null but it must return the top level container.- Parameters:
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.- Returns:
- the container that contains the actions or active settables at the given (sub)menus.
-
createItemContainer
protected abstract Container createItemContainer(String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Creates a new container for the given (sub)menus. The actions and active settables that need to be added to the given (sub)menus will be added to the created container. The created menu must not be inserted into its parent.An example implemention could look like this:
return new JMenu( aMenus[ aMenus.length - 1 ] )
- Parameters:
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.- Returns:
- a new container for the given (sub)menus.
-
isAutoHide
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.- Returns:
- the autoHide property of the action bar.
- See Also:
-
setAutoHide
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.- Parameters:
aAutoHide
-true
when the an empty action bar must be invisible,false
otherwise.- See Also:
-
getProperties()
instead.