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 |
byte | align |
Color | background |
int | baseline |
static byte | BOOL_FALSE |
static byte | BOOL_INHERIT |
static byte | BOOL_INVALID |
static byte | BOOL_TRUE |
int | borderbottom |
int | borderleft |
int | borderright |
int | bordertop |
static Color | COLOR_INHERIT Special color. |
static Color | COLOR_INVALID Special color. |
float[] | dasharray |
float | dashphase |
static BasicStroke | DEFAULT_STROKE |
String | display |
boolean | elide |
String | family Font properties set independently of one another. |
static float | FLOAT_INVALID |
static float[] | FLOATARRAY_INVALID |
byte | floats |
byte | flush Pending flush at next flowFloats()? |
Color | foreground Foreground/fill color. |
Graphics2D | g |
static int | INT_INVALID Use to set primitive-based properties to invalid. |
int | justify Corresponds to CSS text-align property. |
int | linecap |
int | linejoin |
float | linewidth |
int | marginbottom |
int | marginleft |
int | marginright |
int | margintop |
float | miterlimit |
int | mode |
static Object | OBJECT_INVALID Use to set Object-based properties to invalid, as null is valid for some properties. |
Color | overline |
Color | overstrike |
int | paddingbottom |
int | paddingleft |
int | paddingright |
int | paddingtop |
Color | pagebackground |
Map<Object,Object> | signal |
float | size Size in logical points, which is scaled to match screen resolution. |
int | spaceabove |
int | spacebelow |
NFont | spot |
static String | STRING_INVALID |
Color | strokeColor |
int | style Logical-OR of Font.PLAIN, Font.BOLD, Font.ITALIC. |
StyleSheet | styleSheet |
AffineTransform | textAT |
String | texttransform |
Color | underline |
Color | underline2 |
List<ContextListener> | vactive_ |
boolean | valid
Valid means all property settings are current for current Node in tree.
|
byte | valign |
float | x current point a la PostScript (OUT). |
float | xdelta {sub,super}scripts, opening gaps for spliced in text. |
Color | xor Doesn't seem very useful, though does affect images. |
float | y current point a la PostScript (OUT). |
float | ydelta {sub,super}scripts, opening gaps for spliced in text. |
double | zoom or pagewise? |
Method Summary |
void | add(ContextListener r) Add ContextListener to active set, bring Context values up to date. |
void | addBase(ContextListener cl) |
void | addq(ContextListener r)
Add ContextListener, leave Context in need of reset().
|
void | clear() |
void | clearBase() |
void | clearNonInherited() |
void | deleteBase(ContextListener cl) |
void | eatHeight(int h, Node lastn, int lastnoff) |
int | floatStackSize() |
void | flowFloats(int y, int width)
Position queued floats.
|
int | flushFloats(int side) |
int | getFloatHeightToGo(int side) Returns max height of left height-to-go's. |
int | getFloatWidth(int side) Returns total width of active left floats |
Font | getFont() |
FontMetrics | getFontMetrics() |
Stroke | getStroke() |
boolean | paintAfter(Context cx, INode node) |
void | paintAfter(Context cx, Leaf n) |
boolean | paintBefore(Context cx, INode node)
Upon entering node,
Draw background, border, |
void | paintBefore(Context cx, Leaf n) |
void | popFloat() |
static 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. |
void | pushFloat() |
void | queueFloat(Node n) Encountered float, queue up for next time have chance to position. |
void | remove(ContextListener r) Remove ContextListener to active set, bring Context values up to date. |
void | removeq(ContextListener r) Remove ContextListener, leave Context in need of reset(). |
void | reset() |
void | reset(Node n) |
void | reset(Mark m) |
void | reset(Node n, int offset) |
String | toString() |
public byte align
public Color background
public int baseline
public static final byte BOOL_FALSE
public static final byte BOOL_INHERIT
public static final byte BOOL_INVALID
public static final byte BOOL_TRUE
public int borderbottom
public int borderleft
public int borderright
public int bordertop
public static final Color COLOR_INHERIT
Special color. Use ==
, not equals()
.
public static final Color COLOR_INVALID
Special color. Use ==
, not equals()
.
public float[] dasharray
public float dashphase
public static final BasicStroke DEFAULT_STROKE
public String display
public boolean elide
public String family
Font properties set independently of one another.
public static final float FLOAT_INVALID
public static final float[] FLOATARRAY_INVALID
public byte floats
public byte flush
Pending flush at next flowFloats()? Set to Node.LEFT/RIGHT/BOTH?
public Color foreground
Foreground/fill color.
public Graphics2D g
public static final int INT_INVALID
Use to set primitive-based properties to invalid.
public int justify
Corresponds to CSS text-align property. Set to LEFT, RIGHT, CENTER, FILL.
public int linecap
public int linejoin
public float linewidth
public int marginbottom
public int marginleft
public int marginright
public int margintop
public float miterlimit
public int mode
public static final Object OBJECT_INVALID
Use to set Object-based properties to invalid, as null is valid for some properties.
public Color overline
public Color overstrike
public int paddingbottom
public int paddingleft
public int paddingright
public int paddingtop
public Color pagebackground
public Map<Object,Object> signal
public float size
Size in logical points, which is scaled to match screen resolution.
public int spaceabove
public int spacebelow
public static final String STRING_INVALID
public Color strokeColor
public int style
Logical-OR of Font.PLAIN, Font.BOLD, Font.ITALIC.
public AffineTransform textAT
public String texttransform
public Color underline
public Color underline2
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.
public byte valign
public float x
current point a la PostScript (OUT).
public float xdelta
{sub,super}scripts, opening gaps for spliced in text.
public Color xor
Doesn't seem very useful, though does affect images.
public float y
current point a la PostScript (OUT).
public float ydelta
{sub,super}scripts, opening gaps for spliced in text.
public double zoom
or pagewise?
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.
Add ContextListener to active set, bring Context values up to date.
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()
).
public void clear()
public void clearBase()
public void clearNonInherited()
public void eatHeight(int h,
Node lastn, int lastnoff)
public int floatStackSize()
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.
public int flushFloats(int side)
public int getFloatHeightToGo(int side)
Returns max height of left height-to-go's. Used by BR clear=XXX
public int getFloatWidth(int side)
Returns total width of active left floats
public Font getFont()
public FontMetrics getFontMetrics()
public Stroke getStroke()
Upon entering node,
Draw background, border, ...
public void popFloat()
Order by priority, low to high so high wins; within equal priority, latest set added last so it wins.
public void pushFloat()
public void queueFloat(
Node n)
Encountered float, queue up for next time have chance to position.
Remove ContextListener to active set, bring Context values up to date.
Remove ContextListener, leave Context in need of reset(). Good for removing more than one ContextListener before needing a valid Context.
public void reset()
public void reset(
Node n)
public void reset(
Mark m)
public void reset(
Node n, int offset)
public String toString()