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 AnchorColumn

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
                                  extended by com.bea.wlw.netui.tags.databinding.grid.column.ImageColumn
                                      extended by com.bea.wlw.netui.tags.databinding.grid.column.AnchorColumn
All Implemented Interfaces:
Formattable, HtmlConstants, URLParams, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class AnchorColumn
extends ImageColumn
implements URLParams

A column that renders an HTML anchor into each data cell in the column. The anchor that is created is constructed from attributes on this tag and any nested Parameter or ParameterMap tags; this GridColumn implements the URLParams interface. The anchor can be constructed in one of two ways -- using text provided in the title attribute or using data from the current item in the data set. If using the title attribute, the column is not filterable or sortable as there is no data from the data set to filter or sort. If using data from the current item, the column can be filtered and sorted.

The AnchorColumn has the ability to render an image inside the anchor, resulting in the image being clickable. This can be accomplished by setting the src attribute and other attributes that are available on the ImageColumn tag. An image will be rendered if the src attribute is set and the name attribute is null. Otherwise, the data in the current data item that that matches the name attribute will be rendered. If rendering an image using the src attribute, the column can be sorted and filtered on the name of the image.

In constructing an anchor from the attributes on the tag, exactly one of the href and action attributes must be specified. Providing both or neither will result in an error being reported.

Required resources:

The JavaScript file _grid.js must be included in any JSP page with a grid that uses a filter-enabled AnchorColumn. The Page Flow Wizard adds the _grid.js file to a project's /resources/grid directory, when you build a page flow over a database control. The JSP should contain:

<script language="javascript" src="/resources/grid/_grid.js" type="text/javascript"></script>

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
actionNoNoNo
The action that should be part of the HTML anchor that is rendered in this column.
addRowIdNoYesNo
A boolean that denotes that the unique identifier for this row, if one is available, will be rendered onto the generated HTML anchor.
altNoYesNo
The alternate text displayed in the browser if the image cannot be displayed.
borderNoYesNo
The number of pixels to display in a border around this image. The default border is zero.
filterableNoYesNo
A boolean specifying whether the anchors can be filtered.
filterActionNoYesNo
The name of the action that will perform the filter operation.
hrefNoYesNo
The web addressable resource that will be part of the HTML anchor that is rendered in this column.
nameNoYesYes
If specified, the value of the data is extracted from the Grid's current data item. Otherwise, the title attribute is used for the cell's content.
sortableNoYesNo
A boolean specifying whether the anchor column's contents can be sorted.
sortActionNoYesNo
The name of the action that will perform the sort operation.
titleNoNoNo
The text that will be rendered in the header for this column.

See Also:
Serialized Form
Example:
This sample shows <netui-data:anchorColumn> tags used in a <netui:grid> tag.
         <netui-data:grid dataSource="{pageFlow.allRows}" name="{pageFlow.gridName}">
             <netui-data:gridStyle styleClassPrefix="gridStyle"/>
             <netui-data:pager renderInHeader="true" action="pageAction" renderInFooter="true"/>
             <netui-data:columns filterAction="begin" sortAction="begin">
                 <netui-data:anchorColumn action="detailsItems" addRowId="true" title="Details"/>
                 <netui-data:anchorColumn action="updateItems" addRowId="true" title="Edit"/>
                 <netui-data:basicColumn filterable="true" title="Itemnumber" sortable="true" name="itemnumber"/>
                 <netui-data:basicColumn filterable="true" title="Itemname" sortable="true" name="itemname"/>
                 <netui-data:basicColumn filterable="true" title="Quantityavailable" sortable="true" name="quantityavailable"/>
                 <netui-data:basicColumn filterable="true" title="Price" sortable="true" name="price"/>
             </netui-data:columns>
         </netui-data:grid>

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/grid/grid.jsp
Beadoc.see:
<netui-data:grid> Tag Sample
Beadoc.tagdescription:

This tag renders a column with an HTML hyperlink in each data cell. The anchor that is created is constructed from attributes on this tag and any nested Parameter or ParameterMap tags.

The hyperlink can be constructed in one of two ways: (1) using text provided in the title attribute or (2) using data from the current item in the data set. If using the title attribute, the column is not filterable or sortable as there is no data from the data set to filter or sort. If using data from the current item, the column can be filtered and sorted.

The <netui:anchorColumn> has the ability to render a clickable image inside the hyperlink. An image will be rendered if the src attribute is set and the name attribute is null. Otherwise, the data in the current data item that matches the name attribute will be rendered. If rendering an image using the src attribute, the column can be sorted and filtered on the name of the image.

In constructing an anchor from the attributes on the tag, exactly one of the href and action attributes must be specified. Providing both or neither will result in an error being reported.

Required resources:

The JavaScript file _grid.js must be included in any JSP page with a grid that uses a filter-enabled <netui:anchorColumn>. The New Page Flow Wizard (available at File-->New-->Page Flow) adds the _grid.js file to a project's /resources/grid directory, when you build a Page Flow over a database control. The JSP page should contain:

    <script language="javascript" src="/resources/grid/_grid.js"
        type="text/javascript"></script>


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
AnchorColumn()
           
 
Method Summary
 void addParameter(String name, Object value)
          This method allows the key / value pairs that will be written onto the URL to be added to the anchor that is rendered for each cell in the column that is rendered for an item in the dataset.
 String getAction()
          Get the action that is rendered in the anchor of this column.
 boolean getAddRowId()
          Get the boolean for whether this tag will encode a record's unique identifier into the URL.
 String getHref()
          Get the href that is rendered in the anchor of this column.
 String getTagName()
          Get the name of this tag.
 String getTarget()
          Returns the window target.
