How to Create a Context Menu

Using Popup Dialogs, Menus, and Windows 13-13 6. Optionally, in the Property Inspector, expand the Other section and specify a number of seconds for the AutoDismissalTimeout property. The value you specify determines the time in seconds that the note window displays before the application automatically dismisses it. Any value you specify overrides the default automatic dismissal behavior. This override is revoked if the end user moves the mouse over the content of the note window because this gesture reverts the automatic dismissal behavior back to the default automatic dismissal behavior for the note window. The default automatic dismissal behavior is to dismiss the note window when focus changes from the launching source or from the content of the popup. 7. Add logic on the parent page to invoke the popup and note window. For more information, see Section 13.4, Invoking Popup Elements.

13.2.5 What Happens at Runtime: Popup Component Events

When content is delivered to the popup, and the contentDelivery attribute is set to either lazy or lazyUncached, the popupFetch server-side event is invoked. This event has two properties, eventContext and launcherVar. The eventContext property determines the context from which the event is delivered, either from the context of the popup self or from the component that launched the popup launcher. Setting the context to launcher can be very useful if the popup is shared by multiple components, because the framework will behave as though the component that launched the popup had launched the event, and not the popup. The launcherVar property is used to keep track of the current launcher, similar to the way in which variables are used to stamp out rows in a table. For example, say you have a column in a table that displays a person’s first name using a command link. When the command link is hovered over, a popup noteWindow is invoked that shows the person’s full name. Because this noteWindow will be used by all rows in the table, but it needs to display the full name only for the row containing the command link that was clicked, you need to use the eventContext property to ensure that the context is that row, as shown in Example 13–4 . Example 13–4 Using eventContext for Shared Popup elements af:popup id=noteWindow contentDelivery=lazyUncached eventContext=launcher launcherVar=source af:noteWindow af:outputText value={testBean.fullName} af:noteWindow af:popup af:table var=person value={testBean.people} af:column id=firstName af:commandLink text={person.firstName} af:showPopupBehavior popupId=::noteWindow triggerType=mouseHover af:commandLink af:column af:table Note: The feature enabled by this property is not accessible friendly because a mouse over triggers the timeout cancellation period and there is no keyboard equivalent. 13-14 Web User Interface Developers Guide for Oracle Application Development Framework Using the variable source, you can take values from the source and apply them, or you can set values. For example, you could get the full name value of the people object used in the table, and set it as the value of the testBean’s fullName property used by the window, using a setPropertyListener and clientAttribute tag, as shown in Example 13–5 . Example 13–5 Setting the Value of a Component in a Popup Using the launcherVar Property af:popup id=noteWindow contentDelivery=lazyUncached eventContext=launcher launcherVar=source af:noteWindow af:outputText value={testBean.fullName} af:noteWindow af:setPropertyListener from={source.attributes.fullName} to={testBean.fullName} type=popupFetch af:popup af:table var=person value={testBean.people} af:column id=firstName f:facet name=header af:outputText value=First Name f:facet af:commandLink text={person.firstName} af:showPopupBehavior popupId=::noteWindow triggerType=mouseHover af:clientAttribute name=fullName value={person.fullName} af:commandLink af:column af:table In this example, the launcherVar property source gets the full name for the current row using the popupFetch event. For more information about using the setPropertyListener tag, see Section 4.7.2, How to Use the pageFlowScope Scope Without Writing Java Code. For more information about using client attributes, see Section 3.7, Using Bonus Attributes for Client-Side Components. For more information about the showPopupBehavior tag, see Section 13.4, Invoking Popup Elements. Popups also invoke the following client-side events: ■ popupOpening: Fired when the popup is invoked. If this event is canceled in a client-side listener, the popup will not be shown. ■ popupOpened: Fired after the popup becomes visible. One example for using this event would be to create custom rules for overriding default focus within the popup. ■ popupCanceled: Fired when a popup is unexpectedly dismissed by auto-dismissal or by explicitly invoking the popup client components cancel method. This client-side event also has a server-side counterpart. ■ popupClosed: Fired when the popup is hidden or when the popup is unexpectedly dismissed. This client-side event also has a server-side counterpart. When a popup is closed by an affirmative condition, for example, when the Yes button is clicked, it is hidden. When a popup is closed by auto-dismissal, for example when either the Close icon or the Cancel button is clicked, it is canceled. Both types of dismissals result in raising a popupClosed client-side event. Canceling a popup also raises a client-side popupCanceled event that has an associated server-side counterpart. The event will not be propagated to the server unless there are registered listeners for the event. If it is propagated, it prevents processing of any child