How to Use the detailStamp Facet

Using Tables and Trees 10-31 ... af:column af:column sortProperty=warehouse filterable=true sortable=true af:outputText value={row.warehouse} ... af:column af:table

10.4.1 How to Add Filtering to a Table

To add filtering to a table, first create a class that can provide the filtering functionality. You then bind the table to that class, and configure the table and columns to use filtering. The table that will use filtering must either have a value for its headerText attribute, or it must contain a component in the header facet of the column that is to be filtered. This allows the filter component to be displayed. Additionally, the column must be configured to be sortable, because the filterModel class uses the sortProperty attribute. To add filtering to a table: 1. Create a Java class that is a subclass of the FilterableQueryDescriptor class. For more information about this class, see the ADF Faces Javadoc . 2. Create a table, as described in Section 10.2, Displaying Data in Tables. 3. Select the table in the Structure window and set the following attributes in the Property Inspector: ■ FilterVisible : Set to true to display the filter criteria input field above searchable column. ■ FilterModel : Bind to an instance of the FilterableQueryDescriptor class created in Step 1.

4. In the Structure window, select a column in the table and in the Property Inspector,

and set the following for each column in the table: ■ Filterable : Set to true. ■ FilterFeatures : Set to caseSensitive or caseInsensitive. If not specified, the case sensitivity is determined by the model. Tip: If you want to use a component other than an inputText component for your filter for example, an inputDate component, then instead of setting filterVisible to true, you can add the needed component to the filter facet. To do so: 1. In the Structure window, right-click the column to be filtered and choose Insert inside af:column JSF Core Filter facet. 2. From the Component Palette, drag and drop a component into the facet. 3. Set the value of the component to the corresponding attribute within the FilterableQueryDescriptor class created in Step 1. Note that the value must take into account the variable used for the row, for example: {af:inputDate label=Select Date id=name value=row.filterCriteria.date} 10-32 Web User Interface Developers Guide for Oracle Application Development Framework

10.5 Displaying Data in Trees

The ADF Faces tree component displays hierarchical data, such as organization charts or hierarchical directory structures. In data of these types, there may be a series of top-level nodes, and each element in the structure may expand to contain other elements. As an example, in an organization chart, each element, that is, each employee, in the hierarchy may have any number of child elements direct reports. The tree component supports multiple root elements. It displays the data in a form that represents the structure, with each element indented to the appropriate level to indicate its level in the hierarchy, and connected to its parent. Users can expand and collapse portions of the hierarchy. Figure 10–19 shows a tree used to display directories in the File Explorer application. Figure 10–19 Tree Component in the File Explorer Application The ADF Faces tree component uses a model to access the data in the underlying hierarchy. The specific model class is oracle.adf.view.rich.model.TreeModel, which extends CollectionModel, described in Section 10.2, Displaying Data in Tables. You must create your own tree model to support your tree. The tree model is a collection of rows. It has an isContainer method that returns true if the current row contains child rows. To access the children of the current row, you call the enterContainer method. Calling this method results in the TreeModel instance changing to become a collection of the child rows. To revert back up to the parent collection, you call the exitContainer method. You may find the oracle.adf.view.rich.model.ChildPropertyTreeModel class useful when constructing a TreeModel class, as shown in Example 10–10 . Example 10–10 Constructing a TreeModel ListTreeNode root = new ArrayListTreeNode; forint i = 0; i firstLevelSize; i++ { ListTreeNode level1 = new ArrayListTreeNode; forint j = 0; j i; j++ { ListTreeNode level2 = new ArrayListTreeNode; forint k=0; kj; k++