An event target is a BI Beans device for transferring information from one thin bean to another in an HTML-client application. You use event targets to:
Route a thin-bean event from one thin bean to another. This makes it possible for a Save Options dialog, for example, to generate a Save event, while a thin presentation bean handles the event.
Route a thin-bean event to another application or to a frame in the current application.
Add information to an event. For example, if a single PrintOptions
object can print more than one thin presentation bean, you need a way to identify the view to print. You can use an event target to add a parameter to the Print event.
The Thin-Bean Event List identifies the thin-bean events that support event targets.
Construct a new EventTargetImpl
.
Set the target. (Note that you can set the target in the constructor, combining these two steps.)
To route the event to another thin bean or to a class in your application, call the setThinBeanTarget
method, passing it the name of the thin bean or class.
To route the event to a frame in the application, call the setTargetFrame
method, passing it the name of the HTML frame.
To route the event to another application, call the setDestination
method, passing it the URI of the application.
To add parameters, call the setExtraEventParameters
method, as shown in the topic "Adding Query Parameters to a Single Event."
Call the setEventTarget
method on the thin bean that will generate the event that you want to route. For example, to route the Print event to a thin presentation bean, set the event target on the PrintOptions
object.
The following code sets an event target on an Export Options dialog, to route the Export event to the thin Crosstab to export. This code assumes that session
is the current HTTPSession
, and that the thin crosstab has been stored on the session.
ThinDataviewCommon dataView = (ThinDataviewCommon)session.getAttribute(viewName); // instantiate the ExportOptions and set the view if ( dataView != null ) { exportOptions = new ExportOptions ( ); exportOptions.setView ( dataView.getThinBeanName( ) ); exportOptions.setThinBeanName ("myExportOptions" ); eventTarget = new EventTargetImpl(); eventTarget.setThinBeanTarget(dataView); exportOptions.setEventTarget ( BIConstants.EXPORT_EVENT, eventTarget ); }