public abstract class AbstractDisplayerSettingsBuilder<T> extends org.dashbuilder.dataset.impl.AbstractDataSetLookupBuilder<T> implements DisplayerSettingsBuilder<T>
Modifier and Type | Field and Description |
---|---|
protected DisplayerSettings |
displayerSettings |
Constructor and Description |
---|
AbstractDisplayerSettingsBuilder() |
Modifier and Type | Method and Description |
---|---|
T |
allowCsvExport(boolean allowCsvExport) |
T |
allowExcelExport(boolean allowExcelExport) |
T |
backgroundColor(String backgroundColor)
Set the background color for the displayer.
|
DisplayerSettings |
buildSettings() |
protected abstract DisplayerSettings |
createDisplayerSettings() |
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.
|
T |
expression(String expression)
Defines a mathematical expression used to calculate the real values to display for the last specified data set
column.
|
T |
expression(String columnId,
String expression)
Sames as expression(String expression) but using the specified column.
|
T |
filterOff(boolean receiveFromOthers)
Disable the ability to select/filter values (or range of values) within the displayer.
|
T |
filterOn(boolean applySelf,
boolean notifyOthers,
boolean receiveFromOthers)
Enable the ability to select/filter values (or range of values) within the data displayer.
|
T |
format(String name)
Defines the display name for the last specified data set column.
|
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.
|
T |
format(String columnId,
String name,
String pattern)
Defines the display format for the specified data set column.
|
T |
htmlTemplate(String html)
Support for user-provided HTML templates.
|
T |
jsTemplate(String onDrawJs)
Specifies the JS template that is invoked every time the displayer is drawn.
|
T |
refreshOff()
Switch off the automatic refresh.
|
T |
refreshOn()
Force the displayer to redraw only when data becomes stale.
|
T |
refreshOn(int seconds,
boolean staleData)
Force the displayer to redraw every time interval.
|
T |
renderer(String renderer)
Set the renderer that will be used for visualizing this DisplayerSettings.
|
T |
subtype(DisplayerSubType displayerSubType)
Set the DisplayerSettings' subtype.
|
T |
title(String title)
Sets the caption that will be shown for this particular visualization of the data.
|
T |
titleVisible(boolean visible)
Set whether the caption should be visible or not.
|
T |
uuid(String uuid)
Set the DisplayerSettings' UUID.
|
T |
xAxisAngle(int angle) |
T |
xAxisTitle(String title) |
T |
yAxisTitle(String title) |
asc, buildColumnId, buildLookup, column, column, column, column, column, dataset, desc, dynamic, dynamic, dynamic, filter, filter, firstDay, firstMonth, fixed, getCurrentOp, group, group, join, rowNumber, rowOffset, select, sort, sort
protected DisplayerSettings displayerSettings
protected abstract DisplayerSettings createDisplayerSettings()
public T uuid(String uuid)
DisplayerSettingsBuilder
uuid
in interface DisplayerSettingsBuilder<T>
uuid
- The UUID of the DisplayerSettings that is being assembled.public T dataset(org.dashbuilder.dataset.DataSet dataSet)
DisplayerSettingsBuilder
When using this dataset provided mode the data set lookup operations set (if any): filter, group & sort will not be taking into account).
dataset
in interface DisplayerSettingsBuilder<T>
DataSet
public T title(String title)
DisplayerSettingsBuilder
title
in interface DisplayerSettingsBuilder<T>
title
- The caption to be shownpublic T titleVisible(boolean visible)
DisplayerSettingsBuilder
titleVisible
in interface DisplayerSettingsBuilder<T>
visible
- True if the caption is to be visible, false if not.public T allowCsvExport(boolean allowCsvExport)
public T allowExcelExport(boolean allowExcelExport)
public T backgroundColor(String backgroundColor)
DisplayerSettingsBuilder
backgroundColor
in interface DisplayerSettingsBuilder<T>
backgroundColor
- The background color code.public T xAxisAngle(int angle)
public T renderer(String renderer)
DisplayerSettingsBuilder
renderer
in interface DisplayerSettingsBuilder<T>
renderer
- The identifier of the renderer.public T subtype(DisplayerSubType displayerSubType)
DisplayerSettingsBuilder
subtype
in interface DisplayerSettingsBuilder<T>
displayerSubType
- The displayer's subtype.public T filterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers)
DisplayerSettingsBuilder
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.
filterOn
in interface DisplayerSettingsBuilder<T>
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.public T filterOff(boolean receiveFromOthers)
DisplayerSettingsBuilder
filterOff
in interface DisplayerSettingsBuilder<T>
receiveFromOthers
- If true then the data displayer will listen for filter requests coming from other displayers.DisplayerSettingsBuilder's filterOn method.
public T refreshOn()
DisplayerSettingsBuilder
refreshOn
in interface DisplayerSettingsBuilder<T>
public T refreshOn(int seconds, boolean staleData)
DisplayerSettingsBuilder
refreshOn
in interface DisplayerSettingsBuilder<T>
seconds
- The refresh time frame in seconds. If < 0 then periodic refresh is disabled.staleData
- Refresh when the data becomes stale.public T refreshOff()
DisplayerSettingsBuilder
refreshOff
in interface DisplayerSettingsBuilder<T>
DisplayerSettingsBuilder's refreshOn method.
public T format(String name)
DisplayerSettingsBuilder
format
in interface DisplayerSettingsBuilder<T>
name
- The column display name.public T format(String name, String pattern)
DisplayerSettingsBuilder
format
in interface DisplayerSettingsBuilder<T>
name
- The column display name.pattern
- The standard java DecimalFormat and DateFormat can be used used for both number and date columns.DecimalFormat
,
SimpleDateFormat
public T format(String columnId, String name, String pattern)
DisplayerSettingsBuilder
format
in interface DisplayerSettingsBuilder<T>
columnId
- The column identifier.name
- The column display name.pattern
- The standard java DecimalFormat and DateFormat are used for both number and date columns.DecimalFormat
,
SimpleDateFormat
public T expression(String expression)
DisplayerSettingsBuilder
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:
For text columns you can manipulate the string using any javascript statement: Examples
expression
in interface DisplayerSettingsBuilder<T>
expression
- The expression used to calculate the value to displaypublic T expression(String columnId, String expression)
DisplayerSettingsBuilder
expression
in interface DisplayerSettingsBuilder<T>
columnId
- The column identifier.expression
- The expression used to calculate the value to displaypublic T htmlTemplate(String html)
DisplayerSettingsBuilder
Support for user-provided HTML templates. For instance, a metric displayer could be configured as follows:
<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>
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 DisplayerSettingsBuilder.jsTemplate(String)
for further details.htmlTemplate
in interface DisplayerSettingsBuilder<T>
html
- The HTML template used to render the displayer. The following enumeration contains all the available variables:
DisplayerSettingsBuilder.filterOn(boolean, boolean, boolean)
)public T jsTemplate(String onDrawJs)
DisplayerSettingsBuilder
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:
${valref}.style.color= ${value.raw} > 1000 ? "red" : "black";
where the "${valref}" is the identifier of the HTML element holding the value.jsTemplate
in interface DisplayerSettingsBuilder<T>
onDrawJs
- A JS template. Notice, the same variables supported in DisplayerSettingsBuilder.htmlTemplate(String)
can be used in the JS.public DisplayerSettings buildSettings()
buildSettings
in interface DisplayerSettingsBuilder<T>
DisplayerSettings
Copyright © 2012–2018 JBoss by Red Hat. All rights reserved.