Class TLcyPopupMenu
- All Implemented Interfaces:
ILcyActionBar,ILcyPopupMenu
ALcyActionBarSW that represents a popup menu.
Creates JMenuItems,
JCheckBoxMenuItem or JRadioButtonMenuItem to
represent the ILcdActions or ILcyActiveSettables.
Creates JMenus for the submenus. Uses default menu bar
separators.Uses the name of the actions or active settables as the button text. The short description is used as a tool tip.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newTLcyPopupMenu, ready to be used.TLcyPopupMenu(ALcyHelpManager aHelpManager) Creates a newTLcyPopupMenu, ready to be used.TLcyPopupMenu(ALcyHelpManager aHelpManager, JPopupMenu aPopupMenu) Creates a newTLcyPopupMenu, ready to be used.TLcyPopupMenu(JPopupMenu aPopupMenu) Creates a newTLcyPopupMenu, ready to be used. -
Method Summary
Modifier and TypeMethodDescriptionprotected ComponentcreateItem(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Creates a gui widget to represent the given action.protected ComponentcreateItem(ILcyActiveSettable aActiveSettable, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors, boolean aDeactivatePossible) Creates a gui widget to represent the given active settable.protected ContainercreateItemContainer(String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Creates a new container for the given (sub)menus.protected Component[]getChildren(Container aParent) Returns all children of a given parent, including separators etc.Returns the visual component representing this action bar, so that it can be added to the application UI.protected ContainergetItemContainer(String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Retrieves the (sub)menu container that contains the actions or active settables at the given (sub)menus.protected ContainerReturns the parent of a given component.protected voidinsertSeparator(int aIndex, Container aContainerSFCT) Inserts a separator at the given index into the given component.protected voidremoveSeparator(int aIndex, Container aContainerSFCT) Removes the separator at the given index from the given component.voidDisplays the popup menu at the position (x,y) in the coordinate space of the invoker.Methods inherited from class com.luciad.lucy.gui.ALcyActionBar
addActionBarListener, getActionBarItem, getActionBarItemComparator, getActionBarItemCount, getGroupDescriptorComparator, getHelpManager, getProperties, insertAction, insertAction, insertActiveSettable, insertActiveSettable, insertActiveSettable, insertChildInParent, insertComponent, isAutoHide, removeAction, removeActionBarListener, removeActiveSettable, removeChildFromParent, removeComponent, retrieveDeactivatePossible, retrieveGroupDescriptor, retrieveGroupDescriptor, retrieveHelpIDString, retrieveHelpIDString, retrieveMenuGroupDescriptors, retrieveMenuGroupDescriptors, retrieveMenus, retrieveMenus, setActionBarItemComparator, setAutoHide, setGroupDescriptorComparator, setHelpIDString, setHelpIDString, setHelpManager, setPropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.lucy.gui.ILcyActionBar
addActionBarListener, getActionBarItem, getActionBarItemCount, insertAction, insertAction, insertActiveSettable, insertActiveSettable, insertActiveSettable, removeAction, removeActionBarListener, removeActiveSettable, retrieveDeactivatePossible, retrieveGroupDescriptor, retrieveGroupDescriptor, retrieveHelpIDString, retrieveHelpIDString, retrieveMenuGroupDescriptors, retrieveMenuGroupDescriptors, retrieveMenus, retrieveMenus, setHelpIDString, setHelpIDString
-
Constructor Details
-
TLcyPopupMenu
public TLcyPopupMenu()Creates a newTLcyPopupMenu, ready to be used. -
TLcyPopupMenu
Creates a newTLcyPopupMenu, ready to be used.- Parameters:
aHelpManager- The help manager.
-
TLcyPopupMenu
Creates a newTLcyPopupMenu, ready to be used.- Parameters:
aPopupMenu- The (empty) JPopupMenu to which the menu items will be added.
-
TLcyPopupMenu
Creates a newTLcyPopupMenu, ready to be used.- Parameters:
aHelpManager- The help manager.aPopupMenu- The (empty) JPopupMenu to which the menu items will be added.
-
-
Method Details
-
getComponent
Description copied from interface:ILcyActionBarReturns the visual component representing this action bar, so that it can be added to the application UI.
Components should not be added to it or removed from it directly using Swing. Use the various insert methods instead.
- Specified by:
getComponentin interfaceILcyActionBar- Returns:
- the visual component representing this action bar.
-
show
Description copied from interface:ILcyPopupMenuDisplays the popup menu at the position (x,y) in the coordinate space of the invoker.- Specified by:
showin interfaceILcyPopupMenu- Parameters:
aInvoker- the component in whose space the popup menu will appear.aX- the x coordinate.aY- the y coordinate.
-
getChildren
Description copied from class:ALcyActionBarReturns all children of a given parent, including separators etc.This implementation returns
aParent.getComponents(), but subclasses using for instanceJMenus should be aware that they should return( ( JMenu ) aParent ).getMenuComponents()when the given parent is aJMenu.- Overrides:
getChildrenin classALcyActionBar- Parameters:
aParent- The parent to retrieve the children from.- Returns:
- An array containing all children of the given parent.
-
getParent
Description copied from class:ALcyActionBarReturns the parent of a given component.This implementation returns
aComponent.getParent(), but subclasses using for instanceJPopupMenus (these are used for example byJMenus) must return( ( JPopupMenu ) aComponent ).getInvoker()when the given component is aJPopupMenu.- Overrides:
getParentin classALcyActionBar- Parameters:
aComponent- The component to retrieve the parent for.- Returns:
- The parent of the given component, or null.
-
insertSeparator
Description copied from class:ALcyActionBarInserts a separator at the given index into the given component.Implementation can be left empty, but if and only if implementation of
ALcyActionBar.removeSeparator(int, java.awt.Container)is left empty as well.- Specified by:
insertSeparatorin classALcyActionBar- 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
Description copied from class:ALcyActionBarRemoves the separator at the given index from the given component.Implementation can be left empty, but if and only if implementation of
ALcyActionBar.insertSeparator(int, java.awt.Container)is left empty as well.- Specified by:
removeSeparatorin classALcyActionBar- Parameters:
aIndex- The index where to remove the separator from the given component.aContainerSFCT- The container to remove the separator from.
-
createItem
protected Component createItem(ILcdAction aAction, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Description copied from class:ALcyActionBarCreates a gui widget to represent the given action. E.g. a menu bar could create aJMenuItemto represent the given action. A toolbar could create aJButtonto represent the given action.- Specified by:
createItemin classALcyActionBar- 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 Component createItem(ILcyActiveSettable aActiveSettable, TLcyGroupDescriptor aGroupDescriptor, String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors, boolean aDeactivatePossible) Description copied from class:ALcyActionBarCreates a gui widget to represent the given active settable. E.g. a menu bar could create aJCheckBoxMenuItemto represent the given action or aJRadioButtonMenuItemwhenaDeactivatePossibleis false. A toolbar could create aJToggleButtonto represent the given active settable.- Specified by:
createItemin classALcyActionBar- 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
Description copied from class:ALcyActionBarRetrieves 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.- Specified by:
getItemContainerin classALcyActionBar- 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 Container createItemContainer(String[] aMenus, TLcyGroupDescriptor[] aMenuGroupDescriptors) Description copied from class:ALcyActionBarCreates 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 ] )
- Specified by:
createItemContainerin classALcyActionBar- 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.
-