|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.arsdigita.acs.html.Table
Displays database query results in an html table, with automatic sorting functionality.
Field Summary | |
static int |
DISPLAY_CENTER
|
static int |
DISPLAY_CUSTOM
|
static int |
DISPLAY_DEFAULT
|
static int |
DISPLAY_LEFT
|
static int |
DISPLAY_RIGHT
|
static int |
DISPLAY_TRUE_OR_FALSE
|
static int |
DISPLAY_ZERO_OR_ONE
|
static int |
SORT_CUSTOM
|
static int |
SORT_DEFAULT
|
static int |
SORT_NO_SORT
|
Constructor Summary | |
Table()
Default constructor to make it easier to create an anonymous subclass |
|
Table(PageContext pc)
Public constructor |
Method Summary | |
void |
addColumn(String columnId,
String headerText,
int sortInfo,
int displayInfo)
Adds a new column to the table. |
void |
formatCell(StringBuffer sb,
String columnId,
DataSource ds)
For columns whose displayInfo parameter is set to CUSTOM, this method is called so that subclasses can generate a display different from what is possible with the default displays. |
void |
formatSortClause(StringBuffer sb,
String columnId,
String order)
Called from the orderByFromSortSpec method for columns whose sortInfo parameter has been set to SORT_CUSTOM. |
String |
getHtml()
Iterates through the DataSource to generate an html table. |
static void |
main(String[] args)
|
String |
newSortSpec(String columnId,
String orderby)
Makes a new orderby string, sorting by columnId. |
String |
orderByFromSortSpec()
Translates the "orderby" URL parameter into a SQL ORDER BY clause that may be inserted into a query. |
void |
setAscOrderImg(String ascOrderImg)
This string may contain an icon to display next to the table header which is currently sorted in ascending order. |
void |
setBandColors(String[] bandColors)
Each row in the table will be displayed with alternating colors from this array. |
void |
setDataSource(DataSource ds)
Sets the dataSource property used by the table to retrieve data. |
void |
setDescOrderImg(String descOrderImg)
This string may contain an icon to display next to the table header which is currently sorted in descending order. |
void |
setHeaderRowExtra(String headerRowExtra)
This string may contain any attributes to add to the <th> tag. |
void |
setMaxRows(Integer maxRows)
Specifies the maximum number of rows to display in the table. |
void |
setMissingText(String missingText)
Message to display when the DataSource is empty. |
void |
setOrderby(String orderby)
This is the variable that specifies the last sort column that was clicked. |
void |
setOrderTargetUrl(String orderTargetUrl)
The url linked by the table header tags, meant to sort the table on a different column. |
void |
setPageContext(PageContext pc)
Sets the JSP Page Context for the current request. |
void |
setRowsPerBand(Integer rowsPerBand)
How many rows to display within a single color band. |
void |
setRowsPerPage(Integer rowsPerPage)
Breaks up the display into multiple <table> tags. |
void |
setTableBreakHtml(String tableBreakHtml)
Specifies the html to use between </table> and the next <table>, when breaking the display into multiple tables using the rowsPerPage property. |
void |
setTableExtraHtml(String tableExtraHtml)
This string may contain any attributes to add to the <table> tag. |
String |
toString()
|
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int DISPLAY_DEFAULT
public static final int DISPLAY_LEFT
public static final int DISPLAY_RIGHT
public static final int DISPLAY_CENTER
public static final int DISPLAY_TRUE_OR_FALSE
public static final int DISPLAY_ZERO_OR_ONE
public static final int DISPLAY_CUSTOM
public static final int SORT_DEFAULT
public static final int SORT_NO_SORT
public static final int SORT_CUSTOM
Constructor Detail |
public Table()
public Table(PageContext pc) throws ACSException
pc
- the pageContext for the current requestMethod Detail |
public void setPageContext(PageContext pc) throws ACSException
public final void addColumn(String columnId, String headerText, int sortInfo, int displayInfo) throws ACSException
columnId
- The column name to get from the DataSource. Also used to set orderby for sorting.headerText
- The text to be wrapped in <th> and </th> tags.sortInfo
- Specifies the way sorting works for this column. Choose from one of the SORT_*
constants defined in this class. If CUSTOM is specified, the formatOrderByClause method will be
called to allow customization.displayInfo
- Specifies the way column values are to be displayed. Choose from one of the DISPLAY_*
constants defined in this class. If CUSTOM is specified, the formatCell method will be called
to display values in this column. See the docs for the formatCell method for further information.ACSException
- if the dataSource property has already been set.public void setDataSource(DataSource ds)
ds
- the data this table should display. Most commonly
obtained via the <ad:db_query> custom tag. You
should create the table and set up its column definitions
before specifying the query, so that the table's
orderByFromSortSpec method can be used to limit the query.public String toString()
toString
in class Object
public final String getHtml() throws ACSException, DataSourceException
public void formatCell(StringBuffer sb, String columnId, DataSource ds) throws DataSourceException
sb
- Generate output by calling append on this StringBuffer.columnId
- the column in the DataSource we want to displayds
- the DataSource we are in the process of displayingpublic String newSortSpec(String columnId, String orderby)
public String orderByFromSortSpec() throws ACSException
ACSException
- if pageContext has not been setpublic void formatSortClause(StringBuffer sb, String columnId, String order)
sb
- Contains the ORDER BY clause that orderByFromSortSpec is generating.
You should append your custom sort expression to this StringBuffer.columnId
- The column for which to provide custom sort information.order
- Either "desc" or "asc", according to the current state of the
orderby URL parameter.public void setOrderTargetUrl(String orderTargetUrl)
public void setBandColors(String[] bandColors)
public void setRowsPerBand(Integer rowsPerBand)
public void setOrderby(String orderby)
public void setTableExtraHtml(String tableExtraHtml)
public void setHeaderRowExtra(String headerRowExtra)
public void setAscOrderImg(String ascOrderImg)
public void setDescOrderImg(String descOrderImg)
public void setMaxRows(Integer maxRows)
public void setRowsPerPage(Integer rowsPerPage)
public void setTableBreakHtml(String tableBreakHtml)
public void setMissingText(String missingText)
public static void main(String[] args) throws Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |