public abstract class SubMenu<O extends OutputManager<?>> extends AbstractContainer<O> implements WidgetWithConfig<SubMenuConfig>, MenuElement<O>
SubMenu
client abstract implementation class.Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
protected SubMenuConfig |
config
Menu attribute container.
|
private MnemonicInfo |
label
Label with mnemonic info
|
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> |
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)
|
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 |
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()
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.
|
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, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, currentFocus, currentFocus, cycleFocus, destroy, detach, dimension, doLayout, draw, endSizeChange, findMouseSource, firstFocus, focus, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, remove, replace, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setSize, setSize, setWidth, startSizeChange, unrealize, updateSizeWorker, widgets, width
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getParentMenu, getParentMenuContainer, getParentSubMenu
addFocusListener, addKeyListener, ancestorId, bounds, clearWidget, defaultMousePtr, destroy, dimension, displayPhysicalLocation, draw, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, height, hidden, hide, highlighted, insets, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, location, minimumSize, moveToBottom, moveToTop, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestFocus, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, supportsCustomMousePointer, topLevelWindow, unrealize, width, window
protected SubMenuConfig config
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_UNDEFINED
true
if corresponding menu item found, otherwise - false
java.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()
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
- public TitledWindow<O> ancestor()
ancestor
in interface Widget<O extends OutputManager<?>>
ancestor
in class AbstractWidget<O extends OutputManager<?>>
java.lang.IllegalStateException
- When this widget is not attached to window.public MnemonicInfo getPreparedLabel()
public java.lang.String getPreparedTitle()
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.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()