multivalent.gui

Class VFrame

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 intHEIGHT_MIN
Minimum dimension for window.
booleanlampshade
Show just title bar or full window.
static StringMSG_CLOSED
Announce that Frame has been closed.
static StringMSG_MOVED
Announce that Frame has been moved.
static StringMSG_RAISED
Announce that Frame has raised above all other Frames.
static StringMSG_RESIZED
Announce that Frame has changed size.
static StringPREF_VANISHING
Remove window controls when cursor not in frame?
booleanresizable
Refers to interactive resizing with mouse, not programmatic control.
static intWIDTH_MIN
Minimum dimension for window.
Constructor Summary
VFrame(String name, Map<String,Object> attr, INode parent)
VFrame(String name, Map<String,Object> attr, INode parent, URI docuri)
Content given by passed URL; pass null if want to build subtree yourself.
Method Summary
voidclose()
Remove window from screen.
voidevent(AWTEvent e)
Handle events while moving, resizing, ....
booleaneventBeforeAfter(AWTEvent e, Point rel)
booleaneventNode(AWTEvent e, Point rel)
booleanformatNode(int width, int height, Context cx)
RectanglegetContentBounds()
Returns new Rectangle sized and positioned to cover content, not title bar.
StringgetTitle()
Bounds of window, with (x,y) relative to containing Document.
booleanisPinned()
voidpaintNode(Rectangle docclip, Context cx)
Draw content, then window apparatus (title bar, resize nib).
voidraise()
Windows added on top, so raise to top = remove + add.
voidsetBounds(int x, int y, int width, int height)
Identical to setLocation(x,y), setSize(width,height);
voidsetIn(boolean in)
voidsetLocation(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.
voidsetPinned(boolean pinned)
Moves between RELATIVE and ABSOLUTE visual layers on class Document, translating coordinates so window appears at same location at present scroll.
voidsetSize(int width, int height)
Set dimensions of window, including title bar.
voidsetTitle(String title)

Field Detail

HEIGHT_MIN

public static final int HEIGHT_MIN
Minimum dimension for window.

lampshade

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

MSG_CLOSED

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

"frameResized": arg= VFrame instance.

MSG_MOVED

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

"frameMoved": arg= VFrame instance.

MSG_RAISED

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

"frameRaised": arg= VFrame instance.

MSG_RESIZED

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

"frameResized": arg= VFrame instance.

PREF_VANISHING

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

Boolean "vanishingTitle"

resizable

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

WIDTH_MIN

public static final int WIDTH_MIN
Minimum dimension for window.

Constructor Detail

VFrame

public VFrame(String name, Map<String,Object> attr, INode parent)

VFrame

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

Method Detail

close

public void close()
Remove window from screen.

event

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

eventBeforeAfter

public boolean eventBeforeAfter(AWTEvent e, Point rel)

eventNode

public boolean eventNode(AWTEvent e, Point rel)

formatNode

public boolean formatNode(int width, int height, Context cx)

getContentBounds

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

getTitle

public 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); }

isPinned

public boolean isPinned()

paintNode

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

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);

setIn

public void setIn(boolean in)

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.

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.

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).

setTitle

public void setTitle(String title)