public class MenuGuiImpl extends Menu<GuiOutputManager> implements MouseWidgetsEnumerator, MenuStructure<GuiOutputManager>
Menu GUI client implementation class.Menu.PopupKeyListener| Modifier and Type | Field and Description |
|---|---|
private GuiDriver |
gd
Screen driver
|
private int |
menubarLines
Number of MENUBAR lines
|
private boolean |
mnemonicsOn
If
true => mnemonics are drawn. |
listeners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
MenuGuiImpl(WidgetId id,
MenuConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearItemsHighlight()
Resets all highlight related variables to default state.
|
private void |
detachFromPopupWindow(TopLevelWindow wnd)
Detahces this widget from the parent window.
|
void |
doLayout()
Lay out container.
|
void |
doShowPopup(Widget<GuiOutputManager> src,
NativePoint location,
java.lang.Runnable dismissHandler)
The abstract portion of the logic making pop-up menu shown.
|
void |
draw()
Draw the peer container.
|
protected static Widget<GuiOutputManager> |
findMenuMouseSource(AbstractContainer menu,
NativePoint p,
NativeRectangle bodyBounds)
Find the mouse source in this menu, recursive.
|
Widget<GuiOutputManager> |
findMouseSource(NativePoint p)
Find the widget positioned just bellow the specified mouse position (in physical units),
in this menu bar, walking the entire opened menu tree, recursively.
|
Widget<GuiOutputManager> |
getFirstEnabledWidget()
Looks up the very first enabled widget.
|
protected Widget |
getFirstFocusableItem()
Returns the first focusable child.
|
protected Widget |
getLastFocusableItem()
Returns the last focusable child.
|
java.util.List<Widget> |
getMouseWidgets()
Returns the list of widgets that will be considered when registering mouse widgets by GUI driver.
|
double |
height()
Replace original version to take into account P2J specific behavior.
|
void |
hide()
Hide widget.
|
void |
initialize(WidgetId id,
MenuConfig 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 |
isLegacyFocus()
Returns a flag marking the widget as subject to legacy focus handling.
|
boolean |
isMnemonicsOn()
Get keyboard mnemonics mode.
|
void |
leaveMenu()
Close all opened bodies and remove focus from the menu.
|
protected int[] |
mouseActions()
Determine the mouse actions processed by this widget.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
protected boolean |
processAccelerator(KeyInput event,
MenuItem<?> m)
Process accelerator event.
|
void |
processKeyEvent(KeyInput event)
Process key event.
|
void |
setMnemonicsOn(boolean mnemonicsOn)
Set mnemonics mode.
|
void |
setVisible(boolean visible)
Hide/show widget.
|
double |
width()
Replace original version to take into account P2J specific behavior.
|
private double |
width(boolean includeNested)
Replace original version to take into account P2J specific behavior.
|
afterConfigUpdate, config, currentFocus, destroy, enterMenu, focusWorker, getMenu, getTabItemList, hasFocus, hasMenuFocus, isMenubarElement, processKeyAccelerator, setMenuClosedHandler, showPopup, triggerMenuClosedadd, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, childrenLocation, clipping, clipRectangle, copyState, currentFocus, cycleFocus, defaultFocus, deregisterSelectedWidget, detach, dimension, dumpCurrentWidgets, dumpWidgets, endSizeChange, firstFocus, focus, focusTraversable, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, hasFocusable, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, prepareWidgets, prevFocus, reflectAncestorChange, reflectLocationChanged, registerSelectedWidget, remove, removeContainerStateListener, repaint, replace, requestFocus, requestFocus, setFocus, setFocusInt, setHeight, setIgnoreFocus, setInsets, setLayout, setPhysicalDimensionInt, setSize, setSize, setTabItemList, setWidth, startSizeChange, swap, triggerContainerStateRedrawEnabled, unrealize, updateSizeWorker, widgets, widgetsAsList, widgetStateChanged_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, forceCursorOnFocus, 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, highlighted, ignoreAction, initialHeight, initialWidth, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, 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, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, completeTrigger, config, defaultMousePtr, destroy, dimension, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, hidden, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isEnabled, isFocusable, isHeader, isInitialValueLayout, 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, repaint, requestFocus, 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, windowmouseEntered, mouseExited, mousePressed, mouseReleasedwidgetsAsListprivate GuiDriver gd
private int menubarLines
private boolean mnemonicsOn
true => mnemonics are drawn.
This mode is intended only for MENUBAR. It activated using ALT key.public MenuGuiImpl(WidgetId id, MenuConfig cfg)
id - The widget's ID.cfg - Configuration data.protected static Widget<GuiOutputManager> findMenuMouseSource(AbstractContainer menu, NativePoint p, NativeRectangle bodyBounds)
menu - The (sub)menu parent.p - The mouse location, relative to parent.bodyBounds - The bounds of the (sub)menu's body.null if the mouse is not over
a child in the menu tree.public void initialize(WidgetId id, MenuConfig cfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<MenuConfig>initialize in class Menu<GuiOutputManager>id - The widget's ID.cfg - The config used to initialize this widget.public boolean isMnemonicsOn()
true if mnemonics are active in the menu.public void setMnemonicsOn(boolean mnemonicsOn)
mnemonicsOn - true if mnemonics should become active in the menu.public void clearItemsHighlight()
protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>public void draw()
Drawing for the redirected terminal differs. Labels/headers are drawn only once per page, instead of the usual once per menu.
draw in interface Widget<GuiOutputManager>draw in class AbstractContainer<GuiOutputManager>public boolean isLegacyFocus()
isLegacyFocus in interface Widget<GuiOutputManager>public double width()
width in interface Widget<GuiOutputManager>width in class AbstractContainer<GuiOutputManager>Widget.width()public double height()
height in interface Widget<GuiOutputManager>height in class AbstractContainer<GuiOutputManager>Widget.height()public void doLayout()
doLayout in interface Container<GuiOutputManager>doLayout in class AbstractContainer<GuiOutputManager>public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenermouseClicked in class AbstractWidget<GuiOutputManager>e - The mouse event.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<GuiOutputManager>setVisible in class Menu<GuiOutputManager>visible - New visible state.public Widget<GuiOutputManager> findMouseSource(NativePoint p)
findMouseSource in interface Widget<GuiOutputManager>findMouseSource in class AbstractContainer<GuiOutputManager>p - The mouse physical location.null if none found.public Widget<GuiOutputManager> getFirstEnabledWidget()
getFirstEnabledWidget in class Menu<GuiOutputManager>nullpublic void hide()
hide in interface Widget<GuiOutputManager>hide in class AbstractWidget<GuiOutputManager>public void leaveMenu()
leaveMenu in class Menu<GuiOutputManager>public java.util.List<Widget> getMouseWidgets()
getMouseWidgets in interface MouseWidgetsEnumeratornull.public void processKeyEvent(KeyInput event)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class Menu<GuiOutputManager>event - Key event to process.protected Widget getFirstFocusableItem()
protected Widget getLastFocusableItem()
public void doShowPopup(Widget<GuiOutputManager> src, NativePoint location, java.lang.Runnable dismissHandler)
doShowPopup in class Menu<GuiOutputManager>src - Source widget.location - The popup location.dismissHandler - When not null, the runnable instance is executed when the popup menu is dismissed, regardless
whether an item is chosen or not.protected boolean processAccelerator(KeyInput event, MenuItem<?> m)
processAccelerator in class Menu<GuiOutputManager>event - KeyInput object, related to key event.m - Target accelerator source menu-item.true means accelerator was processed.
false means accelerator was ignored.private double width(boolean includeNested)
includeNested - true if we should process nested sub-menusprivate void detachFromPopupWindow(TopLevelWindow wnd)
wnd - Parent window to detach from.