multivalent

Class Document

public class Document extends IScrollPane

An independent document, generally with content subtree, stylesheet, java.net.URI URI (not java.net.URL URL), Layers of behaviors that implementing genre- or document-specific functionality, and document-wide variables. Documents can contain other documents, as for a HTML FRAMESET. The topmost containing document is the Root, of which there is exactly one in a Browser.

Documents contain:

Version: $Revision: 1.8 $ $Date: 2003/06/02 05:04:14 $

Field Summary
static StringATTR_AUTHOR
Document author.
static StringATTR_GENRE
Document genre, such as "HTML" or "ManualPage".
static StringATTR_LOADING
Non-null while loading is in progress.
static StringATTR_PAGE
Attribute in Document giving current page number in a multipage document.
static StringATTR_PAGECOUNT
Attribute in Document giving number of pages in a multipage document.
static StringATTR_STOP
Non-null if loading has been aborted.
static StringATTR_TITLE
Document title.
static StringATTR_URI
Document URI.
static StringMSG_BUILD
Request build of document, which comes after successful open.
static StringMSG_CLOSE
Close current document, stopping loading if necessary, saving annotations and so on.
static StringMSG_CURRENT
Announce document has taken the active one, taking the focus.
static StringMSG_FORMATTED
Announce document has been formatted, which means all geometric posisions are valid.
static StringMSG_OPEN
Open new document; if this is the a different point in the current document, a shortcut may bypass "openedDocument"
static StringMSG_OPENED
Announce opening of document has finished, before it has been formatted (completely -- there may be incremental displays)
static StringMSG_REDIRECTED
Announce a redirection has taken place.
static StringMSG_REFORMAT
Request reformat of "current" document.
static StringMSG_RELOAD
Create new browser window.
static StringMSG_REPAINT
Request repaint of "current" document, which will invoke reformat if document layout is dirty.
static StringMSG_STOP
Stop loading of current document.
protected StyleSheetstyleSheet_
URIuri
???
static StringVAR_HEADERS
Key to java.util.Map of HTTP headers (perhaps simulated if loading from file system).
Constructor Summary
Document(String name, Map<String,Object> attr, INode parent)
Document(String name, Map<String,Object> attr, INode parent, Browser br)
Method Summary
booleancheckRep()
voidclear()
Clean up state (globals, children, ...), destroy genre and document-specific behaviors, and recursively close sub-Documents.
booleaneventNode(AWTEvent e, Point rel)
On mouse click, set this document to the current one.
booleanformatBeforeAfter(int width, int height, Context cx)
Documents have own StyleSheet and associated Context.
booleanformatNode(int width, int height, Context cx)
BrowsergetBrowser()
DocumentgetDocument()
End Node's chain up tree by returning this.
LayergetLayer(String name)
Convenience method for getLayers plus getInstance.
LayergetLayers()
Returns the topmost layer, which holds useful layers (system, genre, annotations, ...).
MediaAdaptorgetMediaAdaptor()
Returns (primary) media adaptor that created document tree.
RootgetRoot()
StyleSheetgetStyleSheet()
URIgetURI()
ObjectgetVar(Object key)
INodegetVisualLayer(String name)
Returns visual layer of passed name, creating if necessary
INodegetVisualLayer(String name, String classname)
voidpaintBeforeAfter(Rectangle docclip, Context cx)
Substitutes own StyleSheet and associated Context in place of one in prevailing Context.
voidpaintNode(Rectangle docclip, Context cx)
voidputVar(Object key, Object val)
voidremoveVar(Object key)
voidsetMediaAdaptor(MediaAdaptor me)
voidsetParentNode(INode p)
voidsetStyleSheet(StyleSheet ss)

Field Detail

ATTR_AUTHOR

public static final String ATTR_AUTHOR
Document author.

ATTR_GENRE

public static final String ATTR_GENRE
Document genre, such as "HTML" or "ManualPage".

ATTR_LOADING

public static final String ATTR_LOADING
Non-null while loading is in progress.

ATTR_PAGE

public static final String ATTR_PAGE
Attribute in Document giving current page number in a multipage document. Pages are logically numbered starting from 1 to total-pages inclusive, regardless of "printed" page numbers. Media adaptors translate between this and their internal numbering scheme.

ATTR_PAGECOUNT

public static final String ATTR_PAGECOUNT
Attribute in Document giving number of pages in a multipage document. This is set by the media adaptor, if intrinsic to the document (as in DVI, PDF), or otherwise must be set in a hub.

ATTR_STOP

public static final String ATTR_STOP
Non-null if loading has been aborted. Document is left in a partially loaded state. Behaviors that depend on a well-formed document should abort.

ATTR_TITLE

public static final String ATTR_TITLE
Document title.

ATTR_URI

public static final String ATTR_URI
Document URI.

MSG_BUILD

public static final String MSG_BUILD
Request build of document, which comes after successful open.

"buildDocument": arg= Document instance

MSG_CLOSE

public static final String MSG_CLOSE
Close current document, stopping loading if necessary, saving annotations and so on. Document data structures can then be safely destroyed.

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

MSG_CURRENT

public static final String MSG_CURRENT
Announce document has taken the active one, taking the focus.

"currentDocument": arg= Document instance.

See Also: setCurDocument

MSG_FORMATTED

public static final String MSG_FORMATTED
Announce document has been formatted, which means all geometric posisions are valid.

"formattedDocument": arg= Document instance.

MSG_OPEN

public static final String MSG_OPEN
Open new document; if this is the a different point in the current document, a shortcut may bypass "openedDocument".

"openDocument": arg= java.util.HashMap null - same as reload
"openDocument": arg= java.lang.String URI to open - translated into...
"openDocument": arg= java.net.URL URI to open - translated into...
"openDocument": arg= java.net.URI URI to open - translated into..., replacing the current document
"openDocument": arg= DocInfo URI, document to replace, and other details - final form of all "openDocument"'s

MSG_OPENED

public static final String MSG_OPENED
Announce opening of document has finished, before it has been formatted (completely -- there may be incremental displays).

"openedDocument": arg= DocInfo data of document just opened

MSG_REDIRECTED

public static final String MSG_REDIRECTED
Announce a redirection has taken place.

"redirectedDocument": arg= URI of new address, as in MSG_OPEN

MSG_REFORMAT

public static final String MSG_REFORMAT
Request reformat of "current" document.

"reloadDocument": arg= java.net.URI location of hub

MSG_RELOAD

public static final String MSG_RELOAD
Create new browser window.

"reloadDocument": arg= Node replace this document, or current document if null.

MSG_REPAINT

public static final String MSG_REPAINT
Request repaint of "current" document, which will invoke reformat if document layout is dirty.

"repaintDocument": arg= java.net.URI location of hub

MSG_STOP

public static final String MSG_STOP
Stop loading of current document.

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

styleSheet_

protected StyleSheet styleSheet_

uri

public URI uri
??? Actual URI of content, after redirects and whatever else, as opposed to logical URI which is an attribute. ??? Used when saving, and as base for relative URIs.

VAR_HEADERS

public static final String VAR_HEADERS
Key to java.util.Map of HTTP headers (perhaps simulated if loading from file system).

Constructor Detail

Document

public Document(String name, Map<String,Object> attr, INode parent)

Document

public Document(String name, Map<String,Object> attr, INode parent, Browser br)

Method Detail

checkRep

public boolean checkRep()

clear

public void clear()
Clean up state (globals, children, ...), destroy genre and document-specific behaviors, and recursively close sub-Documents. Whatever saving needs to be done should have already taken place.

eventNode

public boolean eventNode(AWTEvent e, Point rel)
On mouse click, set this document to the current one. Have to do this before behaviors that would rely on document being set so right behaviors get called, which means can't do it in BindingsDefault because that would be too late, and can't do in BindingsDefault.eventBefore() because don't know right document.

formatBeforeAfter

public boolean formatBeforeAfter(int width, int height, Context cx)
Documents have own StyleSheet and associated Context.

formatNode

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

getBrowser

public Browser getBrowser()

getDocument

public Document getDocument()
End Node's chain up tree by returning this.

getLayer

public Layer getLayer(String name)
Convenience method for getLayers plus getInstance.

getLayers

public Layer getLayers()
Returns the topmost layer, which holds useful layers (system, genre, annotations, ...).

getMediaAdaptor

public MediaAdaptor getMediaAdaptor()
Returns (primary) media adaptor that created document tree.

getRoot

public Root getRoot()

getStyleSheet

public StyleSheet getStyleSheet()

getURI

public URI getURI()

getVar

public final Object getVar(Object key)

getVisualLayer

public INode getVisualLayer(String name)

Deprecated: visual layers not special

Returns visual layer of passed name, creating if necessary. Maybe move this to IScrollPane.

getVisualLayer

public INode getVisualLayer(String name, String classname)

paintBeforeAfter

public void paintBeforeAfter(Rectangle docclip, Context cx)
Substitutes own StyleSheet and associated Context in place of one in prevailing Context.

paintNode

public void paintNode(Rectangle docclip, Context cx)

putVar

public final void putVar(Object key, Object val)

removeVar

public final void removeVar(Object key)

setMediaAdaptor

public void setMediaAdaptor(MediaAdaptor me)

setParentNode

public void setParentNode(INode p)

setStyleSheet

public void setStyleSheet(StyleSheet ss)