multivalent

Class Browser

public class Browser extends 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 getBrowser.

State:

Functionality:

Browsers do not contain:

Version: $Revision: 1.23 $ $Date: 2003/06/02 04:46:57 $

Field Summary
static StringMSG_CLOSE
Close browser window, safely saving component documents as needed and releasing resources.
static StringMSG_CREATE_TOOLBAR
Construct toolbar by passing around to behaviors and letting them add (or delete) entiries.
static StringMSG_CREATE_TOOLBAR2
Like MSG_CREATE_TOOLBAR, but for a second toolbar, under the first.
static StringMSG_NEW
Create new browser window.
static StringMSG_STATUS
Another semantic command, which should be given more descriptive name.
static StringPROTOCOL_BUILD
static StringPROTOCOL_EVENT
static StringPROTOCOL_FORMAT
static StringPROTOCOL_PAINT
static StringPROTOCOL_REFORMAT
static StringPROTOCOL_RESTORE
static StringPROTOCOL_SEMANTICEVENT
Method Summary
ObjectcallSemanticEvent(String msg, Object arg)
Treat mutation (filtering, augmenting, replacing) during semantic event pass as a method.
booleancheckRep()
Stringclipboard()
Stringclipboard(Span span)
voidcreateBufferStrategy(int numBuffers, BufferCapabilities caps)
booleanevent(AWTEvent e)
Process event.
voideventq(AWTEvent e)
There are two types of events: low-level events and semantic events.
voideventq(String message, Object arg)
A convenience function for behaviors to create a semantic event and put on event queue.
voidformat()
FORMAT - geometrically place doc tree elements.
DocumentgetCurDocument()
Current Document on which to attach annotations.
NodegetCurNode()
Returns node under the cursor.
intgetCurOffset()
Returns offset within node under the cursor.
PointgetCurScrn()
Returns coordinates of mouse cursor, relative to top-level Frame.
CursorMarkgetCursorMark()
Returns handle to cursor.
INodegetDocRoot()
EventListenergetGrab()
Returns owner of grab; null if none.
StringgetName()
Return logical internal name of browser window instance.
ImagegetOffImage()
Returns handle to offscreen java.awt.Image that holds the image of the Browser content.
DimensiongetPreferredSize()
RootgetRoot()
Returns master Root, which contains both GUI and perhaps multiple content subdocument.
INodegetScope()
Interactive editing should be done only within subtree rooted here.
SpangetSelectionSpan()
Returns handle to the selection span.
voidpaint(Graphics g_old_api)
protected voidprocessEvent(AWTEvent e)
Hook into Java's event system
voidreleaseGrab(EventListener owner)
Release grab, assuming owner currently has grab.
voidresetProfile()
voidsetBounds(int x, int y, int width, int height)
voidsetCurDocument(Document doc)
Switching from one completely formed independent document tree (Document) to another.
voidsetCurNode(Mark m)
voidsetCurNode(Node newnode, int newoffset)
The current node under the cursor, either a Leaf or its corresponding IScrollPane.
voidsetGrab(EventListener owner)
Delivers subsequent events directly to , in absolute coordinates.
voidsetGrab(EventListener owner, Node relativeTo)
Delivers subsequent events directly to owner, in coordinates relative to relativeTo.
voidsetScope(INode scope)
voidshowProfile(StringBuffer sb)
voidshowStatusX(String label)
booleantickleActives(AWTEvent e, Point rel, Node obsn)
Used by Leaf (which knows rel) and IHBox and IParaBox.

Field Detail

MSG_CLOSE

public static final String MSG_CLOSE
Close browser window, safely saving component documents as needed and releasing resources.

"closeBrowserInstance": arg= Browser browser to close

MSG_CREATE_TOOLBAR

public static final 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.

MSG_CREATE_TOOLBAR2

public static final String MSG_CREATE_TOOLBAR2
Like MSG_CREATE_TOOLBAR, but for a second toolbar, under the first.

MSG_NEW

public static final String MSG_NEW
Create new browser window.

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

MSG_STATUS

public static final String MSG_STATUS
Another semantic command, which should be given more descriptive name.

"showStatus": arg= java.lang.String message-to-show.

PROTOCOL_BUILD

public static final String PROTOCOL_BUILD

PROTOCOL_EVENT

public static final String PROTOCOL_EVENT

PROTOCOL_FORMAT

public static final String PROTOCOL_FORMAT

PROTOCOL_PAINT

public static final String PROTOCOL_PAINT

PROTOCOL_REFORMAT

public static final String PROTOCOL_REFORMAT

PROTOCOL_RESTORE

public static final String PROTOCOL_RESTORE

PROTOCOL_SEMANTICEVENT

public static final String PROTOCOL_SEMANTICEVENT

Method Detail

callSemanticEvent

public Object callSemanticEvent(String msg, 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.

checkRep

public boolean checkRep()

clipboard

public String clipboard()

clipboard

public String clipboard(Span span)

createBufferStrategy

public void createBufferStrategy(int numBuffers, BufferCapabilities caps)

event

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

eventq

public void eventq(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(String message, Object arg)
A convenience function for behaviors to create a semantic event and put on event queue. Use this in preferences to event() whenever possible!

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.

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.

getCurNode

public Node getCurNode()
Returns node under the cursor.

getCurOffset

public int getCurOffset()
Returns offset within node under the cursor.

getCurScrn

public Point getCurScrn()
Returns coordinates of mouse cursor, relative to top-level Frame.

getCursorMark

public CursorMark getCursorMark()
Returns handle to cursor.

getDocRoot

public INode getDocRoot()

getGrab

public EventListener getGrab()
Returns owner of grab; null if none.

getName

public String getName()
Return logical internal name of browser window instance.

getOffImage

public Image getOffImage()
Returns handle to offscreen java.awt.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 java.awt.Image#getGraphics()).

getPreferredSize

public Dimension getPreferredSize()

getRoot

public Root getRoot()
Returns master Root, which contains both GUI and perhaps multiple content subdocument.

getScope

public INode getScope()
Interactive editing should be done only within subtree rooted here. So, if null, no editing.

getSelectionSpan

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

paint

public void paint(Graphics g_old_api)

processEvent

protected void processEvent(AWTEvent e)
Hook into Java's event system. Event propagation within Multivalent is unrelated to however Java does it.

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.

resetProfile

public void resetProfile()

setBounds

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

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.

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.

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.

setScope

public void setScope(INode scope)

showProfile

public void showProfile(StringBuffer sb)

showStatusX

public final void showStatusX(String label)

Deprecated: in favor of MSG_STATUS.

tickleActives

public boolean tickleActives(AWTEvent e, Point rel, Node obsn)
Used by Leaf (which knows rel) and IHBox and IParaBox.