Multivalent API

multivalent.gui
Class VFrame

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Node
          extended by multivalent.INode
              extended by multivalent.gui.VFrame
All Implemented Interfaces:
java.lang.Cloneable, EventListener, java.util.EventListener
Direct Known Subclasses:
VDialog

public class VFrame
extends INode
implements EventListener

Movable, resizable internal window, with title bar. Lens subclasses to add composition of effects via a LensMan(ager). The class Note subclasses to add a Document instance. Dialog subclasses to add HTML form.

Version:
$Revision: 1.4 $ $Date: 2002/05/28 19:50:20 $
See Also:
Lens

Field Summary
static int HEIGHT_MIN
          Minimum dimension for window.
 boolean lampshade
          Show just title bar or full window.
static java.lang.String MSG_CLOSED
          Announce that Frame has been closed.
static java.lang.String MSG_MOVED
          Announce that Frame has been moved.
static java.lang.String MSG_RAISED
          Announce that Frame has raised above all other Frames.
static java.lang.String MSG_RESIZED
          Announce that Frame has changed size.
static java.lang.String PREF_VANISHING
          Remove window controls when cursor not in frame?
 boolean resizable
          Refers to interactive resizing with mouse, not programmatic control.
static int WIDTH_MIN
          Minimum dimension for window.
 
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_
 
Constructor Summary
VFrame(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent)
           
VFrame(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attr, INode parent, java.net.URI docuri)
          Content given by passed URL; pass null if want to build subtree yourself.
 
Method Summary
 void close()
          Remove window from screen.
 void event(java.awt.AWTEvent e)
          Handle events while moving, resizing, ....
 boolean eventBeforeAfter(java.awt.AWTEvent e, java.awt.Point rel)
          Adjust for bbox (which itself has been adjusted for margins), padding, border.
 boolean eventNode(java.awt.AWTEvent e, java.awt.Point rel)
          Internal nodes pass on to children.
 boolean formatNode(int width, int height, Context cx)
          Children report dimensions (width and height), parent places at (x,y).
 java.awt.Rectangle getContentBounds()
          Returns new Rectangle sized and positioned to cover content, not title bar.
 java.lang.String getTitle()
          Bounds of window, with (x,y) relative to containing Document.
 boolean isPinned()
           
 void paintNode(java.awt.Rectangle docclip, Context cx)
          Draw content, then window apparatus (title bar, resize nib).
 void raise()
          Windows added on top, so raise to top = remove + add.
 void setBounds(int x, int y, int width, int height)
          Identical to setLocation(x,y), setSize(width,height);
 void setIn(boolean in)
           
 void setLocation(int x, int y)
          Should be fast so can interactively move window -- in the past have minimized amount of redrawing, but at 500MHz Pentium and HotSpot, plenty fast enough to redraw entire document.
 void setPinned(boolean pinned)
          Moves between RELATIVE and ABSOLUTE visual layers on class Document, translating coordinates so window appears at same location at present scroll.
 void setSize(int width, int height)
          Set dimensions of window, including title bar.
 void setTitle(java.lang.String title)
           
 
Methods inherited from class multivalent.INode
addCategory, appendChild, breakAfter, breakBefore, checkRep, childAt, childNum, clipboardNode, clone, contains, dump, dx, dy, findDFS, formatBeforeAfter, getElementById, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getNextSibling, getPreviousSibling, insertChildAt, isStruct, markDirtySubtreeDown, paintBeforeAfter, 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, reformat, 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
 

Field Detail

MSG_RESIZED

public static final java.lang.String MSG_RESIZED
Announce that Frame has changed size.

"frameResized": arg= VFrame instance.

See Also:
Constant Field Values

MSG_MOVED

public static final java.lang.String MSG_MOVED
Announce that Frame has been moved.

"frameMoved": arg= VFrame instance.

See Also:
Constant Field Values

MSG_CLOSED

public static final java.lang.String MSG_CLOSED
Announce that Frame has been closed.

"frameResized": arg= VFrame instance.

See Also:
Constant Field Values

MSG_RAISED

public static final java.lang.String MSG_RAISED
Announce that Frame has raised above all other Frames.

"frameRaised": arg= VFrame instance.

See Also:
Constant Field Values

