com.sun.rave.web.ui.component
Class TableBase

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended bycom.sun.rave.web.ui.component.TableBase
All Implemented Interfaces:
javax.faces.component.StateHolder
Direct Known Subclasses:
Table

public abstract class TableBase
extends javax.faces.component.UIComponentBase

Use the ui:table tag to create a table that can be configured to perform actions on objects in the table, and to manipulate the rows and columns of the table. The table component features behaviors that let the user sort, filter, and paginate the table objects, and provides actions that can be performed on selected objects. The component also allows you to implement developer-defined custom actions.

Note that the ui:table tag is not intended to be used to create HTML tables that are used purely to handle page layout. The table component renders a table with a well-defined structure, including a title, column headings, and borders. You can use tags such as ui:propertySheet and ui:panelGroup for page layout if possible.

The table component implements Sun's user interface (UI) guidelines for web applications. The guidelines describe in detail how the table should appear and behave, including the placement of titles, group headers, and actions. The table component's default behavior implements the UI guidelines. The component is also extensible through JavaServer Faces facets to allow the component to be used for tables that do not need to adhere strictly to the UI guidelines.

The ui:table tag must be used with the ui:tableRowGroup and ui:tableColumn tags. The ui:table tag is used to define the structure and actions of the table, and is a container for ui:tableRowGroup tags.  The ui:tableRowGroup tag is used to define the rows of the table, and is a container for ui:tableColumn tags. The ui:tableColumn tag is used to define the columns of the table.

HTML Elements and Layout

The table component renders an XHTML <table> element.  Depending upon the attributes specified with the ui:table tag, the table component can also render a title in a <caption> element, and image hyperlinks for the various buttons for sorting and pagination.  The table component does not render table rows except for the rows that contain the view-changing and pagination controls.

Table Structure

Tables are composed of several discrete areas. You can use  ui:table tag attributes to cause the table component to create the default layout for each area. The default layout strictly adheres to UI guidelines.  The layout for each area can also be customized by using facets.  Some areas require you to use facets to implement the content you want in those areas. Descriptions of the table areas are shown below, followed by a diagram that shows the placement of the areas.

The following diagram shows the relative location of the table areas and facets that can be used for each area. The areas that are specified with the ui:table tag  attributes are highlighted in blue.  The grayed out area is controlled with ui:tableRowGroup and ui:tableColumn tags, but is shown here for context.


Title Bar title
Action Bar (top)  
Actions actionsTop View-Changing Controls
Filter
filter
Sort
Clear Sort Preferences
Vertical Pagination
Embedded Panels filterPanel sortPanel preferencesPanel
Column Header
Column Header
Group Header Bar 
Table data



Table data
Column Footer Column Footer
Group Footer Bar 
Table Column Footer Table Column Footer
Action Bar (bottom)
Actions actionsBottom
Pagination Controls
Footer

Buttons and Controls

The following attributes can be specified to add buttons and controls to the table:

Cell Spacing and Shading

The following attribute can be specified to change the spacing and shading weight of the table:

Headers

The table component allows for multiple headers. The following types of headers are supported:

Footers

The table component allows for multiple footers. The following types of footers are supported:

Facets

The ui:table tag supports the following facets, which allow you to customize the layout  of the component.


Facet Name
Table Item Implemented by the Facet
actionsBottom Actions area of the Action Bar (bottom).
actionsTop Actions area of the Action Bar (top).
filter Drop down menu for selecting a filter, in the Filter area of the Action Bar (top).
filterPanel Embedded panel for specifying custom filter options, which is displayed when user selects the Custom Filter option from the filter drop down menu. The Custom Filter option is a recommended option that you can provide in the drop down component that you specify in the filter facet.  The Custom Filter can be used to give users greater control over filtering. The Filter example explains filters in more detail.
footer Footer that spans the width of the table.
preferencesPanel Panel displayed when the preferences toggle button is clicked, to allow users to specify preferences for viewing the table.
sortPanel Panel displayed when the sort toggle button is clicked, to allow users to specify sort options.
title Title in the top bar of the table.

Client-side JavaScript Functions

The following JavaScript functions are available in any page that uses the ui:table tag. After the table is rendered, the functions you specify in the JSP page can be invoked directly on the rendered HTML elements. For example:

var table = document.getElementById("form1:table1");
var count = table.getAllSelectedRowsCount();

Note: To use the JavaScript functions, formElements.js file must be included in the page. The file is automatically included by the basic components such as the button and dropDown components.


Function Name
Purpose
confirmSelectedRows(message)
Confirm the number of selected rows affected by an action such as edit, archive, etc.
confirmDeleteSelectedRows() Confirm the number of selected rows affected by a delete action.
filterMenuChanged() Toggle the filter panel when the user selects Custom Filter in the Filter menu.
getAllSelectedRowsCount() Get the number of selected rows in the table, including the rows that are rendered in the current page, and rows that are hidden from view on other pages.
getAllHiddenSelectedRowsCount() Get the number of selected rows in the table that are on pages that are not currently displayed.
getAllRenderedSelectedRowsCount() Get the number of selected rows that are currently rendered in the table. This function does not count the rows that are hidden from view on other pages. Note that rows might be rendered but not visible, and invisible rows are counted.  See the description of the visible and rendered attributes.
initAllRows() Initialize all rows displayed in the table when the state of selected components change, such as when checkboxes or radiobuttons are used to select or deselect all rows.
toggleFilterPanel() Open and close the custom filter panel.
togglePreferencesPanel() Open and close the table preferences panel.

Notes about ui:table tag

Life Cycle

See the Lifecycle description in the documentation for the ui:tableRowGroup component.

Layout Tables

You should not use the ui:table tag for page layout. The table component renders elements for a table title, columns headers, and row headers. These elements should not be used in a layout table, and create an accessibility issue.  Use a standard HTML <table> element, a ui:propertySheet tag, or the JavaServer Faces h:dataTable tag to perform page layout. If your application needs to iterate over the same components as in jato:tiledView, use a custom tag.  The JSP Standard Tag Library (JSTL) forEach tag might also be useful, but there are interoperability issues with JSTL and JavaServer Faces, so use with caution.

Nested Tables

Although it is technically possible to nest tables with the ui:table tag, you should not use the table component to layout multiple tables for the following reasons:

If you need to display similar types of data using the same table layout, you should use a group table. Sorting is supported for group tables because they are configured using separate tableRowGroup instances.

Validation

To maintain state, the table component submits the surrounding form. For example, when the table is sorted, the form is submitted to update checkbox values. Likewise, the form might be submitted to update text field values when the table component must display a new page of a paginated table.  These components cannot be updated if validation fails for any reason. If a component requires a value to be entered, and no value is entered, validation fails. 

Consider the case where a required text field and table appear on the same page. If the user clicks on a table sort button while the required text field has no value, the sort action is never invoked because a value was required and validation failed.

To prevent this validation issue, you can do either of the following:

Value Bindings

Value expressions that use DataProviders must use the following syntax:
#{sourceVar['PERSON.NAME']}
#{sourceVar.value['PERSON.NAME']}

Note that the word value is between the DataProvider and the FieldKey to bind. The  brackets [] are required only if the FieldKey contains dot syntax. 

For example:

#{TableBean.test}

Method Bindings

A JavaServer Faces issue prevents method bindings from working in a DataProvider. To work around the issue, you can bind to a method in a backing bean, and use that method to retrieve values from the DataProvider.

For example, the following syntax to bind to a DataProvider does not work:

<ui:hyperlink text="#{name.last}" action="#{name.action}"/>

Instead of using a DataProvider to handle the action (which breaks the MVC paradigm), bind the action to a method in the backing bean. For example:

<ui:hyperlink text="#{name.last}" action="#{TableBean.action}"/>

In the TableBean.action method, you may invoke the following code to retrieve values from the DataProvider:

public String action() {
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{name.first}");
    String first = (String) (vb.getValue(context));
    return "whatever";
}


If you have an instance of the DataProvider, you can also invoke the following code to retrieve values:

public String action() {
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{name.tableRow}");
    RowKey row = (RowKey) (vb.getValue(context));
    String first = (String) provider.getFieldKey("first"), row)
}

Logging

To see messages logged by the table component, set the following global defaults in your JDK's "jre/lib/logging.properties" file. Alternatively, you can use a different file by specifying a filename with the java.util.logging.config.file system property (e.g., setenv CATALINA_OPTS -Djava.util.logging.config.file=myFile).

java.util.logging.ConsoleHandler.level = FINE
com.sun.rave.web.ui.event.TablePaginationActionListener.level = FINE
com.sun.rave.web.ui.event.TableSelectPhaseListener.level = FINE
com.sun.rave.web.ui.event.TableSortActionListener.level = FINE
com.sun.rave.web.ui.component.Table.level = FINE
com.sun.rave.web.ui.component.TableActions.level = FINE
com.sun.rave.web.ui.component.TableColumn.level = FINE
com.sun.rave.web.ui.component.TableFooter.level = FINE
com.sun.rave.web.ui.component.TableHeader.level = FINE
com.sun.rave.web.ui.component.TablePanels.level = FINE
com.sun.rave.web.ui.component.TableRowGroup.level = FINE
com.sun.rave.web.ui.renderer.TableActionsRenderer.level = FINE
com.sun.rave.web.ui.renderer.TableColumnRenderer.level = FINE
com.sun.rave.web.ui.renderer.TableFooterRenderer.level = FINE
com.sun.rave.web.ui.renderer.TableHeaderRenderer.level = FINE
com.sun.rave.web.ui.renderer.TablePanelsRenderer.level = FINE
com.sun.rave.web.ui.renderer.TableRenderer.level = FINE
com.sun.rave.web.ui.renderer.TableRowGroupRenderer.level = FINE

Examples

The following examples use a backing bean called TableBean and some utility classes, which are included after the examples.  Additional examples are shown in the ui:tableRowGroup and ui:tableColumn documents.

Examples in this file:

Example 1: Basic Table

Example 2: Custom Title in Table

Example 3: Paginated Table

Example 4: Table Sort Panel

Example 5: Table Preferences

Example 6: Table Filter

Example 7: Table Actions

Supporting files:

TableBean backing bean

