|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.faces.component.UIComponent javax.faces.component.UIComponentBase com.sun.rave.web.ui.component.TableBase
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.
<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.
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.
Title - displays a title for the table,
which you can also use to include information about paginated rows and
applied
filters. Use the title
attribute to specify the title
content. Use the itemsText
attribute to specify the text
displayed for the table title for an unpaginated table. Use
the filterText
attribute to specify text to include in the title about the filter that
is applied. You
can override the default implementation of the
title bar
with a different component by using the title
facet.
Action Bar (top) - in the first row of the table, displays controls that operate on the table and its data. This area contains the following sub areas:
Actions - displays local actions that apply to
the objects in the table. You must provide the components for each
action, by specifying them in the actionsTop
facet. You can specify the same actions for the Action Bar
(bottom) area in the actionsBottom
facet.
View-Changing
Controls - displays controls for changing the view of the
table data, such as custom filtering and sorting. This area
contains the following sub areas:
Filter - displays a drop down menu of filter options, which allow users to select criteria to be used to determine the items to display. The component provides a default implementation for adding options when the Custom filter becomes active, to display the filter panel, etc. However, you must implement your filters through custom options. An example filter is shown in Filter.java.
clearTableSortButton
attribute to display the clear table sort button. Sort
- displays a
toggle button for the sort panel. Clicking this button
opens and closes an embedded panel with custom sort
options. The panel
opens inside the table below the Action Bar (top). Use the sortPanelToggleButton
attribute
to display the default sort button with a default
layout of the sort panel. You can
provide custom content for the sort panel by using the sortPanel
facet.
Preferences
- displays a toggle button for setting the
user's preferences. Clicking this
button opens and closes an embedded
panel with view preferences. The preferences panel opens inside
the table below
the Action Bar (top). You must provide the content of
the preferences panel by using the preferencesPanel
facet. There is no
default implementation of the preferences panel content, and therefore
no attribute to specify that the button should be displayed.
Vertical Pagination - The Vertical Pagination area displays a
paginate button, which allows users to switch between viewing the table
as multiple pages, or as a single scrolling page. You can specify
the paginateButton
attributes to display the
default paginate button. Note that the Vertical
Pagination area is limited to this button. You cannot use extra
pagination controls in this area, as you can in the bottom Pagination
area.
Action Bar (bottom)
Actions - displays local actions that apply to
the objects in the table. You must provide the implementation for each
table action, by using the actionsBottom
facet . The
same actions can exist for the Table both the "Action
Bar
(top)" and "Action Bar
(bottom)" sections
Pagination Controls
- displays controls for pagination, including the
paginate button, which allows users to switch between viewing the table
as multiple pages, or as a single scrolling page. The Pagination area
also includes buttons for turning the pages in sequence, jumping to a
specific page, and jumping to the first or last page. You can specify
the paginateButton
and paginateControls
attributes to display the default layout of the Pagination area.
Footer - displays a footer across all columns at the
bottom of the table. You can specify the footerText
attribute to display footer content with a default layout, or specify a
component for the footer by using the footer
facet.
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)
|
||||||||||||||||
|
||||||||||||||||
Footer
|
clearSortButton
adds a button to the View-Changing
Controls area that clears any sorting of the
table.
deselectMultipleButton
adds a button for
tables in which multiple rows can be
selected, to allow users to deselect all table rows that are currently
displayed.
deselectSingleButton
adds a button for tables in
which only a single table row
can be selected at a time, to allow users to deselect a column of radio
buttons
paginateButton
adds a button
to allow users to switch between
viewing all data on a single page (unpaginated) or to see data in
multiple pages (paginated).
paginationControls
adds table
pagination controls to allow users to change which page is
displayed.
selectMultipleButton
adds a button that is used
for selecting multiple rows.
sortPanelToggleButton
adds a button that is
used to open and close the sort panel.
The following attribute can be specified to change the spacing and shading weight of the table:
cellPadding
specifies the amount of
whitespace that
should be placed between the cell contents and the cell borders in all
the cells of the table.
cellSpacing
specifies the amount of
whitespace
that should be placed between cells, and between the edges of the table
content area and the sides of the table.
lite
renders the table in a style
that makes the table look lighter weight.
The table component allows
for multiple headers. The following types of headers are supported:
ui:tableColumn
tag. User interface
guidelines recommend
that column headers are rendered once for each table. In tables with
multiple groups, the column headers should be defined in the ui:tableColumn
tags that are contained in the first ui:tableRowGroup
tag.
See the ui:tableColumn
documentation for more
information. ui:tableRowGroup
tag. See the ui:tableRowGroup
documentation for more
information.The table component allows
for multiple footers. The following types of footers are supported:
Footer - spans the full
width of the table, and displayed at the bottom of the table. Only one
table footer is displayed in each table. The table footer is
defined in the ui:table
tag.
Column footer - confined to the
column for which it is defined, and displayed by default at the bottom
of the column. In tables with multiple groups of rows, each group can
display its own column footer. The column footer is defined in ui:tableColumn
tags. See the ui:tableColumn
documentation for more
information.
Table column footer -
confined to the column for which
it is defined, and displayed by default near the bottom of the table,
below all row groups, and above the Action Bar (bottom). User interface
guidelines recommend
that table column footers are rendered once for each table. In tables
with multiple groups, the table column footers should be defined in the
ui:tableColumn
tags that are contained in the first ui:tableRowGroup
tag. See the ui:tableColumn
documentation for more
information.
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. |
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. |
ui:table
tagui:tableRowGroup
component.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. ui:tabl
e tag, you should
not use the table component to layout multiple tables for the following
reasons:Nested tables create accessibility issues, as described in Layout Tables.
UI guidelines do not support nested tables.
Styles used by the table component might not display properly because they are not intended to be nested.
Table sorting is not
supported in nested tables. The table component does not
support complex components that maintain state not defined by the
JavaServer Faces EditableValueHolder
interface. Since a
single
component instance is
used when iterating over DataProvider rows, only the state of an EditableValueHolder
can be maintained.
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:
internalVirtualForm
method of the Table component to true. For example: // Set table component.
public void setTable(Table table) {
this.table = table;
// This binding is used only
for the internal virtual form example.
table.setInternalVirtualForm(true);
}
immediate
property of a
button, but allows
table children to be updated so that selected checkbox values may be
sorted, for example. The
advantage to using a virtual form is that the values of the other
components on the page are not lost when table data is submitted.
#{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.
last
, where the sourceVar
property of the table component is names
:#{names.value.last}
test
, where the backing bean is
named TableBean
.#{TableBean.test}
<ui:hyperlink text="#{name.last}" action="#{name.action}"/>
<ui:hyperlink text="#{name.last}"
action="#{TableBean.action}"/>
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";
}
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)
}
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
ui:tableRowGroup
and ui:tableColumn
documents.Supporting files:
<!-- 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>
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>
rows
attribute in
the ui:tableRowGroup
tag. <!-- 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>
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>
sortPanel
facet. The sort panel toggle
button is shown when you use the facet, so you do not
need to specify the sortPanelToggleButton
attribute.
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. 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
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. -->
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();
}
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.
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.<!-- 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
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
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();
}
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. disableActions
, which is shown in actions.js.
The disableActions
function is
defined by the developer, and is not part of the table component. 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.jspactionsTop.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
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
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
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
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>
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));
}
}
ui:table
, ui:tableRowGroup
, and ui:tableColumn.
Group.java
Actions.java
Filter.java
Name.java
Select.java
Preferences.java
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;
}
}
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",
"— More Actions —"),
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.
}
}
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;
}
}
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);
}
}
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);
}
}
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 |
public TableBase()
Construct a new TableBase
.
Method Detail |
public java.lang.String getFamily()
Return the family for this component.
public java.lang.String getAlign()
Sets the alignment of the table (left, right or center) on the page (deprecated in HTML 4.0)
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)
getAlign()
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.
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.
isAugmentTitle()
public java.lang.String getBgColor()
Sets the background color for the table (deprecated in HTML 4.0)
public void setBgColor(java.lang.String bgColor)
Sets the background color for the table (deprecated in HTML 4.0)
getBgColor()
public int getBorder()
Set the border width in pixels within the table
public void setBorder(int border)
Set the border width in pixels within the table
getBorder()
public java.lang.String getCellPadding()
Sets the whitespace between the borders and the contents of a cell
public void setCellPadding(java.lang.String cellPadding)
Sets the whitespace between the borders and the contents of a cell
getCellPadding()
public java.lang.String getCellSpacing()
Sets the whitespace between cells and also at the edges of the table
public void setCellSpacing(java.lang.String cellSpacing)
Sets the whitespace between cells and also at the edges of the table
getCellSpacing()
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.
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.
isClearSortButton()
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.
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.
isDeselectMultipleButton()
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.
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.
getDeselectMultipleButtonOnClick()
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.
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.
isDeselectSingleButton()
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.
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.
getDeselectSingleButtonOnClick()
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'"
.
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'"
.
getExtraActionBottomHtml()
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'"
.
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'"
.
getExtraActionTopHtml()
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'"
.
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'"
.
getExtraFooterHtml()
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.
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.
getExtraPanelHtml()
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'"
.
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'"
.
getExtraTitleHtml()
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.
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.
getFilterId()
public java.lang.String getFilterPanelFocusId()
The element id used to set focus when the filter panel is open.
public void setFilterPanelFocusId(java.lang.String filterPanelFocusId)
The element id used to set focus when the filter panel is open.
getFilterPanelFocusId()
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.
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.
getFilterText()
public java.lang.String getFooterText()
The text to be displayed in the table footer, which expands across the width of the table.
public void setFooterText(java.lang.String footerText)
The text to be displayed in the table footer, which expands across the width of the table.
getFooterText()
public java.lang.String getFrame()
Specifies the width in pixels of the border around a table.
public void setFrame(java.lang.String frame)
Specifies the width in pixels of the border around a table.
getFrame()
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.
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.
isHiddenSelectedRows()
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.
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.
isInternalVirtualForm()
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).
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).
getItemsText()
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.
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.
isLite()
public java.lang.String getOnClick()
Scripting code executed when a mouse click occurs over this component.
public void setOnClick(java.lang.String onClick)
Scripting code executed when a mouse click occurs over this component.
getOnClick()
public java.lang.String getOnDblClick()
Scripting code executed when a mouse double click occurs over this component.
public void setOnDblClick(java.lang.String onDblClick)
Scripting code executed when a mouse double click occurs over this component.
getOnDblClick()
public java.lang.String getOnKeyDown()
Scripting code executed when the user presses down on a key while the component has focus.
public void setOnKeyDown(java.lang.String onKeyDown)
Scripting code executed when the user presses down on a key while the component has focus.
getOnKeyDown()
public java.lang.String getOnKeyPress()
Scripting code executed when the user presses and releases a key while the component has focus.
public void setOnKeyPress(java.lang.String onKeyPress)
Scripting code executed when the user presses and releases a key while the component has focus.
getOnKeyPress()
public java.lang.String getOnKeyUp()
Scripting code executed when the user releases a key while the component has focus.
public void setOnKeyUp(java.lang.String onKeyUp)
Scripting code executed when the user releases a key while the component has focus.
getOnKeyUp()
public java.lang.String getOnMouseDown()
Scripting code executed when the user presses a mouse button while the mouse pointer is on the component.
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.
getOnMouseDown()
public java.lang.String getOnMouseMove()
Scripting code executed when the user moves the mouse pointer while over the component.
public void setOnMouseMove(java.lang.String onMouseMove)
Scripting code executed when the user moves the mouse pointer while over the component.
getOnMouseMove()
public java.lang.String getOnMouseOut()
Scripting code executed when a mouse out movement occurs over this component.
public void setOnMouseOut(java.lang.String onMouseOut)
Scripting code executed when a mouse out movement occurs over this component.
getOnMouseOut()
public java.lang.String getOnMouseOver()
Scripting code executed when the user moves the mouse pointer into the boundary of this component.
public void setOnMouseOver(java.lang.String onMouseOver)
Scripting code executed when the user moves the mouse pointer into the boundary of this component.
getOnMouseOver()
public java.lang.String getOnMouseUp()
Scripting code executed when the user releases a mouse button while the mouse pointer is on the component.
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.
getOnMouseUp()
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).
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).
isPaginateButton()
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.
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.
isPaginationControls()
public java.lang.String getPreferencesPanelFocusId()
The element id used to set focus when the preferences panel is open.
public void setPreferencesPanelFocusId(java.lang.String preferencesPanelFocusId)
The element id used to set focus when the preferences panel is open.
getPreferencesPanelFocusId()
public java.lang.String getRules()
public void setRules(java.lang.String rules)
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.
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.
isSelectMultipleButton()
public java.lang.String getSelectMultipleButtonOnClick()
Scripting code executed when the user clicks the mouse on the select multiple button.
public void setSelectMultipleButtonOnClick(java.lang.String selectMultipleButtonOnClick)
Scripting code executed when the user clicks the mouse on the select multiple button.
getSelectMultipleButtonOnClick()
public java.lang.String getSortPanelFocusId()
The element id used to set focus when the sort panel is open.
public void setSortPanelFocusId(java.lang.String sortPanelFocusId)
The element id used to set focus when the sort panel is open.
getSortPanelFocusId()
public boolean isSortPanelToggleButton()
Show the button that is used to open and close the sort panel.
public void setSortPanelToggleButton(boolean sortPanelToggleButton)
Show the button that is used to open and close the sort panel.
isSortPanelToggleButton()
public java.lang.String getStyle()
CSS style(s) to be applied when this component is rendered.
public void setStyle(java.lang.String style)
CSS style(s) to be applied when this component is rendered.
getStyle()
public java.lang.String getStyleClass()
CSS style class(es) to be applied when this component is rendered.
public void setStyleClass(java.lang.String styleClass)
CSS style class(es) to be applied when this component is rendered.
getStyleClass()
public java.lang.String getSummary()
Summary text that describes the table for accessibility purposes
public void setSummary(java.lang.String summary)
Summary text that describes the table for accessibility purposes
getSummary()
public int getTabIndex()
The position of this component in the tabbing order sequence
public void setTabIndex(int tabIndex)
The position of this component in the tabbing order sequence
getTabIndex()
public java.lang.String getTitle()
The text displayed for the table title.
public void setTitle(java.lang.String title)
The text displayed for the table title.
getTitle()
public java.lang.String getToolTip()
Display the text as a tooltip for this component
public void setToolTip(java.lang.String toolTip)
Display the text as a tooltip for this component
getToolTip()
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.
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.
isVisible()
public java.lang.String getWidth()
Set the width of the table on the page (deprecated in HTML 4.0)
public void setWidth(java.lang.String width)
Set the width of the table on the page (deprecated in HTML 4.0)
getWidth()
public void restoreState(javax.faces.context.FacesContext _context, java.lang.Object _state)
Restore the state of this component.
public java.lang.Object saveState(javax.faces.context.FacesContext _context)
Save the state of this component.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |