Multivalent API

multivalent.node
Class LeafImage

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Node
          extended by multivalent.Leaf
              extended by multivalent.node.LeafImage
All Implemented Interfaces:
java.lang.Cloneable, java.awt.image.ImageObserver
Direct Known Subclasses:
FixedLeafImage

public class LeafImage
extends Leaf
implements java.awt.image.ImageObserver

Medium-specific leaf node. LATER: Expose information that's information hidden by Java's getImage(), such as animated GIF frames delays.

Version:
$Revision: 1.6 $ $Date: 2002/05/08 09:57:32 $

Field Summary
protected static java.awt.Image Broken_
           
protected static java.util.Map<java.net.URI,> cache_
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LeafImage(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent, java.awt.Image img)
          Take Image from passed parameter.
LeafImage(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent, java.net.URI uri)
          Take Image from passed URI.
 
Method Summary
 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.
 boolean eventNode(java.awt.AWTEvent e, java.awt.Point rel)
          unless overridden, leaves see if owner is interested
 boolean formatNodeContent(Context cx, int start, int end)
           
 java.awt.Image getImage()
           
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
           
 boolean paintNodeContent(Context cx, int start, int end)
          Contract violation: painting an image does not paint the background color in place of any transparent pixels, because that might clear out essential existing background.
 void reformat(Node dirty)
          For images, just mark dirty and batch to next repaint.
 void setImage(java.awt.Image img)
           
 void setImage(java.net.URI uri)
           
 void setSize(int width, int height)
          Scale image as necessary to width x height, or to natural dimension of parameter is -1.
 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
append, checkRep, clipboardBeforeAfter, copy, cut, delete, dx, dy, eatme, eventBeforeAfter, formatBeforeAfter, formatNode, getFirstLeaf, getLastLeaf, insert, insert, isLeaf, lengthTo, markDirtySubtreeDown, offset2rel, paintBeforeAfter, paintNode, paste, paste, removeTidy, setName, split, subelement, subelementCalc
 
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, 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
 

Field Detail

Broken_

protected static java.awt.Image Broken_

cache_

protected static java.util.Map<java.net.URI,> cache_
Constructor Detail

LeafImage

public LeafImage(java.lang.String name,
                 java.util.Map<java.lang.String,java.lang.Object> attr,
                 INode parent,
                 java.awt.Image img)
Take Image from passed parameter.


LeafImage

public LeafImage(java.lang.String name,
                 java.util.Map<java.lang.String,java.lang.Object> attr,
                 INode parent,
                 java.net.URI uri)
Take Image from passed URI.

Method Detail

getImage

public java.awt.Image getImage()

setImage

public void setImage(java.awt.Image img)

setImage

public void setImage(java.net.URI uri)

setSize

public void setSize(int width,
                    int height)
Scale image as necessary to width x height, or to natural dimension of parameter is -1.


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

formatNodeContent

public boolean formatNodeContent(Context cx,
                                 int start,
                                 int end)
Overrides:
formatNodeContent in class Leaf

reformat

public void reformat(Node dirty)
For images, just mark dirty and batch to next repaint. This way, more likely to batch HTML images when load. Images don't change size, so efficiency not supremely important.

Overrides:
reformat in class Node

paintNodeContent

public boolean paintNodeContent(Context cx,
                                int start,
                                int end)
Contract violation: painting an image does not paint the background color in place of any transparent pixels, because that might clear out essential existing background.

Overrides:
paintNodeContent in class Leaf

eventNode

public boolean eventNode(java.awt.AWTEvent e,
                         java.awt.Point rel)
Description copied from class: Leaf
unless overridden, leaves see if owner is interested

Overrides:
eventNode in class Leaf
See Also:
TreeEvent, SemanticEvent

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

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

Multivalent API