PREF_VANISHING

public static final java.lang.String PREF_VANISHING
Remove window controls when cursor not in frame?

Boolean "vanishingTitle"

See Also:
Constant Field Values

WIDTH_MIN

public static final int WIDTH_MIN
Minimum dimension for window.

See Also:
Constant Field Values

HEIGHT_MIN

public static final int HEIGHT_MIN
Minimum dimension for window.

See Also:
Constant Field Values

resizable

public boolean resizable
Refers to interactive resizing with mouse, not programmatic control.


lampshade

public boolean lampshade
Show just title bar or full window. Different than iconify.

Constructor Detail

VFrame

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

VFrame

public VFrame(java.lang.String name,
              java.util.Map<java.lang.String,java.lang.Object> attr,
              INode parent,
              java.net.URI docuri)
Content given by passed URL; pass null if want to build subtree yourself.

Method Detail

getTitle

public java.lang.String getTitle()
Bounds of window, with (x,y) relative to containing Document. public Rectangle getBounds() { Rectangle r = super.getBounds(); if (lampshade) r.setSize(r.width,titleh+1); //if (doc!=null) System.out.println("doc="+doc_+", x="+doc_.getHsb().getValue()+", y="+doc_.getVsb().getValue()); //System.out.print(r+" => "); Document doc=getDocument(); if (!pinned_) r.translate(-doc.getHsb().getValue(), -doc.getVsb().getValue()); //System.out.println(" => "+r); // if (pir!=null) r.translate(-pir.x,-pir.y); return r; } public Rectangle getContentBounds() { Point p = getRelLocation(getDocument()); return new Rectangle(p.x,p.y, bbox.width,bbox.height-titleh); }


setTitle

public void setTitle(java.lang.String title)

setIn

public void setIn(boolean in)

getContentBounds

public java.awt.Rectangle getContentBounds()
Returns new Rectangle sized and positioned to cover content, not title bar.


isPinned

public boolean isPinned()

setPinned

public void setPinned(boolean pinned)
Moves between RELATIVE and ABSOLUTE visual layers on class Document, translating coordinates so window appears at same location at present scroll.


raise

public void raise()
Windows added on top, so raise to top = remove + add.


setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Identical to setLocation(x,y), setSize(width,height);


setSize

public void setSize(int width,
                    int height)
Set dimensions of window, including title bar. Should be fast so can interactively resize window. Use this instead of setting bbox dimensions directly (should probably enforce all Node bbox manipulation with setSize/setLocation/setBounds).


setLocation

public void setLocation(int x,
                        int y)
Should be fast so can interactively move window -- in the past have minimized amount of redrawing, but at 500MHz Pentium and HotSpot, plenty fast enough to redraw entire document.


close

public void close()
Remove window from screen.


formatNode

public boolean formatNode(int width,
                          int height,
                          Context cx)
Description copied from class: INode
Children report dimensions (width and height), parent places at (x,y). Bbox = union of children's bboxes Children stacked vertically like TeX vbox; override to implement other layout strategies To implement a new layout manager, override this method.

Overrides:
formatNode in class INode
See Also:
FixedI

paintNode

public void paintNode(java.awt.Rectangle docclip,
                      Context cx)
Draw content, then window apparatus (title bar, resize nib). LATER: take colors for window apparatus from style sheet.

Overrides:
paintNode in class INode

eventBeforeAfter

public boolean eventBeforeAfter(java.awt.AWTEvent e,
                                java.awt.Point rel)
Description copied from class: INode
Adjust for bbox (which itself has been adjusted for margins), padding, border.

Overrides:
eventBeforeAfter in class INode

eventNode

public boolean eventNode(java.awt.AWTEvent e,
                         java.awt.Point rel)
Description copied from class: INode
Internal nodes pass on to children. Events are propogated from last child to first (and painted first to last), which means that later children have implicitly higher priority as they get first chance at setting a grab. Event passed on only if (x,y) within child's bounding box, or if TreeEvent.VALIDATE event. Event is translated to be in child's coordinate system (that is, (0,0) corresponds to the child's origin).

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

event

public void event(java.awt.AWTEvent e)
Handle events while moving, resizing, ....

Specified by:
event in interface EventListener

Multivalent API