Utility classes used in the examples

Example 1: Basic Table

This example shows how to create a basic table.

<!-- Basic Table -->
<ui:table id="table1" title="Basic Table">
  <ui:tableRowGroup id="rowGroup1"
      sourceData="#{TableBean.groupB.names}" sourceVar="name">
    <ui:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <ui:staticText text="#{name.value.last}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col2" alignKey="first" headerText="First Name">
      <ui:staticText text="#{name.value.first}"/>
    </ui:tableColumn>
  </ui:tableRowGroup>
</ui:table>


Example 2: Custom Title
This example shows how to create a custom title for a table, using the title facet. When you use the title attribute as shown in the BasicTable example, the component provides a default title implementation which can include information regarding paginated rows and applied filters. This example implements the title with a ui:staticText tag in the title facet.

<!-- Custom Title -->
<ui:table id="table1">
  <ui:tableRowGroup id="rowGroup1"
      sourceData="#{TableBean.groupB.names}" sourceVar="name">
    <ui:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <ui:staticText text="#{name.value.last}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col2" alignKey="first" headerText="First Name">
      <ui:staticText text="#{name.value.first}"/>
    </ui:tableColumn>
  </ui:tableRowGroup>
  <!-- Title -->
  <f:facet name="title">
    <ui:staticText text="Custom Title"/>
  </f:facet>
</ui:table>

Example 3: Paginated Table

This example shows how to create a paginated table. The default number of rows to be displayed for a paginated table is 25 per page. You can override this value with the rows attribute in the ui:tableRowGroup tag.

Note: The rows attribute is used only for paginated tables.

<!-- Paginated Table -->
<ui:table id="table1"
    paginateButton="true"
    paginationControls="true"
    title="Paginated Table">
  <ui:tableRowGroup id="rowGroup1"
      sourceData="#{TableBean.groupA.names}" sourceVar="name" rows="5">
    <ui:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <ui:staticText text="#{name.value.last}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col2" alignKey="first" headerText="First Name">
      <ui:staticText text="#{name.value.first}"/>
    </ui:tableColumn>
  </ui:tableRowGroup>
</ui:table>

Example 4: Sort Panel

This example shows how to add the sort panel. You can use the default sort panel by setting the sortPanelToggleButton attribute to true. This button opens an embedded panel in the table, displaying a default implementation.   The default implementation shows one, two, or three drop down menus that represent the primary, secondary, and tertiary sorts. The menus list the column headers for each sortable column. If a column is not sortable, it is not shown as a sortable option. If there are only two sortable columns, only the primary and secondary drop down menus are shown. If there is only one sort, only the primary drop down menu is shown. Next to each sort menu is a menu to select ascending or descending sort order.

<!-- Sort Panel -->
<ui:table id="table"
    clearSortButton="true"
    sortPanelToggleButton="true"
    title="Sort Panel">
  <!-- Insert tableRowGroup tag here -->
</ui:table>


To override the default sort panel, use the sortPanel facet.  The sort panel toggle button is shown when you use the facet, so you do not need to specify the sortPanelToggleButton attribute.

Example 5: Table Preferences

This example shows how to add the preferences toggle button and the table panel. The preferences panel toggle button is shown only when you use the preferencesPanel facet. The button opens an embedded panel in the table, displaying the contents that you provide in the preferencesPanel facet.

In this example, the preferences panel is used to set the number of paginated rows with the rows attribute of ui:tableRowGroup. See the Preferences.java example utility class, which provides functionality for preferences for this example.

<!-- Preferences -->
<ui:table id="table1" paginationControls="true" title="Preferences">
  <ui:tableRowGroup id="rowGroup1"
      rows="#{TableBean.groupA.preferences.rows}"
      sourceData="#{TableBean.groupA.names}"
      sourceVar="name">
    <ui:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <ui:staticText text="#{name.value.last}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col2" alignKey="first" headerText="First Name">
      <ui:staticText text="#{name.value.first}"/>
    </ui:tableColumn>
  </ui:tableRowGroup>

  <!-- Preferences Panel -->
  <f:facet name="preferencesPanel">
    <f:subview id="preferencesPanel">
      <jsp:include page="preferencesPanel.jsp"/>
    </f:subview>
  </f:facet>
</ui:table>


preferencesPanel.jsp

This example shows the contents of the preferencesPanel.jsp file included in the JSP page example above.

<!-- Preferences Panel -->
<ui:textField id="rows"
    columns="5"
    label="Rows Per Page:"
    labelLevel="2"
    onKeyPress="if (event.keyCode==13) {var e=document.getElementById('form1:table1:preferencesPanel:submit'); if (e != null) e.click(); return false}"
    text="#{TableBean.groupA.preferences.preference}"/>
<ui:markup tag="div" styleClass="TblPnlBtnDiv">
  <ui:button id="submit"
      action="#{TableBean.groupA.preferences.applyPreferences}"
      mini="true"
      primary="true"
      text="OK"/>
  <ui:button id="cancel"
      mini="true"
      onClick="togglePreferencesPanel(); return false"
      text="Cancel"/>
</ui:markup>

<!-- Note: If the user presses the enter key while the text field has focus,
     the page will be submitted incorrectly, unless we capture the onKeyPress
     event and invoke the click method of the submit button. -->


preferences.js

This example shows the contents of the preferences.js file used in the tablePreferencesPanel.jsp  example above. The togglePreferencesPanel() JavaScript function is used with the onClick attribute of a ui:button tag.

// Use this function to toggle the preferences panel open or closed. This
// functionality requires the filterId of the table component to be set.
function togglePreferencesPanel() {
    var table = document.getElementById("form1:table1");
    table.togglePreferencesPanel();
}

Example 6: Table Filter

This example shows how to add filters using a filter drop down menu and the filter panel. In this example, the filter panel is used to set a custom filter. The custom filter removes all rows from the view that do not match the given last name. See the Filter.java example, which provides the  functionality for filters for this example.

Basic filters are filters that you define for the users of your application. Custom filters enable users to specify the data to be used by the table component to determine which table entries to display.  You specify the basic filter names as items in a ui:dropDown tag in the filter facet. If you want to allow users to use a custom filter, include a "Custom Filter" item as one of the ui:dropDown items.

If you include a "Custom Filter" item in the Filter drop down menu, you can allow users to open a filter panel to filter the table data using a custom filter.  When the Custom Filter option is selected, an embedded panel in the table is opened, displaying the contents that you provide in the filterPanel facet. The default custom filter functionality requires you to use the filterMenuChanged JavaScript function for the onChange event in the ui:dropDown tag.  After the custom filter is applied, you should display a non-selectable "Custom Filter Applied" item in the filter drop down menu,  to indicate that a custom filter has been applied. You should also set the filterText attribute. The table component updates the table title to indicate that a basic or custom filter has been applied by inserting the text <filterText> Filter Applied.

The default custom filter functionality depends on a specific value assigned to the Custom Filter item in the dropDown component. The table component provides a method named getFilterOptions() to add the item text and value for the custom filter option to the drop down list. You can use getFilterOptions() in your backing bean to append either the "Custom Filter" or "Custom Filter Applied" item to the basic filter items.

In the Filter.java util example, the "Custom Filter" and "Custom Filter Applied" items are assigned based on the boolean value provided to getFilterOptions(). If this value is true, the "Custom Filter Applied" item value is added. If the value is false, "Custom Filter" item value is added. The filterMenuChanged JavaScript function, assigned to the dropDown component's onChange event,  behaves differently depending on which item is added.  See the comments in filters.js for more information.

The default custom filter functionality also depends on the id of the ui:dropDown tag in the filter facet. Note that if you use the ui:dropDown tag as the only component in the filter facet, the filterId is optional. If you use a custom component, or use the ui:dropDown as a child component, you must specify a filterID.

The table implements functionality to reset the dropDown menu. If you use the filterId attribute, the menu can be reset whenever the sort and preferences toggle buttons are clicked. You can also use the filterMenuChanged JavaScript function to reset the menu at some other time.   Note: This functionality requires the selected value of the ui:dropDown tag to be set in order to restore the default selected value when the embedded filter panel is closed.

The filter code can be placed in a util class, as shown in the Filter.java example, or in a backing bean.

<!-- Filter -->
<ui:table id="table1"
    filterText="#{TableBean.groupA.filter.filterText}"
    paginateButton="true"
    paginationControls="true"
    title="Filter">
  <ui:tableRowGroup id="rowGroup1"
      binding="#{TableBean.groupA.tableRowGroup}"
      rows="5"
      sourceData="#{TableBean.groupA.names}"
      sourceVar="name">
    <ui:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <ui:staticText text="#{name.value.last}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col2" alignKey="first" headerText="First Name">
      <ui:staticText text="#{name.value.first}"/>
    </ui:tableColumn>
  </ui:tableRowGroup>

  <!-- Filter -->
  <f:facet name="filter">
    <ui:dropDown submitForm="true" id="filter"
        action="#{TableBean.groupA.filter.applyBasicFilter}"
        items="#{TableBean.groupA.filter.filterOptions}"
        onChange="if (filterMenuChanged() == false) return false"
        selected="#{TableBean.groupA.filter.basicFilter}"/>
  </f:facet>

  <!-- Filter Panel -->
  <f:facet name="filterPanel">
    <f:subview id="filterPanel">
      <jsp:include page="filterPanel.jsp"/>
    </f:subview>
  </f:facet>
</ui:table>


filterPanel.jsp

This example shows the contents of the filterPanel.jsp file included in the JSP page in the example above.

<!-- Filter Panel -->
<ui:textField id="customFilter"
    columns="50"
    label="Show only rows containing last name:"
    labelLevel="2"
    onKeyPress="if (event.keyCode==13) {var e=document.getElementById('form1:table1:filterPanel:submit'); if (e != null) e.click(); return false}"
    text="#{TableBean.groupA.filter.customFilter}"/>
<ui:markup tag="div" styleClass="TblPnlBtnDiv">
  <ui:button id="submit"
      action="#{TableBean.groupA.filter.applyCustomFilter}"
      mini="true"
      primary="true"
      text="OK"/>
  <ui:button id="cancel"
      mini="true"
      onClick="toggleFilterPanel(); return false"
      text="Cancel"/>
</ui:markup>

<!-- Note: If the user presses the enter key while the text field has focus,
     the page will be submitted incorrectly, unless we capture the onKeyPress
     event and invoke the click method of the submit button. -->


filters.js

This example shows the contents of the filters.js file used in the filterPanel.jsp
example above. The toggleFilterPanel() JavaScript function is used with the onClick attribute of a ui:button tag to allow the user to close the filter panel without specifying a filter.

// Toggle the filter panel from the filter menu.
//
// If the "Custom Filter" option has been selected, the filter panel is
// toggled. In this scenario, false is returned indicating the onChange event,
// generated by the filter menu, should not be allowed to continue.
//
// If the "Custom Filter Applied" option has been selected, no action is taken.
// Instead, the filter menu is reverted back to the original selection. In this
// scenario, false is also returned indicating the onChange event, generated by
// the filter menu, should not be allowed to continue.
//
// For all other selections, true is returned indicating the onChange event,
// generated by the filter menu, should be allowed to continue.
function filterMenuChanged() {
    var table = document.getElementById("form1:table1");
    return table.filterMenuChanged();
}

// Use this function to toggle the filter panel open or closed. This
// functionality requires the filterId of the table component to be set. In
// addition, the selected value must be set as well to restore the default
// selected value when the embedded filter panel is closed.
function toggleFilterPanel() {
    var table = document.getElementById("form1:table1");
    table.toggleFilterPanel();
}

Example 7: Table Actions

This example shows how to add actions to a table by using the actionsTop and actionsBottom facets. Four buttons and a drop down menu are added to the Action Bar (top) and Action Bar (bottom). When the page is initially displayed, all actions are disabled. When the user selects at least one checkbox, the actions are enabled. If the user deselects all checkboxes, the actions are disabled again.

Note that this example defines a JavaScript function called disableActions, which is shown in actions.js. The
disableActions function is defined by the developer, and is not part of the table component.

When the user clicks on a checkbox, a JavaScript disableActions function is invoked with the onClick event.  The JavaScript setTimeout function is used to ensure checkboxes are selected immediately, instead of waiting for the JavaScript function to complete. See the Actions.java example, which provides functionality for table actions in this example.

<!-- Actions -->
<ui:table id="table1"
    deselectMultipleButton="true"
    deselectMultipleButtonOnClick="setTimeout('disableActions()', 0)"
    paginateButton="true"
    paginationControls="true"
    selectMultipleButton="true"
    selectMultipleButtonOnClick="setTimeout('disableActions()', 0)"
    title="Actions">
  <ui:tableRowGroup id="rowGroup1"
      binding="#{TableBean.groupA.tableRowGroup}"
      rows="5"
      selected="#{TableBean.groupA.select.selectedState}"
      sourceData="#{TableBean.groupA.names}"
      sourceVar="name">
    <ui:tableColumn id="col0"
        selectId="select"
        sort="#{TableBean.groupA.select.selectedState}">
      <ui:checkbox id="select"
          onClick="setTimeout('initAllRows(); disableActions()', 0)"
          selected="#{TableBean.groupA.select.selected}"
          selectedValue="#{TableBean.groupA.select.selectedValue}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <ui:staticText text="#{name.value.last}"/>
    </ui:tableColumn>
    <ui:tableColumn id="col2" alignKey="first" headerText="First Name">
      <ui:staticText text="#{name.value.first}"/>
    </ui:tableColumn>
  </ui:tableRowGroup>

  <!-- Actions (Top) -->
  <f:facet name="actionsTop">
    <f:subview id="actionsTop">
      <jsp:include page="actionsTop.jsp"/>
    </f:subview>
  </f:facet>

  <!-- Actions (Bottom) -->
  <f:facet name="actionsBottom">
    <f:subview id="actionsBottom">
      <jsp:include page="actionsBottom.jsp"/>
    </f:subview>
  </f:facet>
</ui:table>


actionsTop.jsp

This example shows the contents of the actionsTop.jsp file included  in the actionsTop facet in the JSP page in the example above.

<!-- Actions (Top) -->
<ui:button id="action1"
    action="#{TableBean.groupA.actions.delete}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmDeleteSelectedRows() == false) return false"
    text="Delete"/>
<ui:button id="action2"
    action="#{TableBean.groupA.actions.action}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmSelectedRows() == false) return false"
    text="Action 2"/>
<ui:button id="action3"
    action="#{TableBean.groupA.actions.action}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmSelectedRows() == false) return false"
    text="Action 3"/>
<ui:button id="action4"
    action="#{TableBean.groupA.actions.action}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmSelectedRows() == false) return false"
    text="Action 4"/>
<ui:dropDown submitForm="true" id="moreActions"
    action="#{TableBean.groupA.actions.moreActions}"
    disabled="#{TableBean.groupA.actions.disabled}"
    items="#{TableBean.groupA.actions.moreActionsOptions}"
    selected="#{TableBean.groupA.actions.moreActions}"/>


actionsBottom.jsp

This example shows the contents of the actionsBottom.jsp file included  in the actionsBottom facet in the JSP page in the example above.

<!-- Actions (Bottom) -->
<ui:button id="action1"
    action="#{TableBean.groupA.actions.delete}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmDeleteSelectedRows() == false) return false"
    text="Delete"/>
<ui:button id="action2"
    action="#{TableBean.groupA.actions.action}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmSelectedRows() == false) return false"
    text="Action 2"/>
<ui:button id="action3"
    action="#{TableBean.groupA.actions.action}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmSelectedRows() == false) return false"
    text="Action 3"/>
<ui:button id="action4"
    action="#{TableBean.groupA.actions.action}"
    disabled="#{TableBean.groupA.actions.disabled}"
    onClick="if (confirmSelectedRows() == false) return false"
    text="Action 4"/>
<ui:dropDown submitForm="true" id="moreActions"
    action="#{TableBean.groupA.actions.moreActions}"
    disabled="#{TableBean.groupA.actions.disabled}"
    items="#{TableBean.groupA.actions.moreActionsOptions}"
    selected="#{TableBean.groupA.actions.moreActions}"/>


select.js

This example shows the contents of the select.js file used in the example above.

// Use this function to initialize all rows displayed in the table when the
// state of selected components change (i.e., checkboxes or radiobuttons used to
// de/select rows of the table). This functionality requires the selectId
// property of the tableColumn component to be set.
//
// Note: Use setTimeout when invoking this function. This will ensure that
// checkboxes and radiobutton are selected immediately, instead of waiting for
// the onClick event to complete. For example:
//
// onClick="setTimeout('initAllRows(); disableActions()', 0)"
function initAllRows() {
    // Disable table actions by default.
    var table = document.getElementById("form1:table1");
    table.initAllRows();
}


actions.js

This example shows the contents of the actions.js file used in the example above.

// Set disabled state of table actions. If a selection has been made, actions
// are enabled. If no selection has been made, actions are disabled.
//
// Note: Use setTimeout when invoking this function. This will ensure that
// checkboxes and radiobutton are selected immediately, instead of waiting for
// the onClick event to complete. For example:
//
// onClick="setTimeout('initAllRows(); disableActions()', 0)"
function disableActions() {
    // Disable table actions by default.
    var table = document.getElementById("form1:table1");
    var selections = table.getAllSelectedRowsCount(); // Hidden & visible selections.
    var disabled = (selections > 0) ? false : true;

    // Set disabled state for top actions.
    document.getElementById("form1:table1:actionsTop:action1").setDisabled(disabled);
    document.getElementById("form1:table1:actionsTop:action2").setDisabled(disabled);
    document.getElementById("form1:table1:actionsTop:action3").setDisabled(disabled);
    document.getElementById("form1:table1:actionsTop:action4").setDisabled(disabled);
    dropDown_setDisabled("form1:table1:actionsTop:moreActions", disabled);

    // Set disabled state for bottom actions.
    document.getElementById("form1:table1:actionsBottom:action1").setDisabled(disabled);
    document.getElementById("form1:table1:actionsBottom:action2").setDisabled(disabled);
    document.getElementById("form1:table1:actionsBottom:action3").setDisabled(disabled);
    document.getElementById("form1:table1:actionsBottom:action4").setDisabled(disabled);
    dropDown_setDisabled("form1:table1:actionsBottom:moreActions", disabled);
}

//
// Use this function to confirm the number of selected components (i.e.,
// checkboxes or radiobuttons used to de/select rows of the table), affected by
// a delete action. This functionality requires the selectId property of the
// tableColumn component and hiddenSelectedRows property of the tableRowGroup
// component to be set.
//
// If selections are hidden from view, the confirmation message indicates the
// number of selections not displayed in addition to the total number of
// selections. If selections are not hidden, the confirmation message indicates
// only the total selections.
function confirmDeleteSelectedRows() {
    var table = document.getElementById("form1:table1");
    return table.confirmDeleteSelectedRows();
}

// Use this function to confirm the number of selected components (i.e.,
// checkboxes or radiobuttons used to de/select rows of the table), affected by
// an action such as edit, archive, etc. This functionality requires the
// selectId property of the tableColumn component and hiddenSelectedRows
// property of the tableRowGroup component to be set.
//
// If selections are hidden from view, the confirmation message indicates the
// number of selections not displayed in addition to the total number of
// selections. If selections are not hidden, the confirmation message indicates
// only the total selections.
function confirmSelectedRows() {
    var table = document.getElementById("form1:table1");
    return table.confirmSelectedRows("\n\nArchive all selections?");
}

faces_config.xml Entry for Managed Bean

The previous examples are based on managed beans, such as the example below, added to the faces_config.xml file.

<!DOCTYPE faces-config PUBLIC
    '-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN'
    'http://java.sun.com/dtd/web-facesconfig_1_1.dtd'>

<faces-config>
    <managed-bean>
        <description>The backing bean for the table example</description>
        <managed-bean-name>TableBean</managed-bean-name>
        <managed-bean-class>table.TableBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
</faces-config>

TableBean

package table;

import com.sun.rave.web.ui.component.Alarm;

import java.util.ArrayList;

import table.util.Group;
import table.util.Name;

// Backing bean for table examples.
public class TableBean {
    // Group util for table examples.
    private Group groupA = null; // List (rows 0-19).
    private Group groupB = null; // Array (rows 0-9).
    private Group groupC = null; // Array (rows 10-19).

    // Alarms.
    private static final Alarm down = new Alarm(Alarm.SEVERITY_DOWN);
    private static final Alarm critical = new Alarm(Alarm.SEVERITY_CRITICAL);
    private static final Alarm major = new Alarm(Alarm.SEVERITY_MAJOR);
    private static final Alarm minor = new Alarm(Alarm.SEVERITY_MINOR);
    private static final Alarm ok = new Alarm(Alarm.SEVERITY_OK);

    // Data for table examples.
    protected static final Name[] names = {
        new Name("William", "Dupont", down),
        new Name("Anna", "Keeney", critical),
        new Name("Mariko", "Randor", major),
        new Name("John", "Wilson", minor),
        new Name("Lynn", "Seckinger", ok),
        new Name("Richard", "Tattersall", down),
        new Name("Gabriella", "Sarintia", critical),
        new Name("Lisa", "Hartwig", major),
        new Name("Shirley", "Jones", minor),
        new Name("Bill", "Sprague", ok),
        new Name("Greg", "Doench", down),
        new Name("Solange", "Nadeau", critical),
        new Name("Heather", "McGann", major),
        new Name("Roy", "Martin", minor),
        new Name("Claude", "Loubier", ok),
        new Name("Dan", "Woodard", down),
        new Name("Ron", "Dunlap", critical),
        new Name("Keith", "Frankart", major),
        new Name("Andre", "Nadeau", minor),
        new Name("Horace", "Celestin", ok),
    };

    // Default constructor.
    public TableBean() {
    }

    // Get Group util created with a List containing all names.
    public Group getGroupA() {
        if (groupA != null) {
            return groupA;
        }
        // Create List with all names.
        ArrayList newNames = new ArrayList();
        for (int i = names.length - 1; i >= 0; i--) {
            newNames.add(names[i]);
        }
        return (groupA = new Group(newNames));
    }

    // Get Group util created with an array containing a subset of names.
    public Group getGroupB() {
        if (groupB != null) {
            return groupB;
        }
        // Create an array with subset of names (i.e., 0-9).
        Name[] newNames = new Name[10];
        System.arraycopy(names, 0, newNames, 0, 10);
        return (groupB = new Group(newNames));
    }

    // Get Group util created with an array containing a subset of names.
    public Group getGroupC() {
        if (groupC != null) {
            return groupC;
        }
        // Create an array with subset of names (i.e., 10-19).
        Name[] newNames = new Name[10];
        System.arraycopy(names, 10, newNames, 0, 10);
        return (groupC = new Group(newNames));
    }
}

Utility Classes used in the examples

The following utility classes are used in the examples for the table tags: ui:table, ui:tableRowGroup, and ui:tableColumn.

Group.java
Actions.java
Filter.java
Name.java
Select.java
Preferences.java

Group.java Utility Class

package table.util;

import com.sun.data.provider.TableDataProvider;
import com.sun.data.provider.impl.ObjectArrayDataProvider;
import com.sun.data.provider.impl.ObjectListDataProvider;
import com.sun.rave.web.ui.component.Checkbox;
import com.sun.rave.web.ui.component.TableRowGroup;

import java.util.List;

// This class contains data provider and util classes. Note that not all util
// classes are used for each example.
public class Group {
    private TableRowGroup tableRowGroup = null; // TableRowGroup component.
    private TableDataProvider provider = null; // Data provider.
    private Checkbox checkbox = null; // Checkbox component.
    private Preferences prefs = null; // Preferences util.
    private Messages messages = null; // Messages util.
    private Actions actions = null; // Actions util.
    private Filter filter = null; // Filter util.
    private Select select = null; // Select util.
    private Clean clean = null; // Clean util.

    // Default constructor.
    public Group() {
        actions = new Actions(this);
        filter = new Filter(this);
        select = new Select(this);
        clean = new Clean(this);
        prefs = new Preferences();
        messages = new Messages();
    }

    // Construct an instance using given Object array.
    public Group(Object[] array) {
        this();
        provider = new ObjectArrayDataProvider(array);
    }

    // Construct an instance using given List.
    public Group(List list) {
        this();
        provider = new ObjectListDataProvider(list);
    }

    // Get data provider.
    public TableDataProvider getNames() {
        return provider;
    }

    // Get Actions util.
    public Actions getActions() {
        return actions;
    }

    // Get Filter util.
    public Filter getFilter() {
        return filter;
    }

    // Get Messages util.
    public Messages getMessages() {
        return messages;
    }

    // Get Preferences util.
    public Preferences getPreferences() {
        return prefs;
    }

    // Get Select util.
    public Select getSelect() {
        return select;
    }

    // Get tableRowGroup component.
    public TableRowGroup getTableRowGroup() {
        return tableRowGroup;
    }

    // Set tableRowGroup component.
    public void setTableRowGroup(TableRowGroup tableRowGroup) {
        this.tableRowGroup = tableRowGroup;
    }

    // Get checkbox component.
    public Checkbox getCheckbox() {
        return checkbox;
    }

    // Set checkbox component.
    public void setCheckbox(Checkbox checkbox) {
        this.checkbox = checkbox;
    }
}

Actions.java Utility Class

package table.util;

import com.sun.data.provider.FieldKey;
import com.sun.data.provider.RowKey;
import com.sun.data.provider.TableDataProvider;
import com.sun.data.provider.impl.ObjectListDataProvider;
import com.sun.rave.web.ui.model.Option;

import java.util.List;
import java.util.Map;

import javax.faces.context.FacesContext;

// This class provides functionality for table actions.
public class Actions {
    private Group group = null; // Group util.

    // Action menu items.
    protected static final Option[] moreActionsOptions = {
        new Option("ACTION0", "&#8212; More Actions &#8212;"),
        new Option("ACTION1", "Action 1"),
        new Option("ACTION2", "Action 2"),
        new Option("ACTION3", "Action 3"),
        new Option("ACTION4", "Action 4"),
    };

    // Default constructor.
    public Actions(Group group) {
        this.group = group;
    }

    // Action button event.
    public void action() {
        String message = null;

        // Get hyperlink parameter used for embedded actions example.
        Map map = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestParameterMap();
        String param = (String) map.get("param");
        if (param != null) {
            message = "Embedded Action Selected: Parameter = " + param;
        } else {
            message = "Table Action Selected";
        }

        group.getMessages().setMessage(message);
    }

    // Action to remove rows from ObjectListDataProvider.
    public void delete() {
        // Since mutiple examples are using the same beans, the binding
        // simply tells us that checkbox state is maintained arcoss pages.
        if (group.getSelect().isKeepSelected()) {
            // If we got here, then we're maintaining state across pages.
            delete(group.getTableRowGroup().getSelectedRowKeys());
        } else {
            // If we got here, then we're using the phase listener and must
            // take filtering, sorting, and pagination into account.
            delete(group.getTableRowGroup().getRenderedSelectedRowKeys());
        }
    }

    // Set disabled value for table actions.
    public boolean getDisabled() {
        // If there is at least one row selection, actions are enabled.
        boolean result = true;
        if (group.getTableRowGroup() == null) {
            return result;
        }

        // Since mutiple examples are using the same beans, the binding
        // simply tells us that checkbox state is maintained arcoss pages.
        if (group.getSelect().isKeepSelected()) {
            // If we got here, then we're maintaining state across pages.
            result = group.getTableRowGroup().getSelectedRowsCount() < 1;
        } else {
            // If we got here, then we're using the phase listener and must
            // take filtering, sorting, and pagination into account.
            result = group.getTableRowGroup().getRenderedSelectedRowsCount() < 1;
        }
        return result;
    }

    // Get action.
    public String getMoreActions() {
        // Per the UI guidelines, always snap back to "More Actions...".
        return "ACTION0";
    }

    // Get action menu options.
    public Option[] getMoreActionsOptions() {
        return moreActionsOptions;
    }

    // Action menu event.
    public void moreActions() {
        group.getMessages().setMessage("More Actions Menu Selected");
    }

    // Set action.
    public void setMoreActions(String action) {
        // Do nothing.
    }

    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // Private methods
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // Action to remove rows from ObjectListDataProvider.
    private void delete(RowKey[] rowKeys) {
        if (rowKeys == null) {
            return;
        }
        TableDataProvider provider = group.getNames();
        for (int i = 0; i < rowKeys.length; i++) {
            RowKey rowKey = rowKeys[i];
            if (provider.canRemoveRow(rowKey)) {
                provider.removeRow(rowKey);
            }
        }
        ((ObjectListDataProvider) provider).commitChanges(); // Commit.
        group.getSelect().clear(); // Clear phase listener.
    }
}

Filter.java Utility Class

package table.util;

import com.sun.data.provider.FilterCriteria;
import com.sun.data.provider.impl.CompareFilterCriteria;
import com.sun.rave.web.ui.component.Table;
import com.sun.rave.web.ui.model.Option;

// This class provides functionality for table filters.
//
// This util class sets filters directly on the TableRowGroup component using
// FilterCriteria; however, there is also a FilteredTableDataProvider class that
// can used for filtering outside of the table. The table will pick up what ever
// filter has been applied automatically, for example:
//
// // Some choice of TableDataProvider.
// TableDataProvider provider = new ...
//
// // This wraps and filters an existing TableDataProvider.
// FilteredTableDataProvider filteredProvider = new FilteredTableDataProvider();
// filteredProvider.setTableDataProvider(provider);
//
// // Set FilteredTableDataProvider in the TableRowGroup component.
// tableRowGroup.setSourceData(filteredProvider);
//
// The table component itself has no idea that there is any filtering going on,
// but the filtering functionality has been encapsulated in the data provider.
// The developer can then use different FilterCriteria types to apply filters,
// for example:
//
// CompareFilterCriteria cfc = new ...
// RegexFilterCriteria rxfc = new ...
// filteredProvider.setFilterCriteria(new FilterCriteria[] { cfc, fxfc });
public class Filter {
    private String customFilter = null; // Custom filter.
    private String basicFilter = null; // Basic filter menu option.
    private String filterText = null; // Filter text.
    private Group group = null; // Group util.

