com.novell.emframe.dev.dataTable
Class LinkTableCell

java.lang.Object
  extended bycom.novell.emframe.dev.dataTable.TableCell
      extended bycom.novell.emframe.dev.dataTable.LinkTableCell

public class LinkTableCell
extends TableCell

Class representing an individual cell in a simpleTable containing clickable text. When the user clicks on the text, the linkActionHandler JavaScript function is called as specified in the simpleTable tag Library (ex. linkActionHandler="contentLinkActionHandler" with the prototype of:
function contentLinkActionHandler(column, row, data)
The linkActionHandler is given the column and row of the item clicked as well as the tableData[][] double array.

Here is an example of using the simpleTable tag libary in a JSP:

<iman:dataTable titleKey="RBS.AvailableModules" titleBundle="FwResources" menuItems="${menuItems}" columnHeaders="${columnHeaders}" tableData="${tableData}" menuActionHandler="contentEventHandler" linkActionHandler="contentLinkActionHandler" />

For the tableData variable of the simpleTable tag Library (ex. tableData="${tableData}"), you would pass an TableCell[][] double array. The TableCell[][] array can contain TextTableCell, IconTableCell, LinkTableCell, and CheckboxTableCell objects.

For example, here is how you could create the TableCell[][] double array:

List theList = (List)request.getAttribute("availableModules"); // Data for the table
TableCell[][] tableData = new TableCell[theList.size()][];
int index = 0;
for(Iterator iterator = theList.iterator(); iterator.hasNext(); index++)
{
  // ModuleData is the data being displayed in this table
  ModuleData element = (ModuleData)iterator.next();
  tableData[index] = new TableCell[4];
  String iconUrl = "dev/dir/rbsModule2.gif";
  tableData[index][0] = new IconTableCell(c.string("RBS.Module"), iconUrl, "module");
  tableData[index][1] = new TextTableCell(element.getModuleDisplayName(), element.getModuleFDN());
  tableData[index][2] = new LinkTableCell(element.getModulePackageName(), element.getModulePackageName());
  tableData[index][3] = new CheckboxTableCell("true");
}
request.setAttribute("tableData", tableData);

This example would show four columns of data: the first an icon, the second text displaying the name of the module, the third a URL with a link to the module, and fourth a checkbox that is checked.


Constructor Summary
LinkTableCell(java.lang.String text, java.lang.String value)
          Constructs a TableCell that will display clickable text.
 
Method Summary
 java.lang.String getText()
          Returns the text to display as the content of this TableCell.
 void render(java.io.PrintWriter out, TableCellContext context)
          Render HTML for cell containing the linked text.
 
Methods inherited from class com.novell.emframe.dev.dataTable.TableCell
getValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkTableCell

public LinkTableCell(java.lang.String text,
                     java.lang.String value)
Constructs a TableCell that will display clickable text. When the user clicks on the text, the linkActionHandler JavaScript function is called as specified in the simpleTable tag Library (ex. linkActionHandler="collectionLinkActionHandler" with the prototype of:
function collectionLinkActionHandler(column, row, data)
The linkActionHandler is given the column and row of the item clicked as well as the tableData[][] double array.

Parameters:
text - String containing the text to display in this TableCell (may be localized or not)
value - String containing the actual value of this TableCell
Method Detail

getText

public java.lang.String getText()
Returns the text to display as the content of this TableCell. The text may be localized or not.

Returns:
String containing the text to display in this TableCell (may be localized or not)

render

public void render(java.io.PrintWriter out,
                   TableCellContext context)
Render HTML for cell containing the linked text.

Specified by:
render in class TableCell
Parameters:
out - PrintWriter for TableCell to use to output its HTML data.
context - TableCellContext containing information about the position of the cell in the table and general information about the table itself


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.