How to Use a quickQuery Component Without a Model

Using Query Components 12-15 If the underlying attribute is the Date data type, the component that will be rendered is shown in Table 12–5 . If a search criterions underlying attribute was defined as an LOV, in order for the auto-complete feature to work, the ListOfValues model instance returned by the getModelList method of the AttributeCriterion class must return true for its isAutoCompleteEnabled method. For more information about LOV, see Chapter 11, Using List-of-Values Components. When autoSubmit is set to true, any value change on the search criterion will be immediately pushed to the model. The query component will automatically flush its criterion list only when it has dependent criteria. If the criterion instance has no Table 12–4 Rendered Component for Search Criteria Field of Type Number Operator Component Component When Multiple Select Is Enabled Equals Default list type hint af:selectManyChoice Does not equal Default list type hint af:selectManyChoice Less than af:inputNumberSpinBox af:inputNumberSpinBox Less than or equal to af:inputNumberSpinBox af:inputNumberSpinBox Greater than af:inputNumberSpinBox af:inputNumberSpinBox Greater than or equal to af:inputNumberSpinBox af:inputNumberSpinBox Between af:inputNumberSpinBox af:inputNumberSpinBox Not between af:inputNumberSpinBox af:inputNumberSpinBox Is blank None None Is not blank None None Table 12–5 Rendered Component for Search Criteria Field of Type Date Operator Component Component When Multiple Select Is Enabled Equals Default list type hint af:selectManyChoice Does not equal Default list type hint af:selectManyChoice Before af:inputDate af:inputDate After af:inputDate af:inputDate On or before af:inputDate af:inputDate On or after af:inputDate af:inputDate Between af:inputDate 2 af:inputDate 2 Not between af:inputDate 2 af:inputDate 2 Is blank None None Is not blank None None 12-16 Web User Interface Developers Guide for Oracle Application Development Framework dependent criteria but autoSubmit is set to true, then the query component will be only partially refreshed. A Match All or Match Any radio button group further modifies the query. A Match All selection is essentially an AND function. The query will return only rows that match all the selected criteria. A Match Any selection is an OR function. The query will return all rows that match any one of the criteria items. After the user enters all the search criteria values including null values and selects the Match All or Match Any radio button, the user can click the Search button to initiate the query. The query results can be displayed in any output component. Typically, the output component will be a table or tree table, but you can associate other display components such as af:forms, af:outputText, and graphics to be the results component by specifying it in the resultComponentId attribute. If the Basic or Advanced button is enabled and displayed, the user can toggle between the two modes. Each mode will display only the search criteria that were defined for that mode. A search criteria field can be defined to appear only for basic, only for advanced, or for both modes. In advanced mode, the control panel also includes an Add Fields button that exposes a popup list of searchable attributes. When the user selects any of these attributes, a dynamically generated search criteria input field and dropdown operator list is displayed. The position of all search criteria input fields, as well as newly added fields, are determined by the model implementation. This newly created search criteria field will also have a delete icon next to it. The user can subsequently click this icon to delete the added field. The originally defined search criteria fields do not have a delete icon and therefore cannot be deleted by the user. Figure 12–6 shows an advanced mode query component with a dynamically added search criteria field named Salary. Notice the delete icon an X next to the field. Figure 12–6 Advanced Mode Query with Dynamically Added Search Criteria The user can also save the entered search criteria and the mode by clicking the Save button. A popup dialog allows the user to provide a name for the saved search and specify hints by selecting checkboxes. A persistent data store is required if the saved search is to be available beyond the session. For more information about persistence, see Chapter 31, Allowing User Customization on JSF Pages. A seeded search is essentially a saved search that was created by the application developer. When the component is initialized, any seeded searches associated with that query component become available for the user to select. Any user-created saved searches and seeded system searches appear in the Saved Search dropdown list. The seeded searches and user-saved searches are separated by a divider. Users can also personalize the saved and seeded searches for future use. Personalization of saved searches requires the availability of a persistent data store. For more information about persistence, see Chapter 31, Allowing User Customization on JSF Pages. Using Query Components 12-17 Along with the default display described previously, you can also configure the query component to display in a compact mode, simple mode, or design mode. The compact mode has no header or border, and the Saved Search dropdown list moves next to the expand or collapse icon. Figure 12–7 shows the same query component as in Figure 12–6 , but set to compact mode. Figure 12–7 Query Component in Compact Mode The simple mode displays the component without the header and footer, and without the buttons typically displayed in those areas. Figure 12–8 shows the same query component set to simple mode. Figure 12–8 Query Component in Simple Mode The design mode has the same visual appearance as the simple mode but is used mostly for designing the QueryDescriptor. The query component supports toolbar and footer facets that allow you to add additional components to the query, such as command buttons. For example, you can create command components to toggle between the quickQuery and query components and place those in a toolbar in the toolbar facet.

12.4.1 How to Add the Query Component

Before you begin: Implement a QueryModel class and associated classes. For more information, see Section 12.2, Implementing the Model for Your Query. To add a query component: 1. In the Component Palette, from the Common Components panel, drag a Query and drop it onto the page.

2. In the Property Inspector, expand the Common section and set the following

attributes: ■ id : Set a unique ID for the component. ■ model : Enter an EL expression that resolves to the QueryModel class, as created in Section 12.2, Implementing the Model for Your Query. ■ value : Enter an EL expression that resolves to the QueryDescriptor class, as created in Section 12.2, Implementing the Model for Your Query.