    // Filter menu items.
    protected static final Option[] filterOptions = {
        new Option("FILTER0", "All Items"),
        new Option("FILTER1", "Filter 1"),
        new Option("FILTER2", "Filter 2"),
    };

    // Default constructor.
    public Filter(Group group) {
        this.group = group;
    }

    // UI guidelines state that a "Custom Filter" option should be added to the
    // filter menu, used to open the table filter panel. Thus, if the
    // CUSTOM_FILTER option is selected, Javascript invoked via the onChange
    // event will open the table filter panel.
    //
    // UI guidelines also state that a "Custom Filter Applied" option should be
    // added to the filter menu, indicating that a custom filter has been
    // applied. In this scenario, set the selected property of the filter menu
    // as CUSTOM_FILTER_APPLIED. This selection should persist until another
    // menu option has been selected.
    //
    // Further, UI guidelines state that the table title should indicate that a
    // custom filter has been applied. To add this text to the table title, set
    // the filter property.

    // Basic filter event.
    public void applyBasicFilter() {
        if (basicFilter.equals("FILTER1")) {
            filterText = "Filter 1";
        } else if (basicFilter.equals("FILTER2")) {
            filterText = "Filter 2";
        } else {
            filterText = null;
        }

        // Clear all filters since we don't have an example here.
        //
        // Note: TableRowGroup ensures pagination is reset per UI guidelines.
        group.getTableRowGroup().setFilterCriteria(null);
    }

    // Custom filter event.
    public void applyCustomFilter() {
        basicFilter = Table.CUSTOM_FILTER_APPLIED; // Set filter menu option.
        filterText = "Custom";

        // Filter rows that do not match custom filter.
        CompareFilterCriteria criteria = new CompareFilterCriteria(
            group.getNames().getFieldKey("last"), customFilter);

        // Note: TableRowGroup ensures pagination is reset per UI guidelines.
        group.getTableRowGroup().setFilterCriteria(
            new FilterCriteria[] {criteria});
    }

    // Get basic filter.
    public String getBasicFilter() {
        // Note: the selected value must be set to restore the default selected
        // value when the embedded filter panel is closed. Further, the selected
        // value should never be set as "Custom Filter...".
        return (basicFilter != null && !basicFilter.equals(Table.CUSTOM_FILTER))
            ? basicFilter : "FILTER0";
    }

    // Set basic filter.
    public void setBasicFilter(String value) {
        basicFilter = value;
    }

    // Get custom filter.
    public String getCustomFilter() {
        return customFilter;
    }

    // Set custom filter.
    public void setCustomFilter(String value) {
        customFilter = value;
    }

    // Get filter menu options.
    public Option[] getFilterOptions() {
        // Get filter options based on the selected filter menu option.
        return Table.getFilterOptions(filterOptions,
            basicFilter == Table.CUSTOM_FILTER_APPLIED);
    }

    // Get filter text.
    public String getFilterText() {
        return filterText;
    }
}

Name.java Utility Class

package table.util;

import com.sun.rave.web.ui.component.Alarm;
import com.sun.rave.web.ui.theme.ThemeImages;

public class Name {
    private String last = null; // Last name.
    private String first = null; // First name.
    private Alarm alarm = null; // Alarm.
   
    // Default constructor.
    public Name(String first, String last) {
        this.last = last;
        this.first = first;
    }

    // Construct an instance with given alarm severity.
    public Name(String first, String last, Alarm alarm) {
        this(first, last);
        this.alarm = alarm;
    }

    // Get first name.
    public String getFirst() {
        return (alarm != null) ? " " + first : first;
    }

    // Set first name.
    public void setFirst(String first) {
        this.first = first;
    }

    // Get last name.
    public String getLast() {
        return last;
    }

    // Set last name.
    public void setLast(String last) {
        this.last = last;
    }

    // Get alarm.
    public Alarm getAlarm() {
        return alarm;
    }

    // Get alarm.
    public void setAlarm(Alarm alarm) {
        this.alarm = alarm;
    }

    // Get alarm severity.
    public String getSeverity() {
        return alarm.getSeverity();
    }

    // Get alarm severity.
    public void setSeverity(String severity) {
        alarm.setSeverity(severity);
    }
}

Select.java Utility Class

package table.util;

import com.sun.data.provider.FieldKey;
import com.sun.data.provider.RowKey;
import com.sun.data.provider.TableDataProvider;
import com.sun.rave.web.ui.event.TableSelectPhaseListener;

import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;

// This class provides functionality for select tables.
//
// Note: UI guidelines recomend that rows should be unselected when no longer in
// view. For example, when a user selects rows of the table and navigates to
// another page. Or, when a user applies a filter or sort that may hide
// previously selected rows from view. If a user invokes an action to delete
// the currently selected rows, they may inadvertently remove rows not
// displayed on the current page. Using TableSelectPhaseListener ensures
// that invalid row selections are not rendered by clearing selected state
// after the render response phase.
public class Select {
    private TableSelectPhaseListener tspl = null; // Phase listener.
    private Group group = null; // Group util.

    // Default constructor.
    public Select(Group group) {
        this.group = group;
        tspl = new TableSelectPhaseListener();
    }

    // Clear selected state from phase listener (e.g., when deleting rows).
    public void clear() {
        tspl.clear();
    }

    // Test flag indicating that selected objects should not be cleared.
    public boolean isKeepSelected() {
        return tspl.isKeepSelected();
    }

    // Set flag indicating that selected objects should not be cleared.
    public void keepSelected(boolean keepSelected) {
        tspl.keepSelected(keepSelected);
    }

    // Get selected property.
    public Object getSelected() {
    return tspl.getSelected(getTableRow());
    }

    // Set selected property.
    public void setSelected(Object object) {
        RowKey rowKey = getTableRow();
        if (rowKey != null) {
            tspl.setSelected(rowKey, object);
        }
    }

    // Get selected value property.
    public Object getSelectedValue() {
        RowKey rowKey = getTableRow();
        return (rowKey != null) ? rowKey.getRowId() : null;
    }

    // Get the selected state -- Sort on checked state only.
    public boolean getSelectedState() {
        // Typically, selected state is tested by comparing the selected and
        // selectedValue properties. In this example, however, the phase
        // listener value is not null when selected.
        return getSelectedState(getTableRow());
    }

    // Get the selected state.
    public boolean getSelectedState(RowKey rowKey) {
        return tspl.isSelected(rowKey);
    }

    // Get current table row.
    //
    // Note: To obtain a RowKey for the current table row, the use the same
    // sourceVar property given to the TableRowGroup component. For example, if
    // sourceVar="name", use "#{name.tableRow}" as the expression string.
    private RowKey getTableRow() {
        FacesContext context = FacesContext.getCurrentInstance();
        ValueBinding vb = context.getApplication().createValueBinding(
            "#{name.tableRow}");
        return (RowKey) vb.getValue(context);
    }
}

Preferences.java Utility Class

package table.util;

// This class provides functionality for table preferences.
public class Preferences {
    private String preference = null; // Rows preference.
    private int rows = 5; // Rows per page.

    // Default constructor.
    public Preferences() {
    }

    // Table preferences event.
    public void applyPreferences() {
        try {
            int rows = Integer.parseInt(preference);
            if (rows > 0) {
                this.rows = rows;
            }
        } catch (NumberFormatException e) {}
    }

    // Get rows per page.
    public int getRows() {
        return rows;
    }

    // Get preference.
    public String getPreference() {
        return Integer.toString(rows);
    }

    // Set preference.
    public void setPreference(String value) {
        preference = value;
    }
}


Auto-generated component class. Do NOT modify; all changes will be lost!


Constructor Summary
TableBase()
          Construct a new TableBase.
 
Method Summary
 java.lang.String getAlign()
          Sets the alignment of the table (left, right or center) on the page (deprecated in HTML 4.0)
 java.lang.String getBgColor()
          Sets the background color for the table (deprecated in HTML 4.0)
 int getBorder()
          Set the border width in pixels within the table
 java.lang.String getCellPadding()
          Sets the whitespace between the borders and the contents of a cell
 java.lang.String getCellSpacing()
          Sets the whitespace between cells and also at the edges of the table
 java.lang.String getDeselectMultipleButtonOnClick()
          Scripting code that is executed when the user clicks the deselect multiple button.
 java.lang.String getDeselectSingleButtonOnClick()
          Scripting code that is executed when the user clicks the deselect single button.
 java.lang.String getExtraActionBottomHtml()
          Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (bottom).
 java.lang.String getExtraActionTopHtml()
          Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (top).
 java.lang.String getExtraFooterHtml()
          Extra HTML code to be appended to the <td> HTML element that is rendered for the table footer.
 java.lang.String getExtraPanelHtml()
          Extra HTML code to be appended to the <td> HTML element that is rendered for an embedded panel.
 java.lang.String getExtraTitleHtml()
          Extra HTML code to be appended to the <caption> HTML element that is rendered for the table title.
 java.lang.String getFamily()
          Return the family for this component.
 java.lang.String getFilterId()
          The element id to be applied to the outermost HTML element that is rendered for the dropDown component used to display filter options.
 java.lang.String getFilterPanelFocusId()
          The element id used to set focus when the filter panel is open.
 java.lang.String getFilterText()
          Text to be inserted into the table title bar when a filter is applied.
 java.lang.String getFooterText()
          The text to be displayed in the table footer, which expands across the width of the table.
 java.lang.String getFrame()
          Specifies the width in pixels of the border around a table.
 java.lang.String getItemsText()
          Text to add to the title of an unpaginated table.
 java.lang.String getOnClick()
          Scripting code executed when a mouse click occurs over this component.
 java.lang.String getOnDblClick()
          Scripting code executed when a mouse double click occurs over this component.
 java.lang.String getOnKeyDown()
          Scripting code executed when the user presses down on a key while the component has focus.
 java.lang.String getOnKeyPress()
          Scripting code executed when the user presses and releases a key while the component has focus.
 java.lang.String getOnKeyUp()
          Scripting code executed when the user releases a key while the component has focus.
 java.lang.String getOnMouseDown()
          Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
 java.lang.String getOnMouseMove()
          Scripting code executed when the user moves the mouse pointer while over the component.
 java.lang.String getOnMouseOut()
          Scripting code executed when a mouse out movement occurs over this component.
 java.lang.String getOnMouseOver()
          Scripting code executed when the user moves the mouse pointer into the boundary of this component.
 java.lang.String getOnMouseUp()
          Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
 java.lang.String getPreferencesPanelFocusId()
          The element id used to set focus when the preferences panel is open.
 java.lang.String getRules()
           
 java.lang.String getSelectMultipleButtonOnClick()
          Scripting code executed when the user clicks the mouse on the select multiple button.
 java.lang.String getSortPanelFocusId()
          The element id used to set focus when the sort panel is open.
 java.lang.String getStyle()
          CSS style(s) to be applied when this component is rendered.
 java.lang.String getStyleClass()
          CSS style class(es) to be applied when this component is rendered.
 java.lang.String getSummary()
          Summary text that describes the table for accessibility purposes
 int getTabIndex()
          The position of this component in the tabbing order sequence
 java.lang.String getTitle()
          The text displayed for the table title.
 java.lang.String getToolTip()
          Display the text as a tooltip for this component
 java.lang.String getWidth()
          Set the width of the table on the page (deprecated in HTML 4.0)
 boolean isAugmentTitle()
          Flag indicating that the table title should be augmented with the range of items currently displayed and the total number of items in the table.
 boolean isClearSortButton()
          In the View-Changing Controls area of the Action Bar, display a button that clears any sorting of the table.
 boolean isDeselectMultipleButton()
          In the Action Bar, display a deselect button for tables in which multiple rows can be selected, to allow users to deselect all table rows that are currently displayed.
 boolean isDeselectSingleButton()
          In the Action Bar, display a deselect button for tables in which only a single table row can be selected at a time.
 boolean isHiddenSelectedRows()
          Flag indicating that selected rows might be currently hidden from view.
 boolean isInternalVirtualForm()
          Flag indicating that this component should use a virtual form.
 boolean isLite()
          Renders the table in a style that makes the table look lighter weight, generally by omitting the shading around the table and in the title bar.
 boolean isPaginateButton()
          Show table paginate button to allow users to switch between viewing all data on a single page (unpaginated) or to see data in multiple pages (paginated).
 boolean isPaginationControls()
          Show the table pagination controls, which allow users to change which page is displayed.
 boolean isSelectMultipleButton()
          Show the button that is used for selecting multiple rows.
 boolean isSortPanelToggleButton()
          Show the button that is used to open and close the sort panel.
 boolean isVisible()
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext _context)
          Save the state of this component.
 void setAlign(java.lang.String align)
          Sets the alignment of the table (left, right or center) on the page (deprecated in HTML 4.0)
 void setAugmentTitle(boolean augmentTitle)
          Flag indicating that the table title should be augmented with the range of items currently displayed and the total number of items in the table.
 void setBgColor(java.lang.String bgColor)
          Sets the background color for the table (deprecated in HTML 4.0)
 void setBorder(int border)
          Set the border width in pixels within the table
 void setCellPadding(java.lang.String cellPadding)
          Sets the whitespace between the borders and the contents of a cell
 void setCellSpacing(java.lang.String cellSpacing)
          Sets the whitespace between cells and also at the edges of the table
 void setClearSortButton(boolean clearSortButton)
          In the View-Changing Controls area of the Action Bar, display a button that clears any sorting of the table.
 void setDeselectMultipleButton(boolean deselectMultipleButton)
          In the Action Bar, display a deselect button for tables in which multiple rows can be selected, to allow users to deselect all table rows that are currently displayed.
 void setDeselectMultipleButtonOnClick(java.lang.String deselectMultipleButtonOnClick)
          Scripting code that is executed when the user clicks the deselect multiple button.
 void setDeselectSingleButton(boolean deselectSingleButton)
          In the Action Bar, display a deselect button for tables in which only a single table row can be selected at a time.
 void setDeselectSingleButtonOnClick(java.lang.String deselectSingleButtonOnClick)
          Scripting code that is executed when the user clicks the deselect single button.
 void setExtraActionBottomHtml(java.lang.String extraActionBottomHtml)
          Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (bottom).
 void setExtraActionTopHtml(java.lang.String extraActionTopHtml)
          Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (top).
 void setExtraFooterHtml(java.lang.String extraFooterHtml)
          Extra HTML code to be appended to the <td> HTML element that is rendered for the table footer.
 void setExtraPanelHtml(java.lang.String extraPanelHtml)
          Extra HTML code to be appended to the <td> HTML element that is rendered for an embedded panel.
 void setExtraTitleHtml(java.lang.String extraTitleHtml)
          Extra HTML code to be appended to the <caption> HTML element that is rendered for the table title.
 void setFilterId(java.lang.String filterId)
          The element id to be applied to the outermost HTML element that is rendered for the dropDown component used to display filter options.
 void setFilterPanelFocusId(java.lang.String filterPanelFocusId)
          The element id used to set focus when the filter panel is open.
 void setFilterText(java.lang.String filterText)
          Text to be inserted into the table title bar when a filter is applied.
 void setFooterText(java.lang.String footerText)
          The text to be displayed in the table footer, which expands across the width of the table.
 void setFrame(java.lang.String frame)
          Specifies the width in pixels of the border around a table.
 void setHiddenSelectedRows(boolean hiddenSelectedRows)
          Flag indicating that selected rows might be currently hidden from view.
 void setInternalVirtualForm(boolean internalVirtualForm)
          Flag indicating that this component should use a virtual form.
 void setItemsText(java.lang.String itemsText)
          Text to add to the title of an unpaginated table.
 void setLite(boolean lite)
          Renders the table in a style that makes the table look lighter weight, generally by omitting the shading around the table and in the title bar.
 void setOnClick(java.lang.String onClick)
          Scripting code executed when a mouse click occurs over this component.
 void setOnDblClick(java.lang.String onDblClick)
          Scripting code executed when a mouse double click occurs over this component.
 void setOnKeyDown(java.lang.String onKeyDown)
          Scripting code executed when the user presses down on a key while the component has focus.
 void setOnKeyPress(java.lang.String onKeyPress)
          Scripting code executed when the user presses and releases a key while the component has focus.
 void setOnKeyUp(java.lang.String onKeyUp)
          Scripting code executed when the user releases a key while the component has focus.
 void setOnMouseDown(java.lang.String onMouseDown)
          Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
 void setOnMouseMove(java.lang.String onMouseMove)
          Scripting code executed when the user moves the mouse pointer while over the component.
 void setOnMouseOut(java.lang.String onMouseOut)
          Scripting code executed when a mouse out movement occurs over this component.
 void setOnMouseOver(java.lang.String onMouseOver)
          Scripting code executed when the user moves the mouse pointer into the boundary of this component.
 void setOnMouseUp(java.lang.String onMouseUp)
          Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
 void setPaginateButton(boolean paginateButton)
          Show table paginate button to allow users to switch between viewing all data on a single page (unpaginated) or to see data in multiple pages (paginated).
 void setPaginationControls(boolean paginationControls)
          Show the table pagination controls, which allow users to change which page is displayed.
 void setPreferencesPanelFocusId(java.lang.String preferencesPanelFocusId)
          The element id used to set focus when the preferences panel is open.
 void setRules(java.lang.String rules)
           
 void setSelectMultipleButton(boolean selectMultipleButton)
          Show the button that is used for selecting multiple rows.
 void setSelectMultipleButtonOnClick(java.lang.String selectMultipleButtonOnClick)
          Scripting code executed when the user clicks the mouse on the select multiple button.
 void setSortPanelFocusId(java.lang.String sortPanelFocusId)
          The element id used to set focus when the sort panel is open.
 void setSortPanelToggleButton(boolean sortPanelToggleButton)
          Show the button that is used to open and close the sort panel.
 void setStyle(java.lang.String style)
          CSS style(s) to be applied when this component is rendered.
 void setStyleClass(java.lang.String styleClass)
          CSS style class(es) to be applied when this component is rendered.
 void setSummary(java.lang.String summary)
          Summary text that describes the table for accessibility purposes
 void setTabIndex(int tabIndex)
          The position of this component in the tabbing order sequence
 void setTitle(java.lang.String title)
          The text displayed for the table title.
 void setToolTip(java.lang.String toolTip)
          Display the text as a tooltip for this component
 void setVisible(boolean visible)
          Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page.
 void setWidth(java.lang.String width)
          Set the width of the table on the page (deprecated in HTML 4.0)
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableBase

public TableBase()

Construct a new TableBase.

Method Detail

getFamily

public java.lang.String getFamily()

Return the family for this component.


getAlign

public java.lang.String getAlign()

Sets the alignment of the table (left, right or center) on the page (deprecated in HTML 4.0)


setAlign

public void setAlign(java.lang.String align)

Sets the alignment of the table (left, right or center) on the page (deprecated in HTML 4.0)

See Also:
getAlign()

isAugmentTitle

public boolean isAugmentTitle()

Flag indicating that the table title should be augmented with the range of items currently displayed and the total number of items in the table. For example, "(1 - 25 of 200)". If the table is not currently paginated, the title is augmented with the number of displayed items. For example, "(18)". When set to false, any values set for itemsText and filterText are overridden.


setAugmentTitle

public void setAugmentTitle(boolean augmentTitle)

Flag indicating that the table title should be augmented with the range of items currently displayed and the total number of items in the table. For example, "(1 - 25 of 200)". If the table is not currently paginated, the title is augmented with the number of displayed items. For example, "(18)". When set to false, any values set for itemsText and filterText are overridden.

See Also:
isAugmentTitle()

getBgColor

public java.lang.String getBgColor()

Sets the background color for the table (deprecated in HTML 4.0)


setBgColor

public void setBgColor(java.lang.String bgColor)

Sets the background color for the table (deprecated in HTML 4.0)

See Also:
getBgColor()

getBorder

public int getBorder()

Set the border width in pixels within the table


setBorder

public void setBorder(int border)

Set the border width in pixels within the table

See Also:
getBorder()

getCellPadding

public java.lang.String getCellPadding()

Sets the whitespace between the borders and the contents of a cell


setCellPadding

public void setCellPadding(java.lang.String cellPadding)

Sets the whitespace between the borders and the contents of a cell

See Also:
getCellPadding()

getCellSpacing

public java.lang.String getCellSpacing()

Sets the whitespace between cells and also at the edges of the table


setCellSpacing

public void setCellSpacing(java.lang.String cellSpacing)

Sets the whitespace between cells and also at the edges of the table

See Also:
getCellSpacing()

isClearSortButton

public boolean isClearSortButton()

In the View-Changing Controls area of the Action Bar, display a button that clears any sorting of the table. When the button is clicked, the table items return to the order they were in when the page was initially rendered.


setClearSortButton

public void setClearSortButton(boolean clearSortButton)

In the View-Changing Controls area of the Action Bar, display a button that clears any sorting of the table. When the button is clicked, the table items return to the order they were in when the page was initially rendered.

See Also:
isClearSortButton()

isDeselectMultipleButton

public boolean isDeselectMultipleButton()

In the Action Bar, display a deselect button for tables in which multiple rows can be selected, to allow users to deselect all table rows that are currently displayed. This button is used to deselect a column of checkboxes using the id that was given to the selectId attribute of the ui:tableColumn tag.


setDeselectMultipleButton

public void setDeselectMultipleButton(boolean deselectMultipleButton)

In the Action Bar, display a deselect button for tables in which multiple rows can be selected, to allow users to deselect all table rows that are currently displayed. This button is used to deselect a column of checkboxes using the id that was given to the selectId attribute of the ui:tableColumn tag.

See Also:
isDeselectMultipleButton()

getDeselectMultipleButtonOnClick

public java.lang.String getDeselectMultipleButtonOnClick()

Scripting code that is executed when the user clicks the deselect multiple button. You should use the JavaScript setTimeout() function to invoke the script to ensure that checkboxes are deselected immediately, instead of waiting for the script to complete.


setDeselectMultipleButtonOnClick

public void setDeselectMultipleButtonOnClick(java.lang.String deselectMultipleButtonOnClick)

Scripting code that is executed when the user clicks the deselect multiple button. You should use the JavaScript setTimeout() function to invoke the script to ensure that checkboxes are deselected immediately, instead of waiting for the script to complete.

See Also:
getDeselectMultipleButtonOnClick()

isDeselectSingleButton

public boolean isDeselectSingleButton()

In the Action Bar, display a deselect button for tables in which only a single table row can be selected at a time. This button is used to deselect a column of radio buttons using the id that was given to the selectId attribute of the ui:tableColumn tag.


setDeselectSingleButton

public void setDeselectSingleButton(boolean deselectSingleButton)

In the Action Bar, display a deselect button for tables in which only a single table row can be selected at a time. This button is used to deselect a column of radio buttons using the id that was given to the selectId attribute of the ui:tableColumn tag.

See Also:
isDeselectSingleButton()

getDeselectSingleButtonOnClick

public java.lang.String getDeselectSingleButtonOnClick()

Scripting code that is executed when the user clicks the deselect single button. You should use the JavaScript setTimeout() function to invoke the script to ensure that the radio button is deselected immediately, instead of waiting for the script to complete.


setDeselectSingleButtonOnClick

public void setDeselectSingleButtonOnClick(java.lang.String deselectSingleButtonOnClick)

Scripting code that is executed when the user clicks the deselect single button. You should use the JavaScript setTimeout() function to invoke the script to ensure that the radio button is deselected immediately, instead of waiting for the script to complete.

See Also:
getDeselectSingleButtonOnClick()

getExtraActionBottomHtml

public java.lang.String getExtraActionBottomHtml()

Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (bottom). Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "style=`myActionBarStyle'".


setExtraActionBottomHtml

public void setExtraActionBottomHtml(java.lang.String extraActionBottomHtml)

Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (bottom). Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "style=`myActionBarStyle'".

See Also:
getExtraActionBottomHtml()

getExtraActionTopHtml

public java.lang.String getExtraActionTopHtml()

Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (top). Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "style=`myActionBarStyle'".


setExtraActionTopHtml

public void setExtraActionTopHtml(java.lang.String extraActionTopHtml)

Extra HTML code to be appended to the <td> HTML element that is rendered for the Action Bar (top). Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "style=`myActionBarStyle'".

See Also:
getExtraActionTopHtml()

getExtraFooterHtml

public java.lang.String getExtraFooterHtml()

Extra HTML code to be appended to the <td> HTML element that is rendered for the table footer. Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "nowrap=`nowrap'".


setExtraFooterHtml

public void setExtraFooterHtml(java.lang.String extraFooterHtml)

Extra HTML code to be appended to the <td> HTML element that is rendered for the table footer. Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "nowrap=`nowrap'".

See Also:
getExtraFooterHtml()

getExtraPanelHtml

public java.lang.String getExtraPanelHtml()

Extra HTML code to be appended to the <td> HTML element that is rendered for an embedded panel. Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity.


setExtraPanelHtml

public void setExtraPanelHtml(java.lang.String extraPanelHtml)

Extra HTML code to be appended to the <td> HTML element that is rendered for an embedded panel. Use only code that is valid in an HTML <td> element. The code you specify is inserted in the HTML element, and is not checked for validity.

See Also:
getExtraPanelHtml()

getExtraTitleHtml

public java.lang.String getExtraTitleHtml()

Extra HTML code to be appended to the <caption> HTML element that is rendered for the table title. Use only code that is valid in an HTML <caption> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "style=`myTitleStyle'".


setExtraTitleHtml

public void setExtraTitleHtml(java.lang.String extraTitleHtml)

Extra HTML code to be appended to the <caption> HTML element that is rendered for the table title. Use only code that is valid in an HTML <caption> element. The code you specify is inserted in the HTML element, and is not checked for validity. For example, you might set this attribute to "style=`myTitleStyle'".

See Also:
getExtraTitleHtml()

getFilterId

public java.lang.String getFilterId()

The element id to be applied to the outermost HTML element that is rendered for the dropDown component used to display filter options. The id must be fully qualified. This id is required for JavaScript functions to set the dropDown styles when the embedded filter panel is opened, and to reset the default selected value when the panel is closed. Note that if you use the ui:dropDown tag as the only component in the filter facet, the filterId is optional. If you use a custom component, or use the ui:dropDown as a child component, you must specify a filterID.


setFilterId

public void setFilterId(java.lang.String filterId)

The element id to be applied to the outermost HTML element that is rendered for the dropDown component used to display filter options. The id must be fully qualified. This id is required for JavaScript functions to set the dropDown styles when the embedded filter panel is opened, and to reset the default selected value when the panel is closed. Note that if you use the ui:dropDown tag as the only component in the filter facet, the filterId is optional. If you use a custom component, or use the ui:dropDown as a child component, you must specify a filterID.

See Also:
getFilterId()

getFilterPanelFocusId

public java.lang.String getFilterPanelFocusId()

The element id used to set focus when the filter panel is open.


setFilterPanelFocusId

public void setFilterPanelFocusId(java.lang.String filterPanelFocusId)

The element id used to set focus when the filter panel is open.

See Also:
getFilterPanelFocusId()

getFilterText

public java.lang.String getFilterText()

Text to be inserted into the table title bar when a filter is applied. This text is expected to be the name of the filter that the user has selected. The attribute value should be a JavaServer Faces EL expression that resolves to a backing bean property whose value is set in your filter code. The value of the filterText attribute is inserted into the table title, as follows: Your Table's Title filterText Filter Applied.


setFilterText

public void setFilterText(java.lang.String filterText)

Text to be inserted into the table title bar when a filter is applied. This text is expected to be the name of the filter that the user has selected. The attribute value should be a JavaServer Faces EL expression that resolves to a backing bean property whose value is set in your filter code. The value of the filterText attribute is inserted into the table title, as follows: Your Table's Title filterText Filter Applied.

See Also:
getFilterText()

getFooterText

public java.lang.String getFooterText()

The text to be displayed in the table footer, which expands across the width of the table.


setFooterText

public void setFooterText(java.lang.String footerText)

The text to be displayed in the table footer, which expands across the width of the table.

See Also:
getFooterText()

getFrame

public java.lang.String getFrame()

Specifies the width in pixels of the border around a table.


setFrame

public void setFrame(java.lang.String frame)

Specifies the width in pixels of the border around a table.

See Also:
getFrame()

isHiddenSelectedRows

public boolean isHiddenSelectedRows()

Flag indicating that selected rows might be currently hidden from view. UI guidelines recommend that rows that are not in view are deselected. For example, when users select rows of the table and navigate to another page, the selected rows should be deselected automatically. Or, when a user applies a filter or sort that hides previously selected rows from view, those selected rows should be deselected. By deselecting hidden rows, you prevent the user from inadvertantly invoking an action on rows that are not displayed.

However, sometimes state must be maintained aross table pages. If your table must maintain state, you must set the hiddenSelectedRows attribute to true. The attribute causes text to be displayed in the table title and footer to indicate the number of selected rows that are currently hidden from view. This title and footer text is also displayed with a count of 0 when there are no hidden selections, to make the user aware of the possibility of hidden selections.

Note: When hiddenSelectedRows is false, the descending sort button for the select column is disabled when the table is paginated. Disabling this button prevents a sort from placing selected rows on a page other than the current page.


setHiddenSelectedRows

public void setHiddenSelectedRows(boolean hiddenSelectedRows)

Flag indicating that selected rows might be currently hidden from view. UI guidelines recommend that rows that are not in view are deselected. For example, when users select rows of the table and navigate to another page, the selected rows should be deselected automatically. Or, when a user applies a filter or sort that hides previously selected rows from view, those selected rows should be deselected. By deselecting hidden rows, you prevent the user from inadvertantly invoking an action on rows that are not displayed.

However, sometimes state must be maintained aross table pages. If your table must maintain state, you must set the hiddenSelectedRows attribute to true. The attribute causes text to be displayed in the table title and footer to indicate the number of selected rows that are currently hidden from view. This title and footer text is also displayed with a count of 0 when there are no hidden selections, to make the user aware of the possibility of hidden selections.

