public interface DisplayerSettingsBuilder<T>
extends org.dashbuilder.dataset.DataSetLookupBuilder<T>
DisplayerSettingsFactory.newBarChartSettings() .title("By Product") .titleVisible(false) .margins(10, 50, 100, 100) .column("Product") .column("Total amount") .horizontal() .buildSettings();
DisplayerSettings
Modifier and Type | Method and Description |
---|---|
T |
backgroundColor(String backgroundColor)
Set the background color for the displayer.
|
DisplayerSettings |
buildSettings() |
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 js)
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 onStale)
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 uuid(String uuid)
uuid
- The UUID of the DisplayerSettings that is being assembled.T dataset(org.dashbuilder.dataset.DataSet dataSet)
When using this dataset provided mode the data set lookup operations set (if any): filter, group & sort will not be taking into account).
DataSet
T title(String title)
title
- The caption to be shownT titleVisible(boolean visible)
visible
- True if the caption is to be visible, false if not.T backgroundColor(String backgroundColor)
backgroundColor
- The background color code.T renderer(String renderer)
renderer
- The identifier of the renderer.T subtype(DisplayerSubType displayerSubType)
displayerSubType
- The displayer's subtype.T filterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers)
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.
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.T filterOff(boolean receiveFromOthers)
receiveFromOthers
- If true then the data displayer will listen for filter requests coming from other displayers.DisplayerSettingsBuilder's filterOn method.
T refreshOn()
T refreshOn(int seconds, boolean onStale)
seconds
- The refresh time frame in seconds. If < 0 then periodic refresh is disabled.onStale
- Refresh when the data becomes stale.T refreshOff()
DisplayerSettingsBuilder's refreshOn method.
T format(String name)
name
- The column display name.T format(String name, String pattern)
name
- The column display name.pattern
- The standard java DecimalFormat and DateFormat can be used used for both number and date columns.DecimalFormat
,
SimpleDateFormat
T format(String columnId, String name, String pattern)
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
T expression(String expression)
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
- The expression used to calculate the value to displayT expression(String columnId, String expression)
columnId
- The column identifier.expression
- The expression used to calculate the value to displayT htmlTemplate(String html)
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 jsTemplate(String)
for further details.html
- The HTML template used to render the displayer. The following enumeration contains all the available variables:
filterOn(boolean, boolean, boolean)
)T jsTemplate(String js)
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.js
- A JS template. Notice, the same variables supported in htmlTemplate(String)
can be used in the JS.DisplayerSettings buildSettings()
DisplayerSettings
Copyright © 2012–2019 JBoss by Red Hat. All rights reserved.