Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## multivalent
Class Context

    java.lang.Object
      multivalent.Context

Direct Known Subclasses:
  CSSContext

public class Context
extends java.lang.Object

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

Version:
  $Revision: 1.14 $ $Date: 2004/04/30 19:05:37 $

Field Summary
`byte` | `align`
`java.awt.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 java.awt.Color` | `COLOR_INHERIT` Special color.
`static java.awt.Color` | `COLOR_INVALID` Special color.
`float[]` | `dasharray`
`float` | `dashphase`
`java.lang.String` | `display`
`boolean` | `elide`
`java.lang.String` | `family` Font properties set independently of one another.
`int` | `flags` More than just `Font.ITALIC`, `flags`.
`static float` | `FLOAT_INVALID`
`static float[]` | `FLOATARRAY_INVALID`
`byte` | `floats`
`byte` | `flush` Pending flush at next flowFloats()?
`java.awt.Color` | `foreground` Foreground/fill color.
`java.awt.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` Text `fill mode`.
`static java.lang.Object` | `OBJECT_INVALID` Use to set Object-based properties to invalid, as `null` is valid for some properties.
`java.awt.Color` | `overline`
`java.awt.Color` | `overstrike`
`int` | `paddingbottom`
`int` | `paddingleft`
`int` | `paddingright`
`int` | `paddingtop`
`java.awt.Color` | `pagebackground`
`java.util.Map<java.lang.Object,java.lang.Object>` | `signal`
`float` | `size` Size in pixels.
`int` | `spaceabove`
`int` | `spacebelow`
`NFont` | `spot` A spot font overrides font properties.
`static java.lang.String` | `STRING_INVALID`
`static java.awt.BasicStroke` | `STROKE_DEFAULT`
`java.awt.Color` | `strokeColor`
`StyleSheet` | `styleSheet`
`java.awt.geom.AffineTransform` | `textAT`
`java.lang.String` | `texttransform`
`java.awt.Color` | `underline`
`java.awt.Color` | `underline2`
`java.util.List<ContextListener>` | `vactive_`
`boolean` | `valid` Valid means all property settings are current for current Node in tree.
`byte` | `valign`
`int` | `weight` More than just `Font.BOLD`, `weights`.
`float` | `x` current point a la PostScript (OUT).
`float` | `xdelta` {sub,super}scripts, opening gaps for spliced in text.
`java.awt.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.
`float` | `zoom` or pagewise?

Constructor Summary
`Context()` Usually use `getStyleSheet().getContext()` instead.

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
`NFont` | `getFont()` Returns active font, which is the spot font if set, otherwise computed from family, weight, flags, and size.
`java.awt.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, java.util.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(Mark m)`
`void` | `reset(Node n)`
`void` | `reset(Node n, int offset)`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### INT_INVALID

    public static final int INT_INVALID

  Use to set primitive-based properties to invalid.

  See Also:
    Constant Field Values

### FLOAT_INVALID

    public static final float FLOAT_INVALID

See Also:
  Constant Field Values

### FLOATARRAY_INVALID

    public static final float[] FLOATARRAY_INVALID

### OBJECT_INVALID

    public static final java.lang.Object OBJECT_INVALID

  Use to set Object-based properties to invalid, as `null` is valid for some properties.

### STRING_INVALID

    public static final java.lang.String STRING_INVALID

### COLOR_INHERIT

    public static final java.awt.Color COLOR_INHERIT

  Special color. Use `==`, not `equals()`.

### COLOR_INVALID

    public static final java.awt.Color COLOR_INVALID

  Special color. Use `==`, not `equals()`.

### BOOL_FALSE

    public static final byte BOOL_FALSE

See Also:
  Constant Field Values

### BOOL_TRUE

    public static final byte BOOL_TRUE

See Also:
  Constant Field Values

### BOOL_INHERIT

    public static final byte BOOL_INHERIT

See Also:
  Constant Field Values

### BOOL_INVALID

    public static final byte BOOL_INVALID

See Also:
  Constant Field Values

### STROKE_DEFAULT

    public static final java.awt.BasicStroke STROKE_DEFAULT

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

### vactive_

    public java.util.List<ContextListener> vactive_

### g

    public java.awt.Graphics2D g

### styleSheet

    public StyleSheet styleSheet

### zoom

    public float zoom

  or pagewise?

### x

    public float x

  current point a la PostScript (OUT).

### y

    public float y

  current point a la PostScript (OUT).

### baseline

    public int baseline

### xdelta

    public float xdelta

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

### ydelta

    public float ydelta

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

### xor

    public java.awt.Color xor

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

### foreground

    public java.awt.Color foreground

  Foreground/fill color.

### background

    public java.awt.Color background

### strokeColor

    public java.awt.Color strokeColor

### pagebackground

    public java.awt.Color pagebackground

### linewidth

    public float linewidth

### linecap

    public int linecap

### linejoin

    public int linejoin

### miterlimit

    public float miterlimit

### dasharray

    public float[] dasharray

### dashphase

    public float dashphase

### family

    public java.lang.String family

  Font properties set independently of one another.

### size

    public float size

  Size in pixels.

### flags

    public int flags

  More than just `Font.ITALIC`, `flags`.

### weight

    public int weight

  More than just `Font.BOLD`, `weights`.

### textAT

    public java.awt.geom.AffineTransform textAT

### mode

    public int mode

  Text `fill mode`.

### texttransform

    public java.lang.String texttransform

### display

    public java.lang.String display

### underline

    public java.awt.Color underline

### underline2

    public java.awt.Color underline2

### overline

    public java.awt.Color overline

### overstrike

    public java.awt.Color overstrike

### elide

    public boolean elide

### justify

    public int justify

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

### spaceabove

    public int spaceabove

### spacebelow

    public int spacebelow

### align

    public byte align

### valign

    public byte valign

### floats

    public byte floats

### flush

    public byte flush

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

### spot

    public NFont spot

  A spot font overrides font properties. A spot font can't generally be computed from family, weight, et cetera and then selected from OS fonts, because it is dynamically load and thus not available in the OS, or has special treatment such as `NFont#setWidths(int[])`. For example, fonts embedded in PDF are set as spot fonts.

### marginleft

    public int marginleft

### marginright

    public int marginright

### margintop

    public int margintop

### marginbottom

    public int marginbottom

### paddingleft

    public int paddingleft

### paddingright

    public int paddingright

### paddingtop

    public int paddingtop

### paddingbottom

    public int paddingbottom

### borderleft

    public int borderleft

### borderright

    public int borderright

### bordertop

    public int bordertop

### borderbottom

    public int borderbottom

### signal

    public java.util.Map<java.lang.Object,java.lang.Object> signal

Constructor Detail

### Context

    public Context()

  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

### getFont

    public NFont getFont()

  Returns active font, which is the spot font if set, otherwise computed from family, weight, flags, and size.

### getStroke

    public java.awt.Stroke getStroke()

### clear

    public void clear()

### clearNonInherited

    public void clearNonInherited()

### reset

    public void reset()

### addBase

    public void addBase(ContextListener cl)

### deleteBase

    public void deleteBase(ContextListener cl)

### clearBase

    public void clearBase()

### reset

    public void reset(Node n)

### reset

    public void reset(Mark m)

### reset

    public void reset(Node n,
                      int offset)

### floatStackSize

    public int floatStackSize()

### pushFloat

    public void pushFloat()

### popFloat

    public void popFloat()

### queueFloat

    public void queueFloat(Node n)

  Encountered float, queue up for next time have chance to position.

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

### getFloatWidth

    public int getFloatWidth(int side)

  Returns total width of active left floats

### getFloatHeightToGo

    public int getFloatHeightToGo(int side)

  Returns max height of left height-to-go's. Used by BR clear=XXX

### eatHeight

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

### priorityInsert

    public static final int priorityInsert(ContextListener r,
                                           java.util.List<ContextListener> v)

  Order by priority, low to high so high wins; within equal priority, latest set added last so it wins.

### add

    public final void add(ContextListener r)

  Add ContextListener to active set, bring Context values up to date.

### remove

    public final void remove(ContextListener r)

  Remove ContextListener to active set, bring Context values up to date.

### 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()`).

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

### paintBefore

    public boolean paintBefore(Context cx,
                               INode node)

  Upon entering node, Draw background, border, ...

### paintAfter

    public boolean paintAfter(Context cx,
                              INode node)

### paintBefore

    public void paintBefore(Context cx,
                            Leaf n)

### paintAfter

    public void paintAfter(Context cx,
                           Leaf n)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Multivalent API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD