BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.databinding.grid.column
Class SortFilterColumn

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag
                  extended by com.bea.wlw.netui.tags.databinding.grid.GridComponent
                      extended by com.bea.wlw.netui.tags.databinding.grid.column.GridColumn
                          extended by com.bea.wlw.netui.tags.databinding.grid.column.FormattableColumn
                              extended by com.bea.wlw.netui.tags.databinding.grid.column.SortFilterColumn
All Implemented Interfaces:
Formattable, HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
BasicColumn, ImageColumn

public abstract class SortFilterColumn
extends FormattableColumn

The abstract base class of a grid column that is sortable and / or filterable. Depending on the type of the data set to which a grid tag is bound, the data set may be sortable and / or filterable. Columns of this type have attributes that determine these capabilities by using the attributes set on a GridColumn tag and the parent Columns tag.

If a particular GridColumn is determined to be either sortable or filterable, the header of the column is rendered with HTML anchor tags (links) that will parameterize the URL to preform the sort or filter.

For a sortable column, the title of the column will be rendered as a link which, if clicked on, will set a sort in the URL parameters that preserves all previous sorts / filters and changes or sets the direction of a sort on this column.

For a filterable columm, a small filter icon will be rendered next to the column name that will display a UI which allows a filter, including the filter operation and filter value, to be set on the column.

In both the sort and filter case, the URL for a current page is changed in order to display the correct view on a data set on the next page.

Required resources:

The JavaScript file _grid.js must be included in any page with a com.bea.wlw.netui.tags.databinding.Grid if the Grid includes any SortFilterColumn that has filtering enabled.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
filterableNoNoNo
A boolean that enables this column to be sortable. This attribute overrides the Columns.setFilterable(boolean) attribute of the Columns tag.
filterActionNoNoNo
The action that will be executed if this GridColumn is sorted. This attribute overrides the Columns.setFilterAction(String) attribute of the Columns tag.
nameNoNoNo
When rendering in Grid.ROWS state, this is the name of the data from the current data item that is rendered for this row.
sortableNoNoNo
A boolean that enables this column to be sortable. This attribute overrides the Columns.setSortable(boolean) attribute of the Columns tag.
sortActionNoNoNo
The action that will be executed if this GridColumn is sorted. This attribute overrides the Columns.setSortAction(String) attribute of the Columns tag.
titleNoNoYes
The title that will be rendered in the header of this tag

See Also:
SortFilterService, Serialized Form

Field Summary
 
Fields inherited from class com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag
EMPTY_STRING
 
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
SortFilterColumn()
           
 
Method Summary
protected  String calculateURL(String destination, Map queryParams)
          Given a destination, action or href, and a list of query parameters, calculate the URL that will be rendered for a sort or filter link.
 boolean canFilter()
          Determine the absolute ability of a SortFilterColumn to be filtered.
 boolean canSort()
          Determine the absolute ability of a SortFilterColumn to be filtered.
 String computeFilterAction()
          Get the absolute filter action for a SortFilterColumn.
 String computeSortAction()
          Get the absolute sort action for a SortFilterColumn.
 String getFilterAction()
          Get the action that will be invoked if this column is filtered.
 String getName()
          Get the name of the data that is rendered by this column.
 String getSortAction()
          Get the action that will be invoked if this column is sorted.
 String getTitle()
          Get the title rendered in the header cell of this column.
protected  String getTitleText()
           
 boolean isFilterable()
          Get whether or not this column can be filtered.
 boolean isSortable()
          Get whether or not this column can be sorted.
protected  void localRelease()
          Reset all of the fields of this tag.
protected  void prepare()
          Implementation of the StructuredBaseTag.prepare() method.
protected  String renderFilterMarkup(GridContext gridContext, String realColumnName, String readableColumnName, int columnType)
          Render the filter mark-up that will enable this column to be filtered.
 String renderHeaderCell()
          Render the header of a column that may be sortable or filterable.
