multivalent.node
Class LeafShape
java.lang.Object
multivalent.VObject
multivalent.Node
multivalent.Leaf
multivalent.node.LeafShape
- All Implemented Interfaces:
- java.lang.Cloneable
- Direct Known Subclasses:
- FixedLeafShape
- public class LeafShape
- extends Leaf
Holds a Shape
, which is painted stroked or filled or both.
- Version:
- $Revision: 1.3 $ $Date: 2002/09/27 23:37:04 $
Field Summary |
protected boolean |
fill_
|
protected java.awt.Shape |
shape_
|
protected boolean |
stroke_
|
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 |
Constructor Summary |
LeafShape(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> attr,
INode parent,
java.awt.Shape shape,
boolean stroke,
boolean fill)
|
Method Summary |
boolean |
eventNode(java.awt.AWTEvent e,
java.awt.Point rel)
Shapes can interfere with text -- consider a diagonal line across the page and its large rectangular bounding box,
so on the one hand we want to ignore them. |
boolean |
formatNode(int width,
int height,
Context cx)
Handles span transitions on node and elided portions. |
java.awt.Shape |
getShape()
Returns shape (not a copy). |
boolean |
isFill()
|
boolean |
isStroke()
|
boolean |
paintNodeContent(Context cx,
int start,
int end)
Fill, then stroke shape. |
void |
setFill(boolean b)
|
void |
setStroke(boolean b)
|
Methods inherited from class multivalent.Leaf |
append, checkRep, clipboardBeforeAfter, clipboardNode, copy, cut, delete, dx, dy, eatme, eventBeforeAfter, formatBeforeAfter, formatNodeContent, getFirstLeaf, getLastLeaf, insert, insert, isLeaf, lengthTo, markDirtySubtreeDown, offset2rel, paintBeforeAfter, paintNode, paste, paste, removeTidy, setName, split, subelement, subelementCalc, subelementHit |
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, size, 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 |
shape_
protected java.awt.Shape shape_
stroke_
protected boolean stroke_
fill_
protected boolean fill_
LeafShape
public LeafShape(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> attr,
INode parent,
java.awt.Shape shape,
boolean stroke,
boolean fill)
getShape
public java.awt.Shape getShape()
- Returns shape (not a copy).
isStroke
public boolean isStroke()
setStroke
public void setStroke(boolean b)
isFill
public boolean isFill()
setFill
public void setFill(boolean b)
formatNode
public boolean formatNode(int width,
int height,
Context cx)
- Description copied from class:
Leaf
- Handles span transitions on node and elided portions.
Called medium-specific leaf formatNodeContent in hunks of maximum-length homogeneous span coverage to get content size.
Marks node valid, so if node not (e.g., LeafImage's image not loaded), set valid_=false in formatNodeContent.
- Overrides:
formatNode
in class Leaf
paintNodeContent
public boolean paintNodeContent(Context cx,
int start,
int end)
- Fill, then stroke shape.
- Overrides:
paintNodeContent
in class Leaf
eventNode
public boolean eventNode(java.awt.AWTEvent e,
java.awt.Point rel)
- Shapes can interfere with text -- consider a diagonal line across the page and its large rectangular bounding box,
so on the one hand we want to ignore them.
However, PDF can have hyperlinked shapes, so we want hits.
Compromise: ignore stroke only, hit if fill (or fill&stroke).
(If too much interference, limit to small shapes or rectangles.)
- Overrides:
eventNode
in class Leaf
- See Also:
TreeEvent
,
SemanticEvent