public class SubMenuGuiImpl extends SubMenu<GuiOutputManager> implements FocusListener
SubMenu client abstract implementation class.| Modifier and Type | Class and Description |
|---|---|
private class |
SubMenuGuiImpl.SubMenuBody
Sub-menu body.
|
| Modifier and Type | Field and Description |
|---|---|
private SubMenuGuiImpl.SubMenuBody |
body
The sub-menu body container.
|
private boolean |
bodySwitch
When a submenu overlay window is opened while another submenu is opened, do not activate
the parent submenu's overlay window.
|
private double |
cachedHeight
Cached height of this item.
|
private double |
cachedWidth
Cached width of this item.
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver
|
(package private) static int |
HEIGHT_PAD
This menu-item top/bottom padding in a MENUBAR, in pixels.
|
private static int |
HIDE_SHOW_MENUBAR_MS_DELAY
Default delay time to show/hide submenu body for menubar items in milliseconds.
|
private static int |
HIDE_SHOW_MS_DELAY
Default delay time to show/hide submenu body in milliseconds if not specified in config.
|
private static int |
menuDelayMS
Configurable menu delay time in milliseconds.
|
private boolean |
mousePressedToShowBody
Flag to indicate whether the mouse has been pressed to show the body.
|
private static java.util.concurrent.ScheduledFuture<?> |
sf
Scheduled task for show/hide workers.
|
private static java.util.concurrent.ScheduledExecutorService |
srvPopUp
Executor service for show/hide workers.
|
(package private) static int |
WIDTH_PAD
This menu-item minimum left/righ padding in a MENUBAR, in pixels.
|
listeners, location, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
SubMenuGuiImpl(WidgetId id,
SubMenuConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected Dimension |
bodyDimension()
Calculates body dimension
|
protected Point |
bodyLocation()
Get location of SUB-MENU body, relative to container.
|
Point |
childrenLocation(Widget<GuiOutputManager> child)
Get children location for one child.
|
(package private) static void |
clearHighlights(Container<GuiOutputManager> container)
Clears highlighted flag for all child menu elements.
|
(package private) static SubMenuGuiImpl |
createDynamicSubmenu(java.lang.String title)
Create a dynamic submenu with the specified title.
|
protected MnemonicInfo |
createLabelInfo()
Creates new MnemonicInfo instance
|
Widget<GuiOutputManager> |
currentFocus()
Get widget which is in focus.
|
Widget<GuiOutputManager> |
defaultFocus()
Get default focusable widget.
|
void |
destroy()
Destroy this widget.
|
private void |
detachFromPopupWindow()
Detaches this widget from the parent body widget.
|
void |
doLayout()
Lay out container.
|
void |
draw()
Draw the peer container.
|
Widget<GuiOutputManager> |
findMouseSource(NativePoint p)
Find the widget positioned just bellow the specified mouse position (in physical units).
|
MenuStructure<GuiOutputManager> |
getBody()
Returns the submenu body instance.
|
Widget<GuiOutputManager> |
getFocusInt()
Get focused widget.
|
static int |
getLongestItemAccelWidth(Container<?> menu,
GuiFontResolver gf,
GuiDriver<?,?> gd)
Calculates max menu/sub-menu item accelerator width.
|
static int |
getLongestItemTitleWidth(Container<?> menu,
MenuElement<?> exclude,
GuiFontResolver gf,
GuiDriver<?,?> gd)
Calculates max menu/sub-menu item title (config's) width.
|
static double |
getMaxSubMenuHeight(AbstractContainer<?> menu)
Calculates a max height of specified Menu or SubMenu including borders.
|
static double |
getMaxSubMenuItemWidth(Container<?> menu,
boolean includeNested)
Calculates max menu/sub-menu item width with borders
|
double |
height()
Get sub-menu height.
|
(package private) static void |
hideBodies(Container<GuiOutputManager> container,
SubMenuGuiImpl exclude,
boolean bodySwitch)
Recursively hides all the sub-menu bodies starting at the passed in container reference
down.
|
(package private) static void |
hideBodiesWithDelay(Container<GuiOutputManager> container,
SubMenuGuiImpl exclude)
Recursively hides all the sub-menu bodies starting at this sub-menu.
|
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.
|
void |
invalidateCachedSize()
Invalidate the cached size of this item.
|
protected boolean |
isBodyDisplayed()
Returns the boolean, denoting is body displayed or not.
|
boolean |
isBodySwitch()
Returns the body switch state.
|
boolean |
isLegacyFocus()
Returns a flag marking the widget as subject to legacy focus handling.
|
protected void |
menuDropEvents(boolean fromMnemonic)
Raise the MENU-DROP 4GL events.
|
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.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Notification of a mouse entered event occurred for this widget.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Notification of a mouse exited event occurred for this widget.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Notification of a mouse pressed event occurred for this widget.
|
boolean |
navigable()
Returns
true only if this widget is navigable using mouse. |
void |
onFocusGained(FocusEvent event)
This method is invoked when focus is gained.
|
void |
onFocusLost(FocusEvent event)
This method is invoked when focus is lost.
|
private void |
openSubmenuBody()
Opens submenu body immediately or delayed.
|
protected java.util.List<Widget<GuiOutputManager>> |
prepareWidgets(java.util.List<Widget<GuiOutputManager>> widgets)
Prepare widgets before drawing
|
protected Point |
prepParentLocation(Widget<?> parent)
Trick, that lets to correct parent location in cases, when it needed,
for example for menus.
|
void |
processKeyEvent(KeyInput event)
Process key event.
|
void |
resetBody()
Hard reset sub menu internal to initial state.
|
void |
setVisible(boolean visible)
Hide/show widget.
|
protected void |
showBody()
Shows this sub-menu body.
|
private static void |
stopScheduledShowHide()
Cancels the scheduled task if one exists.
|
static double |
titleHeight(AbstractContainer<?> menu)
Gets sub-menu title height
|
static double |
titleHeightWithBorders(AbstractContainer<?> menu)
Gets sub-menu title height, considering border padding.
|
double |
titleWidth()
Gets sub-menu title width (with '->' if sub-menu is in other sub-menu or in popup menu)
Borders are not included.
|
double |
titleWidthWithBorders()
Gets sub-menu title width (with '->' if sub-menu is in other sub-menu or in popup menu)
If SUBMENU is not MENUBAR element, then calculate longest neighbor.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
double |
width()
Get widget width with borders.
|
afterConfigUpdate, ancestor, config, currentFocus, focusTraversable, focusWorker, forceCursorOnFocus, getFirstFocusableItem, getFocusedChild, getLastFocusableItem, getPreparedLabel, getPreparedTitle, hasChildSubmenu, isEnabled, isShowBody, manageSystemActions, processMnemonicEvent, repaint, requestFocus, setInitialFocusadd, add, add, addContainerStateListener, addDirectly, belongsTo, checkWidget, clipping, clipRectangle, copyState, cycleFocus, deregisterSelectedWidget, detach, dimension, dumpCurrentWidgets, dumpWidgets, endSizeChange, firstFocus, focus, formatDump, get, getAllSelectedWidgets, getClipRect, getEffectiveScrollableSize, getIgnoreFocus, getLayout, getScrollableSize, getTabItemList, hasFocusable, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, onWidgetAdded, onWidgetRemoved, paintOnTop, parentOf, 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_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, mouseDragged, mouseMoved, mouseReleased, mouseWheelMoved, moveToBottom, moveToTop, name, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, 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, 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, dimension, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getIdForTrigger, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getSelectedText, getState, getTriggerWidget, getTriggerWidget, getVisiblePart, getZOrderClass, hasFocus, hasFocus, hasTooltip, hidden, hide, highlighted, ignoreEnable, initialHeight, initialWidth, insets, isCurrent, isCurrent, isDirectManipulable, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDisplayed, isDroppable, isFocusable, isHeader, isInitialValueLayout, isProcessProgressEvent, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, 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, windowwidgetsAsListstatic final int HEIGHT_PAD
static final int WIDTH_PAD
private static final int HIDE_SHOW_MS_DELAY
private static final int HIDE_SHOW_MENUBAR_MS_DELAY
private static java.util.concurrent.ScheduledExecutorService srvPopUp
private static java.util.concurrent.ScheduledFuture<?> sf
private static int menuDelayMS
private GuiDriver gd
private GuiFontResolver gf
private SubMenuGuiImpl.SubMenuBody body
private double cachedWidth
private double cachedHeight
private boolean bodySwitch
private boolean mousePressedToShowBody
public SubMenuGuiImpl(WidgetId id, SubMenuConfig cfg)
id - The widget's ID.cfg - Configuration data.static void hideBodies(Container<GuiOutputManager> container, SubMenuGuiImpl exclude, boolean bodySwitch)
hideBody(boolean) instead.container - The reference container.exclude - The SubMenu item to exclude.bodySwitch - Pass true to make this hide bodies request part of another submenu body showing up.static void hideBodiesWithDelay(Container<GuiOutputManager> container, SubMenuGuiImpl exclude)
container - The reference container.exclude - The SubMenu item to exclude.static void clearHighlights(Container<GuiOutputManager> container)
container - The reference container.static SubMenuGuiImpl createDynamicSubmenu(java.lang.String title)
title - The title of the submenu.public static int getLongestItemAccelWidth(Container<?> menu, GuiFontResolver gf, GuiDriver<?,?> gd)
menu - Parent container: MENU or SUB-MENU.gf - Font resolver.gd - Gui driver.public static int getLongestItemTitleWidth(Container<?> menu, MenuElement<?> exclude, GuiFontResolver gf, GuiDriver<?,?> gd)
menu - Parent container: MENU or SUB-MENU.exclude - Current menu item, to exclude from processing.gf - Font resolver.gd - Gui driver.public static double getMaxSubMenuHeight(AbstractContainer<?> menu)
menu - Menu or SubMenu.public static double getMaxSubMenuItemWidth(Container<?> menu, boolean includeNested)
menu - MENU or SUB-MENUincludeNested - true means, that we should process nested sub-menus,
false otherwise.public static double titleHeight(AbstractContainer<?> menu)
menu - The parent MENU or SUB-MENU widget.public static double titleHeightWithBorders(AbstractContainer<?> menu)
menu - The parent MENU or SUB-MENU widget.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>initialize in class SubMenu<GuiOutputManager>id - The widget's ID.cfg - The config used to initialize this widget.public MenuStructure<GuiOutputManager> getBody()
protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>public Widget<GuiOutputManager> defaultFocus()
defaultFocus in interface Container<GuiOutputManager>defaultFocus in class SubMenu<GuiOutputManager>public Widget<GuiOutputManager> currentFocus()
currentFocus in interface Container<GuiOutputManager>currentFocus in class AbstractContainer<GuiOutputManager>public void doLayout()
doLayout in interface Container<GuiOutputManager>doLayout in class AbstractContainer<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 boolean isBodySwitch()
public void invalidateCachedSize()
public double width()
width in interface Widget<GuiOutputManager>width in class AbstractContainer<GuiOutputManager>public double height()
height in interface Widget<GuiOutputManager>height in class AbstractContainer<GuiOutputManager>public void hideBody(boolean recursiveUp)
hideBody in class SubMenu<GuiOutputManager>recursiveUp - true means hide body for all parent sub-menus.public double titleWidth()
titleWidth in class SubMenu<GuiOutputManager>public double titleWidthWithBorders()
public boolean navigable()
true only if this widget is navigable using mouse.navigable in interface Widget<GuiOutputManager>navigable in class AbstractWidget<GuiOutputManager>true if widget is navigable using mouse.public void processKeyEvent(KeyInput event)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class SubMenu<GuiOutputManager>event - Key event to process.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 mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenermouseEntered in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenermouseExited in class AbstractWidget<GuiOutputManager>e - The mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractWidget<GuiOutputManager>e - The mouse event.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 Point childrenLocation(Widget<GuiOutputManager> child)
childrenLocation in interface Container<GuiOutputManager>childrenLocation in class AbstractContainer<GuiOutputManager>child - Child component.public void onFocusGained(FocusEvent event)
onFocusGained in interface FocusListenerevent - Event which triggered this call.public void onFocusLost(FocusEvent event)
onFocusLost in interface FocusListenerevent - Event which triggered this call.public void setVisible(boolean visible)
setVisible in interface Widget<GuiOutputManager>setVisible in class SubMenu<GuiOutputManager>visible - New visible state.public java.lang.String toString()
toString in class AbstractWidget<GuiOutputManager>public void destroy()
destroy in interface Widget<GuiOutputManager>destroy in class AbstractContainer<GuiOutputManager>public Widget<GuiOutputManager> getFocusInt()
getFocusInt in class AbstractContainer<GuiOutputManager>protected MnemonicInfo createLabelInfo()
createLabelInfo in class SubMenu<GuiOutputManager>protected void menuDropEvents(boolean fromMnemonic)
menuDropEvents in class SubMenu<GuiOutputManager>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.protected Point prepParentLocation(Widget<?> parent)
prepParentLocation in class AbstractWidget<GuiOutputManager>parent - Parent component - must be a sub-menu.protected Point bodyLocation()
bodyLocation in class SubMenu<GuiOutputManager>protected Dimension bodyDimension()
bodyDimension in class SubMenu<GuiOutputManager>protected java.util.List<Widget<GuiOutputManager>> prepareWidgets(java.util.List<Widget<GuiOutputManager>> widgets)
prepareWidgets in class AbstractContainer<GuiOutputManager>widgets - Container children.protected void showBody()
In GUI, it also registers it for "any" actions, so that it is notified when a click occurs outside of its boundaries.
showBody in class SubMenu<GuiOutputManager>protected boolean isBodyDisplayed()
true if body is displayed, false - otherwise.private static void stopScheduledShowHide()
private void openSubmenuBody()
public void resetBody()
private void detachFromPopupWindow()