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
Class Browser

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      multivalent.Browser

All Implemented Interfaces:
  javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Browser
extends javax.swing.JPanel

This class implements a browser window. It interfaces with the operating systems GUI, holds a document tree with both user interface and content, manages flow of control through associated behaviors according to the protocols, and holds resources shared among all documents in a window. Don't instantiate directly -- use `Multivalent.getBrowser(String)`.

State:

- `browser name`
- mouse location within window (`getCurScrn()`)
- node and offset under mouse (`getCurNode()` and `getCurOffset()`)
- the `grab`
- hooks to `cursor` and `selection span` (at most one of which is valid at a time)
- hook to `offscreen image`
- hook to overall `getRoot()` of GUI and content
- hook to "current" `document`, the one with the focus

Functionality:

- `eventq(AWTEvent)` add event to event queue, either low level or semantic

Browsers do not contain:

- Attributes and variables (these can be put in the `Root`)

Version:
  $Revision: 1.23 $ $Date: 2003/06/02 04:46:57 $
See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`static java.lang.String` | `MSG_CLOSE` Close browser window, safely saving component documents as needed and releasing resources.
`static java.lang.String` | `MSG_CREATE_TOOLBAR` Construct toolbar by passing around to behaviors and letting them add (or delete) entiries.
`static java.lang.String` | `MSG_CREATE_TOOLBAR2` Like `MSG_CREATE_TOOLBAR`, but for a second toolbar, under the first.
`static java.lang.String` | `MSG_NEW` Create new browser window.
`static java.lang.String` | `MSG_STATUS` Another semantic command, which should be given more descriptive name.
`static java.lang.String` | `PROTOCOL_BUILD`
`static java.lang.String` | `PROTOCOL_EVENT`
`static java.lang.String` | `PROTOCOL_FORMAT`
`static java.lang.String` | `PROTOCOL_PAINT`
`static java.lang.String` | `PROTOCOL_REFORMAT`
`static java.lang.String` | `PROTOCOL_RESTORE`
`static java.lang.String` | `PROTOCOL_SEMANTICEVENT`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Method Summary
`java.lang.Object` | `callSemanticEvent(java.lang.String msg, java.lang.Object arg)` Treat mutation (filtering, augmenting, replacing) during semantic event pass as a method.
`boolean` | `checkRep()`
`java.lang.String` | `clipboard()`
`java.lang.String` | `clipboard(Span span)`
`void` | `createBufferStrategy(int numBuffers, java.awt.BufferCapabilities caps)`
`boolean` | `event(java.awt.AWTEvent e)` Process event.
`void` | `eventq(java.awt.AWTEvent e)` There are two types of events: low-level events and semantic events.
`void` | `eventq(java.lang.String message, java.lang.Object arg)` A convenience function for behaviors to create a semantic event and put on event queue.
`void` | `format()` Deprecated.
`Document` | `getCurDocument()` Current Document on which to attach annotations.
`Node` | `getCurNode()` Returns node under the cursor.
`int` | `getCurOffset()` Returns offset within node under the cursor.
`java.awt.Point` | `getCurScrn()` Returns coordinates of mouse cursor, relative to top-level Frame.
`CursorMark` | `getCursorMark()` Returns handle to `cursor`.
`INode` | `getDocRoot()`
`EventListener` | `getGrab()` Returns owner of grab; `null` if none.
`java.lang.String` | `getName()` Return logical internal name of browser window instance.
`java.awt.Image` | `getOffImage()` Returns handle to offscreen `Image` that holds the image of the Browser content.
`java.awt.Dimension` | `getPreferredSize()`
`Root` | `getRoot()` Returns master `Root`, which contains both GUI and perhaps multiple content subdocument.
`INode` | `getScope()` Interactive editing should be done only within subtree rooted here.
`Span` | `getSelectionSpan()` Returns handle to the `selection span`.
`void` | `paintComponent(java.awt.Graphics g_old_api)`
`protected void` | `processEvent(java.awt.AWTEvent e)` Hook into Java's event system
`void` | `releaseGrab(EventListener owner)` Release grab, assuming owner currently has grab.
`void` | `repaint(long ms, int x, int y, int w, int h)`
`void` | `resetProfile()`
`void` | `setBounds(int x, int y, int width, int height)`
`void` | `setCurDocument(Document doc)` Switching from one completely formed independent document tree (Document) to another.
`void` | `setCurNode(Mark m)`
`void` | `setCurNode(Node newnode, int newoffset)` The current node under the cursor, either a Leaf or its corresponding IScrollPane.
`void` | `setGrab(EventListener owner)` Delivers subsequent events directly to , in absolute coordinates.
`void` | `setGrab(EventListener owner, Node relativeTo)` Delivers subsequent events directly to owner, in coordinates relative to relativeTo.
`void` | `setScope(INode scope)`
`void` | `showProfile(java.lang.StringBuffer sb)`
`void` | `showStatusX(java.lang.String label)` Deprecated. in favor of `MSG_STATUS`.
`boolean` | `tickleActives(java.awt.AWTEvent e, java.awt.Point rel, Node obsn)` Used by Leaf (which knows rel) and IHBox and IParaBox.

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

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