protected  String renderSortMarkup(String gridName, String columnName, String columnTitle, int columnType)
          Render the sort mark-up that will enable this column to be sorted.
 void setFilterable(boolean filterable)
          Set whether or not this column can be filtered.
 void setFilterAction(String filterAction)
          Set the action that will be invoked if this column is sorted.
 void setName(String name)
          Set the name of the data that is referenced by this column.
 void setSortable(boolean sortable)
          Set whether or not this column can be sorted.
 void setSortAction(String sortAction)
          Set the action that will be invoked if this column is sorted.
 void setTitle(String title)
          Set the title rendered in the header cell of this column.
protected  void verifyAttributes()
          Ensure that the attributes set on the tag are valid.
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.column.FormattableColumn
addFormatter, format, renderStartTag
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.column.GridColumn
getColumns, getStyleClassPrefix, getValidContainerType, renderCloseCellTag, renderDataCell, renderDataCellTag, renderEndTag, renderFooterCell, renderFooterCellTag, renderHeaderCellTag, renderOpenCellTag, setStyleClassPrefix
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.GridComponent
getCurrentRenderState, getGrid, getGridContext
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag
addContent, doEndTag, doStartTag, getContent, verifyStructure
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getTagName, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Constructor Detail

SortFilterColumn

public SortFilterColumn()
Method Detail

setTitle

public void setTitle(String title)
Set the title rendered in the header cell of this column.

Parameters:
title - the title of the column
Beadoc.attributedescription:
The text that will be rendered in the columns header.
Beadoc.attributesyntaxvalue:
string_title
Beadoc.databindable:
false

getTitle

public String getTitle()
Get the title rendered in the header cell of this column.

Returns:
the title of the colum

setName

public void setName(String name)
Set the name of the data that is referenced by this column. Because data is extracted from the "current" data item by name, the name attribute is used to specify which data should be extraced for a given column. This attribute is usually used when rendering the value for a cell that is rendered in the Grid's Grid.ROWS render state.

Parameters:
name - the name of the data to extract from the current data item.
Beadoc.attributedescription:
The name of the data that is referenced by this column. Because data is extracted from the current data item by name, this attribute attribute is used to specify which data should be extracted for a given column.
Beadoc.attributesyntaxvalue:
string_name
Beadoc.databindable:
true

getName

public String getName()
Get the name of the data that is rendered by this column.

Returns:
the name of the data to render

setFilterable

public void setFilterable(boolean filterable)
Set whether or not this column can be filtered.

Parameters:
filterable - a boolean that sets this capability. If true this column may be filterable; otherwise it is not.
Beadoc.attributedescription:
Boolean. Determines whether or not the column is filterable
Beadoc.attributesyntaxvalue:
boolean_filterable
Beadoc.databindable:
false

isFilterable

public boolean isFilterable()
Get whether or not this column can be filtered.

Returns:
true if this column is filterable; false otherwise.

setSortable

public void setSortable(boolean sortable)
Set whether or not this column can be sorted.

Parameters:
sortable - a boolean that sets this capability. If true this column may be filterable; otherwise it is not.
Beadoc.attributedescription:
Boolean. Determines whether or not the column is sortable.
Beadoc.attributesyntaxvalue:
boolean_sortable
Beadoc.databindable:
false

isSortable

public boolean isSortable()
Get whether or not this column can be sorted.

Returns:
true if this coolumn is sortable; false otherwise.

setSortAction

public void setSortAction(String sortAction)
Set the action that will be invoked if this column is sorted. The use of this attribute requires the presence of a PageFlowController in the JSP's directory.

Parameters:
sortAction - the action that will be called to sort the column
Beadoc.attributedescription:
The action method that will handle the sort operation.
Beadoc.attributesyntaxvalue:
string_sortAction
Beadoc.databindable:
false

getSortAction

public String getSortAction()
Get the action that will be invoked if this column is sorted.

Returns:
the action that will be called to sort the column

setFilterAction

public void setFilterAction(String filterAction)
Set the action that will be invoked if this column is sorted. The use of this attribute requires the presence of a PageFlowController in the JSP's directory.

