|
PAJES 3.0.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pajes.db.entity.MaintenanceDisplayElement
org.pajes.db.entity.Lister
org.pajes.db.entity.PagingLister
org.pajes.db.entity.DefaultLister
public class DefaultLister
Default concrete implementation of a Lister that displays all
columns of all Entity objects in a table.
| Field Summary | |
|---|---|
static java.lang.String |
EVEN_CLASS
The name of the stylesheet class used on even-numbered list rows. |
static java.lang.String |
HEAD_CLASS
The name of the stylesheet class used on the list header row. |
static java.lang.String |
LISTER_FACTORY
The name of the ServletContext attribute that can contain a PajeFactory instance that will generate generic
lists to displaying Entity objects. |
static java.lang.String |
ODD_CLASS
The name of the stylesheet class used on odd-numbered list rows. |
static java.lang.String |
PAGE_CLASS
The name of the stylesheet class used on the cells containing navigation anchors. |
| Fields inherited from class org.pajes.db.entity.PagingLister |
|---|
FIRST_LIST_VALUE, LAST_LIST_VALUE, LIST_PARAMETER, NEXT_LIST_VALUE, PREVIOUS_LIST_VALUE, ROWS_PARAMETER |
| Fields inherited from class org.pajes.db.entity.Lister |
|---|
SEARCH_ATTRIBUTE_SUFFIX, SEARCH_PARAMETER, SEARCH_PARAMETER_VALUE, SORT_ATTRIBUTE_SUFFIX, SORT_PARAMETER |
| Constructor Summary | |
|---|---|
DefaultLister()
Creates the default Lister. |
|
| Method Summary | |
|---|---|
protected Paje |
createPaje()
Creates the Paje to display a list of Entity objects. |
protected HTML |
getAddAnchor()
Gets the HTML tag to add a new item. |
protected Anchor |
getBaseAnchor()
Returns the base Anchor used by Lister.getAnchor(org.pajes.db.entity.Entity). |
protected Anchor |
getBaseNavigationAnchor(HTML text,
java.lang.String listParameterValue)
Returns the base Anchor used by getFirstPageAnchor(),
getLastPageAnchor(), getNextPageAnchor() and
getPreviousPageAnchor(). |
protected HTML |
getFirstPageAnchor()
Gets the HTML tag to go to the first page of Entity objects. |
protected int |
getHeaderRowCount()
Returns the number of header rows. |
protected HTML |
getLastPageAnchor()
Gets the Anchor to go to the last page of Entity objects. |
protected HTML |
getNextPageAnchor()
Gets the Anchor to go to the next page of Entity objects. |
Paje |
getPaje()
Returns a Paje to display a list of Entity objects. |
protected HTML |
getPreviousPageAnchor()
Gets the Anchor to go to the previous page of Entity objects. |
protected Table.Row |
getRow(int rowNumber)
Returns the row to be populated from an Entity. |
protected Anchor |
getSortAnchor(Attributes attributes)
Gets the Anchor to sort by a specified column. |
protected java.lang.String |
getSortByTitle(java.lang.String columnLabel)
Returns the title to indicate that clicking the
label will sort by that column. |
protected Table |
getTable()
Returns the Table that can be used to display a list of
Entity objects managed by this object. |
protected void |
getTableAddRow(Table.Row add,
java.util.Collection<Attributes> columns)
Called by getTable() to populate the Add Row. |
protected java.util.Collection<Attributes> |
getTableColumns()
Called by getTable() to return a Collection
containing the Attributes objects, in the correct sequence, of
the columns that should be displayed in the table. |
protected void |
getTableEvenPrototype(Table.Row even,
java.util.Collection<Attributes> columns)
Called by getTable() to populate the even prototype
Row . |
protected void |
getTableHeader(Table.Row header,
java.util.Collection<Attributes> columns)
Called by getTable() to populate the Row containing
the column headings. |
protected void |
getTableNavigation(Table.Row row,
java.util.Collection<Attributes> columns)
Called by getTable() to populate the Navigation Row. |
protected void |
getTableOddPrototype(Table.Row odd,
java.util.Collection<Attributes> columns)
Called by getTable() to populate the odd prototype
Row . |
protected java.lang.String |
getUpToMessage()
Returns the "up to" message displayed in the navigation bar. |
protected void |
init()
DefaultLister initialisation to set defaults from the Servlet Context. |
void |
setAddLabel(HTML label)
Sets the label used to identify the hyperlink to add a new Entity
. |
void |
setAddLabel(java.lang.String label)
Sets the label used to identify the hyperlink to add a new Entity
. |
void |
setAddTitle(java.lang.String text)
Sets the title of the hyperlink to add a new Entity. |
void |
setFirstPageAnchorText(HTML text)
Sets the Anchor text to go to the first page of Entity objects. |
void |
setFirstPageAnchorText(java.lang.String text)
Sets the Anchor text to go to the first page of Entity objects. |
void |
setFirstPageAnchorTitle(java.lang.String title)
Sets the Anchor title to go to the first page of Entity objects. |
void |
setLastPageAnchorText(HTML text)
Sets the Anchor text to go to the last page of Entity objects. |
void |
setLastPageAnchorText(java.lang.String text)
Sets the Anchor text to go to the last page of Entity objects. |
void |
setLastPageAnchorTitle(java.lang.String title)
Sets the Anchor title to go to the last page of Entity objects. |
protected void |
setListerFactory(PajeFactory lister)
Sets the Lister factory object. |
void |
setNextPageAnchorText(HTML text)
Sets the Anchor text to go to the next page of Entity objects. |
void |
setNextPageAnchorText(java.lang.String text)
Sets the Anchor text to go to the next page of Entity objects. |
void |
setNextPageAnchorTitle(java.lang.String title)
Sets the Anchor title to go to the next page of Entity objects. |
void |
setPreviousPageAnchorText(HTML text)
Sets the Anchor text to go to the previous page of Entity
objects. |
void |
setPreviousPageAnchorText(java.lang.String text)
Sets the Anchor text to go to the previous page of Entity
objects. |
void |
setPreviousPageAnchorTitle(java.lang.String title)
Sets the Anchor title to go to the previous page of Entity
objects. |
void |
setSortByTitle(java.text.MessageFormat heading)
The MessageFormat that will be used to create the title to indicate that clicking the label will sort by that column. |
void |
setUpToMessage(java.text.MessageFormat upto)
The MessageFormat that will be used to create the indicating the first ({0}) and last ({1}) row numbers displayed, and the total number of rows in the set ({2}), or the current page ({3}) and total number of pages ({4}). |
void |
setViewOnly()
Changes the behaviour of the list so that it displays the Viewer rather than the
Editor when an entity is selected. |
| Methods inherited from class org.pajes.db.entity.PagingLister |
|---|
getFirstIndex, getLastIndex, getLastPageNumber, getPageNumber, getPageSize, getSetSize, init, retrieveSet, setFirstIndex, setPageSize |
| Methods inherited from class org.pajes.db.entity.Lister |
|---|
build, getAnchor, getScope, getSearchAttributeName, getSortAttributeName, init, onCell, onFirstRow, onLastRow, onRow, setNullDisplay, useQualifiedColumnNamesInScope |
| Methods inherited from class org.pajes.db.entity.MaintenanceDisplayElement |
|---|
clone, getManager, getRequest, getServletContext, isInitialised, setRequest |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EVEN_CLASS
public static final java.lang.String HEAD_CLASS
public static final java.lang.String LISTER_FACTORY
PajeFactory instance that will generate generic
lists to displaying Entity objects.
public static final java.lang.String ODD_CLASS
public static final java.lang.String PAGE_CLASS
| Constructor Detail |
|---|
public DefaultLister()
| Method Detail |
|---|
public Paje getPaje()
throws java.io.IOException
Paje to display a list of Entity objects.
The default implementation calls createPaje(), then
Lister.build(). It then uses PagingLister.getFirstIndex() and
PagingLister.getLastIndex() to determine whether the
ListerTemplate.getNavigateFirst(org.pajes.html.Container) and
ListerTemplate.getNavigatePrevious(org.pajes.html.Container), or
ListerTemplate.getNavigateNext(org.pajes.html.Container) and
ListerTemplate.getNavigateLast(org.pajes.html.Container) tags should be
setWritable(false) or in fact whether the entire
ListerTemplate.getNavigationRow(org.pajes.html.Container) should not be written. If it
should, and ListerTemplate.getNavigateUptoMessage(org.pajes.html.Container) returns a valid
HTML item, then its content will be set to the String returned by
getUpToMessage().
getPaje in class Listerjava.io.IOException - if an error occurs creating the lister paje.Lister.build()public void setAddLabel(HTML label)
Entity
.
label - the new label.public void setAddLabel(java.lang.String label)
Entity
.
The default is "Add...".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.addLabel and a
<param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.addLabel</param-name>
<param-value>Add...</param-value>
</context-param>
label - the new label.public void setAddTitle(java.lang.String text)
Entity.
The default is "Add".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.addTitle and a
<param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.addTitle</param-name>
<param-value>Add</param-value>
</context-param>
text - the new title text.public void setFirstPageAnchorText(HTML text)
Entity objects.
text - The new firstPageAnchorText valuepublic void setFirstPageAnchorText(java.lang.String text)
Entity objects.
The default is "<<".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.firstPageAnchorText and
a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.firstPageAnchorText</param-name>
<param-value><<</param-value>
</context-param>
text - The new firstPageAnchorText valuepublic void setFirstPageAnchorTitle(java.lang.String title)
Entity objects.
The default is "First Page".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.firstPageAnchorTitle
and a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.firstPageAnchorTitle</param-name>
<param-value>First Page</param-value>
</context-param>
title - The new firstPageAnchorTitle valuepublic void setLastPageAnchorText(HTML text)
Entity objects.
text - The new lastPageAnchorText valuepublic void setLastPageAnchorText(java.lang.String text)
Entity objects.
The default is ">>"..
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.lastPageAnchorText ,
and a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.lastPageAnchorText</param-name>
<param-value>>></param-value>
</context-param>
text - The new lastPageAnchorText valuepublic void setLastPageAnchorTitle(java.lang.String title)
Entity objects.
The default is "Last Page".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.lastPageAnchorTitle and
a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.lastPageAnchorTitle</param-name>
<param-value>Last Page</param-value>
</context-param>
title - The new lastPageAnchorTitle valuepublic void setNextPageAnchorText(HTML text)
Entity objects.
text - The new nextPageAnchorText valuepublic void setNextPageAnchorText(java.lang.String text)
Entity objects.
The default is ">"..
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.nextPageAnchorText and
a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.nextPageAnchorText</param-name>
<param-value>></param-value>
</context-param>
text - The new nextPageAnchorText valuepublic void setNextPageAnchorTitle(java.lang.String title)
Entity objects.
The default is "Next Page".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.nextPageAnchorTitle and
a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.nextPageAnchorTitle</param-name>
<param-value>Next Page</param-value>
</context-param>
title - The new nextPageAnchorTitle valuepublic void setPreviousPageAnchorText(HTML text)
Entity
objects.
text - The new previousPageAnchorText valuepublic void setPreviousPageAnchorText(java.lang.String text)
Entity
objects.
The default is "<".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.previousPageAnchorText
and a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.previousPageAnchorText</param-name>
<param-value><</param-value>
</context-param>
text - The new previousPageAnchorText valuepublic void setPreviousPageAnchorTitle(java.lang.String title)
Entity
objects.
The default is "Previous Page".
This default value may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.previousPageAnchorTitle
and a <param-value> containing the text. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.previousPageAnchorTitle</param-name>
<param-value>Previous Page</param-value>
</context-param>
title - The new previousPageAnchorTitle valuepublic void setSortByTitle(java.text.MessageFormat heading)
title to indicate that clicking the label will sort by that column. The
column label will be passed in and replace {0}.
The default pattern is "Sort by {0}".
This default pattern may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.sortByTitlePattern and
a <param-value> containing the pattern. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.sortByTitlePattern</param-name>
<param-value>Sort by {0}</param-value>
</context-param>
heading - The new heading MessageFormat.public void setUpToMessage(java.text.MessageFormat upto)
The default pattern is "{0,number,integer} to {1,number,integer} of {2,number,integer}".
This default pattern may be over-ridden in the web application deployment
descriptor. To set the default value, create a
<context-param> with a <param-name>
of org.pajes.db.entity.DefaultLister.upToMessagePattern and
a <param-value> containing the pattern. For example:
<context-param>
<param-name>org.pajes.db.entity.DefaultLister.upToMessagePattern</param-name>
<param-value>
Page {3,number,integer} of {4,number,integer} pages
</param-value>
</context-param>
upto - The new up to message MessageFormat.public void setViewOnly()
Viewer rather than the
Editor when an entity is selected.
protected Paje createPaje()
throws java.io.IOException
Paje to display a list of Entity objects.
The Paje to be returned will be determined as follows:
Lister has been defined, it will be
requested to create a document.Lister has been defined, the
ServletContext will be searched for an attribute named
LISTER_FACTORY, and the object returned by
ServletContext.getAttribute will be requested to create a
document. Context default Lister factory objects should be created in
your Initialisation sub-class.
Once a document has been instantiated, the Container
identified by ListerTemplate.LIST_CONTAINER_ID will be retrieved.
If this container is empty, the Table returned by
getTable() will be added to the container.
Note that the table to be populated must contain two prototype
rows for displaying odd and even numbered records. These table rows must
have id attributes of oddPrototype and evenPrototype
respectivlely. The table may optionally contain a row with an id
attribute of addRow, which should contain
an anchor or a button to add a new Entity.
java.io.IOException - if an error occurs creating the lister paje.
EntityException - if an error occurs creatign the paje.protected HTML getAddAnchor()
Anchor.
Sub-classes may over-ride this method to return a tag other than the
default, which directs the user to the MaintenanceServlet in
create mode.
protected Anchor getBaseAnchor()
Anchor used by Lister.getAnchor(org.pajes.db.entity.Entity).
Sub-classes may over-ride this method to return an Anchor
other than the default, which directs the user to the
MaintenanceServlet in
edit mode.
getBaseAnchor in class Lister
protected Anchor getBaseNavigationAnchor(HTML text,
java.lang.String listParameterValue)
Anchor used by getFirstPageAnchor(),
getLastPageAnchor(), getNextPageAnchor() and
getPreviousPageAnchor().
text - the text to appear in the anchor.listParameterValue - the value of the PagingLister.LIST_PARAMETER.
protected HTML getFirstPageAnchor()
Entity objects. The
default implementation returns an Anchor.
protected int getHeaderRowCount()
Lister
getHeaderRowCount in class ListerLister.getHeaderRowCount()protected HTML getLastPageAnchor()
Entity objects. The
default implementation returns an Anchor.
protected HTML getNextPageAnchor()
Entity objects. The
default implementation returns an Anchor.
protected HTML getPreviousPageAnchor()
Entity objects. The
default implementation returns an Anchor.
protected Table.Row getRow(int rowNumber)
Entity. Sub-classes may
over-ride this method to return different rows based on its position in
the list.
getRow in class ListerrowNumber - the position in the list.
protected Anchor getSortAnchor(Attributes attributes)
attributes - The column attributes.
protected java.lang.String getSortByTitle(java.lang.String columnLabel)
title to indicate that clicking the
label will sort by that column.
columnLabel - The name of the column.
protected Table getTable()
throws java.io.IOException
Table that can be used to display a list of
Entity objects managed by this object. All columns will be displayed,
except those where Attributes.getListerPosition() returns a number
less than zero.
This implementation creates a new Table, and then populates
it by calling the following methods in the sequence shown:
getTableHeader(org.pajes.html.Table.Row, java.util.Collection) getTableOddPrototype(org.pajes.html.Table.Row, java.util.Collection) getTableEvenPrototype(org.pajes.html.Table.Row, java.util.Collection) getTableAddRow(org.pajes.html.Table.Row, java.util.Collection) getTableNavigation(org.pajes.html.Table.Row, java.util.Collection)
The Collection passed to each of these methods is obtained
from getTableColumns().
Sub-classes may over-ride this method to return a table other than the default.
Note that if getPaje() does not find an empty
container in which to place the
table, this method will not be called.
Also note that the table returned should either be a clone of a pre-defined table, or a new table each time. The same instance of the table should never be returned more than once.
java.io.IOException - if an IO exception occurs.
protected void getTableAddRow(Table.Row add,
java.util.Collection<Attributes> columns)
throws java.io.IOException
getTable() to populate the Add Row.
Sub-classes may over-ride this method to create an add row other than the default.
add - the row to be populated.columns - a Collection containing the Attributes
objects, in the correct sequence, of the columns that should
be displayed.
java.io.IOException - if an IO exception occurs.
protected java.util.Collection<Attributes> getTableColumns()
throws java.io.IOException
getTable() to return a Collection
containing the Attributes objects, in the correct sequence, of
the columns that should be displayed in the table.
Collection containing the Attributes
objects, in the correct sequence, of the columns that should be
displayed.
java.io.IOException - if an IO exception occurs.
protected void getTableEvenPrototype(Table.Row even,
java.util.Collection<Attributes> columns)
throws java.io.IOException
getTable() to populate the even prototype
Row .
Sub-classes may over-ride this method to create an even prototype row other than the default.
even - the row to be populated.columns - a Collection containing the Attributes
objects, in the correct sequence, of the columns that should
be displayed.
java.io.IOException - if an IO exception occurs.
protected void getTableHeader(Table.Row header,
java.util.Collection<Attributes> columns)
throws java.io.IOException
getTable() to populate the Row containing
the column headings.
Sub-classes may over-ride this method to create a heading row other than the default.
header - the row to be populated.columns - a Collection containing the Attributes
objects, in the correct sequence, of the columns that should
be displayed.
java.io.IOException - if an IO exception occurs.
protected void getTableNavigation(Table.Row row,
java.util.Collection<Attributes> columns)
throws java.io.IOException
getTable() to populate the Navigation Row.
Sub-classes may over-ride this method to create a navigation row other than the default.
row - the row to be populated.columns - a Collection containing the Attributes
objects, in the correct sequence, of the columns that should
be displayed.
java.io.IOException - if an IO exception occurs.
protected void getTableOddPrototype(Table.Row odd,
java.util.Collection<Attributes> columns)
throws java.io.IOException
getTable() to populate the odd prototype
Row .
Sub-classes may over-ride this method to create an odd prototype row other than the default.
odd - the row to be populated.columns - a Collection containing the Attributes
objects, in the correct sequence, of the columns that should
be displayed.
java.io.IOException - if an IO exception occurs.
protected java.lang.String getUpToMessage()
throws java.sql.SQLException
java.sql.SQLException - if an error occurs determing the set size.
protected void init()
throws java.io.IOException
If this method is over-rdden, the sub-class MUST call
super.init() to correctly iniitalise the lister.
init in class MaintenanceDisplayElementjava.io.IOException - if an IO exception occurs.protected void setListerFactory(PajeFactory lister)
lister - the Lister factory object.
|
PAJES 3.0.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||