Skip to content

Add Widget Properties

Michael Mairegger edited this page Jul 20, 2015 · 2 revisions

To add properties to a widget you have to add some annotation to the class that extends AbstractRubyTemplate and implements RubyRailsWidget.

The annotation class is WidgetProperties. There you can add a collection of WidgetProperty.

@WidgetProperties(
{
    @WidgetProperty(
        key="metric1",
        description="This is a mandatory parameter",
        type=WidgetPropertyType.METRIC,
        optional=false
    ),
    @WidgetProperty(
        key="metric2",
        description="This is a mandatory parameter",
        type=WidgetPropertyType.METRIC,
        optional=false
    )
})

The property type describes the possible value that the widget property has. Possible types can be found on GitHub

Clone this wiki locally