Parameters:
filterAction - the action that will be called to filter the column
Beadoc.attributedescription:
The action method that will handle the filter operation.
Beadoc.attributesyntaxvalue:
string_filterAction
Beadoc.databindable:
false

getFilterAction

public String getFilterAction()
Get the action that will be invoked if this column is filtered.

Returns:
the action that will be called to filter the column

localRelease

protected void localRelease()
Reset all of the fields of this tag.

Overrides:
localRelease in class FormattableColumn

renderHeaderCell

public String renderHeaderCell()
                        throws javax.servlet.jsp.JspException
Render the header of a column that may be sortable or filterable. Sorting and filtering on a Grid is performed through the use of a URL syntax that is interpreted into statements that can sort or filter the grid's dataset. The links to sort or filter a grid column are rendered in the header of the column.
If a column is sortable, the title of the column will be rendered as a link that, when pressed, will sort the column in an order opposite the order of the current sort.
If a column is filterable, an image anchor will be rendered as a link that, when pressed, will filter the column using the operation and values that are provided in the URL.

Specified by:
renderHeaderCell in class GridColumn
Returns:
the String content of this header cell
Throws:
javax.servlet.jsp.JspException - if an error occurs that can not be shown in the page

canFilter

public boolean canFilter()
Determine the absolute ability of a SortFilterColumn to be filtered. The capability of a column to be filterable is determined as a combination of the sortable attributes on this tag as well as the sortable attribute on the Columns tag. The rules for determining whether a column is filterable are:


canSort

public boolean canSort()
Determine the absolute ability of a SortFilterColumn to be filtered. The capability of a column to be sortable is determined as a combination of the sortable attributes on this tag as well as the sortable attribute on the Columns tag. The rules for determining whether a column is sortable are:


computeFilterAction

public String computeFilterAction()
Get the absolute filter action for a SortFilterColumn. This filter action is determined by combining the filter action on this tag as well as the filter action on the Columns tag. The rules for determining the filter action are:


computeSortAction

public String computeSortAction()
Get the absolute sort action for a SortFilterColumn. This sort action is determined by combining the sort action on this tag as well as the sort action on the Columns tag. The rules for determining the sort action are:


verifyAttributes

protected void verifyAttributes()
                         throws javax.servlet.jsp.JspException
Ensure that the attributes set on the tag are valid. The requirements are:

Overrides:
verifyAttributes in class StructuredBaseTag
Throws:
javax.servlet.jsp.JspException - if an error occurs that can not be reported in the page

getTitleText

protected String getTitleText()

calculateURL

protected final String calculateURL(String destination,
                                    Map queryParams)
                             throws javax.servlet.jsp.JspException
Given a destination, action or href, and a list of query parameters, calculate the URL that will be rendered for a sort or filter link.

Throws:
javax.servlet.jsp.JspException
Exclude:

renderFilterMarkup

protected final String renderFilterMarkup(GridContext gridContext,
                                          String realColumnName,
                                          String readableColumnName,
                                          int columnType)
                                   throws javax.servlet.jsp.JspException
Render the filter mark-up that will enable this column to be filtered. This implementation renders a small filter icon that changes depending on whether or not this column is already filtered.

Throws:
javax.servlet.jsp.JspException
Exclude:

renderSortMarkup

protected final String renderSortMarkup(String gridName,
                                        String columnName,
                                        String columnTitle,
                                        int columnType)
                                 throws javax.servlet.jsp.JspException
Render the sort mark-up that will enable this column to be sorted. This implementation renders the title of a column as a link that submits to the given action with additional URL parameters that, when interpreted in the action, will cause the data set to be sorted.

Throws:
javax.servlet.jsp.JspException
Exclude:

prepare

protected void prepare()
Description copied from class: GridColumn
Implementation of the StructuredBaseTag.prepare() method. This method finds the parent Columns tag and references it locally so that subclasses can access the Columns tag easily.

Overrides:
prepare in class GridColumn

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.