|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sssw.rt.tview.AgoColumnBase | +--com.sssw.rt.tview.AgoColumnText
AgoColumnText is a bound column that you can use to display data to users. These columns are for read-only textual data.
Field Summary | |
static int |
MULTILINE
Column alignments. |
Constructor Summary | |
AgoColumnText(int width,
boolean visible,
boolean transparent,
Color backgroundColor,
int borderType)
AgoColumnText constructor. |
Method Summary | |
String |
applyFormat(Object obj)
Return a String which is the result of applying the format pattern to a specified object (String, Long, Date etc.) |
boolean |
getAdjustWidthForContent()
Returns a boolean which specifies whether the column automatically adjusts its width to accomodate its content. |
Color |
getColor()
Returns a Color object that represents the color of the column's text. |
String |
getColumnName()
Returns the text of the column if it is able to get the name (for example, if this column has been initialized either with setColumnName() or with initColumnTextHeader()). |
int |
getDatatype()
Returns the datatype of the column. |
AgoFontIdentifier |
getFontIdentifier()
Returns the SilverStream font object (AgoFontIdentifier) which describes the font used for text in this column. |
String |
getFormatPattern()
Returns the format pattern or null if no format pattern has been set for the column. |
int |
getFormatStyle()
Get the format style. |
int |
getMaxPointSize()
Returns the maximum point size allowed for the text in this column. |
int |
getMinPointSize()
Returns the minimum point size allowed for the text in this column. |
String |
getPropertyName()
Returns the name of the property associated with this column. |
void |
initColumnTextHeader(String headerText,
AgoFontIdentifier fontid,
Color textColor,
int alignment)
Utility method for setting up a number of parameters for the column text simultaneously. |
void |
initColumnTextProperty(String propertyName,
AgoFontIdentifier fontid,
Color textColor,
int alignment)
Utility method that allows you to bind the column to data and set its font, text color, and alignment for the column. |
void |
setAdjustWidthForContent(boolean adjustwidthforcontent)
Sets the AdjustWidthForContent property. |
void |
setColor(Color color)
Sets the column text color. |
boolean |
setColumnName(String columnName)
Sets the text to be displayed in the specified column. |
void |
setFontIdentifier(AgoFontIdentifier fontid)
Specifies the SilverStream font object (AgoFontIdentifier) which describes the size, style and font to be used for the text in this column. |
void |
setFormatPattern(String pattern,
char datatype)
Set the format pattern for the column. |
void |
setFormatStyle(int style,
char datatype)
Set the format style and column datatype. |
void |
setMaxPointSize(int maxpointsize)
Sets maximum point size allowed for the text in this column. |
void |
setMinPointSize(int minpointsize)
Set the minimum point size allowed for the text in this column. |
void |
setPropertyName(String propertyName)
Set the name of the property associated with this column. |
Methods inherited from class com.sssw.rt.tview.AgoColumnBase |
getAlignment,
getBackgroundColor,
getBorderType,
getDisplayWidth,
getHidden,
getResizable,
getSelectable,
getTransparent,
getVisible,
getWidth,
isWidthFixed,
setAlignment,
setBackgroundColor,
setBorderType,
setFixedWidth,
setHidden,
setProportionalWidth,
setProportionalWidth,
setResizable,
setSelectable,
setTransparent,
setVisible,
setWidth |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int MULTILINE
Constructor Detail |
public AgoColumnText(int width, boolean visible, boolean transparent, Color backgroundColor, int borderType)
width
- column text width, in pixelsvisible
- true means text column is visibletransparent
- true means text column is transparentColor
- text column background color. Background color is only visible when the column is not transparent.borderType
- column border type
For the borderType
parameter, see the setBorderType method.
AgoColumnText colText = new AgoColumnText(25, // width in pixels true, // visible false, // not transparent Color.red, // background color AgoColumnBase.BORDER_3D); // border type
AgoColumnBase
,
AgoColumnText.initColumnTextProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)
,
AgoColumnText.initColumnTextHeader(String headerText, AgoFontIdentifier fontid, Color textColor, int alignment)
Method Detail |
public void initColumnTextProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)
propertyName
- the AgcData column name from which to initialize this columnfontid
- AgoFontIdentifiertextColor
- text color (java.awt.Color object)alignment
- text alignment
For a list of values to use with the alignment
parameter, see the Column Alignment Values in the AgoColumnBase.
AgoFontIdentifier fontid = new AgoFontIdentifier("Helvetica", 0, 12); colText.initColumnTextProperty( "CustomerId", // use CustomerId property for the value of this column fontid, // the font identifier for text in this column Color.black, // the color for text in this column AgoColumnBase.ALIGN_TOP_LEFT);// the alignment of text in this column
AgoFontIdentifier
public void initColumnTextHeader(String headerText, AgoFontIdentifier fontid, Color textColor, int alignment)
headerText
- the actual text to display in this columnfontid
- AgoFontIdentifiertextColor
- text color (java.awt.Color object)alignment
- text alignment
The list of values for the alignment
parameter are described in the Column Alignment Values section of AgoColumnBase class..
AgoFontIdentifier fontid = new AgoFontIdentifier("Helvetica", 0, 12); colText.initColumnTextHeader( "CustomerId", // this column will always display the text "CustomerId" fontid, // the font identifier for text in this column Color.black, // the color for text in this column AgoColumnBase.ALIGN_TOP_LEFT);// the alignment of text in this column
AgoFontIdentifier
public final AgoFontIdentifier getFontIdentifier()
The AgoFontIdentifier object consists of three parts: a Font Name, a Font Style and a Font Size. The Font Style can be one of these values:
AgoFontIdentifier.PLAIN AgoFontIdentifier.BOLD AgoFontIdentifier.ITALIC AgoFontIdentifier.BOLD + AgoFontIdentifier.ITALICThe Font Name can be one of these values:Dialog, SansSerif, Serif, Monospaced, Helvetica, TimesRoman, Courier, DialogInput, Zapfdingbats. At runtime, Java translates this value to the appropriate font installed on the system. The Font Size can be any integer.
The following code fragment illustrates how to construct a new AgoFontIdentifier object (called newFont) and how to call the getFontIdentifier() method:
AgoFontIdentifier font; font = colText.getFontIdentifier();
AgoColumnText.setFontIdentifier(AgoFontIdentifier fontid)
public final void setFontIdentifier(AgoFontIdentifier fontid)
If you change this value at runtime, you must call the AgcView.setAgoViewFormat() method to repaint the view and make the change visible to the user.
fontid
- the AgoFontIdentifierThe AgoFontIdentifier object consists of three parts: a Font Name, a Font Style and a Font Size.
The Font Name can be one of these values:Dialog, SansSerif, Serif, Monospaced, Helvetica, TimesRoman, Courier, DialogInput, Zapfdingbats.
At runtime, Java translates this value to the appropriate font installed on the system.
The Font Size can be any integer.
The Font Style can be one of these values:
AgoFontIdentifier.PLAIN AgoFontIdentifier.BOLD AgoFontIdentifier.ITALIC AgoFontIdentifier.BOLD + AgoFontIdentifier.ITALIC
This code fragment illustrates how to construct a new AgoFontIdentifier object (called newFont) and how to call the setFontIdentifier() method:
AgoFontIdentifier newFont; newFont=new AgoFontIdentifier("TimesRoman", AgoFontIdentifier.ITALIC, 20); columnFmt.setFontIdentifier(newFont);
AgoFontIdentifier
public final int getMinPointSize()
When the font size is scaled up or down according to the indent level, it will never be made smaller than this value. When you define a font value using AgoFontIdentifier, the font size is ignored if it is set smaller than the minimum point size.
When changing this value at runtime, you must call the AgcView.setAgoViewFormat() method. It repaints the view and makes the font change visible to the user.
int pointSize = colText.getMinPointSize();
AgoColumnText.setMinPointSize(int minpointsize)
,
AgoColumnText.getMaxPointSize()
public final void setMinPointSize(int minpointsize)
minpointsize
- value for the minimum font size
Font size will not scale smaller than this size.When the font size is scaled up or down according to the indent level, it will never be made smaller than this value. When you define a font value using AgoFontIdentifier, the font size is ignored if it is set smaller than the minimum point size.
When changing this value at runtime, you must call the AgcView.setAgoViewFormat() method. It repaints the view and makes the font change visible to the user.
colText.setMaxPointSize(8);
AgoColumnText.getMinPointSize()
,
AgoColumnText.setMaxPointSize(int maxpointsize)
public final int getMaxPointSize()
When the font size is scaled up or down according to the indent level, it will never be made larger than this value. When you define a font value using AgoFontIdentifier, the font size is ignored if it is set larger than the maximum point size.
When changing this value at runtime, you must call the AgcView.setAgoViewFormat() method. It repaints the view and makes the font change visible to the user.
int pointSize = colText.getMaxPointSize();
AgoColumnText.getMinPointSize()
public final void setMaxPointSize(int maxpointsize)
maxpointsize
- maximum font point size. The font will not scale larger than this size.When the font size is scaled up or down according to the indent level, it will never be made larger than this value. When you define a font value using AgoFontIdentifier, the font size is ignored if it is set larger than the maximum point size.
When changing this value at runtime, you must call the AgcView.setAgoViewFormat() method. It repaints the view and makes the font change visible to the user.
colText.setMaxPointSize(20);
AgoColumnText.getMaxPointSize()
,
AgoColumnText.setMinPointSize(int minpointsize)
public final Color getColor()
Color textColor = colText.getColor();
AgoColumnText.setColor(Color color)
public final void setColor(Color color)
If you change this value at runtime, you must call the AgcView.setAgoViewFormat() method to repaint the view and make the change immediately visible to the user.
color
- the text color as defined in java.awt.Color
colText.setColor(Color.green);
AgoColumnText.getColor()
public final boolean getAdjustWidthForContent()
boolean willAdjust = colText.getAdjustWidthforContent();
AgoColumnText.setAdjustWidthForContent(boolean adjustwidthforcontent)
public final void setAdjustWidthForContent(boolean adjustwidthforcontent)
adjustwidthforcontent
- when true, the column is automatically adjusted for the width of the text.Consider setting any header columns to the same value to maintain a consistent look and feel for the control.
If you change this value at runtime, you must call the AgcView.setAgoViewFormat() method to repaint the view and make the change immediately visible to the user.
coltext.setAdjustWidthForContent(true);
AgoColumnText.getAdjustWidthForContent()
public final void setPropertyName(String propertyName)
propertyName
- the property namecolText.setPropertyName("CustomerNumber");
AgoColumnText.getPropertyName()
public final String getPropertyName()
If the column was initialized with initColumnTextProperty(), the value returned will be the value specified in the initColumnTextProperty() call, or by any subsequent call to setPropertyName(). If the column was initialized with initColumnTextHeader(), the value returned will be the value specified in the initColumnTextHeader() call, or by any subsequent call to setColumnName().
This example shows what happens when the column is initialized with initColumnTextProperty(), then setPropertyName() is called to change the property name, and then getPropertyName() is called:
AgoFontIdentifier fontid = new AgoFontIdentifier("Helvetica", 0, 12); colText.initColumnTextProperty( "CustomerId", // use CustomerId property // for the value of this column fontid, // the font identifier for // text in this column Color.black, // the color for text in this column AgoColumnBase.ALIGN_TOP_LEFT);// the alignment of text in this column colText.setPropertyName("CustomerNumber"); // this will return "CustomerNumber" String propName = colText.getPropertyName();This example shows what happens when the column is initialized with initColumnTextHeader(), then setColumnName() is used to change the column text, and then getPropertyName() is called:
AgoFontIdentifier fontid = new AgoFontIdentifier("Helvetica", 0, 12); colText.initColumnTextHeader( "CustomerId", // this column will always // display the text "CustomerId" fontid, // the font identifier for // text in this column Color.black, // the color for text in this column AgoColumnBase.ALIGN_TOP_LEFT);// the alignment of text in this column // this column will always display the text "CustomerNumber" colText.setColumnName("CustomerNumber"); // this will return "CustomerNumber" String propName = colText.getPropertyName();
AgoColumnText.setPropertyName(String propertyName)
public final void setFormatPattern(String pattern, char datatype)
pattern
- the pattern to be used for formatting the text in this column (for example, "yyyy/MM/dd")datatype
- the value which specifies the datatype of this columnThe following is a list of settable datatype values. The only valid datatype values for AgoColumnText are DatatypeCodes with an * in this list.
DatatypeCodes.TYPE_BOOLEAN | DatatypeCodes.TYPE_CHAR | DatatypeCodes.TYPE_BYTE |
DatatypeCodes.TYPE_SHORT | DatatypeCodes.TYPE_INT | * DatatypeCodes.TYPE_LONG |
DatatypeCodes.TYPE_FLOAT | * DatatypeCodes.TYPE_DOUBLE | DatatypeCodes.TYPE_BYTEARRAY |
DatatypeCodes.TYPE_STRING | DatatypeCodes.TYPE_NUMERIC | * DatatypeCodes.TYPE_DATE |
* DatatypeCodes.TYPE_TIME | * DatatypeCodes.TYPE_TIMESTAMP | DatatypeCodes.TYPE_UUID |
colText1.setFormatPattern("yyyy/MM/dd", DatatypeCodes.TYPE_DATE); colText2.setFormatPattern("##.##", DatatypeCodes.TYPE_DOUBLE);
AgoColumnText.getFormatPattern()
,
AgoColumnText.setFormatStyle(int style, char datatype)
,
AgoColumnText.getDatatype()
public final String getFormatPattern()
The format pattern is used for formatting the column's text.
String fmt = colText.getFormatPattern();
AgoColumnText.setFormatPattern(String pattern, char datatype)
,
AgoColumnText.getFormatStyle()
,
AgoColumnText.getDatatype()
public final void setFormatStyle(int style, char datatype)
style
- the value which specifies the format style to usedatatype
- the value which specifies the datatype of this column
For the datatype
parameter, see the List of datatypes.
For Longs and Doubles, use AgFormat.NUMBERSTYLE, AgFormat.CURRENCYSTYLE, or
AgFormat.PERCENTSTYLE. For Dates, Times, and Timestamps use DatatypeCodes.TYPE_DEFAULT,
DatatypeCodes.TYPE_SHORT, DatatypeCodes.TYPE_LONG, or DatatypeCodes.TYPE_FULL.
colText1.setFormatStyle(DEFAULT, DatatypeCodes.TYPE_TIME); colText2.setFormatStyle(CURRENCYSTYLE, DatatypeCodes.TYPE_DOUBLE);
AgoColumnText.getFormatStyle()
,
AgoColumnText.setFormatPattern(String pattern, char datatype)
,
AgoColumnText.getDatatype()
public final int getFormatStyle()
Returns the format style text column.
int style = colText.getFormatStyle();
AgoColumnText.setFormatStyle(int style, char datatype)
,
AgoColumnText.setFormatPattern(String pattern, char datatype)
,
AgoColumnText.getDatatype()
public final int getDatatype()
For a list of return values see List of datatypes.
int datatype = colText.getDatatype();
AgoColumnText.getFormatPattern()
,
AgoColumnText.getFormatStyle()
public final boolean setColumnName(String columnName)
columnName
- the text you want to display in the columnUse this method only if this column is to contain a constant value (normally a column of a header band). The columnName parameter is equivalent to the string passed in to initColumnTextHeader() method.
colText.setColumnName("Product ID");
AgoColumnText.initColumnTextProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)
,
AgoColumnText.initColumnTextHeader(String headerText, AgoFontIdentifier fontid, Color textColor, int alignment)
public final String getColumnName()
Returns null if it is not able to get the name, for example, if this column has been initialized with initColumnTextProperty() and not the initColumnTextHeader(), or the column is bound to a column in the database.
The return value is equivalent to the string passed in to initColumnTextHeader(). It is available only if this column contains a constant value, which generally means it has to be a column of a header band.
The same value will be returned by a call to getPropertyName().
This example shows what happens when the column is initialized with initColumnTextHeader, then setColumnName is used to change the column text, and then getColumnName is called:
AgoFontIdentifier fontid = new AgoFontIdentifier("Helvetica", 0, 12); colText.initColumnTextHeader( "CustomerId", // this column will always // display the text "CustomerId" fontid, // the font identifier for text // in this column Color.black, // the color for text in this column AgoColumnBase.ALIGN_TOP_LEFT);// the alignment of text in this column // this column will always display the text "CustomerNumber" colText.setColumnName("CustomerNumber"); // this will return "CustomerNumber" String propName = colText.getColumnName();
AgoColumnText.initColumnTextProperty(String propertyName, AgoFontIdentifier fontid, Color textColor, int alignment)
,
AgoColumnText.initColumnTextHeader(String headerText, AgoFontIdentifier fontid, Color textColor, int alignment)
public final String applyFormat(Object obj)
This is a utility function which can be used to format an object in the same way it would be formatted if it were the value of the column. The object specified must be of the same datatype as the column.
colText.setFormatPattern("##.00", DatatypeCodes.TYPE_DOUBLE); Double aNumber = new Double(98.4); // this will return "98.40" String theNumber = colText.applyFormat(aNumber); colText.setFormatPattern("##.##", DatatypeCodes.TYPE_DOUBLE); // this will return "98.4" String theNumber = colText.applyFormat(aNumber);
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |