multivalent

Class Context

public class Context extends Object

Graphics context object passed from node to node. Holds graphics attributes, list of prevailing ContextListeners, random "signals" (name-value pairs),

Version: $Revision: 1.11 $ $Date: 2003/06/02 05:01:12 $

Field Summary
bytealign
Colorbackground
intbaseline
current point a la PostScript (OUT).
static byteBOOL_FALSE
static byteBOOL_INHERIT
static byteBOOL_INVALID
static byteBOOL_TRUE
intborderbottom
intborderleft
intborderright
intbordertop
static ColorCOLOR_INHERIT
Special color.
static ColorCOLOR_INVALID
Special color.
float[]dasharray
floatdashphase
static BasicStrokeDEFAULT_STROKE
Stringdisplay
booleanelide
Stringfamily
Font properties set independently of one another.
static floatFLOAT_INVALID
static float[]FLOATARRAY_INVALID
bytefloats
byteflush
Pending flush at next flowFloats()?
Colorforeground
Graphics2Dg
static intINT_INVALID
Use to set primitive-based properties to invalid.
intjustify
Corresponds to CSS text-align property.
intlinecap
intlinejoin
floatlinewidth
intmarginbottom
intmarginleft
intmarginright
intmargintop
floatmiterlimit
static ObjectOBJECT_INVALID
Use to set Object-based properties to invalid, as null is valid for some properties.
Coloroverline
Coloroverstrike
intpaddingbottom
intpaddingleft
intpaddingright
intpaddingtop
Colorpagebackground
Map<Object,Object>signal
floatsize
Size in logical points, which is scaled to match screen resolution.
intspaceabove
intspacebelow
static StringSTRING_INVALID
ColorstrokeColor
intstyle
Logical-OR of Font.PLAIN, Font.BOLD, Font.ITALIC.
StyleSheetstyleSheet
AffineTransformtextAT
Stringtexttransform
Colorunderline
Colorunderline2
List<ContextListener>vactive_
booleanvalid
Valid means all property settings are current for current Node in tree.
bytevalign
intx
current point a la PostScript (OUT).
intxdelta
{sub,super}scripts, opening gaps for spliced in text.
Colorxor
Doesn't seem very useful, though does affect images.
intydelta
{sub,super}scripts, opening gaps for spliced in text.
doublezoom
or pagewise?
Constructor Summary
Context(Toolkit tk)
Usually use getStyleSheet().getContext() instead.
Method Summary
voidadd(ContextListener r)
Add ContextListener to active set, bring Context values up to date.
voidaddBase(ContextListener cl)
voidaddq(ContextListener r)
Add ContextListener, leave Context in need of reset().
voidclear()
voidclearBase()
voidclearNonInherited()
voiddeleteBase(ContextListener cl)
voideatHeight(int h, Node lastn, int lastnoff)
intfloatStackSize()
voidflowFloats(int y, int width)
Position queued floats.
intflushFloats(int side)
intgetFloatHeightToGo(int side)
Returns max height of left height-to-go's.
intgetFloatWidth(int side)
Returns total width of active left floats
FontgetFont()
FontMetricsgetFontMetrics()
StrokegetStroke()
booleanpaintAfter(Context cx, INode node)
voidpaintAfter(Context cx, Leaf n)
booleanpaintBefore(Context cx, INode node)
Upon entering node, Draw background, border,
voidpaintBefore(Context cx, Leaf n)
voidpopFloat()
static intpriorityInsert(ContextListener r, List<ContextListener> v)
Order by priority, low to high so high wins; within equal priority, latest set added last so it wins.
voidpushFloat()
voidqueueFloat(Node n)
Encountered float, queue up for next time have chance to position.
voidremove(ContextListener r)
Remove ContextListener to active set, bring Context values up to date.
voidremoveq(ContextListener r)
Remove ContextListener, leave Context in need of reset().
voidreset()
voidreset(Node n)
voidreset(Mark m)
voidreset(Node n, int offset)
StringtoString()

Field Detail

align

public byte align

background

public Color background

baseline

public int baseline
current point a la PostScript (OUT).

BOOL_FALSE

public static final byte BOOL_FALSE

BOOL_INHERIT

public static final byte BOOL_INHERIT

BOOL_INVALID

public static final byte BOOL_INVALID

BOOL_TRUE

public static final byte BOOL_TRUE

borderbottom

public int borderbottom

borderleft

public int borderleft

borderright

public int borderright

bordertop

public int bordertop

COLOR_INHERIT

public static final Color COLOR_INHERIT
Special color. Use ==, not equals().

COLOR_INVALID

public static final Color COLOR_INVALID
Special color. Use ==, not equals().

dasharray

public float[] dasharray

dashphase

public float dashphase

DEFAULT_STROKE

public static final BasicStroke DEFAULT_STROKE

display

public String display

elide

public boolean elide

family

public String family
Font properties set independently of one another.

FLOAT_INVALID

public static final float FLOAT_INVALID

