| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private Color | |
| private Color | |
| private Color | |
| private Color | |
| protected Point | grabInputPoint
If the PopupMenu is invoked as a result of right button click first mouse event after grabInput would be MouseReleased. |
| protected boolean | |
| private ArrayList | items
Array of items. |
| private Color | |
| private static PlatformLogger | log
Hides sun. |
| private XBaseMenuWindow. | mappingData
Mapping data that is filled in getMappedItems function and reset in resetSize function. |
| private static Object | menuTreeLock
Static synchronizational object. |
| private Color | |
| private int | selectedIndex
Index of selected item in array of items |
| private XMenuPeer | showingMousePressedSubmenu
If mouse button is clicked on item showing submenu we have to hide its submenu. |
| private XMenuPeer | showingSubmenu
Specifies currently showing submenu. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv XMenuItemPeer[] | |
| public void | delItem(int
the position of the item to be removed index)Removes item at the specified index from items vector. |
| public void | |
| protected void | |
| pack-priv void | doHandleJavaKeyEvent(KeyEvent event)
Performs handling of java keyboard event Note that this function should be invoked only from root of menu window's hierarchy that grabs input focus |
| pack-priv void | doHandleJavaMouseEvent(MouseEvent mouseEvent)
Performs handling of java mouse event Note that this function should be invoked only from root of menu window's hierarchy that grabs input focus |
| pack-priv void | |
| private void | doShowSubmenu(XMenuPeer
submenu to be shown or null
to hide currently showing submenu submenuToShow)Performs hiding of currently showing submenu and showing of submenuToShow. |
| pack-priv void | draw3DRect(Graphics
the graphics on which to draw g, int the coordinate of left edge in coordinates of graphics x, int the coordinate of top edge in coordinates of graphics y, int the width of rectangle width, int the height of rectangle height, boolean true to draw raised rectangle, false to draw sunken raised)Draws raised or sunken rectangle on specified graphics |
| pack-priv Rectangle | fitWindowAbove(Rectangle
rectangle of item in global coordinates itemBounds, Dimension size of submenu window to fit windowSize, Rectangle size of screen screenBounds)Checks if window fits above specified item returns rectangle that the window fits to or null. |
| pack-priv Rectangle | fitWindowBelow(Rectangle
rectangle of item in global coordinates itemBounds, Dimension size of submenu window to fit windowSize, Rectangle size of screen screenBounds)Checks if window fits below specified item returns rectangle that the window fits to or null. |
| pack-priv Rectangle | fitWindowLeft(Rectangle
rectangle of item in global coordinates itemBounds, Dimension size of submenu window to fit windowSize, Rectangle size of screen screenBounds)Checks if window fits to the left specified item returns rectangle that the window fits to or null. |
| pack-priv Rectangle | fitWindowRight(Rectangle
rectangle of item in global coordinates itemBounds, Dimension size of submenu window to fit windowSize, Rectangle size of screen screenBounds)Checks if window fits to the right specified item returns rectangle that the window fits to or null. |
| pack-priv Rectangle | fitWindowToScreen(Dimension
size of submenu window to fit windowSize, Rectangle size of screen screenBounds)The last thing we can do with the window to fit it on screen - move it to the top-left edge and cut by screen dimensions |
| pack-priv Color | |
| pack-priv GraphicsConfiguration | getCurrentGraphicsConfiguration()
Primitives for getSubmenuBounds These functions are invoked from getSubmenuBounds implementations in different order. |
| pack-priv Color | |
| pack-priv Color | |
| pack-priv XMenuItemPeer | getFirstSelectableItem()
Returns first selectable item This function is intended for clearing selection |
| pack-priv Color | |
| pack-priv XMenuItemPeer | getItem(int
the position of the item to be returned. index)Thread-safely returns item at specified index |
| pack-priv XMenuItemPeer | getItemFromPoint(Point
the point in this window's coordinate system pt)returns item which mapped coordinates contain the specified point, null if none. |
| pack-priv Color | |
| pack-priv XBaseMenuWindow. | getMappingData()
Returns array of mapped items, null if error This function has to be not synchronized and we have to guarantee that we return some MappingData to user. |
| pack-priv static Object | |
| pack-priv XBaseMenuWindow | |
| pack-priv XMenuItemPeer | getNextSelectableItem()
Returns first item after currently selected item that can be selected according to mapping array. |
| protected abstract XBaseMenuWindow | |
| pack-priv XMenuItemPeer | getPrevSelectableItem()
Returns first item before currently selected see getNextSelectableItem() for comments |
| pack-priv XBaseMenuWindow | |
| pack-priv Color | |
| pack-priv XMenuItemPeer | |
| pack-priv XBaseMenuWindow | |
| pack-priv XMenuPeer | |
| protected abstract Rectangle | getSubmenuBounds(Rectangle
the bounding rectangle of item
in local coordinates itemBounds, Dimension the desired size of submenu's window windowSize)Calculates placement of submenu window given bounds of item with submenu and size of submenu window. |
| public boolean | grabInput()
Overrides sun. Save location of pointer for further use then invoke superclass |
| protected void | handleEvent(AWTEvent event)
The implementation of base window performs processing of paint events only. |
| pack-priv void | instantPreInit(XCreateWindowParams params)
Overrides sun. Overrides XBaseWindow.instantPreInit |
| protected boolean | |
| protected abstract XBaseMenuWindow. | |
| pack-priv void | postEvent(final AWTEvent event)
Overrides sun. Invokes event processing on eventHandlerThread This function needs to be overridden since XBaseMenuWindow has no corresponding component so events cannot be processed using standard means |
| pack-priv void | |
| public void | reloadItems(Vector<? extends MenuItem>
vector to be loaded items)Clears items vector and loads specified vector |
| pack-priv void | replaceColors(Color
the color of menu window's
background. backgroundColor)Calculates colors of various elements given background color. |
| pack-priv void | |
| protected void | |
| pack-priv void | selectItem(XMenuItemPeer
the item to be selected, null to clear selection item, boolean if the item is XMenuPeer then its
window is shown/hidden according to this param. showWindowIfMenu)Select specified item and shows/hides submenus if necessary We can not select by index, so we need to select by ref. |
| pack-priv final void | |
| protected abstract void |
| backgroundColor | back to summary |
|---|---|
| private Color backgroundColor | |
| darkShadowColor | back to summary |
|---|---|
| private Color darkShadowColor | |
| disabledColor | back to summary |
|---|---|
| private Color disabledColor | |
| foregroundColor | back to summary |
|---|---|
| private Color foregroundColor | |
| grabInputPoint | back to summary |
|---|---|
| protected Point grabInputPoint If the PopupMenu is invoked as a result of right button click first mouse event after grabInput would be MouseReleased. We need to check if the user has moved mouse after input grab. If yes - hide the PopupMenu. If no - do nothing | |
| hasPointerMoved | back to summary |
|---|---|
| protected boolean hasPointerMoved | |
| items | back to summary |
|---|---|
| private ArrayList<XMenuItemPeer> items Array of items. | |
| lightShadowColor | back to summary |
|---|---|
| private Color lightShadowColor | |
| log | back to summary |
|---|---|
| private static PlatformLogger log Hides sun. Data members | |
| mappingData | back to summary |
|---|---|
| private XBaseMenuWindow. Mapping data that is filled in getMappedItems function and reset in resetSize function. It contains array of items in order that they appear on screen and may contain additional data defined by descendants. | |
| menuTreeLock | back to summary |
|---|---|
| private static Object menuTreeLock Static synchronizational object. Following operations should be synchronized using this object: 1. Access to items vector 2. Access to selection 3. Access to showing menu window member This is lowest level lock, no other locks should be taken when thread own this lock. | |
| selectedColor | back to summary |
|---|---|
| private Color selectedColor | |
| selectedIndex | back to summary |
|---|---|
| private int selectedIndex Index of selected item in array of items | |
| showingMousePressedSubmenu | back to summary |
|---|---|
| private XMenuPeer showingMousePressedSubmenu If mouse button is clicked on item showing submenu we have to hide its submenu. And if mouse button is pressed on such item and dragged to another, getShowingSubmenu() is changed. So this member saves the item that the user presses mouse button on _only_ if it's showing submenu. | |
| showingSubmenu | back to summary |
|---|---|
| private XMenuPeer showingSubmenu Specifies currently showing submenu. | |
| XBaseMenuWindow | back to summary |
|---|---|
| pack-priv XBaseMenuWindow() Construction | |
| addItem | back to summary |
|---|---|
| public void addItem(MenuItem item) Adds item to end of items vector. Note that this function does not perform check for adding duplicate items
| |
| copyItems | back to summary |
|---|---|
| pack-priv XMenuItemPeer[] copyItems() Thread-safely creates a copy of the items vector | |
| delItem | back to summary |
|---|---|
| public void delItem(int index) Removes item at the specified index from items vector.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides sun. Invokes disposal procedure on eventHandlerThread
| |
| doDispose | back to summary |
|---|---|
| protected void doDispose() Performs disposal of menu window. Should be called only on eventHandlerThread | |
| doHandleJavaKeyEvent | back to summary |
|---|---|
| pack-priv void doHandleJavaKeyEvent(KeyEvent event) Performs handling of java keyboard event Note that this function should be invoked only from root of menu window's hierarchy that grabs input focus | |
| doHandleJavaMouseEvent | back to summary |
|---|---|
| pack-priv void doHandleJavaMouseEvent(MouseEvent mouseEvent) Performs handling of java mouse event Note that this function should be invoked only from root of menu window's hierarchy that grabs input focus | |
| doHandleJavaPaintEvent | back to summary |
|---|---|
| pack-priv void doHandleJavaPaintEvent(PaintEvent event) Performs repainting | |
| doShowSubmenu | back to summary |
|---|---|
| private void doShowSubmenu(XMenuPeer submenuToShow) Performs hiding of currently showing submenu and showing of submenuToShow. This function should be executed on eventHandlerThread
| |
| draw3DRect | back to summary |
|---|---|
| pack-priv void draw3DRect(Graphics g, int x, int y, int width, int height, boolean raised) Draws raised or sunken rectangle on specified graphics
| |
| fitWindowAbove | back to summary |
|---|---|
| pack-priv Rectangle fitWindowAbove(Rectangle itemBounds, Dimension windowSize, Rectangle screenBounds) Checks if window fits above specified item returns rectangle that the window fits to or null. | |
| fitWindowBelow | back to summary |
|---|---|
| pack-priv Rectangle fitWindowBelow(Rectangle itemBounds, Dimension windowSize, Rectangle screenBounds) Checks if window fits below specified item returns rectangle that the window fits to or null. | |
| fitWindowLeft | back to summary |
|---|---|
| pack-priv Rectangle fitWindowLeft(Rectangle itemBounds, Dimension windowSize, Rectangle screenBounds) Checks if window fits to the left specified item returns rectangle that the window fits to or null. | |
| fitWindowRight | back to summary |
|---|---|
| pack-priv Rectangle fitWindowRight(Rectangle itemBounds, Dimension windowSize, Rectangle screenBounds) Checks if window fits to the right specified item returns rectangle that the window fits to or null. | |
| fitWindowToScreen | back to summary |
|---|---|
| pack-priv Rectangle fitWindowToScreen(Dimension windowSize, Rectangle screenBounds) The last thing we can do with the window to fit it on screen - move it to the top-left edge and cut by screen dimensions | |
| getBackgroundColor | back to summary |
|---|---|
| pack-priv Color getBackgroundColor() | |
| getCurrentGraphicsConfiguration | back to summary |
|---|---|
| pack-priv GraphicsConfiguration getCurrentGraphicsConfiguration() Primitives for getSubmenuBounds These functions are invoked from getSubmenuBounds implementations in different order. They check if window of size windowSize fits to the specified edge of rectangle itemBounds on the screen of screenSize. Return rectangle that occupies the window if it fits or null. | |
| getDarkShadowColor | back to summary |
|---|---|
| pack-priv Color getDarkShadowColor() | |
| getDisabledColor | back to summary |
|---|---|
| pack-priv Color getDisabledColor() | |
| getFirstSelectableItem | back to summary |
|---|---|
| pack-priv XMenuItemPeer getFirstSelectableItem() Returns first selectable item This function is intended for clearing selection | |
| getForegroundColor | back to summary |
|---|---|
| pack-priv Color getForegroundColor() | |
| getItem | back to summary |
|---|---|
| pack-priv XMenuItemPeer getItem(int index) Thread-safely returns item at specified index
| |
| getItemFromPoint | back to summary |
|---|---|
| pack-priv XMenuItemPeer getItemFromPoint(Point pt) returns item which mapped coordinates contain the specified point, null if none.
| |
| getLightShadowColor | back to summary |
|---|---|
| pack-priv Color getLightShadowColor() | |
| getMappingData | back to summary |
|---|---|
| pack-priv XBaseMenuWindow. Returns array of mapped items, null if error This function has to be not synchronized and we have to guarantee that we return some MappingData to user. It's OK if this.mappingData is replaced meanwhile | |
| getMenuTreeLock | back to summary |
|---|---|
| pack-priv static Object getMenuTreeLock() Returns static lock used for menus | |
| getMenuWindowFromPoint | back to summary |
|---|---|
| pack-priv XBaseMenuWindow getMenuWindowFromPoint(Point pt) Returns window that contains pt. search is started from leaf window to return first window in Z-order
| |
| getNextSelectableItem | back to summary |
|---|---|
| pack-priv XMenuItemPeer getNextSelectableItem() Returns first item after currently selected item that can be selected according to mapping array. (no separators and no disabled items). Currently selected item if it's only selectable, null if no item can be selected | |
| getParentMenuWindow | back to summary |
|---|---|
| protected abstract XBaseMenuWindow getParentMenuWindow() Returns parent menu window (not the X-hierarchy parent window) | |
| getPrevSelectableItem | back to summary |
|---|---|
| pack-priv XMenuItemPeer getPrevSelectableItem() Returns first item before currently selected see getNextSelectableItem() for comments | |
| getRootMenuWindow | back to summary |
|---|---|
| pack-priv XBaseMenuWindow getRootMenuWindow() returns root menu window or this if this window is topmost | |
| getSelectedColor | back to summary |
|---|---|
| pack-priv Color getSelectedColor() | |
| getSelectedItem | back to summary |
|---|---|
| pack-priv XMenuItemPeer getSelectedItem() Thread-safely returns selected item | |
| getShowingLeaf | back to summary |
|---|---|
| pack-priv XBaseMenuWindow getShowingLeaf() returns leaf menu window or this if no children are showing | |
| getShowingSubmenu | back to summary |
|---|---|
| pack-priv XMenuPeer getShowingSubmenu() Returns showing submenu, if any | |
| getSubmenuBounds | back to summary |
|---|---|
| protected abstract Rectangle getSubmenuBounds(Rectangle itemBounds, Dimension windowSize) Calculates placement of submenu window given bounds of item with submenu and size of submenu window. Returns suggested rectangle for submenu window in global coordinates | |
| grabInput | back to summary |
|---|---|
| public boolean grabInput() Overrides sun. Save location of pointer for further use then invoke superclass
| |
| handleEvent | back to summary |
|---|---|
| protected void handleEvent(AWTEvent event) The implementation of base window performs processing of paint events only. This behaviour is changed in descendants. | |
| instantPreInit | back to summary |
|---|---|
| pack-priv void instantPreInit(XCreateWindowParams params) Overrides sun. Overrides XBaseWindow.instantPreInit
| |
| isEventDisabled | back to summary |
|---|---|
| protected boolean isEventDisabled(XEvent e) Overrides sun. Filters X events
| |
| map | back to summary |
|---|---|
| protected abstract XBaseMenuWindow. Performs mapping of items in window. This function creates and fills specific descendant of MappingData and sets mapping coordinates of items This function should return default menu data if errors occur | |
| postEvent | back to summary |
|---|---|
| pack-priv void postEvent(final AWTEvent event) Overrides sun. Invokes event processing on eventHandlerThread This function needs to be overridden since XBaseMenuWindow has no corresponding component so events cannot be processed using standard means
| |
| postPaintEvent | back to summary |
|---|---|
| pack-priv void postPaintEvent() Invokes repaint procedure on eventHandlerThread | |
| reloadItems | back to summary |
|---|---|
| public void reloadItems(Vector<? extends MenuItem> items) Clears items vector and loads specified vector | |
| replaceColors | back to summary |
|---|---|
| pack-priv void replaceColors(Color backgroundColor) Calculates colors of various elements given background color. Uses MotifColorUtilities
| |
| resetColors | back to summary |
|---|---|
| pack-priv void resetColors() This function is called before every painting. Todo It would be better to add PropertyChangeListener to target component TODO:It would be better to access background color not invoking user-overridable function | |
| resetMapping | back to summary |
|---|---|
| protected void resetMapping() This function is called to clear all saved size data. | |
| selectItem | back to summary |
|---|---|
| pack-priv void selectItem(XMenuItemPeer item, boolean showWindowIfMenu) Select specified item and shows/hides submenus if necessary We can not select by index, so we need to select by ref.
| |
| setItemsFont | back to summary |
|---|---|
| pack-priv final void setItemsFont(Font font) | |
| updateSize | back to summary |
|---|---|
| protected abstract void updateSize() This function is to be called if it's likely that size of items was changed. It can be called from any thread in any locked state, so it should not take locks | |
| Modifier and Type | Field and Description |
|---|---|
| private XMenuItemPeer[] | items
Array of item in order that they appear on screen |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| public XMenuItemPeer[] |
| items | back to summary |
|---|---|
| private XMenuItemPeer[] items Array of item in order that they appear on screen | |
| MappingData | back to summary |
|---|---|
| pack-priv MappingData(XMenuItemPeer[] items) Constructs MappingData object with list of menu items | |
| MappingData | back to summary |
|---|---|
| pack-priv MappingData() Constructs MappingData without items This constructor should be used in case of errors | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| getItems | back to summary |
|---|---|
| public XMenuItemPeer[] getItems() | |