public class MenuItemGuiImpl extends MenuItem<GuiOutputManager> implements FocusListener
MenuItem GUI client implementation class.| Modifier and Type | Field and Description |
|---|---|
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
|
private java.util.Map<java.lang.Integer,java.util.Set<java.awt.event.MouseAdapter>> |
mouseListeners
TODO: move that to future subclass, intended specially for system pop-ups.
|
insets, listeners, location, LOG, mousePtr, nativeInsets, physicalLocation| Constructor and Description |
|---|
MenuItemGuiImpl(WidgetId id,
MenuItemConfig cfg)
Special constructor used to restore component using given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addMouseClickListener(java.awt.event.MouseAdapter listener)
Adds custom mouse click listener for this item
|
static MenuItemGuiImpl |
createDynamicItem(java.lang.String title,
boolean enabled,
java.awt.event.MouseAdapter evt)
Create a dynamic item with the specified title and mouse actions
for system pop-up menus.
|
(package private) static MenuItemGuiImpl |
createDynamicItem(java.lang.String title,
java.awt.event.MouseAdapter evt)
Create a dynamic item with the specified title and mouse actions
for system pop-up menus.
|
static MenuItemGuiImpl |
createDynamicRule()
Create a dynamic RULE item.
|
protected MnemonicInfo |
createLabelInfo()
Creates new MnemonicInfo instance
|
Dimension |
dimension()
Get widget dimension.
|
void |
draw()
Draw widget.
|
boolean |
focusTraversable()
Check if widget is focus traversable.
|
double |
height()
Get widget height.
|
void |
initialize(WidgetId id,
MenuItemConfig 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.
|
boolean |
isLegacyFocus()
Returns a flag marking the widget as subject to legacy focus handling.
|
boolean |
manageSystemActions()
Check if the current widget can manage non-global system actions on its own, and not via the
enclosing event loop.
|
Dimension |
minimumSize()
Get widget minimum size.
|
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.
|
boolean |
navigable()
Returns
true only if this widget is navigable. |
void |
onFocusGained(FocusEvent event)
This method is invoked when focus is gained.
|
void |
onFocusLost(FocusEvent event)
This method is invoked when focus is lost.
|
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.
|
protected void |
selectMenuItem()
Process an event which trigger selection of this menu-item, depending if the item is a
toggle-box or not.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
double |
width()
Get widget width.
|
afterConfigUpdate, config, forceCursorOnFocus, getPreparedLabel, getPreparedTitle, isEnabled, isInitDisabled, isNormal, isRule, isSkip, setTitle_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, destroy, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, findMouseSource, 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, insets, isCurrent, isDirectManipulationActive, isDirectManipulationActiveOrInUIB, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseDragged, mouseMoved, mousePressed, 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, reflectAncestorChange, reflectLocationChanged, reflectSizeChanged, refresh, registerWidgetListener, repaint, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalDimensionInt, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, translate, triggerLocationChanged, unrealize, unregisterWidgetListener, updateSizeWorker, updateSystemParent, widgetRealized, widgetStateChanged, windowclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetParentMenu, getParentMenuContainer, getParentSubMenu, getParentSubMenuBody, getRootSubMenuacceptsEscAsAnyKey, acceptTrigger, addFocusListener, addKeyListener, ancestor, ancestorId, bounds, canMovetoTop, clearWidget, completeTrigger, defaultMousePtr, destroy, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, 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, 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, repaint, requestFocus, requestFocus, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setDirectManipulationActive, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setMousePointer, setParent, setPhysicalLocation, setSensitiveForUIB, setState, setVisible, setWindow, show, startTrigger, supportsCustomMousePointer, systemFocusGrabbed, topLevelWindow, unrealize, unregisterWidgetListener, validateDisplayValue, widgetStateChanged, windowprivate GuiFontResolver gf
private GuiDriver gd
private java.util.Map<java.lang.Integer,java.util.Set<java.awt.event.MouseAdapter>> mouseListeners
MouseEvent.MOUSE_CLICKED.
This mouse listeners are custom actions (like triggers) but for non-standard cases
such as system pop-up menus: editor pop-ups, scroll pop-ups and window title pop-ups.
For example, such listener can call clipboard operation when corresponding menu-item was selected.
private double cachedWidth
private double cachedHeight
public MenuItemGuiImpl(WidgetId id, MenuItemConfig cfg)
id - The widget's ID.cfg - Configuration data.static MenuItemGuiImpl createDynamicItem(java.lang.String title, java.awt.event.MouseAdapter evt)
title - The title of the popup item in the window's system popup menu.evt - The event processing.MenuItemGuiImpl.public static MenuItemGuiImpl createDynamicItem(java.lang.String title, boolean enabled, java.awt.event.MouseAdapter evt)
title - The title of the popup item in the window's system popup menu.enabled - Flag indicating if the item is enabled or not.evt - The event processing.MenuItemGuiImpl.public static MenuItemGuiImpl createDynamicRule()
MenuItemGuiImpl.public void initialize(WidgetId id, MenuItemConfig cfg)
This API is called after the widget is created and added to the registry.
initialize in interface WidgetWithConfig<MenuItemConfig>initialize in class MenuItem<GuiOutputManager>id - The widget's ID.cfg - The config used to initialize this widget.protected int[] mouseActions()
mouseActions in class AbstractWidget<GuiOutputManager>public Dimension dimension()
dimension in interface Widget<GuiOutputManager>dimension in class AbstractWidget<GuiOutputManager>public boolean navigable()
true only if this widget is navigable.navigable in interface Widget<GuiOutputManager>navigable in class AbstractWidget<GuiOutputManager>true if widget is navigable.public boolean focusTraversable()
focusTraversable in interface Widget<GuiOutputManager>focusTraversable in class AbstractWidget<GuiOutputManager>true if widget is focus traversable.public boolean isLegacyFocus()
isLegacyFocus in interface Widget<GuiOutputManager>public void draw()
draw in interface Widget<GuiOutputManager>draw in class AbstractWidget<GuiOutputManager>public void invalidateCachedSize()
public double height()
height in interface Widget<GuiOutputManager>height in class AbstractWidget<GuiOutputManager>public double width()
width in interface Widget<GuiOutputManager>width in class AbstractWidget<GuiOutputManager>public boolean manageSystemActions()
manageSystemActions in class AbstractWidget<GuiOutputManager>true.public Dimension minimumSize()
minimumSize in interface Widget<GuiOutputManager>minimumSize in class AbstractWidget<GuiOutputManager>public void processKeyEvent(KeyInput event)
processKeyEvent in interface Widget<GuiOutputManager>processKeyEvent in class MenuItem<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 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 java.lang.String toString()
toString in class AbstractWidget<GuiOutputManager>protected void selectMenuItem()
selectMenuItem in class MenuItem<GuiOutputManager>protected MnemonicInfo createLabelInfo()
createLabelInfo in class MenuItem<GuiOutputManager>protected Point prepParentLocation(Widget<?> parent)
prepParentLocation in class AbstractWidget<GuiOutputManager>parent - Parent component - must be a sub-menu.private void addMouseClickListener(java.awt.event.MouseAdapter listener)
listener - MouseAdapter instance.