When you use a BI Beans thin dialog bean, you need to provide OK
and Cancel buttons or hyperlinks for the dialog
page. In JSP applications, use the ApplyButton tag and the CancelButtonTag.
In UIX Language applications, use the submitEventDef element, and use either
a UIX link element or a UIX button element as the UINode
. In either
tagging language, put the OK and Cancel
navigation in the same page as the dialog tag.
In a servlet application, you can use UIX UINode
objects such
as the ButtonBean
or the LinkBean
from the oracle.cabo.ui.beans.nav
package. Put the buttons or hyperlinks on the same HTML page as the thin dialog.
This topic describes how to prepare these objects in a servlet application.
When the user clicks the OK or Cancel navigation, you want the thin dialog to generate an event. If the user clicks OK, then you want the main event that the thin dialog generates. Different thin dialogs generate different events. For example, the Export Options dialog generates an Export event. If the user clicks Cancel, then you want the thin dialog to generate a Cancel event.
To have the button or hyperlink tell the thin dialog to generate the event, set the ON_CLICK_ATTR
attribute of the ButtonBean
or LinkBean
to the return value of the generateOnClickSubmit
method of the thin dialog. In your call to generateOnClickSubmit
, pass the event that you want the thin dialog to generate. For the Cancel button or hyperlink, pass BIConstants.CANCEL_EVENT
. For the OK button, pass the main event of the thin dialog. For example, pass BIConstants.EXPORT_EVENT
for an OK button for the Export Options dialog.
You must also direct the events from the thin dialog to the view, dialog, or other class that handles the event. For example, you must direct the Export event from the thin dialog to the thin presentation bean whose data you want to export. For a Print Options dialog, you must direct the INIT_PRINTER_FRIENDLY_VIEW
event to a Printer-Friendly View.
To direct events, you set event targets. For the OK button or hyperlink, specify the thin presentation bean or the thin dialog as the target. For the Cancel button or hyperlink, specify a class in your application that will handle the Cancel event. The class does not have to implement the ThinBeanUI
interface. You specify the name only.
You might need to add extra event parameters in the event target, to pass information to the thin bean that will handle an event. For example, if a Print Options dialog can be used for more than one thin presentation bean, then you should pass the name of the view to print, from the Print Options dialog to the Printer-Friendly View.
Your application must handle Cancel events. The simplest way to handle this event is to return to the page from which the thin dialog was invoked.
To route the event to your Cancel event handler, your code should check the QueryParameterProvider
to see if the source
parameter (BIConstants.SOURCE
) is your handler. If your handler handles more than just the Cancel event, you should also check the event
parameter (BIConstants.EVENT
) to see if it equals BIConstants.CANCEL_EVENT
.
The following code shows how to set the event target for the ExportOptions
bean and how to set the the ON_CLICK_ATTR
attribute of button beans for the ExportOptions
. This code assumes two ButtonBean
objects, named okButton
and cancelButton
, and an ExportOptions
dialog that is named exportOptions
.
// ExportOptions is the exportOptions object // Set the view that was set on the dialog as the target for the event EventTarget exportTarget = new EventTargetImpl(exportOptions.getView().getThinBeanName(), null); exportOptions.setEventTarget(BIConstants.EXPORT_EVENT, exportTarget); // OK button is the okButton object // Assign JavaScript to the On Click attribute of the OK button String jScriptOK = exportOptions.generateOnClickSubmit(BIConstants.EXPORT_EVENT); okButton.setAttributeValue(ButtonBean.ON_CLICK_ATTR, jScriptOK); // Cancel button is the cancelButton object // Assign JavaScript to the On Click attribute of the Cancel button String jScriptOK = exportOptions.generateOnClickSubmit(BIConstants.CANCEL_EVENT); cancelButton.setAttributeValue(ButtonBean.ON_CLICK_ATTR, jScriptOK);