Multivalent API

multivalent.node
Class LeafText

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Node
          extended by multivalent.Leaf
              extended by multivalent.node.LeafText
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
FixedLeafOCR, LeafUnicode

public class LeafText
extends Leaf

Superclass for text leaf nodes.

Version:
$Revision: 1.7 $ $Date: 2002/02/02 13:41:40 $

Field Summary
protected  java.lang.String estr_
          Name is Unicode, these are characters encoded according to font that will draw them.
protected static double[] Widths_
          Array of letter x-positions.
 
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
LeafText(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent)
           
LeafText(java.lang.String name, java.lang.String estr, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent)
           
 
Method Summary
 void append(Leaf l)
          Append leaf to the end of this one, adjusting content, spans, and so on.
 void append(java.lang.String text)
           
 void append(java.lang.String text, java.lang.String estr)
           
 void clipboardBeforeAfter(java.lang.StringBuffer sb, int start, int end)
           
 void clipboardNode(java.lang.StringBuffer sb)
          To build up selection, pass a StringBuffer to media-specific leaves, which fill it as appropriate for that medium.
 java.lang.String getText()
          Returns Unicode text.
 java.awt.Point offset2rel(int offset)
          Given an offset into a Leaf, return corresponding subcomponent geometric point.
 int size()
          Number of addressable components in node: number of children in INode, number of letters in text leaf, zero for invisible nodes such as comments, and otherwise usually one (the default).
 void subelementCalc(Context cx)
          Calculates an array of x-position at each letter in word.
 int subelementHit(java.awt.Point rel)
          Given a geometric point within the leaf, return index of corresponding subcomponent (e.g., letter within word).
 
Methods inherited from class multivalent.Leaf
checkRep, copy, cut, delete, dx, dy, eatme, eventBeforeAfter, eventNode, formatBeforeAfter, formatNode, formatNodeContent, getFirstLeaf, getLastLeaf, insert, insert, isLeaf, lengthTo, markDirtySubtreeDown, paintBeforeAfter, paintNode, paintNodeContent, paste, paste, removeTidy, setName, split, subelement
 
Methods inherited from class multivalent.Node
addObserver, addSticky, addSticky, breakAfter, breakBefore, childNum, clipboardBeforeAfter, clone, cmp, commonAncestor, commonAncestor, contains, contains, deleteObserver, dump, dump, dump, findBFS, findBFS, findBFS, findDFS, findDFS, findDFS, findDFS, getAbsLocation, getActivesAt, getActivesAt, getActivesAt, getBbox, getBrowser, getDocument, getElementById, getIScrollPane, getName, getNextLeaf, getNextNode, getNodeName, getObservers, getParentNode, getPrevLeaf, getPrevNode, getRelLocation, getRoot, getSticky, indexSticky, intersects, isStruct, isValid, markDirty, markDirtySubtree, markDirtyTo, morphInto, reformat, remove, removeSticky, removeSticky, 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
 

Field Detail

Widths_

protected static double[] Widths_
Array of letter x-positions.


estr_

protected java.lang.String estr_
Name is Unicode, these are characters encoded according to font that will draw them.

Constructor Detail

LeafText

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

LeafText

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

getText

public java.lang.String getText()
Returns Unicode text.


size

public int size()
Description copied from class: Node
Number of addressable components in node: number of children in INode, number of letters in text leaf, zero for invisible nodes such as comments, and otherwise usually one (the default).

Overrides:
size in class Node

append

public void append(Leaf l)
Description copied from class: Leaf
Append leaf to the end of this one, adjusting content, spans, and so on. The appended leaf must either immediately follow this one in the tree, or be unattached to the tree. The appended leaf should be considered invalid and not used subsequently.

Overrides:
append in class Leaf

append

public void append(java.lang.String text)

append

public void append(java.lang.String text,
                   java.lang.String estr)

clipboardNode

public void clipboardNode(java.lang.StringBuffer sb)
Description copied from class: Node
To build up selection, pass a StringBuffer to media-specific leaves, which fill it as appropriate for that medium. Need to fix this to respect subelement addressing

Overrides:
clipboardNode in class Leaf

clipboardBeforeAfter

public void clipboardBeforeAfter(java.lang.StringBuffer sb,
                                 int start,
                                 int end)
Overrides:
clipboardBeforeAfter in class Leaf

subelementCalc

public void subelementCalc(Context cx)
Calculates an array of x-position at each letter in word.

Overrides:
subelementCalc in class Leaf
Parameters:
cx - is up-to-date for this Node

subelementHit

public int subelementHit(java.awt.Point rel)
Description copied from class: Leaf
Given a geometric point within the leaf, return index of corresponding subcomponent (e.g., letter within word). See offset2rel().

Overrides:
subelementHit in class Leaf

offset2rel

public java.awt.Point offset2rel(int offset)
Description copied from class: Leaf
Given an offset into a Leaf, return corresponding subcomponent geometric point. See offset2rel().

Overrides:
offset2rel in class Leaf

Multivalent API