Interface DisplayerSettingsBuilder<T>
-
- All Superinterfaces:
org.dashbuilder.dataset.DataSetLookupBuilder<T>
- All Known Subinterfaces:
AreaChartSettingsBuilder<T>,BarChartSettingsBuilder<T>,BubbleChartSettingsBuilder<T>,ChartSettingsBuilder<T>,ExternalDisplayerSettingsBuilder<T>,LineChartSettingsBuilder<T>,MapChartSettingsBuilder<T>,MeterChartSettingsBuilder<T>,MetricSettingsBuilder<T>,PieChartSettingsBuilder<T>,SelectorDisplayerSettingsBuilder<T>,TableDisplayerSettingsBuilder<T>,XAxisChartSettingsBuilder<T>
- All Known Implementing Classes:
AbstractChartSettingsBuilder,AbstractDisplayerSettingsBuilder,AbstractSelectorSettingsBuilder,AbstractXAxisChartSettingsBuilder,AreaChartSettingsBuilderImpl,BarChartSettingsBuilderImpl,BubbleChartSettingsBuilderImpl,ExternalDisplayerSettingsBuilderImpl,LineChartSettingsBuilderImpl,MapChartSettingsBuilderImpl,MeterChartSettingsBuilderImpl,MetricSettingsBuilderImpl,PieChartSettingsBuilderImpl,SelectorDisplayerSettingsBuilderImpl,TableDisplayerSettingsBuilderImpl
public interface DisplayerSettingsBuilder<T> extends org.dashbuilder.dataset.DataSetLookupBuilder<T>A DisplayerSettingsBuilder allows for the assembly of a DisplayerSettings instance in a friendly manner.DisplayerSettingsFactory.newBarChartSettings() .title("By Product") .titleVisible(false) .margins(10, 50, 100, 100) .column("Product") .column("Total amount") .horizontal() .buildSettings();- See Also:
DisplayerSettings
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TbackgroundColor(String backgroundColor)Set the background color for the displayer.DisplayerSettingsbuildSettings()Tdataset(org.dashbuilder.dataset.DataSet dataSet)Set a direct reference to the source data set that will be used by the Displayer that is being assembled.Texpression(String expression)Defines a mathematical expression used to calculate the real values to display for the last specified data set column.Texpression(String columnId, String expression)Sames as expression(String expression) but using the specified column.TfilterOff(boolean receiveFromOthers)Disable the ability to select/filter values (or range of values) within the displayer.TfilterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers)Enable the ability to select/filter values (or range of values) within the data displayer.Tformat(String name)Defines the display name for the last specified data set column.Tformat(String name, String pattern)Defines the display format for the last specified data set column.Every data set value will be formatted according to the specified pattern parameter which defines the string format of the data set value.Tformat(String columnId, String name, String pattern)Defines the display format for the specified data set column.ThtmlTemplate(String html)Support for user-provided HTML templates.TjsTemplate(String js)Specifies the JS template that is invoked every time the displayer is drawn.TrefreshOff()Switch off the automatic refresh.TrefreshOn()Force the displayer to redraw only when data becomes stale.TrefreshOn(int seconds, boolean onStale)Force the displayer to redraw every time interval.Trenderer(String renderer)Set the renderer that will be used for visualizing this DisplayerSettings.Tsubtype(DisplayerSubType displayerSubType)Set the DisplayerSettings' subtype.Ttitle(String title)Sets the caption that will be shown for this particular visualization of the data.TtitleVisible(boolean visible)Set whether the caption should be visible or not.Tuuid(String uuid)Set the DisplayerSettings' UUID.
-
-
-
Method Detail
-
uuid
T uuid(String uuid)
Set the DisplayerSettings' UUID.- Parameters:
uuid- The UUID of the DisplayerSettings that is being assembled.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
dataset
T dataset(org.dashbuilder.dataset.DataSet dataSet)
Set a direct reference to the source data set that will be used by the Displayer that is being assembled.When using this dataset provided mode the data set lookup operations set (if any): filter, group & sort will not be taking into account).
- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DataSet
-
title
T title(String title)
Sets the caption that will be shown for this particular visualization of the data.- Parameters:
title- The caption to be shown- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
titleVisible
T titleVisible(boolean visible)
Set whether the caption should be visible or not.- Parameters:
visible- True if the caption is to be visible, false if not.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
backgroundColor
T backgroundColor(String backgroundColor)
Set the background color for the displayer.- Parameters:
backgroundColor- The background color code.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
renderer
T renderer(String renderer)
Set the renderer that will be used for visualizing this DisplayerSettings.- Parameters:
renderer- The identifier of the renderer.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
subtype
T subtype(DisplayerSubType displayerSubType)
Set the DisplayerSettings' subtype.- Parameters:
displayerSubType- The displayer's subtype.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
filterOn
T filterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers)
Enable the ability to select/filter values (or range of values) within the data displayer.Usually, in a dashboard there exists a unique coordinator which takes cares of propagate all the data selection events among the other displayers. If enabled then there exists also the ability to configure how to interact with other displayers in the same dashboard.
- Parameters:
applySelf- If true then any filter request issued within the data displayer will be applied to the own displayer.notifyOthers- If true then any filter request issued within the data displayer will be propagated to other interested displayers.receiveFromOthers- If true then the data displayer will listen for filter requests coming from other displayers.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
filterOff
T filterOff(boolean receiveFromOthers)
Disable the ability to select/filter values (or range of values) within the displayer.- Parameters:
receiveFromOthers- If true then the data displayer will listen for filter requests coming from other displayers.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DisplayerSettingsBuilder's filterOn method.
-
refreshOn
T refreshOn()
Force the displayer to redraw only when data becomes stale.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
refreshOn
T refreshOn(int seconds, boolean onStale)
Force the displayer to redraw every time interval.- Parameters:
seconds- The refresh time frame in seconds. If < 0 then periodic refresh is disabled.onStale- Refresh when the data becomes stale.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
refreshOff
T refreshOff()
Switch off the automatic refresh.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DisplayerSettingsBuilder's refreshOn method.
-
format
T format(String name)
Defines the display name for the last specified data set column. NOTE: This method can only be called right after a call to DataSetLookupBuilder#column(...).- Parameters:
name- The column display name.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
format
T format(String name, String pattern)
Defines the display format for the last specified data set column.Every data set value will be formatted according to the specified pattern parameter which defines the string format of the data set value. Examples:- format("Amount", "$ #,###.##") => "$ 10,450.5"
- format("Amount", "$ #,### K") => "$ 450 K"
- Parameters:
name- The column display name.pattern- The standard java DecimalFormat and DateFormat can be used used for both number and date columns.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DecimalFormat,SimpleDateFormat
-
format
T format(String columnId, String name, String pattern)
Defines the display format for the specified data set column. Every data set value will be formatted according to the specified pattern parameter which defines the string format of the data set value. Examples:- format("Amount", "$ #,###.##") => "$ 10,450.5"
- format("Amount", "$ #,### K") => "$ 450 K"
- Parameters:
columnId- The column identifier.name- The column display name.pattern- The standard java DecimalFormat and DateFormat are used for both number and date columns.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DecimalFormat,SimpleDateFormat
-
expression
T expression(String expression)
Defines a mathematical expression used to calculate the real values to display for the last specified data set column.For numeric columns the expression can be any basic math expression where the value keyword represent the source data set value and any of the basic math operators "/ * + -" are allowed. Examples:
- format("Amount", "$ #,###.##").expression("value") => "$ 10,450.5"
- format("Amount", "$ #,###.##").expression("value-1") => "$ 10,449.5"
- format("Amount", "$ #,##0.00 K").expression("value/1000") => "$ 10.45 K"
For text columns you can manipulate the string using any javascript statement: Examples
- format("Quarter").expression("["1st Q", "2nd Q", "3rd Q", "4th Q"][value+1]") => "3rd Q" (value=1 in a date fixed grouped column)
- format("3 chars").expression("value.substring(0, 3) + "...") => "Dav..." it takes the first 3 chars only
- Parameters:
expression- The expression used to calculate the value to display- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
expression
T expression(String columnId, String expression)
Sames as expression(String expression) but using the specified column.- Parameters:
columnId- The column identifier.expression- The expression used to calculate the value to display- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
htmlTemplate
T htmlTemplate(String html)
Support for user-provided HTML templates. For instance, a metric displayer could be configured as follows:
Notice that, references (like "${value.ref}" in the example above) can be added to any of the HTML elements so that they can be referenced from the Javascript template. See<div class="card-pf card-pf-accented card-pf-aggregate-status" style="background-color:${bgColor}; width:${width}px; height:${height}px; margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;"> <h3>${title}</span></h3> <h2 id="${value.ref}">${value}</h2> </div>jsTemplate(String)for further details.- Parameters:
html- The HTML template used to render the displayer. The following enumeration contains all the available variables:- id: An identifier that it is unique among all the displayers
- title: The metric title
- value: The formatted value
- value.raw: The raw value
- width: The metric width
- height: The metric height
- marginTop: The top margin
- marginBottom: The bottom margin
- marginLeft: The left margin
- marginRight: The right margin
- bgColor: The background color
- isFilterEnabled: true or false depending whether the filter setting is enabled (see
filterOn(boolean, boolean, boolean)) - isFilterOn: true or false depending whether the filter function is currently on or of
- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
jsTemplate
T jsTemplate(String js)
Specifies the JS template that is invoked every time the displayer is drawn.Notice, HTML elements tagged as "${...}" can be referenced from the JS template. For instance, given the following HTML template:
<div class="card-pf card-pf-accented card-pf-aggregate-status" style="background-color:${bgColor}; width:${width}px; height:${height}px; margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;"> <h3>${title}</span></h3> <h2 id="${valref}">${value}</h2> </div>It is possible to implement some conditional into the JS so that the color of the text displayed depends on its value:
where the "${valref}" is the identifier of the HTML element holding the value.${valref}.style.color= ${value.raw} > 1000 ? "red" : "black";- Parameters:
js- A JS template. Notice, the same variables supported inhtmlTemplate(String)can be used in the JS.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
buildSettings
DisplayerSettings buildSettings()
- Returns:
- The DisplayerSettings instance that has been configured.
- See Also:
DisplayerSettings
-
-