Oracle Fusion Middleware Tag Reference for Oracle ADF Faces 12c (12.2.1.4.0) E81455-03

# <af:query>

af:query query query

UIComponent class: oracle.adf.view.rich.component.rich.RichQuery
Component type: oracle.adf.RichQuery

Naming container: Yes. When referring to children of this component ("partialTriggers", `findComponent()`, etc.), you must prefix the child's ID with this component's ID and a colon (':')

The query component provides the user the ability to perform a query based on a saved search or personalize saved searches. The component displays a search panel with various elements, each of which help the user to accomplish various tasks.

To properly render the query panel when content width is more than view area, it should be wrapped in a af:panelGroupLayout with layout="horizontal". For ex:

     <af:panelGroupLayout layout="horizontal" inlineStyle="width:100%" >
        <af:query id="queryId" rows="3" headerText="Search" disclosed="true"
                  model="#{demoQuery.queryModel}" queryListener="#{demoQuery.processQuery}"/>
     </af:panelGroupLayout>

## Elements rendered by the query component

- Search Panel: the panel that encloses all elements rendered by the query component
- Search Header: Spans the entire width of the search panel and used to display a disclosure icon, the label, search mode (toggle button) and saved search (choice list of saved searches). The help (deprecated), info and toolbar facets' content is also displayed in the header.
- Match Type: A radio button group that appears below the search header, it defines whether the search criteria should be treated as an AND search or an OR search. For details on the conjunction operators refer to the QueryDescriptor and ConjunctionCriterion classes.
- Criteria region: A form layout that appears below the Match type, it contains search fields that define the search parameters. For details on search fields refer to the QueryDescriptor model.
- Criterion: A criterion represents a single search field, that comprises of an operator and one or more value fields. For value fields that render LOV components, the autoComplete feature is not enabled unless either of the methods, AttributeCriterion.hasDependentCriterion() or ListOfValuesModel.isAutoCompleteEnabled() return true. This is done to allow the end-user to enter partial values with wild-cards and tab around the search panel without causing the LOV dialog to be launched (everytime they tab-out of the LOV value field).
- Action buttons: The search panel has four action buttons: Search, Reset, Save, and Add Fields. The action buttons appear below the criteria region. They are end-aligned within the search header.
- NOTE: The Add Fields feature is only available in the Advanced mode.

## Tasks performed using a query component

The following actions are performed on the currently selected saved search.

- Perform Search: Executes a query based on the search criteria (values entered for the search fields). Exposed as the Search button
- Add Criterion: Adds the selected attribute (represented by an AttributeDescriptor) as a criterion to the current saved search in the search panel (represented by a QueryDescriptor object). The query component by default registers an internal ActionListener for the associated ActionEvent and invokes the addCriterion method in the QueryDescriptor.
- Remove Criterion: Removes the search field (aka AttributeCriterion). The user can click the remove butcon that appears next to certain search fields. The query component by default registers an internal ActionListener for the ActionEvent that is fired as part of the delete and invokes the deleteCriterion method in the QueryDescriptor.
- Toggle Mode: Toggles the mode of the search panel between Basic and Advanced
- Change Conjunction: Changes the conjunction operator to be used when executing a query.

The following actions are performed on saved searches:

- Create: Create a new saved search based on the current search criteria used on the search panel. Exposed as the Save.. button on the Search panel.
- Reset: Resets the saved search to its default state. Exposed as the Reset button.
- Select: Saved searches (displayed in a choice list on the search panel header) can be changed. This allows the user to update the criteria to match that of the selected saved search. The action may also execute the search depending on how the saved search is configured.
- Personalize a saved search: The "Personalize..." option is displayed in the Saved Search choice list. Selecting this option opens the "Personalize Saved Searches" dialog, which allows user to personalize the saved search in the following ways.
  - Update a Saved Search: Change the name and UIHints for the selected saved search. Users are prevented from updating a saved search that is marked as immutable. The Apply and Ok buttons can be used to commit the changes.
  - Delete a Saved Search: delete the selected saved search (by using the Delete button). Users are prevented from changing a system saved search.
  - Duplicate a Saved Search: Clone the selected saved search (by using the Duplicate button).

