Class AbstractTextRenderer
- java.lang.Object
-
- net.sf.jasperreports.engine.export.AbstractTextRenderer
-
- Direct Known Subclasses:
AbstractPdfTextRenderer
,AwtTextRenderer
public abstract class AbstractTextRenderer extends Object
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractTextRenderer.TabSegment
-
Field Summary
Fields Modifier and Type Field Description protected String
allText
protected int
bottomPadding
protected AttributedString
bulletChunk
protected String
bulletText
protected float
drawPosX
protected float
drawPosY
protected int
height
protected int
htmlListIndent
protected boolean
ignoreMissingFont
protected boolean
indentFirstLine
protected boolean
isFirstParagraph
protected boolean
isLastParagraph
protected boolean
isMaxHeightReached
protected JasperReportsContext
jasperReportsContext
protected boolean
justifyLastLine
protected int
leftPadding
static FontRenderContext
LINE_BREAK_FONT_RENDER_CONTEXT
protected float
lineHeight
protected JRPropertiesUtil
propUtil
protected int
rightPadding
protected int
segmentIndex
protected List<AbstractTextRenderer.TabSegment>
segments
protected JRStyledText
styledText
protected JRPrintText
text
protected int
topPadding
protected float
verticalAlignOffset
protected int
width
protected int
x
protected int
y
-
Constructor Summary
Constructors Constructor Description AbstractTextRenderer(JasperReportsContext jasperReportsContext, boolean isMinimizePrinterJobSize, boolean ignoreMissingFont, boolean defaultIndentFirstLine, boolean defaultJustifyLastLine)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
draw()
protected AttributedString
getAttributedString()
int
getBottomPadding()
FontRenderContext
getFontRenderContext()
public static float getLineHeight(JRParagraph paragraph, float lineSpacingFactor, int maxFontSize) { float lineHeight = 0; switch(paragraph.getLineSpacing()) { case SINGLE: case ONE_AND_HALF: case DOUBLE: case PROPORTIONAL: { lineHeight = lineSpacingFactor * maxFontSize; break; } case AT_LEAST: { lineHeight = Math.max(lineSpacingFactor * maxFontSize, paragraph.getLineSpacingSize()); break; } case FIXED: { lineHeight = paragraph.getLineSpacingSize(); break; } default : { throw new JRRuntimeException("Invalid line space type: " + paragraph.getLineSpacing()); } } return lineHeight; } /**int
getHeight()
int
getLeftPadding()
static float
getLineHeight(boolean isFirstLine, JRParagraph paragraph, float maxLeading, float maxAscent)
protected StyledTextListWriter
getListWriter()
String
getPlainText()
int
getRightPadding()
JRStyledText
getStyledText()
int
getTopPadding()
int
getWidth()
int
getX()
int
getY()
void
initialize(JRPrintText text, JRStyledText styledText, int offsetX, int offsetY)
void
render()
protected void
renderParagraph(AttributedCharacterIterator allParagraphs, int paragraphStart, String paragraphText)
-
-
-
Field Detail
-
LINE_BREAK_FONT_RENDER_CONTEXT
public static final FontRenderContext LINE_BREAK_FONT_RENDER_CONTEXT
-
jasperReportsContext
protected final JasperReportsContext jasperReportsContext
-
propUtil
protected final JRPropertiesUtil propUtil
-
text
protected JRPrintText text
-
styledText
protected JRStyledText styledText
-
allText
protected String allText
-
x
protected int x
-
y
protected int y
-
width
protected int width
-
height
protected int height
-
topPadding
protected int topPadding
-
leftPadding
protected int leftPadding
-
bottomPadding
protected int bottomPadding
-
rightPadding
protected int rightPadding
-
verticalAlignOffset
protected float verticalAlignOffset
-
drawPosY
protected float drawPosY
-
drawPosX
protected float drawPosX
-
lineHeight
protected float lineHeight
-
isMaxHeightReached
protected boolean isMaxHeightReached
-
isFirstParagraph
protected boolean isFirstParagraph
-
isLastParagraph
protected boolean isLastParagraph
-
segments
protected List<AbstractTextRenderer.TabSegment> segments
-
segmentIndex
protected int segmentIndex
-
indentFirstLine
protected boolean indentFirstLine
-
justifyLastLine
protected boolean justifyLastLine
-
htmlListIndent
protected int htmlListIndent
-
bulletText
protected String bulletText
-
bulletChunk
protected AttributedString bulletChunk
-
ignoreMissingFont
protected final boolean ignoreMissingFont
-
-
Constructor Detail
-
AbstractTextRenderer
public AbstractTextRenderer(JasperReportsContext jasperReportsContext, boolean isMinimizePrinterJobSize, boolean ignoreMissingFont, boolean defaultIndentFirstLine, boolean defaultJustifyLastLine)
-
-
Method Detail
-
getX
public int getX()
-
getY
public int getY()
-
getWidth
public int getWidth()
-
getHeight
public int getHeight()
-
getTopPadding
public int getTopPadding()
-
getLeftPadding
public int getLeftPadding()
-
getBottomPadding
public int getBottomPadding()
-
getRightPadding
public int getRightPadding()
-
getStyledText
public JRStyledText getStyledText()
-
getPlainText
public String getPlainText()
-
initialize
public void initialize(JRPrintText text, JRStyledText styledText, int offsetX, int offsetY)
-
render
public void render()
-
getListWriter
protected StyledTextListWriter getListWriter()
-
renderParagraph
protected void renderParagraph(AttributedCharacterIterator allParagraphs, int paragraphStart, String paragraphText)
-
getAttributedString
protected AttributedString getAttributedString()
-
draw
public abstract void draw()
-
getLineHeight
public static float getLineHeight(boolean isFirstLine, JRParagraph paragraph, float maxLeading, float maxAscent)
-
getFontRenderContext
public FontRenderContext getFontRenderContext()
public static float getLineHeight(JRParagraph paragraph, float lineSpacingFactor, int maxFontSize) { float lineHeight = 0; switch(paragraph.getLineSpacing()) { case SINGLE: case ONE_AND_HALF: case DOUBLE: case PROPORTIONAL: { lineHeight = lineSpacingFactor * maxFontSize; break; } case AT_LEAST: { lineHeight = Math.max(lineSpacingFactor * maxFontSize, paragraph.getLineSpacingSize()); break; } case FIXED: { lineHeight = paragraph.getLineSpacingSize(); break; } default : { throw new JRRuntimeException("Invalid line space type: " + paragraph.getLineSpacing()); } } return lineHeight; } /**
-
-