Creating and registering dashlet metadata
The dashlet registry contains the list of all dashlet definitions in an application. You must register the dashlet metadata definition with the dashlet registry before adding the dashlet to the dashboard. Using the dashlet registry, you can first register your custom dashlets and then add those dashlets to a dashboard.
- To create dashlet metadata, you define the dashlet metadata definition XML.
- To register dashlet metadata, call the registerDashlet( ) method of the SCUIDashboardManager class (which is described in the Javadoc resource).
Sample XML: dashlet metadata definition
<Dashlets>
<Dashlet id="dashlet_one" title="Dashlet One" type="html" tag="tag_1">
<Url>/stk/dashboard/dashlet_one.jsp</Url>
<Imgurl>/stk/img/dashboard/dashlet_one_preview.png</Imgurl>
<Description>
Dashlet one description bundle key
</Description>
<Config numberOfColumns="3">
</Config>
</Dashlet>
<Dashlet id="dashlet_two" title="Dashlet Two" type="extscreen" tag="tag_2"
refreshable="Y">
<Url>/stk/dashboard/dashlet_two.jsp</Url>
<Imgurl>/stk/img/dashboard/dashlet_two_preview.png</Imgurl>
<Description>
Dashlet two description bundle key
</Description>
<Config numberOfColumns="2">
</Config>
<!-- Other metadata relevant to the dashlet can be added based on type
and url ofthe dashlet -->
<Group>
<Section id="Airports" title="Airports" Icon="/stk/img/cog.png">
<Link linkId="manage_airport" name="Manage Airports"
url="/stk/airport.do" />
</Section>
<Section id="Flights" title="Flight" icon="/stk/img/phone-icon.jpg">
<Link linkid="manage_airport" name="Flights" url="/stk/flight.do" />
<Link linkid="manage_airport" name="Flight Services"
url="/stk/flightService.do"/>
</Section>
</Group>
</Dashlet>
<Dashlet id="dashlet_three" title="Dashlet Three" type="html" tag="tag_3">
<Url>/stk/dashboard/dashlet_three.jsp</Url>
<Imgurl>/stk/img/dashboard/dashlet_three_preview.png</Imgurl>
<Description>
Dashlet three description bundle key
</Description>
<Config>
</Config>
</Dashlet>
</Dashlets>
Attribute and element descriptions for
the above sample are given below. - id
A unique identifier of the dashlet. This id is used to query a dashlet and its properties. It is used by a dashboard definition to add a dashlet to it.
- title
- The title of the dashlet. It can be a bundle key which can be localized.
- type
- The type of the dashlet is a metadata about the type of content returned by a dashlet URL. By default, the Web UI Framework supports following types of dashlet:
- HTML. Response of type HTML must be a valid HTML document fragment. Following examples illustrate various ways in which it can be used to render the dashlet UI: (1) A fully rendered HTML fragment that can be viewed in a browser without any further processing. (2) An iframe that can be used to safely embed widget from external websites. (3) A scriptlet that can dynamically render the content in the container.
- extscreen. An extscreen is an ExtJS-based JavaScript UI rendering script. It can be used to render dynamic and interactive UI components.
- tag
- A comma separated value of tag names of the dashlet.
- refreshable
Setting this value to Y makes the dashboard refreshable and a refresh icon is shown in the dashlet toolbox. When the refresh icon is clicked, the individual dashlet is refreshed.
- URL
The URL used to get contents to render a dashlet. To render a dashlet into the dashboard, a request needs to be made to the server. The request is made to this URL and the response is rendered on the UI.
- Imgurl
The URL to the image to be displayed showing a preview of the content displayed by the dashlet.
- description
- The description of the dashlet. It can be a bundle key which can be localized.
- Config
- The Config element is used to define configuration options used to render the dashlet on the UI. Some dashlets that do not require a configuration option may choose not to specify the Config element. Note: In addition to the Config element, a dashlet can have other metadata elements. In general, the Config is used to define UI properties but it can be used to hold any kind of metadata.