public abstract class SubMenu<O extends OutputManager<?>> extends AbstractContainer<O> implements WidgetWithConfig<SubMenuConfig>, MenuElement<O>
SubMenu client abstract implementation class.| Modifier and Type | Field and Description |
|---|---|
protected SubMenuConfig |
config
Menu attribute container.
|
private MnemonicInfo |
label
Label with mnemonic info
|
protected boolean |
showBody
Flag indicating if the body must be displayed.
|
listeners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
SubMenu(WidgetId id,
SubMenuConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterConfigUpdate(SubMenuConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
TitledWindow<O> |
ancestor()
Get ancestor window for this widget.This method must be called
only for widgets that are already attached to Window.
|
protected abstract Dimension |
bodyDimension()
Calculates body dimension
|
protected abstract Point |
bodyLocation()
Get location of SUB-MENU body, relative to container.
|
SubMenuConfig |
config()
Provide access to the attributes stored in the widget.
|
protected MnemonicInfo |
createLabelInfo()
Creates new MnemonicInfo instance.
|
Widget<O> |
currentFocus(boolean recurse)
Get widget which is in focus.
|
Widget<O> |
defaultFocus()
Get default focusable widget.
|
boolean |
focusTraversable()
Check if widget is focus traversable.
|
protected void |
focusWorker(boolean direction)
Search for the next or previous focusable widget in the container and
set focus on it.
|
boolean |
forceCursorOnFocus()
Check if widget needs in cursor to be on when having the input focus.
|
protected Widget<O> |
getFirstFocusableItem()
Returns the first focusable child.
|
protected Widget<?> |
getFocusedChild()
Get first focused sub-menu child (menu-iter or other sub-menu)
|
protected Widget<O> |
getLastFocusableItem()
Returns the last focusable child.
|
MnemonicInfo |
getPreparedLabel()
Get MENU-ITEM prepared label.
|
java.lang.String |
getPreparedTitle()
Get MENU-ITEM prepared label.
|
static boolean |
hasChildSubmenu(Container<?> menu)
Check if specified MENU/SUB-MENU contains SUB-MENU child.
|
void |
hideBody(boolean recursiveUp)
Hides sub-menu body.
|
void |
initialize(WidgetId id,
SubMenuConfig cfg)
Replacement API for the logic which should exist in the widget's c'tor, but the logic
can't be executed as it depends on the widget being registered into the official registry.
|
boolean |
isEnabled()
Check if this sub-menu is enabled.
|
boolean |
isShowBody()
Get the state of the
showBody flag. |
boolean |
manageSystemActions()
Check if the current widget can manage non-global system actions on its own, and not via the
enclosing event loop.
|
protected abstract void |
menuDropEvents(boolean fromMnemonic)
Raise the MENU-DROP 4GL events.
|
void |
processKeyEvent(KeyInput event)
Process key event.
|
static boolean |
processMnemonicEvent(AbstractContainer<?> menu,
KeyInput event)
Check menu items (first-level) for specified mnemonic.
|
void |
repaint()
Request widget repainting.
|
void |
requestFocus()
Request focus.
|
protected void |
setInitialFocus()
Sets initial focus on first traversable child.
|
void |
setVisible(boolean visible)
Hide/show widget.
|
protected void |
showBody()
Shows this sub-menu body.
|
abstract double |
titleWidth()
Gets sub-menu title width (with '->' if sub-menu is in other sub-menu or in popup menu)
|
add, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, deregisterSelectedWidget, destroy, detach, dimension, doLayout, draw, dumpCurrentWidgets, dumpWidgets, endSizeChange, findMouseSource, firstFocus, focus, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChanged, registerSelectedWidget, remove, removeContainerStateListener, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setPhysicalDimensionInt, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged, width_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, triggerLocationChanged, unregisterWidgetListener, updateSystemParent, widgetRealized, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParentMenu, getParentMenuContainer, getParentSubMenu, getParentSubMenuBody, getRootSubMenuacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestorId, bounds, canMovetoTop, clearWidget, completeTrigger, defaultMousePtr, destroy, dimension, displayPhysicalLocation, draw, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, height, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isFocusable, isHeader, isInitialValueLayout, isLegacyFocus, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, oleDrag, parent, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, refreshWidget, registerWidgetListener, repaint, repaint, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setWindow, show, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetListener, validateDisplayValue, widgetStateChanged, width, windowmouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleasedwidgetsAsListprotected SubMenuConfig config
protected boolean showBody
private MnemonicInfo label
public SubMenu(WidgetId id, SubMenuConfig cfg)
id - The widget's ID.cfg - Configuration data.public static boolean processMnemonicEvent(AbstractContainer<?> menu, KeyInput event)
ItemEvent.menu - MENU or SUB-MENUevent - Key event with event.keyChar() != KeyInput.CHAR_UNDEFINEDtrue if corresponding menu item found, otherwise - falsejava.lang.IllegalArgumentException - If event is generated by other source than character pressing.public static boolean hasChildSubmenu(Container<?> menu)
menu - MENU/SUB-MENU container.true if specified container contains SUB-MENU child.public abstract double titleWidth()
protected abstract Point bodyLocation()
protected abstract Dimension bodyDimension()
protected abstract void menuDropEvents(boolean fromMnemonic)
fromMnemonic - Flag which indicates that the generated menu drop event is caused my a key event
(mnemonic). This is used by the event processor to detect if the first element
of the menu should be focused or not.public void initialize(WidgetId id, SubMenuConfig cfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<SubMenuConfig>id - The widget's ID.cfg - The config used to initialize this widget.public SubMenuConfig config()
config in interface Widget<O extends OutputManager<?>>config in interface ConfigOwner<SubMenuConfig>config in class AbstractWidget<O extends OutputManager<?>>public void afterConfigUpdate(SubMenuConfig beforeUpdate)
afterConfigUpdate in interface ConfigOwner<SubMenuConfig>beforeUpdate - Config reference capturing the config state before
the owner's config was modified.public TitledWindow<O> ancestor()
ancestor in interface Widget<O extends OutputManager<?>>ancestor in class AbstractWidget<O extends OutputManager<?>>public MnemonicInfo getPreparedLabel()
getPreparedLabel in interface MenuElement<O extends OutputManager<?>>public java.lang.String getPreparedTitle()
getPreparedTitle in interface MenuElement<O extends OutputManager<?>>public void hideBody(boolean recursiveUp)
recursiveUp - true means hide body for all parent sub-menus.public void processKeyEvent(KeyInput event)
processKeyEvent in interface Widget<O extends OutputManager<?>>processKeyEvent in class AbstractContainer<O extends OutputManager<?>>event - Key event to process.public void repaint()
repaint in interface Widget<O extends OutputManager<?>>repaint in class AbstractContainer<O extends OutputManager<?>>public void setVisible(boolean visible)
If the menu is being shown and not yet attached to a window, attached it to the default window.
setVisible in interface Widget<O extends OutputManager<?>>setVisible in class AbstractWidget<O extends OutputManager<?>>visible - New visible state.public boolean forceCursorOnFocus()
true so it needs to be overwritten if other return value
is required for particular widget implementation class.forceCursorOnFocus in interface Widget<O extends OutputManager<?>>forceCursorOnFocus in class AbstractWidget<O extends OutputManager<?>>true as the default value.public Widget<O> defaultFocus()
defaultFocus in interface Container<O extends OutputManager<?>>defaultFocus in class AbstractContainer<O extends OutputManager<?>>public boolean focusTraversable()
focusTraversable in interface Widget<O extends OutputManager<?>>focusTraversable in class AbstractContainer<O extends OutputManager<?>>true if widget is focus traversable.public boolean manageSystemActions()
manageSystemActions in class AbstractWidget<O extends OutputManager<?>>true as the widget has its own event management.public Widget<O> currentFocus(boolean recurse)
The method allows to choose whether the focused widget is searched in the nested
containers (recurse == true) or whether only this container is searched
(recurse == false).
The override allows the submenu widget to become focused even without any of the child widgets
in focus. This allows the widget to process key events.
currentFocus in interface Container<O extends OutputManager<?>>currentFocus in class AbstractContainer<O extends OutputManager<?>>recurse - The parameter controls whether the method should recurse to the nested
containers when searching for the focused widget.public void requestFocus()
requestFocus in interface Widget<O extends OutputManager<?>>public boolean isEnabled()
isEnabled in interface Widget<O extends OutputManager<?>>isEnabled in class AbstractWidget<O extends OutputManager<?>>true if widget is enabled.public boolean isShowBody()
showBody flag.protected MnemonicInfo createLabelInfo()
protected Widget<?> getFocusedChild()
protected void focusWorker(boolean direction)
focusWorker in class AbstractContainer<O extends OutputManager<?>>direction - Widget search direction.protected void showBody()
protected void setInitialFocus()
protected Widget<O> getFirstFocusableItem()