Class AbstractDisplayerSettingsBuilder<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method 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 xAxisShowLabels​(boolean show)  
      T xAxisTitle​(String title)  
      T yAxisShowLabels​(boolean show)  
      T yAxisTitle​(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
      • Methods inherited from interface org.dashbuilder.dataset.DataSetLookupBuilder

        asc, buildLookup, column, column, column, column, column, dataset, desc, dynamic, dynamic, dynamic, filter, filter, firstDay, firstMonth, fixed, group, group, group, join, rowNumber, rowOffset, select, sort, sort
    • Constructor Detail

      • AbstractDisplayerSettingsBuilder

        public AbstractDisplayerSettingsBuilder()
    • Method Detail

      • createDisplayerSettings

        protected abstract DisplayerSettings createDisplayerSettings()
      • uuid

        public T uuid​(String uuid)
        Description copied from interface: DisplayerSettingsBuilder
        Set the DisplayerSettings' UUID.
        Specified by:
        uuid in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        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).

        Specified by:
        dataset in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Sets the caption that will be shown for this particular visualization of the data.
        Specified by:
        title in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Set whether the caption should be visible or not.
        Specified by:
        titleVisible in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Set the background color for the displayer.
        Specified by:
        backgroundColor in interface DisplayerSettingsBuilder<T>
        Parameters:
        backgroundColor - The background color code.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.
      • xAxisTitle

        public T xAxisTitle​(String title)
      • xAxisAngle

        public T xAxisAngle​(int angle)
      • yAxisTitle

        public T yAxisTitle​(String title)
      • yAxisShowLabels

        public T yAxisShowLabels​(boolean show)
      • xAxisShowLabels

        public T xAxisShowLabels​(boolean show)
      • renderer

        public T renderer​(String renderer)
        Description copied from interface: DisplayerSettingsBuilder
        Set the renderer that will be used for visualizing this DisplayerSettings.
        Specified by:
        renderer in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Set the DisplayerSettings' subtype.
        Specified by:
        subtype in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        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.

        Specified by:
        filterOn in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Disable the ability to select/filter values (or range of values) within the displayer.
        Specified by:
        filterOff in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Force the displayer to redraw only when data becomes stale.
        Specified by:
        refreshOn in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Force the displayer to redraw every time interval.
        Specified by:
        refreshOn in interface DisplayerSettingsBuilder<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.
      • format

        public T format​(String name)
        Description copied from interface: DisplayerSettingsBuilder
        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(...).
        Specified by:
        format in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        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"
        NOTE: This method can only be called right after a call to DataSetLookupBuilder#column(...).
        Specified by:
        format in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        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"
        Specified by:
        format in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        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
        NOTE: This method can only be called right after a call to DataSetLookupBuilder#column(...)
        Specified by:
        expression in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        Sames as expression(String expression) but using the specified column.
        Specified by:
        expression in interface DisplayerSettingsBuilder<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: 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.
        Specified by:
        htmlTemplate in interface DisplayerSettingsBuilder<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: DisplayerSettingsBuilder
        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:

         ${valref}.style.color= ${value.raw} > 1000 ? "red" : "black";
          
        where the "${valref}" is the identifier of the HTML element holding the value.
        Specified by:
        jsTemplate in interface DisplayerSettingsBuilder<T>
        Parameters:
        onDrawJs - A JS template. Notice, the same variables supported in DisplayerSettingsBuilder.htmlTemplate(String) can be used in the JS.
        Returns:
        The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.