FLOATARRAY_INVALID

public static final float[] FLOATARRAY_INVALID

floats

public byte floats

flush

public byte flush
Pending flush at next flowFloats()? Set to Node.LEFT/RIGHT/BOTH?

foreground

public Color foreground

g

public Graphics2D g

INT_INVALID

public static final int INT_INVALID
Use to set primitive-based properties to invalid.

justify

public int justify
Corresponds to CSS text-align property. Set to LEFT, RIGHT, CENTER, FILL.

linecap

public int linecap

linejoin

public int linejoin

linewidth

public float linewidth

marginbottom

public int marginbottom

marginleft

public int marginleft

marginright

public int marginright

margintop

public int margintop

miterlimit

public float miterlimit

OBJECT_INVALID

public static final Object OBJECT_INVALID
Use to set Object-based properties to invalid, as null is valid for some properties.

overline

public Color overline

overstrike

public Color overstrike

paddingbottom

public int paddingbottom

paddingleft

public int paddingleft

paddingright

public int paddingright

paddingtop

public int paddingtop

pagebackground

public Color pagebackground

signal

public Map<Object,Object> signal

size

public float size
Size in logical points, which is scaled to match screen resolution.

spaceabove

public int spaceabove

spacebelow

public int spacebelow

STRING_INVALID

public static final String STRING_INVALID

strokeColor

public Color strokeColor

style

public int style
Logical-OR of Font.PLAIN, Font.BOLD, Font.ITALIC.

styleSheet

public StyleSheet styleSheet

textAT

public AffineTransform textAT

texttransform

public String texttransform

underline

public Color underline

underline2

public Color underline2

vactive_

public List<ContextListener> vactive_

valid

public boolean valid
Valid means all property settings are current for current Node in tree. Needs to be current on all Nodes because leaves need font, color, ... and INodes need colors to draw background and border. When ContextListners added to or removed from active set, the current property settings are recomputed automatically. Mark valid if skip nodes during tree walk (that have non-empty summary list) and recompute with reset(Node, offset) before use if valid==false.

valign

public byte valign

x

public int x
current point a la PostScript (OUT).

xdelta

public int xdelta
{sub,super}scripts, opening gaps for spliced in text.

xor

public Color xor
Doesn't seem very useful, though does affect images.

ydelta

public int ydelta
{sub,super}scripts, opening gaps for spliced in text.

zoom

public double zoom
or pagewise?

Constructor Detail

Context

public Context(Toolkit tk)
Usually use getStyleSheet().getContext() instead. (The stylesheet can be obtained from Document.getStyleSheet().) Stylesheets use this constructor to create their associated context object.

Method Detail

add

public final void add(ContextListener r)
Add ContextListener to active set, bring Context values up to date.

addBase

public void addBase(ContextListener cl)

addq

public final void addq(ContextListener r)
Add ContextListener, leave Context in need of reset(). Good for adding more than one ContextListener before needing a valid Context (which can be obtained by reset()).

clear

public void clear()

clearBase

public void clearBase()

clearNonInherited

public void clearNonInherited()

deleteBase

public void deleteBase(ContextListener cl)

eatHeight

public void eatHeight(int h, Node lastn, int lastnoff)

floatStackSize

public int floatStackSize()

flowFloats

public void flowFloats(int y, int width)
Position queued floats. If the flush field is set to Node.LEFT/RIGHT/BOTH, floats on that side will be flushed, and the additional vertical space required returned, which should be accounted for in calling flow region.

flushFloats

public int flushFloats(int side)

getFloatHeightToGo

public int getFloatHeightToGo(int side)
Returns max height of left height-to-go's. Used by BR clear=XXX

getFloatWidth

public int getFloatWidth(int side)
Returns total width of active left floats

getFont

public Font getFont()

getFontMetrics

public FontMetrics getFontMetrics()

Returns: not a copy.

getStroke

public Stroke getStroke()

paintAfter

public boolean paintAfter(Context cx, INode node)

paintAfter

public void paintAfter(Context cx, Leaf n)

paintBefore

public boolean paintBefore(Context cx, INode node)
Upon entering node, Draw background, border, ...

paintBefore

public void paintBefore(Context cx, Leaf n)

popFloat

public void popFloat()

priorityInsert

public static final int priorityInsert(ContextListener r, List<ContextListener> v)
Order by priority, low to high so high wins; within equal priority, latest set added last so it wins.

pushFloat

public void pushFloat()

queueFloat

public void queueFloat(Node n)
Encountered float, queue up for next time have chance to position.

remove

public final void remove(ContextListener r)
Remove ContextListener to active set, bring Context values up to date.

removeq

public final void removeq(ContextListener r)
Remove ContextListener, leave Context in need of reset(). Good for removing more than one ContextListener before needing a valid Context.

reset

public void reset()

reset

public void reset(Node n)

reset

public void reset(Mark m)

reset

public void reset(Node n, int offset)

toString

public String toString()