### Dashboard Listener API

Dashboard Listener API defines the start and end events of adding and deleting library components for users to get dashboard related information at the event and to use the information in their own application.

Event types

- The start action of adding a library component
- The end action of adding a library component
- The start action of deleting a library component
- The end action of deleting a library component

Basic Information

- Catalog information
- Dashboard information
- Library component information

For detailed usages about the Dashboard Listener API, see JReport Javadoc com.jinfonet.web.modules.dashboard package in `<install_root>\help\api`. Also, there is a sample implementation file DashboardListenerDemo.java in `<install_root>\help\samples\APIDashboardListener`.

#### Applying the implementations of the Dashboard Listener API

Different uses should have different implementations of the Dashboard Listener API. The implementations can be managed on the server by administrators. After a new implementation is imported to the server and enabled, it will be able to take effect immediately without restarting the server.

Besides, after an implementation is uploaded to the server, you can apply it in the URL which is used for running dashboards. The URL way has higher priority than the enabled implementation on the JReport Administration page.

To import and enable an implementation on the JReport Administration page:

1. Log onto the JReport Administration page.
2. Click Configuration on the system toolbar and then select Dashboard Listener from the drop-down menu.
3. In the Dashboard Listener panel, click New Dashboard Listener.
4. In the New Dashboard Listener dialog, click the Browse button to locate the implementation file which could be a zip or a jar file. Then click Next.
5. From the Class Name drop-down list, choose a class name which is defined in the implementation file.
6. Click beside the Target box, then in the Select Target dialog, specify the target dashboards you would like the implementation to apply to. Click OK to confirm the selection.
7. In the Description text field, enter a description for the implementation if necessary.
8. Select the Enabled checkbox to make the implementation enabled.
9. Click Finish and the registered class will take effect right away.

See also Dashboard Listener panel for additional information.

To apply an implementation via URL:

To apply the dashboard listener via URL, append the key-value pair "jrd_dsh_listener=PackageName.ClassName" in the URL which is used for running dashboards.

For example, if you want your implemented class TestListener to take effect on a new created dashboard (not the target defined on the JReport Administration page), you can define it in the URL. Such URL will not affect the Dashboard Listener Table on the JReport Administration page.

`http://localhost:8888/dashboard/app/entry/run.jsp?jrs.authorization=YWRtaW46YWRtaW4%3D&jrd_dsh_listener=com.jinfonet.TestListener&jrd_resext={"active":0,"reslst":[{"name":"/USERFOLDERPATH/admin/Dashboard1.dsh","ver":"-1"}]}`