Executing a Script Within an Event Response

5-20 Web User Interface Developers Guide for Oracle Application Development Framework model.setRowKeyoldRowKey; } Only really needed if using server-side rerendering of the tree selection, but performing it here saves a roundtrip just one, to fetch the table data, instead of one to process the selection event only after which the table data gets fetched _feBean.getNavigatorManager.getFoldersNavigator.openSelectedFolder; } }

5.6 Using Client Behavior Tags

ADF Faces client behavior tags provide declarative solutions to common client operations that you would otherwise have to write yourself using JavaScript, and register on components as client listeners. By using these tags instead of writing your own JavaScript code to implement the same operations, you reduce the amount of JavaScript code that needs to be downloaded to the browser. ADF Faces provides these client behavior tags that you can use in place of client listeners: ■ panelDashboardBehavior: Enables the runtime insertion of a child component into a panelDasboard component to appear more responsive. For details, see Section 8.7.1, How to Use the panelDashboard Component. ■ insertTextBehavior: Enables a command component to insert text at the cursor in an inputText component. For details, see Section 9.3.2, How to Add the Ability to Insert Text into an inputText Component. ■ richTextEditorInsertBehavior: Enables a command component to insert text including preformatted text at the cursor in a richTextEditor component. For details, see Section 9.8.2, How to Add the Ability to Insert Text into a richTextEditor Component. ■ showPopupBehavior: Enables a command component to launch a popup component. For details, see Section 13.4, Invoking Popup Elements. ■ showPrintablePageBehavior: Enables a command component to generate and display a printable version of the page. For details, see Section 33.2, Displaying a Page for Print. ■ scrollComponentIntoViewBehavior: Enables a command component to jump to a named component when clicked. For details, see Section 5.6.1, How to Use the scrollComponentIntoViewBehavior Tag. Client behavior tags cancel server-side event delivery automatically. Therefore, any actionListener or action attributes on the parent component will be ignored. This cannot be disabled. If you want to also trigger server-side functionality, you should use either a client-side event see Section 5.3, Using JavaScript for ADF Faces Client Events , or add an additional client listener that uses AdfCustomEvent and af:serverListener to deliver a server-side event see Section 5.4, Sending Custom Events from the Client to the Server .

5.6.1 How to Use the scrollComponentIntoViewBehavior Tag

Use the scrollComponentIntoViewBehavior tag when you want the user to be able to jump to a particular component on a page. This action is similar to an anchor in Handling Events 5-21 HTML. For example, you may want to allow users to jump to a particular part of a page using a commandLink component. For the richTextEditor and inlineFrame components, you can jump to a subcomponent. For example, Figure 5–1 shows a richTextEditor component with a number of sections in its text. The command links below the editor allow the user to jump to specific parts of the text. Figure 5–1 scrollComponentIntoViewBehavior Tag in an Editor You can also configure the tag to have focus switched to the component to which the user has scrolled. To use the scrollComponentIntoViewBehavior tag: 1. Create a command component that the user will click to jump to the named component. For procedures, see Section 18.2.1, How to Use Command Buttons and Command Links.

2. In the Component Palette, from the Operations section, drag and drop a Scroll

Component Into View Behavior as a child to the command component.

3. In the Insert Scroll Component Into View Behavior dialog, use the dropdown

arrow to select Edit and then navigate to select the component to which the user should jump.

4. In the Property Inspector, set the focus attribute to true if you want the

component to have focus after the jump.

5. For a richTextEditor or inlineFrame component, optionally enter a value

for the subTargetId attribute. This ID is defined in the value of the richTextEditor or inlineFrame component. For example, the value of the subTargetId attribute for the scrollComponentIntoViewBehavior tag shown in Figure 5–1 is Introduction. The value of the richTextEditor is bound to the property shown in Example 5–17 . Note that Introduction is the ID for the first header. Example 5–17 subTargetId Value Defined in a Property private static final String _RICH_SECTIONED_VALUE = div\n + h2\n + a id=\Introduction\aIntroductionh2\n + p\n + The ADF Table component is used to display a list of structured data. For example,\n + if we have a data structure called Person that has two properties - 5-22 Web User Interface Developers Guide for Oracle Application Development Framework firstname and\n + lastname, we could use a Table with two columns - one for firstname, and the other\n + for lastname - to display a list of Person objects.\n + p\n + div\n + div\n + h2\n + a id=\The_Table_Model\aThe Table Modelh2\n + p\n + . . . div;

5.7 Using Polling Events to Update Pages

ADF Faces provides the poll component whose pollEvent can be used to communicate with the server at specified intervals. For example, you might use the poll component to update an outputText component, or to deliver a heartbeat to the server to prevent a user from being timed out of their session. You need to create a listener for the pollEvent that will be used to do the processing required at poll time. For example, if you want to use the poll component to update the value of an outputText component, you would implement a pollEventListener method that would check the value in the data source and then update the component. You can configure the interval time to determine how often the poll component will deliver its poll event. You also configure the amount of time after which the page will be allowed to time out. This can be useful, as the polling on a page causes the session to never time out. Each time a request is sent to the server, a session time out value is written to the page to determine when to cause a session time out. Because the poll component will continually send a request to the server based on the interval time, the session will never time out. This is expensive both in network usage and in memory. To avoid this issue, the web.xml configuration file contains the oracle.adf.view.rich.poll.TIMEOUT context-parameter, which specifies how long a page should run before it times out. A page is considered eligible to time out if there is no keyboard or mouse activity. The default timeout period is set at ten minutes. So if user is inactive for 10 minutes, that is, does not use the keyboard or mouse, then the framework stops polling, and from that point on, the page participates in the standard server-side session timeout for more information, see Section A.2.3.20, Session Timeout Warning . If the application does time out, when the user moves the mouse or uses the keyboard again, a new session timeout value is written to the page, and polling starts again. You can override this time for a specific page using the poll component’s timeout attribute.

5.7.1 How to Use the Poll Component

When you use the poll component, you normally also create a handler method to handle the functionality for the polling event.