Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## multivalent.gui
Class VMenu

    java.lang.Object
      multivalent.VObject
          multivalent.Node
              multivalent.INode
                  multivalent.IScrollPane
                      multivalent.gui.VMenu

All Implemented Interfaces:
  java.lang.Cloneable, EventListener, java.util.EventListener

public class VMenu
extends IScrollPane
implements EventListener

Pure Multivalent menu widget. Like IVBox + IScrollPane. Connect to VMenuButton for pulldown or popup, invoke post()/unpost() externally for popup anywhere, or embed in document for List-type widget.

As children you can have any kind of node: VButton/VCheckButton/VRadioButton, IHBox for HTML OPTIONs, or VMenuButton for cascaded menus. In other words, there is no need for a separate group of MenuItem widgets. As mentioned on the package-wide description, since Multivalent widgets can have arbitrary content, having, say, a menu item with a image and text is easy.

If selected item has VScript in "script" attribute, it's executed upon selection.

Version:
  $Revision: 1.13 $ $Date: 2003/06/02 05:19:13 $

Field Summary
`static java.lang.String` | `CATEGORY_MEDIUM` Menu category (`medium`) for medium-specific options (where medium is PDF, HTML, DirectoryLocal, ...).
`static int` | `Maxsize` Maximum number of items to show at once (more uses scrolling).
`static java.lang.String` | `MSG_CREATE_ANNO` Construct Anno menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_BOOKMARK` Construct Bookmark menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_EDIT` Construct Edit menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_FILE` Construct File menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_GO` Construct Go menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_HELP` Construct Help menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_LENS` Construct Lens menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_STYLE` Construct Style menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_VIEW` Construct View menu by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `VAR_MENUSTACK` Key into Root's globals to get ordered List<> of menus currently posted.

Fields inherited from class multivalent.IScrollPane
`editable, hchars_, ibbox, MSG_FORMATTED, MSG_SCROLL_TO, wchars_`

Fields inherited from class multivalent.INode
`border, INSETS, INSETS_ZERO, margin, padding`

Fields inherited from class multivalent.Node
`align, ALIGN_INVALID, ATTR_ID, ATTR_SCRIPT, baseline, BASELINE, bbox, BOTH, BOTTOM, CENTER, CHAR, FILL, floats, INHERIT, JUSTIFY, LEFT, MAXNONSTRUCTDEPTH, MIDDLE, name_, NONE, observers_, parent_, PROBEWIDTH, RIGHT, sticky_, stickycnt_, TOP, valid_, valign`

Fields inherited from class multivalent.VObject
`attr_`

Constructor Summary
`VMenu(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent)`

Method Summary
`Node` | `addCategory(Node n, java.lang.String category)` Immediate subtrees of menu are categories: named `VSeparator`'s used to cluster items from disparate behaviors.
`void` | `event(java.awt.AWTEvent e)` Posted with grab,
`boolean` | `eventBeforeAfter(java.awt.AWTEvent e, java.awt.Point rel)` Lets events pass through so disable behavior works.
`boolean` | `formatNode(int width, int height, Context cx)` Like a IVBox, except is max of children (which are menitems).
`Node` | `getSelected()`
`void` | `invoke()` Execute active item's script, if any.
`void` | `paintNode(java.awt.Rectangle docclip, Context cx)` Paints contents in scrolled, clipped `Graphics2D`.
`void` | `post(int x, int y, Browser br)` Show on screen by disconnecting from (old) parent and adding to root (which is in absolutely positioned space).
`void` | `repaint(long ms, int x, int y, int w, int h)` Redraw portion of node within ms milliseconds.
`void` | `setSelected(Node n)` Use `invoke()` to execute any associated script.
`void` | `unpost()` Unshow by removing from root and reconnecting to old parent (if any).

Methods inherited from class multivalent.IScrollPane
`checkRep, dump, dx, dy, eventNode, getHsb, getIScrollPane, getVsb, paintBeforeAfter, scrollBy, scrollTo, scrollTo, setScrollbarShowPolicy, setSizeChars`

Methods inherited from class multivalent.INode
`appendChild, breakAfter, breakBefore, childAt, childNum, clipboardNode, clone, contains, findDFS, formatBeforeAfter, getElementById, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getNextSibling, getPreviousSibling, insertChildAt, isStruct, markDirtySubtreeDown, removeAllChildren, removeChild, removeChildAt, setChildAt, setName, size, structChildAt, structChildNum, structsize`

Methods inherited from class multivalent.Node
`addObserver, addSticky, addSticky, childNum, clipboardBeforeAfter, cmp, commonAncestor, commonAncestor, contains, deleteObserver, dump, dump, findBFS, findBFS, findBFS, findDFS, findDFS, findDFS, getAbsLocation, getActivesAt, getActivesAt, getActivesAt, getBbox, getBrowser, getDocument, getName, getNextLeaf, getNextNode, getNodeName, getObservers, getParentNode, getPrevLeaf, getPrevNode, getRelLocation, getRoot, getSticky, indexSticky, intersects, isLeaf, isValid, markDirty, markDirtySubtree, markDirtyTo, morphInto, reformat, remove, removeSticky, removeSticky, removeTidy, repaint, repaint, repaint, scrollTo, scrollTo, setParentNode, setValid, sizeSticky, spanChunky, spanChunky, structChildNum, toString`

Methods inherited from class multivalent.VObject
`attrEntrySetIterator, attrKeysIterator, clearAttributes, getAttr, getAttr, getAttributes, getGlobal, getValue, hasAttributes, putAttr, removeAttr, setAttributes`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### MSG_CREATE_FILE

    public static final java.lang.String MSG_CREATE_FILE

  Construct File menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/File"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_EDIT

    public static final java.lang.String MSG_CREATE_EDIT

  Construct Edit menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Edit"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_GO

    public static final java.lang.String MSG_CREATE_GO

  Construct Go menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Go"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_BOOKMARK

    public static final java.lang.String MSG_CREATE_BOOKMARK

  Construct Bookmark menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Bookmark"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_LENS

    public static final java.lang.String MSG_CREATE_LENS

  Construct Lens menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Lens"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_STYLE

    public static final java.lang.String MSG_CREATE_STYLE

  Construct Style menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Style"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_ANNO

    public static final java.lang.String MSG_CREATE_ANNO

  Construct Anno menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Anno"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_VIEW

    public static final java.lang.String MSG_CREATE_VIEW

  Construct View menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/View"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_HELP

    public static final java.lang.String MSG_CREATE_HELP

  Construct Help menu by passing around to behaviors and letting them add (or delete) entiries.

  `"createWidget/Help"`: `out=` `VMenu` instance-under-construction.

  See Also:
    Constant Field Values

### CATEGORY_MEDIUM

    public static final java.lang.String CATEGORY_MEDIUM

  Menu category (`medium`) for medium-specific options (where medium is PDF, HTML, DirectoryLocal, ...).

  See Also:
    Constant Field Values

### VAR_MENUSTACK

    public static final java.lang.String VAR_MENUSTACK

  Key into Root's globals to get ordered List<> of menus currently posted.

  See Also:
    Constant Field Values

### Maxsize

    public static int Maxsize

  Maximum number of items to show at once (more uses scrolling).

Constructor Detail

### VMenu

    public VMenu(java.lang.String name,
                 java.util.Map<java.lang.String,java.lang.Object> attr,
                 INode parent)

Method Detail

### addCategory

    public Node addCategory(Node n,
                            java.lang.String category)

  Immediate subtrees of menu are categories: named `VSeparator`'s used to cluster items from disparate behaviors. If category doesn't exist, it's created. If category is `null`, item is appended to end of menu.

  Overrides:
    `addCategory` in class `INode`

### getSelected

    public Node getSelected()

### setSelected

    public void setSelected(Node n)

  Use `invoke()` to execute any associated script.

### formatNode

    public boolean formatNode(int width,
                              int height,
                              Context cx)

  Like a IVBox, except is max of children (which are menitems).

  Overrides:
    `formatNode` in class `IScrollPane`
  See Also:
    `FixedI`

### paintNode

    public void paintNode(java.awt.Rectangle docclip,
                          Context cx)

  Description copied from class: `IScrollPane`
  Paints contents in scrolled, clipped `Graphics2D`.

  Overrides:
    `paintNode` in class `IScrollPane`

### post

    public void post(int x,
                     int y,
                     Browser br)

  Show on screen by disconnecting from (old) parent and adding to root (which is in absolutely positioned space). Independent of mouse clicks. Menu is not necessarily posted, as when used a list widget embedded in content space. Subclasses can dynamically construct menu contents by overriding with construction code and calling super.post(int, int, Browser); the forward/backward buttons and bookmarks do this.

  See Also:
    `ForwardBack`, `Bookmark`

### unpost

    public void unpost()

  Unshow by removing from root and reconnecting to old parent (if any). Independent of mouse clicks.

### eventBeforeAfter

    public boolean eventBeforeAfter(java.awt.AWTEvent e,
                                    java.awt.Point rel)

  Lets events pass through so disable behavior works.

  Overrides:
    `eventBeforeAfter` in class `INode`

### event

    public void event(java.awt.AWTEvent e)

  Posted with grab,

  Specified by:
    `event` in interface `EventListener`

### invoke

    public void invoke()

  Execute active item's script, if any.

### repaint

    public void repaint(long ms,
                        int x,
                        int y,
                        int w,
                        int h)

  Description copied from class: `Node`
  Redraw portion of node within ms milliseconds. Translates coordinates from relative to screen as ascend tree. Like java.awt.Component's repaint().

  Overrides:
    `repaint` in class `Node`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD