Multivalent API

multivalent.node
Class FixedI

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Node
          extended by multivalent.INode
              extended by multivalent.node.FixedI
All Implemented Interfaces:
java.lang.Cloneable, Fixed
Direct Known Subclasses:
FixedIHBox, FixedIVBox

public class FixedI
extends INode
implements Fixed

Internal node for use with formats that are already layed out, such as scanned page images, PostScript, PDF, TeX DVI. Identical to INode except for formatting. If children in vertical or horizontal sequence, use FixedIVBox or FixedIHBox. Have to format entire page, rather than just enough to fill the screen, but this is fine as just processing a page or two or three at a time. Children must all be of type Fixed.

Version:
$Revision: 1.5 $ $Date: 2002/06/01 14:24:47 $

Field Summary
protected  java.awt.Rectangle ibbox_
           
 
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_
 
Fields inherited from interface multivalent.node.Fixed
ATTR_REFORMATTED
 
Constructor Summary
FixedI(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent)
           
 
Method Summary
 void dump(int level, int maxlevel)
          Dump more verbose than toString().
static boolean formatNode(INode p, boolean shrinkwrap, int width, int height, Context cx)
          Fixed internal nodes need to be able to format: make children relative, and reposition children in reponse to changing dimensions.
 boolean formatNode(int width, int height, Context cx)
          Add children with original, absolute fixed coordinates.
 java.awt.Rectangle getIbbox()
          An "ibbox", or initial bbox, holds the absolute coordinates vs relative ones in bboxes.
 void reformat(Node dirty)
          High performance reformatting of subtree.
 
Methods inherited from class multivalent.INode
addCategory, appendChild, breakAfter, breakBefore, checkRep, childAt, childNum, clipboardNode, clone, contains, dx, dy, eventBeforeAfter, eventNode, findDFS, formatBeforeAfter, getElementById, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getNextSibling, getPreviousSibling, insertChildAt, isStruct, markDirtySubtreeDown, paintBeforeAfter, paintNode, 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, getIScrollPane, getName, getNextLeaf, getNextNode, getNodeName, getObservers, getParentNode, getPrevLeaf, getPrevNode, getRelLocation, getRoot, getSticky, indexSticky, intersects, isLeaf, isValid, markDirty, markDirtySubtree, markDirtyTo, morphInto, remove, removeSticky, removeSticky, removeTidy, repaint, 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
 
Methods inherited from interface multivalent.node.Fixed
getBbox
 

Field Detail

ibbox_

protected java.awt.Rectangle ibbox_
Constructor Detail

FixedI

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

getIbbox

public java.awt.Rectangle getIbbox()
Description copied from interface: Fixed
An "ibbox", or initial bbox, holds the absolute coordinates vs relative ones in bboxes.

Specified by:
getIbbox in interface Fixed

formatNode

public boolean formatNode(int width,
                          int height,
                          Context cx)
Add children with original, absolute fixed coordinates. (Doesn't work for XDOC and perhaps others as add children before know coordinates XDOC doesn't know size until get fonts and fonts come at the end--so it has to compute ibboxes itself.)

Overrides:
formatNode in class INode
See Also:
FixedI

formatNode

public static boolean formatNode(INode p,
                                 boolean shrinkwrap,
                                 int width,
                                 int height,
                                 Context cx)
Fixed internal nodes need to be able to format: make children relative, and reposition children in reponse to changing dimensions. However, generally they inherit from a primary flowed node, and so can't do reposition by inheritance. This is a generally available (public static) method that formats the passed fixed internal node.

Parameters:
p - Fixed, internal node to format (N.B. fixed not type checked)
shrinkwrap - if true set FixedI's ibbox to just enclose children, if false accept ibbox as is. Usually true but false for FixedIClip.

reformat

public void reformat(Node dirty)
Description copied from class: Node
High performance reformatting of subtree. Edits to the document tree need to reformat the tree to update the display. Ordinarily this is quite efficient. The path from the change to the root is marked dirty, all changes are batch together in a format that happens at the next paint, and during reformatting nodes that are still clean are not reformatted.

However some applications, such as interactive editing and the display of status messages, need the best possible performance. If the range of changes can be bounded in some subtree, such that if the dimensions (width and height) of the subtree remain the same after reformatting, then reformatting can be speeded up. This rules out floats and HTML tables that compute cell widths based on the needs of their contents. (If the new dimensions are not the same, then fall back to the above guaranteed correct but possibly slower reformatting.)

Subclasses override this method for correctness for that node or for greater performance. An HTML table may compute cell widths based on the relative needs of cell contents, and so for correctness, in general, needs a complete reformat of the table. IParaBox can improve performance by skipping over previous words in the paragraph, and stop reformatting if the change fits on the same line.

To use, first Node.setValid(boolean) with false on node that contains all the changes, then make changes in the subtree, and then invoke this method on that node.

Overrides:
reformat in class Node

dump

public void dump(int level,
                 int maxlevel)
Description copied from class: Node
Dump more verbose than toString().

Overrides:
dump in class INode

Multivalent API