Note: When hiddenSelectedRows is false, the descending sort button for the select column is disabled when the table is paginated. Disabling this button prevents a sort from placing selected rows on a page other than the current page.

See Also:
isHiddenSelectedRows()

isInternalVirtualForm

public boolean isInternalVirtualForm()

Flag indicating that this component should use a virtual form. A virtual form is equivalent to enclosing the table component in its own HTML form element, separate from other HTML elements on the same page. As an example, consider the case where a required text field and table appear on the same page. If the user clicks on a table sort button, while the required text field has no value, the sort action is never invoked because a value was required and validation failed. Placing the table in a virtual form allows the table sort action to complete because validation for the required text field is not processed. This is similar to using the immediate property of a button, but allows table children to be submitted so that selected checkbox values may be sorted, for example.


setInternalVirtualForm

public void setInternalVirtualForm(boolean internalVirtualForm)

Flag indicating that this component should use a virtual form. A virtual form is equivalent to enclosing the table component in its own HTML form element, separate from other HTML elements on the same page. As an example, consider the case where a required text field and table appear on the same page. If the user clicks on a table sort button, while the required text field has no value, the sort action is never invoked because a value was required and validation failed. Placing the table in a virtual form allows the table sort action to complete because validation for the required text field is not processed. This is similar to using the immediate property of a button, but allows table children to be submitted so that selected checkbox values may be sorted, for example.

See Also:
isInternalVirtualForm()

getItemsText

public java.lang.String getItemsText()

Text to add to the title of an unpaginated table. For example, if your table title is "Critical" and there are 20 items in the table, the default unpaginated table title would be Critical (20). If you specify itemsText="alerts", the title would be Critical (20 alerts).


setItemsText

public void setItemsText(java.lang.String itemsText)

Text to add to the title of an unpaginated table. For example, if your table title is "Critical" and there are 20 items in the table, the default unpaginated table title would be Critical (20). If you specify itemsText="alerts", the title would be Critical (20 alerts).

See Also:
getItemsText()

isLite

public boolean isLite()

Renders the table in a style that makes the table look lighter weight, generally by omitting the shading around the table and in the title bar.


setLite

public void setLite(boolean lite)

Renders the table in a style that makes the table look lighter weight, generally by omitting the shading around the table and in the title bar.

See Also:
isLite()

getOnClick

public java.lang.String getOnClick()

Scripting code executed when a mouse click occurs over this component.


setOnClick

public void setOnClick(java.lang.String onClick)

Scripting code executed when a mouse click occurs over this component.

See Also:
getOnClick()

getOnDblClick

public java.lang.String getOnDblClick()

Scripting code executed when a mouse double click occurs over this component.


setOnDblClick

public void setOnDblClick(java.lang.String onDblClick)

Scripting code executed when a mouse double click occurs over this component.

See Also:
getOnDblClick()

getOnKeyDown

public java.lang.String getOnKeyDown()

Scripting code executed when the user presses down on a key while the component has focus.


setOnKeyDown

public void setOnKeyDown(java.lang.String onKeyDown)

Scripting code executed when the user presses down on a key while the component has focus.

See Also:
getOnKeyDown()

getOnKeyPress

public java.lang.String getOnKeyPress()

Scripting code executed when the user presses and releases a key while the component has focus.


setOnKeyPress

public void setOnKeyPress(java.lang.String onKeyPress)

Scripting code executed when the user presses and releases a key while the component has focus.

See Also:
getOnKeyPress()

getOnKeyUp

public java.lang.String getOnKeyUp()

Scripting code executed when the user releases a key while the component has focus.


setOnKeyUp

public void setOnKeyUp(java.lang.String onKeyUp)

Scripting code executed when the user releases a key while the component has focus.

See Also:
getOnKeyUp()

getOnMouseDown

public java.lang.String getOnMouseDown()

Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.


setOnMouseDown

public void setOnMouseDown(java.lang.String onMouseDown)

Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.

See Also:
getOnMouseDown()

getOnMouseMove

public java.lang.String getOnMouseMove()

Scripting code executed when the user moves the mouse pointer while over the component.


setOnMouseMove

public void setOnMouseMove(java.lang.String onMouseMove)

Scripting code executed when the user moves the mouse pointer while over the component.

See Also:
getOnMouseMove()

getOnMouseOut

public java.lang.String getOnMouseOut()

Scripting code executed when a mouse out movement occurs over this component.


setOnMouseOut

public void setOnMouseOut(java.lang.String onMouseOut)

Scripting code executed when a mouse out movement occurs over this component.

See Also:
getOnMouseOut()

getOnMouseOver

public java.lang.String getOnMouseOver()

Scripting code executed when the user moves the mouse pointer into the boundary of this component.


setOnMouseOver

public void setOnMouseOver(java.lang.String onMouseOver)

Scripting code executed when the user moves the mouse pointer into the boundary of this component.

See Also:
getOnMouseOver()

getOnMouseUp

public java.lang.String getOnMouseUp()

Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.


setOnMouseUp

public void setOnMouseUp(java.lang.String onMouseUp)

Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.

See Also:
getOnMouseUp()

isPaginateButton

public boolean isPaginateButton()

Show table paginate button to allow users to switch between viewing all data on a single page (unpaginated) or to see data in multiple pages (paginated).


setPaginateButton

public void setPaginateButton(boolean paginateButton)

Show table paginate button to allow users to switch between viewing all data on a single page (unpaginated) or to see data in multiple pages (paginated).

See Also:
isPaginateButton()

isPaginationControls

public boolean isPaginationControls()

Show the table pagination controls, which allow users to change which page is displayed. The controls include an input field for specifying the page number, a Go button to go to the specified page, and buttons for going to the first, last, previous, and next page.


setPaginationControls

public void setPaginationControls(boolean paginationControls)

Show the table pagination controls, which allow users to change which page is displayed. The controls include an input field for specifying the page number, a Go button to go to the specified page, and buttons for going to the first, last, previous, and next page.

See Also:
isPaginationControls()

getPreferencesPanelFocusId

public java.lang.String getPreferencesPanelFocusId()

The element id used to set focus when the preferences panel is open.


setPreferencesPanelFocusId

public void setPreferencesPanelFocusId(java.lang.String preferencesPanelFocusId)

The element id used to set focus when the preferences panel is open.

See Also:
getPreferencesPanelFocusId()

getRules

public java.lang.String getRules()

setRules

public void setRules(java.lang.String rules)

isSelectMultipleButton

public boolean isSelectMultipleButton()

Show the button that is used for selecting multiple rows. The button is displayed in the Action Bar (top), and allows users to select all rows currently displayed. The button selects a column of checkboxes using the id specified in the selectId attribute of the ui:tableColumn tag.


setSelectMultipleButton

public void setSelectMultipleButton(boolean selectMultipleButton)

Show the button that is used for selecting multiple rows. The button is displayed in the Action Bar (top), and allows users to select all rows currently displayed. The button selects a column of checkboxes using the id specified in the selectId attribute of the ui:tableColumn tag.

See Also:
isSelectMultipleButton()

getSelectMultipleButtonOnClick

public java.lang.String getSelectMultipleButtonOnClick()

Scripting code executed when the user clicks the mouse on the select multiple button.


setSelectMultipleButtonOnClick

public void setSelectMultipleButtonOnClick(java.lang.String selectMultipleButtonOnClick)

Scripting code executed when the user clicks the mouse on the select multiple button.

See Also:
getSelectMultipleButtonOnClick()

getSortPanelFocusId

public java.lang.String getSortPanelFocusId()

The element id used to set focus when the sort panel is open.


setSortPanelFocusId

public void setSortPanelFocusId(java.lang.String sortPanelFocusId)

The element id used to set focus when the sort panel is open.

See Also:
getSortPanelFocusId()

isSortPanelToggleButton

public boolean isSortPanelToggleButton()

Show the button that is used to open and close the sort panel.


setSortPanelToggleButton

public void setSortPanelToggleButton(boolean sortPanelToggleButton)

Show the button that is used to open and close the sort panel.

See Also:
isSortPanelToggleButton()

getStyle

public java.lang.String getStyle()

CSS style(s) to be applied when this component is rendered.


setStyle

public void setStyle(java.lang.String style)

CSS style(s) to be applied when this component is rendered.

See Also:
getStyle()

getStyleClass

public java.lang.String getStyleClass()

CSS style class(es) to be applied when this component is rendered.


setStyleClass

public void setStyleClass(java.lang.String styleClass)

CSS style class(es) to be applied when this component is rendered.

See Also:
getStyleClass()

getSummary

public java.lang.String getSummary()

Summary text that describes the table for accessibility purposes


setSummary

public void setSummary(java.lang.String summary)

Summary text that describes the table for accessibility purposes

See Also:
getSummary()

getTabIndex

public int getTabIndex()

The position of this component in the tabbing order sequence


setTabIndex

public void setTabIndex(int tabIndex)

The position of this component in the tabbing order sequence

See Also:
getTabIndex()

getTitle

public java.lang.String getTitle()

The text displayed for the table title.


setTitle

public void setTitle(java.lang.String title)

The text displayed for the table title.

See Also:
getTitle()

getToolTip

public java.lang.String getToolTip()

Display the text as a tooltip for this component


setToolTip

public void setToolTip(java.lang.String toolTip)

Display the text as a tooltip for this component

See Also:
getToolTip()

isVisible

public boolean isVisible()

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.


setVisible

public void setVisible(boolean visible)

Use the visible attribute to indicate whether the component should be viewable by the user in the rendered HTML page. If set to false, the HTML code for the component is present in the page, but the component is hidden with style attributes. By default, visible is set to true, so HTML for the component HTML is included and visible to the user. If the component is not visible, it can still be processed on subsequent form submissions because the HTML is present.

See Also:
isVisible()

getWidth

public java.lang.String getWidth()

Set the width of the table on the page (deprecated in HTML 4.0)


setWidth

public void setWidth(java.lang.String width)

Set the width of the table on the page (deprecated in HTML 4.0)

See Also:
getWidth()

restoreState

public void restoreState(javax.faces.context.FacesContext _context,
                         java.lang.Object _state)

Restore the state of this component.


saveState

public java.lang.Object saveState(javax.faces.context.FacesContext _context)

Save the state of this component.