## Events

QueryOperationEvent is fired for operations performed on saved searches. The operations include changeMode, create, duplicate, delete, reset, select and update. The specific operation that triggers this event is stored as part of the QueryOperationEvent object. The query component by default registers an internal QueryOperationListener and invokes specific methods on the QueryModel. Please refer to the QueryModel for more details.

QueryEvent is fired in response to the user action to perform a query. For e.g., when the user hits the Search button or if the currently selected saved search is configured to "Run Automatically" when selected in the Saved Search choice list.

## Geometry Management

- This component will be stretched if:
  - type="default" and its parent layout component is stretching the query (e.g. panelDashboard)
  - type="stretch"
- This component will not be stretched if:
  - type="default" and its parent layout component is not stretching the query (e.g. panelGroupLayout)
  - type="flow"
- The query component will only stretch its children if it is being stretched by its parent (or if type="stretch").

## Screen Shot(s)

A query component.

## Events

Type | Phases | Description
--- | --- | ---
oracle.adf.view.rich.event.QueryEvent | Invoke, Application, Apply, Request, Values | The Query event is delivered when a query action is triggered.
oracle.adf.view.rich.event.QueryOperationEvent | Invoke, Application, Apply, Request, Values | The QueryOperationEvent is generated for all operations performed on saved searches. These include creating, deleting, duplicating, reseting and selecting a saved search.
org.apache.myfaces.trinidad.event.AttributeChangeEvent | Invoke, Application, Apply, Request, Values | Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change event might include the width of a column that supported client-side resizing.

## Supported Facets

Name | Description
--- | ---
footer | Used to specify content that displays in the query footer. If a footer is not specified then an 'Add Fields' dropdown is automatically added to the facet. If a footer facet is specified, (that includes custom buttons for example) the default 'Add Fields' dropdown will not appear and users are required to specify it explicitly in the footer facet along with the other content if this functionality is desired. In addition, contents of this facet will only be shown in the Advanced mode. In JSP pages only one component is allowed. When using Facelets multiple components are allowed.
help | This facet is deprecated, instead the attribute 'helpTopicId' should be used for providing help. Both the help facet (when rendered inline) and helpTopicId with instructions text are rendered in the same spot, so if helpTopicId is specified and it has instructions text, the help facet will not be rendered if specified inline. Help content that is displayed to the user. The content of the help is displayed inline inside the header content or as a popup through a link. In JSP pages only one component is allowed. When using Facelets multiple components are allowed.
info | Used to specify content that provides additional information to the user. This content is usually displayed under the search panel header and end aligned with the header. In JSP pages only one component is allowed. When using Facelets multiple components are allowed.
toolbar | Used to specify content that displays in the query header. Contents of this facet will be shown in both Basic and Advanced mode. For example, to show custom command buttons in both Basic and Advanced mode, buttons should be added to the toolbar facet. Must be only one component, multiple components are not supported by this facet

## Attributes

Name | Type | Supports EL? | Description
addFieldsButtonAccessKey | char | Yes | what accessKey will the component set for the add fields button. Options are: null - No access key will be set for the add fields button. provide access key of your choice
addFieldsButtonText | String | Yes | what Text will the component set for the add fields button. Options are: null - default add fields button text will be used. provide text of your choice
attributeChangeListener | javax.el.MethodExpression | Only EL | a method reference to an attribute change listener. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change events might include the width of a column that supported client-side resizing.
binding | oracle.adf.view.rich.component.rich.RichQuery | Only EL | an EL reference that will store the component instance on a bean. This can be used to give programmatic access to a component from a backing bean, or to move creation of the component to a backing bean.
clientComponent | boolean | Yes | Default Value: false whether a client-side component will be generated. A component may be generated whether or not this flag is set, but if client Javascript requires the component object, this must be set to true to guarantee the component's presence. Client component objects that are generated today by default may not be present in the future; setting this flag is the only way to guarantee a component's presence, and clients cannot rely on implicit behavior. However, there is a performance cost to setting this flag, so clients should avoid turning on client components unless absolutely necessary. For the components outputText and outputFormatted, setting the clientComponent to true will render id attribute for the html DOM. This ID attribute can alternatively be generated by setting oracle.adf.view.rich.SUPPRESS_IDS to "auto" in web.xml.
conjunctionReadOnly | boolean | Yes | Default Value: false whether the conjunction is readOnly or not
contentDelivery | String | Yes | Valid Values: immediate, lazyUncached Default Value: lazyUncached whether the undisclosed content is delivered with the initial page. When contentDelivery is "immediate", the content is inlined into the initial page. If contentDelivery is "lazyUncached", the content will be delivered each and every time the component's disclosure changes. By default, contentDelivery is lazyUncached.
criterionFeatures | java.util.Set | Yes | Additional criterion attributes that can be configured/set by the user. Currently we support the following two features matchCaseDisplayed - This allows user to set matchCase for a criterion. This option is available only for String data types. requiredDisplayed - This allows user to set whether a criterion is required/selectively required.
customizationId | String | Yes | This attribute is deprecated. The 'id' attribute should be used when applying persistent customizations. This attribute will be removed in the next release.
disclosed | boolean | Yes | Default Value: false whether the children are currently disclosed
disclosureListener | javax.el.MethodExpression | Only EL | a method reference to a disclosure listener
displayMode | String | Yes | Valid Values: default, compact, simple, design Default Value: default the mode of display for the query component. default: displays all parts of the query component. compact: Similar to 'default' except, in this mode : The header text will not be rendered and headerText property will always be ignored. The component will be rendered undisclosed unless the disclosed property is explicitly set to true. The mode button will be rendered in the footer unless the 'modeButtonPosition' property is set to 'toolbar'. If the modeChangeVisible' property is set to false, it is not rendered at all. The layout of the saved search dropdown will be left aligned on the header. No container or borders will be present around the header or toolbar. simple: In this mode the header and footer will not be rendered and the following properties will be ignored - disclosed, headerText, modeButtonPosition, modeChangeVisible. design: Similar to 'simple' and used mostly for designing the Query Descriptor.
fieldWidth | String | Yes | the preferred width of the value part of the search field. Usually a percentage, but may be specified as either a percentage or an absolute number of pixels. If the width is not specified, it will default appropriately. If specified as a percentage the sum of labelWidth and fieldWidth should add up to 100%, regardless of the number of columns. If the fieldWidth is specified and is a percentage the labelWidth will be derived appropriately if not specified.
headerText | String | Yes | the label of the query header.
helpTopicId | String | Yes | the id used to look up a topic in a helpProvider.
id | String | No | the identifier for the component. Every component may be named by a component identifier that must conform to the following rules: They must start with a letter (as defined by the Character.isLetter() method) or underscore ( _ ). Subsequent characters must be letters (as defined by the Character.isLetter() method), digits as defined by the Character.isDigit() method, dashes ( - ), or underscores ( _ ). To minimize the size of responses generated by JavaServer Faces, it is recommended that component identifiers be as short as possible. If a component has been given an identifier, it must be unique in the namespace of the closest ancestor to that component that is a NamingContainer (if any).
immediate | boolean | Yes | Default Value: false whether data validation - client-side or server-side - should be skipped when events are generated by this component. When immediate is false (the default), the disclosure event will be delivered during the Invoke Application phase, which will trigger validation. When set to true, the disclosure event will be executed during the Apply Request Values phase.
inlineStyle | String | Yes | the CSS styles to use for this component. This is intended for basic style changes. The inlineStyle is a set of CSS styles that are applied to the root DOM element of the component. Be aware that because of browser CSS precedence rules, CSS rendered on a DOM element takes precedence over external stylesheets like the skin file. Therefore skins will not be able to override what you set on this attribute. If the inlineStyle's CSS properties do not affect the DOM element you want affected, then you will have to create a skin and use the skinning keys which are meant to target particular DOM elements, like ::label or ::icon-style.
labelAlignment | String | Yes | Valid Values: start, top Default Value: start the alignment of label prompts for a search field (criterion). 'start' places the label before the operator and value fields. 'top' renders the label above the operator and value fields.
labelWidth | String | Yes | the preferred width of the label. Usually a percentage, but may be specified as either a percentage or an absolute number of pixels. If the width is not specified, it will default appropriately. If specified as a percentage the sum of labelWidth and fieldWidth should add up to 100%, regardless of the number of columns. If the labelWidth is specified and is a percentage the fieldWidth will be derived appropriately if not specified.
maxColumns | int | Yes | the maximum number of columns to show. This property defaults to 3. If the panelForm (containing the search fields) is inside of another panelForm, this will always be 1.
maximizeListener | javax.el.MethodExpression | Only EL | a method reference to a maximize listener
maximized | boolean | Yes | Default Value: false whether the children are currently maximized
modeButtonPosition | String | Yes | Valid Values: footer, toolbar Default Value: toolbar the location the mode button is displayed. Valid values are footer and toolbar (default).
modeChangeVisible | boolean | Yes | Default Value: true the rendering of mode change button. This button is used to switch the modes between basic and advanced. In addition if users choose to toggle between the query and quickQuery components, they can do so by adding a button to the toolbar facet. The actionListener on the button can then be wired to a method on a session scoped managed bean.
model | oracle.adf.view.rich.model.QueryModel | Yes | a QueryModel object that collectively represents the entire model for the query component. The QueryModel manages QueryDescriptors, iow, supports methods to create, clone (from an existing), delete, reset and update a QueryDescriptor. For details about QueryModel, please refer to the Javadocs for oracle.adf.view.rich.model.QueryModel.
partialTriggers | String[] | Yes | the IDs of the components that should trigger a partial update. This component will listen on the trigger components. If one of the trigger components receives an event that will cause it to update in some way, this component will request to be updated too. Identifiers are relative to the source component (this component), and must account for NamingContainers. If your component is already inside of a naming container, you can use a single colon to start the search from the root of the page, or multiple colons to move up through the NamingContainers - "::" will pop out of the component's naming container (or itself if the component is a naming container) and begin the search from there, ":::" will pop out of two naming containers (including itself if the component is a naming container) and begin the search from there, etc.
queryListener | javax.el.MethodExpression | Only EL | a method reference to a Querylistener. The queryListener is called when the user preforms a search.
queryOperationListener | javax.el.MethodExpression | Only EL | a method reference to a QueryOperationlistener
rendered | boolean | Yes | Default Value: true whether the component is rendered. When set to false, no output will be delivered for this component (the component will not in any way be rendered, and cannot be made visible on the client). If you want to change a component's rendered attribute from false to true using PPR, set the partialTrigger attribute of its parent component so the parent refreshes and in turn will render this component.
resetButtonAccessKey | char | Yes | what accessKey will the component set for the reset button. Options are: null - No access key will be set for the reset button. provide access key of your choice
resetButtonText | String | Yes | what Text will the component set for the reset button. Options are: null - default reset button text will be used. provide text and access key of your choice
resultComponentId | String | Yes | a search expression identifying the results component (usually a table or treeTable) that will display the results of the query. Expressions are relative to this source component and must account for NamingContainers. If the results component is already inside of a naming container, you can prepend a single colon to start the search from the root, or multiple colons to move up through the NamingContainers. For example, a leading "::" will pop out of the component's naming container (or itself if the component is a naming container) and begin the search from there, ":::" will pop out of two naming containers (including itself if the component is a naming container) and begin the search from there, etc. Product teams should ensure that this value is set correctly so that the search operation triggers a partial page refresh of the component. Also, the 'Save Results Layout' feature, (applied on the current saved search) uses this value as a UIHint in the model.
rows | int | Yes | the number of rows after which to start a new column. The number of rows actually rendered depends also on the "maxColumns" attribute. When the number of children rendered equals the rows value, the next child is rendered in the next column. If the children will not fit in the given number of rows and columns, the number of rows will increase to accommodate the children. When left blank, rows defaults to the maximum integer value.
runQueryAutomatically | String | Yes | Valid Values: allSavedSearches, searchDependent Default Value: searchDependent Indicates if the query should be run automatically for saved searches. The possible values are allSavedSearches - query shall be run automatically for system and end user saved searches. This will be done when the query component is initially loaded or whenever the saved search is changed. Query shall also be run automatically on "reset" operation. For new saved searches created by the user, "Run Automatically" option shall not be displayed to the user and will be implicitly set. searchDependent (default) - "Run Automatically" option can be chosen by the developer at design time for each system query. End user can choose this option as well when a new saved search is created. By default this option shall be set in the UI, when a saved search is being created.
saveButtonAccessKey | char | Yes | what accessKey will the component set for the save button. Options are: null - No access key will be set for the save button. provide access key of your choice
saveButtonText | String | Yes | what Text will the component set for the save button. Options are: null - default save button text will be used. provide text of your choice
saveQueryMode | String | Yes | Valid Values: default, readOnly, hidden Default Value: default the mode of display and usage for saved searches. default: all saved searches are displayed. In addition any saved search can be created/duplicated but only user saved searches can be deleted/updated. readOnly: saved searches to be viewed/selected, but not edited hidden: all saved searches are hidden
saveResultsLayout | String | Yes | Valid Values: always, never Default Value: always Indicates if the layout of the results component is automatically persisted. Default value is 'always'.
searchButtonAccessKey | char | Yes | what accessKey will the component set for the search button. Options are: null - no access key will be set. provide access key of your choice
searchButtonText | String | Yes | what Text will the component set for the search button. Options are: null - default button text will be used. provide text of your choice
shortDesc | String | Yes | the short description of the component. The shortDesc text may be used in two different ways, depending on the component. For components with images, the shortDesc is often used to render an HTML alt attribute for the image. Please see the accessibility guidelines section for correct alt text usage of the shortDesc attribute. shortDesc is also commonly used to render an HTML title attribute, which is used by user agents to display tooltip help text. In this case the behavior for the tooltip is controlled by the user agent, e.g. Firefox 2 truncates long tooltips. For form components, the shortDesc is displayed in a note window. For components that support the helpTopicId attribute and are not using the shortDesc as image alt text, it is recommended that helpTopicId is used instead of shortDesc as it is more flexible and provides more accessible descriptive text than the use of the title attribute.
showMaximize | String | Yes | Valid Values: never, auto, always Default Value: auto Whether to display the maximize control to allow this component to be maximized. The default value, `auto`, allows the framework to determine whether the maximize control should be displayed beased on a number of factors, including the platform that the component is being displayed on.
simple | boolean | Yes | Default Value: false the boolean that determines if the header and footer will be rendered. This attribute is deprecated and displayMode=simple should be used instead.
styleClass | String | Yes | a CSS style class to use for this component. The style class can be defined in your jspx page or in a skinning CSS file, for example, or you can use one of our public style classes, like 'AFInstructionText'.
type | String | Yes | Valid Values: default, flow, stretch Default Value: default how the component will handle geometry management. Options are: default - either flow or stretch, depending on the container the query is inside flow - does not support being stretched and will not attempt to stretch the children; the height of the component will be determined by the browser based on the children stretch - supports being stretched and will attempt to stretch the sole child or will wrap the children without stretching them; the height of this component is in no way determined by the children
unsecure | java.util.Set | Yes | A whitespace separated list of attributes whose values ordinarily can be set only on the server, but need to be settable on the client. Currently, this is supported only for the "disabled" attribute. Note that when you are able to set a property on the client, you will be allowed to by using the the .setProperty('attribute', newValue) method, but not the .setXXXAttribute(newValue) method. For example, if you have unsecure="disabled", then on the client you can use the method .setProperty('disabled', false), while the method .setDisabled(false) will not work and will provide a javascript error that setDisabled is not a function.
value | oracle.adf.view.rich.model.QueryDescriptor | Yes | a QueryDescriptor object. This provides information about the currently selected saved search. For details about QueryDescriptor, please refer to oracle.adf.view.rich.model.QueryDescriptor
visible | boolean | Yes | Default Value: true the visibility of the component. If it is "false", the component will be hidden on the client. Unlike "rendered", this does not affect the lifecycle on the server - the component may have its bindings executed, etc. - and the visibility of the component can be toggled on and off on the client, or toggled with PPR. When "rendered" is false, the component will not in any way be rendered, and cannot be made visible on the client. In most cases, use the "rendered" property instead of the "visible" property. Not supported on the following renderkits: org.apache.myfaces.trinidad.core