    All Packages    This Package    Previous    Next

# Class awt.Formatter

    java.lang.Object
       |
       +----awt.Formatter

public class Formatter
extends Object

A class that knows how to layout a set of DisplayItems inside a window.

Version:
  1.30 09 Apr 1995
Author:
  Jonathan Payne

##

breakSoFar
  This is used to combine requests to break a paragraph.
color
  Current color as determined by the current FormattingParameters.
currentParameters
  Current formatting parameters.
font
  Current font as determined by the current FormattingParameters.
fontAscent
  Current maximum font ascent.
fpStack
  This is the stack of formatting parameters.
itemCount
  Total number of items we think we've added to the window.
lineAscent
  Current lineAscent for this line.
lineDescent
  Current lineDescent for this line.
lineStartIndex
  The display item index of the first item on this line.
notRendering
  This is true when we're in a section that doesn't render.
win
  This is the window we're laying objects out in.
x
  Current X coordinate, where next display item will be added.
xlimit
  Current X limit for the right margin.
y
  Current Y coordinate.

##

Formatter(TextWindow)

##

addCharacterSpacing(char)
addDisplayItem(DisplayItem, boolean)
adjustItem(DisplayItem, int)
atBeginningOfLine()
breakLine(int)
charAt(int)
finishCurrentLine()
getColor()
getFont()
getLeftMargin()
getLength()
getParameters()
getRightMargin()
getXCoordinate()
getYCoordinate()
layout()
makeTextItem(int, int)
outputString(int, int, int)
popParameters()
processStyleRefs(int)
pushParameters(FormattingParameters)
reset()
setBreakSoFar(int)
setLeftMargin(int)
setParameters(FormattingParameters)
setXCoordinate(int)
startRendering()
stopRendering()
wrapLine()

##

currentParameters

      protected FormattingParameters currentParameters

  Current formatting parameters.

x

      protected int x

  Current X coordinate, where next display item will be added.

xlimit

      protected int xlimit

  Current X limit for the right margin. If a display item moves beyond xlimit, we wrap.

y

      protected int y

  Current Y coordinate. This is the value of Y for the top of the current line we're building.

lineAscent

      protected int lineAscent

  Current lineAscent for this line.

lineDescent

      protected int lineDescent

  Current lineDescent for this line.

fontAscent

      protected int fontAscent

  Current maximum font ascent.

font

      protected Font font

  Current font as determined by the current FormattingParameters.

color

      protected Color color

  Current color as determined by the current FormattingParameters.

lineStartIndex

      protected int lineStartIndex

  The display item index of the first item on this line. This is used to go back to position all the items we accumulate on the line we're laying out right now.

itemCount

      protected int itemCount

  Total number of items we think we've added to the window.

fpStack

      protected Stack fpStack

  This is the stack of formatting parameters.

notRendering

      protected int notRendering

  This is true when we're in a section that doesn't render.

breakSoFar

      protected int breakSoFar

  This is used to combine requests to break a paragraph. This is how much of a break we have accumulated so far since we last wrapped. If a request to break is greater than this number, we bump the new Y position by that much further.

win

      public TextWindow win

  This is the window we're laying objects out in.

##

Formatter

      public Formatter(TextWindow w)

##

setParameters

      public void setParameters(FormattingParameters fp)

finishCurrentLine

      protected void finishCurrentLine()

adjustItem

      protected void adjustItem(DisplayItem di,
                                int x)

getLength

      protected abstract int getLength()

charAt

      protected abstract int charAt(int i)

makeTextItem

      protected abstract TextDisplayItem makeTextItem(int pos0,
                                                      int pos1)

outputString

      protected boolean outputString(int pos0,
                                     int pos1,
                                     int width)

processStyleRefs

      protected int processStyleRefs(int pos)

setBreakSoFar

      protected void setBreakSoFar(int value)

reset

      protected void reset()

layout

      public void layout()

pushParameters

      public void pushParameters(FormattingParameters p)

popParameters

      public void popParameters()

getParameters

      public FormattingParameters getParameters()

addDisplayItem

      public boolean addDisplayItem(DisplayItem di,
                                    boolean checkWrap)

setLeftMargin

      public void setLeftMargin(int lm)

atBeginningOfLine

      public boolean atBeginningOfLine()

getLeftMargin

      public int getLeftMargin()

getRightMargin

      public int getRightMargin()

setXCoordinate

      public void setXCoordinate(int x)

getXCoordinate

      public int getXCoordinate()

getYCoordinate

      public int getYCoordinate()

addCharacterSpacing

      public void addCharacterSpacing(char c)

wrapLine

      public void wrapLine()

breakLine

      public void breakLine(int extra)

getFont

      public Font getFont()

getColor

      public Color getColor()

stopRendering

      public void stopRendering()

startRendering

      public void startRendering()

    All Packages    This Package    Previous    Next