Class AbstractDisplayerSettingsBuilder<T>
- java.lang.Object
-
- org.dashbuilder.dataset.impl.AbstractDataSetLookupBuilder<T>
-
- org.dashbuilder.displayer.impl.AbstractDisplayerSettingsBuilder<T>
-
- All Implemented Interfaces:
org.dashbuilder.dataset.DataSetLookupBuilder<T>,DisplayerSettingsBuilder<T>
- Direct Known Subclasses:
AbstractChartSettingsBuilder,AbstractSelectorSettingsBuilder,TableDisplayerSettingsBuilderImpl
public abstract class AbstractDisplayerSettingsBuilder<T> extends org.dashbuilder.dataset.impl.AbstractDataSetLookupBuilder<T> implements DisplayerSettingsBuilder<T>
Base class for DisplayerSettingsBuilder implementations.
-
-
Field Summary
Fields Modifier and Type Field Description protected DisplayerSettingsdisplayerSettings
-
Constructor Summary
Constructors Constructor Description AbstractDisplayerSettingsBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TallowCsvExport(boolean allowCsvExport)TallowExcelExport(boolean allowExcelExport)TbackgroundColor(String backgroundColor)Set the background color for the displayer.DisplayerSettingsbuildSettings()protected abstract DisplayerSettingscreateDisplayerSettings()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 onDrawJs)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 staleData)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.TxAxisAngle(int angle)TxAxisShowLabels(boolean show)TxAxisTitle(String title)TyAxisShowLabels(boolean show)TyAxisTitle(String title)-
Methods inherited from class org.dashbuilder.dataset.impl.AbstractDataSetLookupBuilder
asc, buildColumnId, buildLookup, column, column, column, column, column, dataset, desc, dynamic, dynamic, dynamic, filter, filter, firstDay, firstMonth, fixed, getCurrentOp, group, group, group, join, rowNumber, rowOffset, select, sort, sort
-
-
-
-
Field Detail
-
displayerSettings
protected DisplayerSettings displayerSettings
-
-
Method Detail
-
createDisplayerSettings
protected abstract DisplayerSettings createDisplayerSettings()
-
uuid
public T uuid(String uuid)
Description copied from interface:DisplayerSettingsBuilderSet the DisplayerSettings' UUID.- Specified by:
uuidin interfaceDisplayerSettingsBuilder<T>- Parameters:
uuid- The UUID of the DisplayerSettings that is being assembled.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
dataset
public T dataset(org.dashbuilder.dataset.DataSet dataSet)
Description copied from interface:DisplayerSettingsBuilderSet 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).
- Specified by:
datasetin interfaceDisplayerSettingsBuilder<T>- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DataSet
-
title
public T title(String title)
Description copied from interface:DisplayerSettingsBuilderSets the caption that will be shown for this particular visualization of the data.- Specified by:
titlein interfaceDisplayerSettingsBuilder<T>- Parameters:
title- The caption to be shown- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
titleVisible
public T titleVisible(boolean visible)
Description copied from interface:DisplayerSettingsBuilderSet whether the caption should be visible or not.- Specified by:
titleVisiblein interfaceDisplayerSettingsBuilder<T>- 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.
-
allowCsvExport
public T allowCsvExport(boolean allowCsvExport)
-
allowExcelExport
public T allowExcelExport(boolean allowExcelExport)
-
backgroundColor
public T backgroundColor(String backgroundColor)
Description copied from interface:DisplayerSettingsBuilderSet the background color for the displayer.- Specified by:
backgroundColorin interfaceDisplayerSettingsBuilder<T>- Parameters:
backgroundColor- The background color code.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
xAxisAngle
public T xAxisAngle(int angle)
-
yAxisShowLabels
public T yAxisShowLabels(boolean show)
-
xAxisShowLabels
public T xAxisShowLabels(boolean show)
-
renderer
public T renderer(String renderer)
Description copied from interface:DisplayerSettingsBuilderSet the renderer that will be used for visualizing this DisplayerSettings.- Specified by:
rendererin interfaceDisplayerSettingsBuilder<T>- Parameters:
renderer- The identifier of the renderer.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
subtype
public T subtype(DisplayerSubType displayerSubType)
Description copied from interface:DisplayerSettingsBuilderSet the DisplayerSettings' subtype.- Specified by:
subtypein interfaceDisplayerSettingsBuilder<T>- Parameters:
displayerSubType- The displayer's subtype.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
filterOn
public T filterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers)
Description copied from interface:DisplayerSettingsBuilderEnable 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.
- Specified by:
filterOnin interfaceDisplayerSettingsBuilder<T>- 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
public T filterOff(boolean receiveFromOthers)
Description copied from interface:DisplayerSettingsBuilderDisable the ability to select/filter values (or range of values) within the displayer.- Specified by:
filterOffin interfaceDisplayerSettingsBuilder<T>- 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
public T refreshOn()
Description copied from interface:DisplayerSettingsBuilderForce the displayer to redraw only when data becomes stale.- Specified by:
refreshOnin interfaceDisplayerSettingsBuilder<T>- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
refreshOn
public T refreshOn(int seconds, boolean staleData)
Description copied from interface:DisplayerSettingsBuilderForce the displayer to redraw every time interval.- Specified by:
refreshOnin interfaceDisplayerSettingsBuilder<T>- Parameters:
seconds- The refresh time frame in seconds. If < 0 then periodic refresh is disabled.staleData- Refresh when the data becomes stale.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
refreshOff
public T refreshOff()
Description copied from interface:DisplayerSettingsBuilderSwitch off the automatic refresh.- Specified by:
refreshOffin interfaceDisplayerSettingsBuilder<T>- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
- See Also:
DisplayerSettingsBuilder's refreshOn method.
-
format
public T format(String name)
Description copied from interface:DisplayerSettingsBuilderDefines the display name for the last specified data set column. NOTE: This method can only be called right after a call to DataSetLookupBuilder#column(...).- Specified by:
formatin interfaceDisplayerSettingsBuilder<T>- Parameters:
name- The column display name.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
format
public T format(String name, String pattern)
Description copied from interface:DisplayerSettingsBuilderDefines 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"
- Specified by:
formatin interfaceDisplayerSettingsBuilder<T>- 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
public T format(String columnId, String name, String pattern)
Description copied from interface:DisplayerSettingsBuilderDefines 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"
- Specified by:
formatin interfaceDisplayerSettingsBuilder<T>- 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
public T expression(String expression)
Description copied from interface:DisplayerSettingsBuilderDefines 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
- Specified by:
expressionin interfaceDisplayerSettingsBuilder<T>- Parameters:
expression- The expression used to calculate the value to display- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
expression
public T expression(String columnId, String expression)
Description copied from interface:DisplayerSettingsBuilderSames as expression(String expression) but using the specified column.- Specified by:
expressionin interfaceDisplayerSettingsBuilder<T>- 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
public T htmlTemplate(String html)
Description copied from interface:DisplayerSettingsBuilderSupport 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>DisplayerSettingsBuilder.jsTemplate(String)for further details.- Specified by:
htmlTemplatein interfaceDisplayerSettingsBuilder<T>- 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
DisplayerSettingsBuilder.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
public T jsTemplate(String onDrawJs)
Description copied from interface:DisplayerSettingsBuilderSpecifies 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";- Specified by:
jsTemplatein interfaceDisplayerSettingsBuilder<T>- Parameters:
onDrawJs- A JS template. Notice, the same variables supported inDisplayerSettingsBuilder.htmlTemplate(String)can be used in the JS.- Returns:
- The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
-
buildSettings
public DisplayerSettings buildSettings()
- Specified by:
buildSettingsin interfaceDisplayerSettingsBuilder<T>- Returns:
- The DisplayerSettings instance that has been configured.
- See Also:
DisplayerSettings
-
-