Field Detail

### MSG_NEW

    public static final java.lang.String MSG_NEW

  Create new browser window.

  `"newBrowserInstance"`: `arg=` `HashMap` attributes, `in=` `INode` root of tree, `out=`unused.

  See Also:
    Constant Field Values

### MSG_CLOSE

    public static final java.lang.String MSG_CLOSE

  Close browser window, safely saving component documents as needed and releasing resources.

  `"closeBrowserInstance"`: `arg=` `Browser` browser to close

  See Also:
    Constant Field Values

### MSG_STATUS

    public static final java.lang.String MSG_STATUS

  Another semantic command, which should be given more descriptive name.

  `"showStatus"`: `arg=` `String` message-to-show.

  See Also:
    Constant Field Values

### MSG_CREATE_TOOLBAR

    public static final java.lang.String MSG_CREATE_TOOLBAR

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

  `"createWidget/Toolbar"`: `out=` `INode` instance-under-construction.

  See Also:
    Constant Field Values

### MSG_CREATE_TOOLBAR2

    public static final java.lang.String MSG_CREATE_TOOLBAR2

  Like `MSG_CREATE_TOOLBAR`, but for a second toolbar, under the first.

  See Also:
    Constant Field Values

### PROTOCOL_RESTORE

    public static final java.lang.String PROTOCOL_RESTORE

See Also:
  Constant Field Values

### PROTOCOL_BUILD

    public static final java.lang.String PROTOCOL_BUILD

See Also:
  Constant Field Values

### PROTOCOL_FORMAT

    public static final java.lang.String PROTOCOL_FORMAT

See Also:
  Constant Field Values

### PROTOCOL_REFORMAT

    public static final java.lang.String PROTOCOL_REFORMAT

See Also:
  Constant Field Values

### PROTOCOL_PAINT

    public static final java.lang.String PROTOCOL_PAINT

See Also:
  Constant Field Values

### PROTOCOL_EVENT

    public static final java.lang.String PROTOCOL_EVENT

See Also:
  Constant Field Values

### PROTOCOL_SEMANTICEVENT

    public static final java.lang.String PROTOCOL_SEMANTICEVENT

See Also:
  Constant Field Values

Method Detail

### getPreferredSize

    public java.awt.Dimension getPreferredSize()

  Overrides:
    `getPreferredSize` in class `javax.swing.JComponent`

### setBounds

    public void setBounds(int x,
                          int y,
                          int width,
                          int height)

  Overrides:
    `setBounds` in class `java.awt.Component`

### createBufferStrategy

    public void createBufferStrategy(int numBuffers,
                                     java.awt.BufferCapabilities caps)
                              throws java.awt.AWTException

  Throws:
    `java.awt.AWTException`

### getName

    public java.lang.String getName()

  Return logical internal name of browser window instance.

  Overrides:
    `getName` in class `java.awt.Component`

### getOffImage

    public java.awt.Image getOffImage()

  Returns handle to offscreen `Image` that holds the image of the Browser content. This can be used for special effects: BitMagnify redraws the portion of the page at a different scale. Interactive drawing tools could quickly re-establish the background as the user moves some object or adjusts a line (draw on `Image.getGraphics()`).

### getRoot

    public Root getRoot()

  Returns master `Root`, which contains both GUI and perhaps multiple content subdocument.

### getDocRoot

    public INode getDocRoot()

### getSelectionSpan

    public Span getSelectionSpan()

  Returns handle to the `selection span`. Check `Span.isSet()` to see if presently set or not.

### getCursorMark

    public CursorMark getCursorMark()

  Returns handle to `cursor`.

### getScope

    public INode getScope()

  Interactive editing should be done only within subtree rooted here. So, if null, no editing.

### setScope

    public void setScope(INode scope)

### getCurNode

    public Node getCurNode()

  Returns node under the cursor.

### getCurOffset

    public int getCurOffset()

  Returns offset within node under the cursor.

### setCurNode

    public void setCurNode(Mark m)

### setCurNode

    public void setCurNode(Node newnode,
                           int newoffset)

  The current node under the cursor, either a Leaf or its corresponding IScrollPane.

### getCurScrn

    public java.awt.Point getCurScrn()

  Returns coordinates of mouse cursor, relative to top-level Frame.

### getCurDocument

    public Document getCurDocument()

  Current Document on which to attach annotations. While an Document's document tree is being built, it is not the current Document.

### setCurDocument

    public void setCurDocument(Document doc)

  Switching from one completely formed independent document tree (Document) to another. Make this an event (instead of or in addition), so other things can hook in.

### showStatusX

    public final void showStatusX(java.lang.String label)

  Deprecated. in favor of `MSG_STATUS`.

### format

    public void format()

  Deprecated.

  FORMAT - geometrically place doc tree elements. In depth-first tree traversal, call observing behaviors in each node in priority order. Default/lowest priority is implicitly the flow layout. Specialized formatters, e.g., CSS, can intercept and prevent subsequent action.

### repaint

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

  Overrides:
    `repaint` in class `javax.swing.JComponent`

### paintComponent

    public void paintComponent(java.awt.Graphics g_old_api)

  Overrides:
    `paintComponent` in class `javax.swing.JComponent`

### tickleActives

    public boolean tickleActives(java.awt.AWTEvent e,
                                 java.awt.Point rel,
                                 Node obsn)

  Used by Leaf (which knows rel) and IHBox and IParaBox.

### callSemanticEvent

    public java.lang.Object callSemanticEvent(java.lang.String msg,
                                              java.lang.Object arg)

  Treat mutation (filtering, augmenting, replacing) during semantic event pass as a method. Usually semantic events are fired via eventq().

  Returns:
    the mutated clientData.

### processEvent

    protected void processEvent(java.awt.AWTEvent e)

  Hook into Java's event system. Event propagation within Multivalent is unrelated to however Java does it.

  Overrides:
    `processEvent` in class `java.awt.Container`

### eventq

    public void eventq(java.awt.AWTEvent e)

  There are two types of events: low-level events and semantic events. Both are handled here, though only low-level events are described here. May want to allow nesting only for SemanticEvent's, as that's all we're set up to withstand now.

  See Also:
    `SemanticEvent`

### eventq

    public void eventq(java.lang.String message,
                       java.lang.Object arg)

  A convenience function for behaviors to create a semantic event and put on event queue. Use this in preferences to `event(AWTEvent)` whenever possible!

### event

    public boolean event(java.awt.AWTEvent e)

  Process event. Most events should be added to the event queue with `eventq()`, instead on demanding instant attention.

### getGrab

    public EventListener getGrab()

  Returns owner of grab; `null` if none.

### setGrab

    public void setGrab(EventListener owner)

  Delivers subsequent events directly to , in absolute coordinates. Won't set grab if it already has an owner.

### setGrab

    public void setGrab(EventListener owner,
                        Node relativeTo)

  Delivers subsequent events directly to owner, in coordinates relative to relativeTo. Won't set grab if it already has an owner.

### releaseGrab

    public void releaseGrab(EventListener owner)

  Release grab, assuming owner currently has grab. For unusual circumstances, it's possible to steal the grab by sending `getGrab()`.

### clipboard

    public java.lang.String clipboard()

### clipboard

    public java.lang.String clipboard(Span span)

### checkRep

    public boolean checkRep()

### resetProfile

    public void resetProfile()

### showProfile

    public void showProfile(java.lang.StringBuffer sb)

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