|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.foray.output.OutputTarget
org.foray.render.Renderer
org.foray.render.awt.AWTRenderer
public class AWTRenderer
A Renderer that displays the document using AWT.
| Field Summary |
|---|
| Fields inherited from class org.foray.render.Renderer |
|---|
SHADING_WEIGHT_BLUE, SHADING_WEIGHT_GREEN, SHADING_WEIGHT_RED |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.print.Pageable |
|---|
UNKNOWN_NUMBER_OF_PAGES |
| Constructor Summary | |
|---|---|
AWTRenderer(org.apache.commons.logging.Log logger,
org.axsl.output.OutputConfiguration renderConfig)
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
addRect(int x,
int y,
int w,
int h,
boolean drawAsOutline)
Draw a filled rectangle in the current color. |
protected void |
addRect(int x,
int y,
int w,
int h,
float r,
float g,
float b)
Draw a rectangle. |
protected void |
addRect(int x,
int y,
int w,
int h,
float r,
float g,
float b,
float fr,
float fg,
float fb)
Draw a filled rectangle. |
protected void |
drawFrame()
Draws a frame around the page. |
protected void |
drawGraphic(org.axsl.galley.GraphicArea area,
org.axsl.graphic.Graphic image,
Rectangle contentRectangle,
Rectangle clipRectangle)
Renders a Graphic to a given contentRectangle, and clipping it to a given clip rectangle. |
protected void |
drawLine(int x1,
int y1,
int x2,
int y2,
int th,
org.axsl.common.value.RuleStyle ruleStyle,
Color strokeColor)
Draw a line in the output document. |
protected void |
drawRectangle(int x,
int y,
int w,
int h,
Color strokeColor,
Color fillColor)
Draw a rectangle in the output document. |
int[] |
getFontSources()
|
BufferedImage |
getLastRenderedPage()
Return the last page rendered. |
int |
getNumberOfPages()
|
org.axsl.output.OutputConfiguration |
getOutputConfiguration()
Returns the output configuration for this renderer. |
int |
getPageCount()
Retrieve the number of pages in this document. |
PageFormat |
getPageFormat(int pageIndex)
|
int |
getPageNumber()
Returns the current page number. |
Printable |
getPrintable(int pageIndex)
|
double |
getScaleFactor()
Returns the current scale factor. |
protected void |
markBorder(org.axsl.galley.BorderPaddingArea area)
Marks the border, if any, for the given area. |
boolean |
outputStreamRequired()
Subclasses that do not need an OutputStream should override this. |
int |
print(Graphics g,
PageFormat pageFormat,
int pageIndex)
|
void |
removePage(int page)
Removes a page from the list of processed pages. |
void |
render(org.axsl.galley.BookmarkTree area)
Render the bookmark tree for this document. |
void |
render(org.axsl.galley.ExternalGraphicArea area)
|
void |
render(org.axsl.galley.ForeignContentMath area)
Render the MathML content of a ForeignObjectArea. |
void |
render(org.axsl.galley.ForeignContentSvg area)
Render the SVG content of a ForeignObjectArea. |
void |
render(int aPageNumber)
Renders a page. |
void |
render(org.axsl.galley.LeaderArea area)
|
void |
render(org.axsl.galley.Page page)
|
void |
render(org.axsl.galley.TextArea area)
|
protected void |
renderPage(org.axsl.galley.Page page)
Renders a given page. |
protected void |
renderSVGDocument(org.axsl.graphic.SvgGraphic graphic,
Rectangle2D.Float contentRectangle,
Rectangle2D.Float clipRectangle)
Renders an SVG document. |
protected void |
renderTextDecoration(int x,
int bl,
int width,
Font font,
String text,
boolean underline,
boolean overline,
boolean linethrough)
Renders text with its text decoration. |
void |
renderTextSegment(org.axsl.galley.TextArea area,
CharSequence text)
Renders an arbitrary text chunk with attributes from an arbitrary Area. |
void |
resetTextCursor()
Provides the Renderer with an opportunity to close any text objects that are in progress. |
void |
setComponent(Component parent)
Sets parent component which is used to set up the font. |
void |
setPageHeight(int pageHeight)
Sets the page height. |
void |
setPageNumber(int aValue)
Sets the current page number. |
void |
setPageWidth(int pageWidth)
Sets the page width. |
void |
setScaleFactor(double newScaleFactor)
Sets the current scale factor. |
void |
startOutput()
|
void |
stopOutput()
|
| Methods inherited from class org.foray.render.Renderer |
|---|
colorToFloat, convertMillipointRectangle, getAreaTree, getPixelsPerInch, markBackground, render, render, render, render, render, render, render, render, render, render, render, render, render, renderChildren, renderDocumentNodes, renderRegions, setGalley, shadingPercent, toPoints |
| Methods inherited from class org.foray.output.OutputTarget |
|---|
getApplicationName, getApplicationNameShort, getApplicationVersion, getDeveloperURLShort, getFontConsumer, getLogger, getOutputStream, getStrokeSVGText, setApplicationName, setApplicationNameShort, setApplicationVersion, setDeveloperUrlShort, setFontConsumer, setOutputStream, setStrokeText |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.axsl.output.OutputTarget |
|---|
setApplicationName, setApplicationNameShort, setApplicationVersion, setDeveloperUrlShort, setFontConsumer, setOutputStream, setStrokeText |
| Constructor Detail |
|---|
public AWTRenderer(org.apache.commons.logging.Log logger,
org.axsl.output.OutputConfiguration renderConfig)
logger - The logger.renderConfig - The configuration for this renderer.| Method Detail |
|---|
public void setComponent(Component parent)
parent - the live AWT component referencepublic int getPageNumber()
public void setPageNumber(int aValue)
aValue - The new page number.public void setScaleFactor(double newScaleFactor)
newScaleFactor - The new scale factor.public double getScaleFactor()
public BufferedImage getLastRenderedPage()
protected void drawLine(int x1,
int y1,
int x2,
int y2,
int th,
org.axsl.common.value.RuleStyle ruleStyle,
Color strokeColor)
Renderer
drawLine in class Rendererx1 - The start x location in millipoints.y1 - The start y location in millipoints.x2 - The end x location in millipoints.y2 - The end y location in millipoints.th - The thickness in millipoints.ruleStyle - The rule style.strokeColor - The stroke color.
protected void drawRectangle(int x,
int y,
int w,
int h,
Color strokeColor,
Color fillColor)
Renderer
drawRectangle in class Rendererx - The x position of left edge in millipoints.y - The y position of top edge in millipoints.w - The width in millipoints.h - The height in millipoints.strokeColor - The color to be used for the stroke.
Stroked means a box will be drawn around the rectangle.
Set to null if the rectangle should not be stroked.fillColor - The color to be used for the fill.
Set to null if the rectangle should not be filled.
protected void addRect(int x,
int y,
int w,
int h,
float r,
float g,
float b)
x - the x position of left edge in millipointsy - the y position of top edge in millipointsw - the width in millipointsh - the height in millipointsr - the red componentg - the green componentb - the blue component
protected void addRect(int x,
int y,
int w,
int h,
float r,
float g,
float b,
float fr,
float fg,
float fb)
x - the x position of left edge in millipointsy - the y position of top edge in millipointsw - the width in millipointsh - the height in millipointsr - the red component of edgesg - the green component of edgesb - the blue component of edgesfr - the red component of the fillfg - the green component of the fillfb - the blue component of the fill
protected void addRect(int x,
int y,
int w,
int h,
boolean drawAsOutline)
x - the x position of left edge in millipointsy - the y position of top edge in millipointsw - the width in millipointsh - the height in millipointsdrawAsOutline - true for draw, false for fillprotected void drawFrame()
public int getPageCount()
public void removePage(int page)
page - The index to the page to be removed.
public void render(int aPageNumber)
throws org.axsl.galley.GalleyVisitorException
aPageNumber - The index to the page to be rendered.
org.axsl.galley.GalleyVisitorException - For errors during rendering.
public void render(org.axsl.galley.Page page)
throws org.axsl.galley.GalleyVisitorException
render in interface org.axsl.output.Rendererrender in class Rendererorg.axsl.galley.GalleyVisitorException
protected void renderPage(org.axsl.galley.Page page)
throws org.axsl.galley.GalleyVisitorException
page - The page to be rendered.
org.axsl.galley.GalleyVisitorException - For errors during rendering.protected void markBorder(org.axsl.galley.BorderPaddingArea area)
Renderer
markBorder in class Rendererarea - The area whose border is to be drawn.
protected void drawGraphic(org.axsl.galley.GraphicArea area,
org.axsl.graphic.Graphic image,
Rectangle contentRectangle,
Rectangle clipRectangle)
Renderer
drawGraphic in class Rendererarea - The Area instance from which to obtain traits.image - The graphic to be rendered.contentRectangle - The rectangle to which the graphic should be
scaled during drawing.clipRectangle - The rectangle to which the content should be clipped
after any scaling.Renderer.drawGraphic(GraphicArea, Graphic, Rectangle, Rectangle)public void render(org.axsl.galley.ExternalGraphicArea area)
render in interface org.axsl.galley.RenderVisitorrender in class Renderer
public void renderTextSegment(org.axsl.galley.TextArea area,
CharSequence text)
Renderer
renderTextSegment in class Rendererarea - An Area instance that contains the traits that should be
used to render the text.text - The text content to be rendered.
protected void renderTextDecoration(int x,
int bl,
int width,
Font font,
String text,
boolean underline,
boolean overline,
boolean linethrough)
x - The x coordinate of the location at which rendering should
occur, in millipoints.bl - The y coordinate of the location at which rendering should
occur, in millipoints.width - The width of the text, in millipoints.font - The font to be used to draw the text.text - The text to be written.underline - True if the text should be underlined.overline - True if the text should be overlined.linethrough - True if the text should have a line drawn through it.public void render(org.axsl.galley.LeaderArea area)
render in interface org.axsl.galley.RenderVisitorpublic void render(org.axsl.galley.TextArea area)
render in interface org.axsl.galley.RenderVisitorpublic void render(org.axsl.galley.ForeignContentSvg area)
RendererForeignObjectArea.
render in class Rendererarea - The SVG content to be rendered.
protected void renderSVGDocument(org.axsl.graphic.SvgGraphic graphic,
Rectangle2D.Float contentRectangle,
Rectangle2D.Float clipRectangle)
graphic - The SVG to be rendered.contentRectangle - The rectangle to which the graphic should be
scaled during drawing.clipRectangle - The rectangle to which the content should be clipped
after any scaling.public void render(org.axsl.galley.ForeignContentMath area)
RendererForeignObjectArea.
render in class Rendererarea - The MathML content to be rendered.public void render(org.axsl.galley.BookmarkTree area)
Renderer
render in class Rendererarea - The bookmark tree to be rendered.
public int print(Graphics g,
PageFormat pageFormat,
int pageIndex)
throws PrinterException
print in interface PrintablePrinterExceptionpublic int getNumberOfPages()
getNumberOfPages in interface Pageablepublic PageFormat getPageFormat(int pageIndex)
getPageFormat in interface Pageablepublic Printable getPrintable(int pageIndex)
getPrintable in interface Pageable
public void startOutput()
throws org.axsl.output.OutputException
startOutput in interface org.axsl.output.OutputTargetorg.axsl.output.OutputException
public void stopOutput()
throws org.axsl.output.OutputException
stopOutput in interface org.axsl.output.OutputTargetorg.axsl.output.OutputExceptionpublic int[] getFontSources()
getFontSources in interface org.axsl.output.OutputTargetpublic void resetTextCursor()
Renderer
resetTextCursor in class Rendererpublic boolean outputStreamRequired()
outputStreamRequired in interface org.axsl.output.OutputTargetoutputStreamRequired in class OutputTargetpublic void setPageWidth(int pageWidth)
pageWidth - The pageWidth to set.public void setPageHeight(int pageHeight)
pageHeight - The pageHeight to set.public org.axsl.output.OutputConfiguration getOutputConfiguration()
OutputTarget
getOutputConfiguration in class OutputTarget
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||