edu.northwestern.at.wordhoard.model.text
Class DrawingContext

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.text.DrawingContext

public class DrawingContext
extends java.lang.Object

A text drawing context.


Constructor Summary
DrawingContext(int rightMargin)
          Creates a new drawing context.
 
Method Summary
 java.awt.font.FontRenderContext getFontRenderContext()
          Gets the font render context.
 java.awt.Graphics2D getGraphics()
          Gets the graphics environment.
 int getLineHeight()
          Gets the height of the current line.
 java.awt.Color getLineNumberColor()
          Gets the line number color.
 FontInfo getLineNumberFontInfo()
          Gets the line number font info.
 int getLineNumberInterval()
          Gets the line number interval.
 int getLineNumberRightMargin()
          Gets the line number right margin.
 int getMarginaliaLeftMargin()
          Gets the marginalia left margin.
 int getMarginaliaRightMargin()
          Gets the marginalia right margin.
 java.awt.Color getMarkerColor()
          Gets the marker color.
 FontInfo getMarkerFontInfo()
          Gets the marker font info.
 int getMarkerOffset()
          Gets the marker offset.
 java.lang.String getMarkerString()
          Gets the marker string.
 int getRightMargin()
          Gets the right margin.
 java.awt.Color getSelectedColor()
          Gets the selected text background color.
 java.awt.Color getSelectedTextColor()
          Gets the selected text color.
 int getYTop()
          Gets the Y coordinate of the top of the current line.
 boolean hasLineNumbers()
          Returns true if this text has line numbers.
 boolean hasMarginalia()
          Returns true if this text has marginalia.
 void setGraphics(java.awt.Graphics2D g)
          Sets the graphics environment.
 void setLineHeight(int lineHeight)
          Sets the height of the current line.
 void setLineNumberInterval(int lineNumberInterval)
          Sets the line number interval.
 void setLineNumbers(int lineNumberInterval, FontInfo lineNumberFontInfo, int lineNumberRightMargin, java.awt.Color lineNumberColor)
          Sets line number information.
 void setMarginaliaMargins(int marginaliaLeftMargin, int marginaliaRightMargin)
          Sets marginalia margins.
 void setMarkerInformation(int markerOffset, java.lang.String markerString, FontInfo markerFontInfo, java.awt.Color markerColor)
          Sets marker information.
 void setYTop(int yTop)
          Sets the Y coordinate of the top of the current line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawingContext

public DrawingContext(int rightMargin)
Creates a new drawing context.

Parameters:
rightMargin - Right margin.
Method Detail

setLineNumbers

public void setLineNumbers(int lineNumberInterval,
                           FontInfo lineNumberFontInfo,
                           int lineNumberRightMargin,
                           java.awt.Color lineNumberColor)
Sets line number information.

Parameters:
lineNumberInterval - Line number interval.
lineNumberFontInfo - Line number font info. May be null if no line numbers will be drawn.
lineNumberRightMargin - Line number right margin. Ignored if line numbers are not drawn.
lineNumberColor - Line number color. May be null if no line numbers will be drawn.

setMarginaliaMargins

public void setMarginaliaMargins(int marginaliaLeftMargin,
                                 int marginaliaRightMargin)
Sets marginalia margins.

Parameters:
marginaliaLeftMargin - Marginalia left margin.
marginaliaRightMargin - Marginalia right margin.

setMarkerInformation

public void setMarkerInformation(int markerOffset,
                                 java.lang.String markerString,
                                 FontInfo markerFontInfo,
                                 java.awt.Color markerColor)
Sets marker information.

Parameters:
markerOffset - Marker offset from left margin.
markerString - Marker string.
markerFontInfo - Marker font info.
markerColor - Marker color.

getGraphics

public java.awt.Graphics2D getGraphics()
Gets the graphics environment.

Returns:
The graphics environment.

setGraphics

public void setGraphics(java.awt.Graphics2D g)
Sets the graphics environment.

Parameters:
g - The graphics environment.

getFontRenderContext

public java.awt.font.FontRenderContext getFontRenderContext()
Gets the font render context.

Returns:
The font render context.

getRightMargin

public int getRightMargin()
Gets the right margin.

Returns:
The right margin.

hasLineNumbers

public boolean hasLineNumbers()
Returns true if this text has line numbers.


getLineNumberInterval

public int getLineNumberInterval()
Gets the line number interval.

Returns:
The line number interval.

setLineNumberInterval

public void setLineNumberInterval(int lineNumberInterval)
Sets the line number interval.

Parameters:
lineNumberInterval - The line number interval.

getLineNumberFontInfo

public FontInfo getLineNumberFontInfo()
Gets the line number font info.

Returns:
The line number font info.

getLineNumberRightMargin

public int getLineNumberRightMargin()
Gets the line number right margin.

Returns:
The line number right margin.

getLineNumberColor

public java.awt.Color getLineNumberColor()
Gets the line number color.

Returns:
The line number color.

hasMarginalia

public boolean hasMarginalia()
Returns true if this text has marginalia.


getMarginaliaLeftMargin

public int getMarginaliaLeftMargin()
Gets the marginalia left margin.

Returns:
The marginalia left margin.

getMarginaliaRightMargin

public int getMarginaliaRightMargin()
Gets the marginalia right margin.

Returns:
The marginalia right margin.

getMarkerOffset

public int getMarkerOffset()
Gets the marker offset.

Returns:
Marker offset from left margin.

getMarkerString

public java.lang.String getMarkerString()
Gets the marker string.

Returns:
Marker string.

getMarkerFontInfo

public FontInfo getMarkerFontInfo()
Gets the marker font info.

Returns:
Marker font info.

getMarkerColor

public java.awt.Color getMarkerColor()
Gets the marker color.

Returns:
Marker color.

getSelectedColor

public java.awt.Color getSelectedColor()
Gets the selected text background color.

Returns:
The selected text background color.

getSelectedTextColor

public java.awt.Color getSelectedTextColor()
Gets the selected text color.

Returns:
The selected text color.

getYTop

public int getYTop()
Gets the Y coordinate of the top of the current line.

Returns:
Y coordinate of the top of the current line.

setYTop

public void setYTop(int yTop)
Sets the Y coordinate of the top of the current line.

Parameters:
yTop - Y coordinate of the top of the current line.

getLineHeight

public int getLineHeight()
Gets the height of the current line.

Returns:
Heigth of the current line.

setLineHeight

public void setLineHeight(int lineHeight)
Sets the height of the current line.

Parameters:
lineHeight - Height of the current line.