|
|||||||||
| Home >> All >> com >> dghda >> [ kent overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.dghda.kent
Class ReportTemplateText

java.lang.Objectcom.dghda.kent.ReportTemplateText
- public class ReportTemplateText
- extends java.lang.Object
This class provides a convenient method of creating a report template text node. Aside from the attributes defined in the DTD, text may include substitutions, which are in the form: {source, field, row} When a report result is transformed the substitution is replaced by the specified datum.
| Field Summary | |
static int |
ALIGN_CENTRE
Align text in the centre. |
static int |
ALIGN_LEFT
Align text to the left (default). |
static int |
ALIGN_RIGHT
Align text to the right. |
private static java.lang.String |
BG_COLOUR_ATTR
|
private static java.lang.String |
FG_COLOUR_ATTR
|
private static java.lang.String |
FONT_FAMILY_ATTR
|
private static java.lang.String |
FONT_ITALIC_ATTR
|
private static java.lang.String |
FONT_SIZE_ATTR
|
private static java.lang.String |
FONT_WEIGHT_ATTR
|
private static java.lang.String |
H_ALIGN_ATTR
|
private int |
m_Alignment
|
private java.awt.Color |
m_BGColour
|
private java.awt.Color |
m_FGColour
|
private java.lang.String |
m_FontFamily
|
private boolean |
m_FontItalic
|
private int |
m_FontSize
|
private boolean |
m_FontWeight
|
private java.lang.String |
m_Text
|
| Constructor Summary | |
ReportTemplateText()
Create a new empty text object with default settings. |
|
ReportTemplateText(org.w3c.dom.Element text)
Create a new text object by parsing the given element. |
|
ReportTemplateText(java.lang.String text)
Create a new object containing the given text, with default settings. |
|
ReportTemplateText(java.lang.String text,
java.awt.Color bg,
java.awt.Color fg,
java.awt.Font font,
int align)
Create a new object containing the given text, using the given settings. |
|
ReportTemplateText(java.lang.String text,
java.awt.Font font)
Create a new object containing the given text, using the given font. |
|
| Method Summary | |
void |
addElement(java.lang.StringBuffer buffer,
java.lang.String tag,
int indent)
Creates an element with the given tag representing the object. |
java.awt.Color |
getBackgroundColour()
Gets the colour to use for the background. |
protected static java.awt.Color |
getColourFromString(java.lang.String rgb)
Returns a Color object constructed from the given RGB values. |
protected static java.lang.String |
getColourString(java.awt.Color colour)
Returns a string containing the RGB values for the given colour. |
java.awt.Font |
getFont()
Gets the font to use. |
boolean |
getFontBold()
Get whether the font is bold. |
java.lang.String |
getFontFamily()
Get the font family to use. |
boolean |
getFontItalic()
Get whether the font is italic. |
int |
getFontSize()
Get the font size to use. |
java.awt.Color |
getForegroundColour()
Gets the colour to use for the foreground. |
int |
getHAlignment()
Gets the horizontal alignment to use. |
java.lang.String |
getSubstitutedText(ReportData data)
Gets the text with all subsitutions made. |
java.lang.String |
getText()
Gets the raw text. |
boolean |
hasCustomFont()
Returns true if any optional font attributes are specified. |
void |
setBackgroundColour(java.awt.Color colour)
Sets the colour to use for the background. |
void |
setFont(java.awt.Font font)
Sets all the font attributes to use. |
void |
setFontBold(boolean bold)
Sets whether the font to use is bold. |
void |
setFontFamily(java.lang.String family)
Sets the font family to use. |
void |
setFontItalic(boolean italic)
Sets whether the font to use is italic. |
void |
setFontSize(int point)
Sets the font size to use. |
void |
setForegroundColour(java.awt.Color colour)
Sets the colour to use for the foreground. |
void |
setHAlignment(int align)
Sets the horizontal alignment to use. |
void |
setText(java.lang.String text)
Sets the text. |
protected void |
writeSubstitution(java.lang.StringBuffer buffer,
java.lang.String substitution,
ReportData data)
Writes the substituted text to the given buffer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
ALIGN_LEFT
public static final int ALIGN_LEFT
- Align text to the left (default).
- See Also:
- Constant Field Values
ALIGN_CENTRE
public static final int ALIGN_CENTRE
- Align text in the centre.
- See Also:
- Constant Field Values
ALIGN_RIGHT
public static final int ALIGN_RIGHT
- Align text to the right.
- See Also:
- Constant Field Values
BG_COLOUR_ATTR
private static final java.lang.String BG_COLOUR_ATTR
- See Also:
- Constant Field Values
FG_COLOUR_ATTR
private static final java.lang.String FG_COLOUR_ATTR
- See Also:
- Constant Field Values
FONT_FAMILY_ATTR
private static final java.lang.String FONT_FAMILY_ATTR
- See Also:
- Constant Field Values
FONT_SIZE_ATTR
private static final java.lang.String FONT_SIZE_ATTR
- See Also:
- Constant Field Values
FONT_WEIGHT_ATTR
private static final java.lang.String FONT_WEIGHT_ATTR
- See Also:
- Constant Field Values
FONT_ITALIC_ATTR
private static final java.lang.String FONT_ITALIC_ATTR
- See Also:
- Constant Field Values
H_ALIGN_ATTR
private static final java.lang.String H_ALIGN_ATTR
- See Also:
- Constant Field Values
m_Text
private java.lang.String m_Text
m_BGColour
private java.awt.Color m_BGColour
m_FGColour
private java.awt.Color m_FGColour
m_FontFamily
private java.lang.String m_FontFamily
m_FontSize
private int m_FontSize
m_FontWeight
private boolean m_FontWeight
m_FontItalic
private boolean m_FontItalic
m_Alignment
private int m_Alignment
| Constructor Detail |
ReportTemplateText
public ReportTemplateText()
- Create a new empty text object with default settings.
ReportTemplateText
public ReportTemplateText(java.lang.String text)
- Create a new object containing the given text, with default settings.
ReportTemplateText
public ReportTemplateText(java.lang.String text, java.awt.Font font)
- Create a new object containing the given text, using the given font.
ReportTemplateText
public ReportTemplateText(java.lang.String text, java.awt.Color bg, java.awt.Color fg, java.awt.Font font, int align)
- Create a new object containing the given text, using the given settings.
ReportTemplateText
public ReportTemplateText(org.w3c.dom.Element text) throws org.xml.sax.SAXException
- Create a new text object by parsing the given element.
| Method Detail |
setText
public void setText(java.lang.String text)
- Sets the text.
getText
public java.lang.String getText()
- Gets the raw text.
The text is returned before any substitutions.
getSubstitutedText
public java.lang.String getSubstitutedText(ReportData data) throws SubstitutionException
- Gets the text with all subsitutions made.
setBackgroundColour
public void setBackgroundColour(java.awt.Color colour)
- Sets the colour to use for the background.
getBackgroundColour
public java.awt.Color getBackgroundColour()
- Gets the colour to use for the background.
setForegroundColour
public void setForegroundColour(java.awt.Color colour)
- Sets the colour to use for the foreground.
getForegroundColour
public java.awt.Color getForegroundColour()
- Gets the colour to use for the foreground.
setFont
public void setFont(java.awt.Font font)
- Sets all the font attributes to use.
setFontFamily
public void setFontFamily(java.lang.String family)
- Sets the font family to use.
setFontSize
public void setFontSize(int point)
- Sets the font size to use.
setFontBold
public void setFontBold(boolean bold)
- Sets whether the font to use is bold.
setFontItalic
public void setFontItalic(boolean italic)
- Sets whether the font to use is italic.
hasCustomFont
public boolean hasCustomFont()
- Returns true if any optional font attributes are specified.
getFontFamily
public java.lang.String getFontFamily()
- Get the font family to use.
getFontSize
public int getFontSize()
- Get the font size to use.
getFontBold
public boolean getFontBold()
- Get whether the font is bold.
getFontItalic
public boolean getFontItalic()
- Get whether the font is italic.
getFont
public java.awt.Font getFont()
- Gets the font to use.
setHAlignment
public void setHAlignment(int align)
- Sets the horizontal alignment to use.
getHAlignment
public int getHAlignment()
- Gets the horizontal alignment to use.
addElement
public void addElement(java.lang.StringBuffer buffer, java.lang.String tag, int indent)
- Creates an element with the given tag representing the object.
writeSubstitution
protected void writeSubstitution(java.lang.StringBuffer buffer, java.lang.String substitution, ReportData data) throws SubstitutionException
- Writes the substituted text to the given buffer.
getColourString
protected static java.lang.String getColourString(java.awt.Color colour)
- Returns a string containing the RGB values for the given colour.
Has the format R,G,B.
getColourFromString
protected static java.awt.Color getColourFromString(java.lang.String rgb) throws org.xml.sax.SAXException
- Returns a Color object constructed from the given RGB values.
|
|||||||||
| Home >> All >> com >> dghda >> [ kent overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.dghda.kent.ReportTemplateText