protected  void localRelease()
          Reset all of the fields of this tag.
protected  void prepare()
          Perform initialization for this tag.
 String renderDataCell()
          Render the contents of this AnchorColumn for the current data item from the containing Grid tag.
 String renderFooterCell()
          Render the footer.
protected  int renderStartTag(int gridState)
          This tag only evaluates its body when the grid is rendering its ROWS.
 void setAction(String action)
          Set the action that is rendered in the anchor of this column.
 void setAddRowId(boolean addRowId)
          Set a boolean that, if true, will encode the record's unique identifier, often the primary key, onto each anchor's URL link.
 void setHref(String href)
          Set the href that is rendered in the anchor of this column.
 void setTarget(String target)
          Sets the window target.
protected  void verifyAttributes()
          Verify the attributes on this tag.
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.column.ImageColumn
getAlt, getBorder, getHeight, getSrc, getWidth, renderImage, setAlt, setBorder, setHeight, setSrc, setWidth
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.column.SortFilterColumn
calculateURL, canFilter, canSort, computeFilterAction, computeSortAction, getFilterAction, getName, getSortAction, getTitle, getTitleText, isFilterable, isSortable, renderFilterMarkup, renderHeaderCell, renderSortMarkup, setFilterable, setFilterAction, setName, setSortable, setSortAction, setTitle
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.column.FormattableColumn
addFormatter, format
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.grid.column.GridColumn
getColumns, getStyleClassPrefix, getValidContainerType, renderCloseCellTag, renderDataCellTag, renderEndTag, 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, 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

AnchorColumn

public AnchorColumn()
Method Detail

setAddRowId

public void setAddRowId(boolean addRowId)
Set a boolean that, if true, will encode the record's unique identifier, often the primary key, onto each anchor's URL link.

Parameters:
addRowId - a boolean that will encode the unique identifier if true
Beadoc.attributedescription:
Boolean. If set to true, the record's unique identifier, often a primary key, will be encoded into the record's link.
Beadoc.attributesyntaxvalue:
boolean_addRowId
Beadoc.databindable:
false

getAddRowId

public boolean getAddRowId()
Get the boolean for whether this tag will encode a record's unique identifier into the URL.

Returns:
true if the unique identifier will be encoded; false otherwise.

setHref

public void setHref(String href)
Set the href that is rendered in the anchor of this column. Only one of the href and action attributes may be set on this tag.

Parameters:
href - the href to render in the HTML anchor tag.
Beadoc.attributedescription:
The URL that is invoked when the column header is clicked.
Beadoc.attributesyntaxvalue:
string_href
Beadoc.databindable:
false

getHref

public String getHref()
Get the href that is rendered in the anchor of this column.

Returns:
the href that was specified or null

setAction

public void setAction(String action)
Set the action that is rendered in the anchor of this column. The use of the action attribute on an AnchorColumn requires a PageFlowController as an action must be defined in order to render the href attrubite on the resulting anchor.

Parameters:
action - the name of the action from a PageFlow
See Also:
PageFlows
Beadoc.attributedescription:
The action method invoked when the column header is clicked.
Beadoc.attributesyntaxvalue:
string_action
Beadoc.databindable:
false

getAction

public String getAction()
Get the action that is rendered in the anchor of this column.

Returns:
the name of the action or null

getTagName

public String getTagName()
Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Overrides:
getTagName in class ImageColumn
Returns:
a constant String representing the name of this tag.

renderDataCell

public String renderDataCell()
                      throws javax.servlet.jsp.JspException
Render the contents of this AnchorColumn for the current data item from the containing Grid tag. An AnchorColumn uses either the href or the action attribute to render an HTML anchor into each data cell in the column. If a name attribute is specified, the value of the data is extracted from the Grid's current data item. Otherwise, the title attribute is used for the cell's content.

Overrides:
renderDataCell in class ImageColumn
Throws:
javax.servlet.jsp.JspException - if an error occurred that can not be reported in the page

renderFooterCell

public String renderFooterCell()
Render the footer. This footer contains no text.

Overrides:
renderFooterCell in class ImageColumn
Returns:
the emtpy string

localRelease

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

Overrides:
localRelease in class ImageColumn

addParameter

public void addParameter(String name,
                         Object value)
This method allows the key / value pairs that will be written onto the URL to be added to the anchor that is rendered for each cell in the column that is rendered for an item in the dataset.

Specified by:
addParameter in interface URLParams
See Also:
URLParams tag, Parameter tag, ParameterMap tag

renderStartTag

protected int renderStartTag(int gridState)
This tag only evaluates its body when the grid is rendering its ROWS.

Overrides:
renderStartTag in class ImageColumn
Parameters:
gridState - the state of this column's Grid tag parent
Returns:
EVAL_BODY_BUFFERED

prepare

protected void prepare()
Perform initialization for this tag.

Overrides:
prepare in class ImageColumn

verifyAttributes

protected void verifyAttributes()
                         throws javax.servlet.jsp.JspException
Verify the attributes on this tag. Exactly one of the attributes href and action must be specified.

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

getTarget

public String getTarget()
Returns the window target.

Returns:
the window target.

setTarget

public void setTarget(String target)
Sets the window target.

Parameters:
target - - the window target.
Beadoc.attributedescription:
The window target.
Beadoc.attributesyntaxvalue:
string_target
Beadoc.databindable:
false

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