Often, BI Beans thin beans handle the events that they render. Each thin bean interprets the event parameters that are in the URL and performs an action in response to the event.
You can customize the behavior of some thin-bean event handlers by registering listeners for the thin-bean events. The thin beans provide standard Java events that you can listen for. The following example shows how to register a listener for a drill-out event on a thin crosstab.
// imports have been omitted for this example // define listener public class DrillOutListener extends GridViewDataAdapterListener{ public void viewDatabodyDrillOut(DatabodyDrillOutEvent e){ // change the current page to the drill-out page // assumes that changeApplicationPage is a method you have written changeApplicationPage("DrillOutPage", (ThinCrosstab)e.getSource(),e.getEdge(), e.getLayouer(), e.getSlice()); } } // in the servlet code // create a thin crosstab and add the listener ThinCrosstab crosstab = new ThinCrosstab(); DrillOutListener drillOutListener = new DrillOutListener(); crosstab.addGridViewDataListener(drillOutListener);
To find the listeners that a thin bean supports, look at the javadoc for the ThinBeanUI
whose events you want to customize. Look for methods that add listeners. For example, to find the listeners that you can add to a thin crosstab, look at the javadoc for the ThinCrosstab
. You will see that the ThinCrosstab
inherits the addGridViewDataListener
from the ThinGridView
class, and that it inherits the addDataListener
and addThinViewListener
methods from the ThinDataview
class.
You can then navigate to the methods for adding listeners to see the javadoc for the listener interface. The interface defines the kind of events that are sent to the listener. For example, if you click the hyperlink for the addThinViewListener
method, then click on the ThinViewListener
hyperlink in the addThinViewListener
method, then you will see the javadoc for the ThinViewListener
interface. There you can see definitions for a saving method and a saved method. If you register a ThinViewListener
, then the saving
method of your listener will receive a SaveEvent
whenever the thin crosstab is about to be saved.