Class PivotTableImpl

java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<JmixPivotTable>
io.jmix.pivottable.component.impl.PivotTableImpl
All Implemented Interfaces:
PivotTable, AttachNotifier, Component, Component.BelongToFrame, Component.Editable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper, HasContextHelp, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, org.springframework.beans.factory.InitializingBean

public class PivotTableImpl extends AbstractComponent<JmixPivotTable> implements PivotTable, org.springframework.beans.factory.InitializingBean
  • Field Details

  • Constructor Details

    • PivotTableImpl

      public PivotTableImpl()
  • Method Details

    • createComponent

      protected JmixPivotTable createComponent()
    • createPivotTableSerializer

      protected PivotTableSerializer createPivotTableSerializer()
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setCurrentAuthentication

      @Autowired public void setCurrentAuthentication(CurrentAuthentication currentAuthentication)
    • setMessageTools

      @Autowired public void setMessageTools(MessageTools messageTools)
    • setPivotTableLocaleHelper

      @Autowired public void setPivotTableLocaleHelper(PivotTableLocaleHelper helper)
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • initLocale

      protected void initLocale()
    • repaint

      public void repaint()
      Description copied from interface: PivotTable
      Resend all items and properties to client and repaint pivot table. Use this method if you change some property of already displayed pivot table.
      Specified by:
      repaint in interface PivotTable
    • isEditable

      public boolean isEditable()
      Specified by:
      isEditable in interface Component.Editable
    • setEditable

      public void setEditable(boolean editable)
      Specified by:
      setEditable in interface Component.Editable
    • getProperties

      public Map<String,String> getProperties()
      Specified by:
      getProperties in interface PivotTable
      Returns:
      the map whose keys are DataItem property names to use as pivot table data and values they localized names
    • setProperties

      public void setProperties(Map<String,String> properties)
      Description copied from interface: PivotTable
      Sets the map whose keys are DataItem property names to use as pivot table data and values they localized names.
      Specified by:
      setProperties in interface PivotTable
      Parameters:
      properties - a map of properties names with localized values
    • addProperties

      public void addProperties(Map<String,String> properties)
      Description copied from interface: PivotTable
      Adds a map whose keys are DataItem property names to use as pivot table data and values they localized names.
      Specified by:
      addProperties in interface PivotTable
      Parameters:
      properties - a map of properties names with localized values
    • addProperty

      public void addProperty(String property, String value)
      Description copied from interface: PivotTable
      Add a property eith its localized value
      Specified by:
      addProperty in interface PivotTable
      Parameters:
      property - property name
      value - localized value
    • getRows

      public List<String> getRows()
      Specified by:
      getRows in interface PivotTable
      Returns:
      the list of properties names to use as rows.
    • setRows

      public void setRows(List<String> rows)
      Description copied from interface: PivotTable
      Sets the list of properties names to use as rows.
      Specified by:
      setRows in interface PivotTable
      Parameters:
      rows - a list of properties names
    • addRows

      public void addRows(String... rows)
      Description copied from interface: PivotTable
      Adds an array of properties names to use as rows.
      Specified by:
      addRows in interface PivotTable
      Parameters:
      rows - an array of properties names
    • getColumns

      public List<String> getColumns()
      Specified by:
      getColumns in interface PivotTable
      Returns:
      the list of property names to use as columns.
    • setColumns

      public void setColumns(List<String> cols)
      Description copied from interface: PivotTable
      Sets the list of property names to use as columns.
      Specified by:
      setColumns in interface PivotTable
      Parameters:
      cols - a list of properties names
    • addColumns

      public void addColumns(String... cols)
      Description copied from interface: PivotTable
      Adds an array of property names to use as columns.
      Specified by:
      addColumns in interface PivotTable
      Parameters:
      cols - an array of properties names
    • getAggregation

      public Aggregation getAggregation()
      Specified by:
      getAggregation in interface PivotTable
      Returns:
      the aggregation object which defines how pivot table will aggregate results per cell
    • setAggregation

      public void setAggregation(Aggregation aggregation)
      Description copied from interface: PivotTable
      Sets the aggregation object.

      Applies only when editable=false.

      Specified by:
      setAggregation in interface PivotTable
      Parameters:
      aggregation - an aggregation object
    • getRenderer

      public Renderer getRenderer()
      Specified by:
      getRenderer in interface PivotTable
      Returns:
      the renderer object which generates output from pivot data structure
    • setRenderer

      public void setRenderer(Renderer renderer)
      Description copied from interface: PivotTable
      Sets the renderer object.

      Applies only when editable=false.

      Specified by:
      setRenderer in interface PivotTable
      Parameters:
      renderer - a renderer object
    • getAggregationProperties

      public List<String> getAggregationProperties()
      Specified by:
      getAggregationProperties in interface PivotTable
      Returns:
      the list of properties names to prepopulate in vals area (gets passed to aggregator generating function)
    • setAggregationProperties

      public void setAggregationProperties(List<String> aggregationProperties)
      Description copied from interface: PivotTable
      Sets the list of properties names to prepopulate in vals area (gets passed to aggregator generating function).

      Applies only when editable=true.

      Specified by:
      setAggregationProperties in interface PivotTable
      Parameters:
      aggregationProperties - a list of properties names
    • addAggregationProperties

      public void addAggregationProperties(String... aggregationProperties)
      Description copied from interface: PivotTable
      Adds an array of properties names to prepopulate in vals area (gets passed to aggregator generating function).

      Applies only when editable=true.

      Specified by:
      addAggregationProperties in interface PivotTable
      Parameters:
      aggregationProperties - an array of properties names
    • getAggregations

      public Aggregations getAggregations()
      Specified by:
      getAggregations in interface PivotTable
      Returns:
      the aggregations object which defines the collection of aggregations to use in pivot table and additional settings for them.
    • setAggregations

      public void setAggregations(Aggregations aggregations)
      Description copied from interface: PivotTable
      Sets the aggregations object which defines the collection of aggregations to use in pivot table and additional settings for them.

      Applies only when editable=true.

      Specified by:
      setAggregations in interface PivotTable
      Parameters:
      aggregations - an aggregations object
    • getRenderers

      public Renderers getRenderers()
      Specified by:
      getRenderers in interface PivotTable
      Returns:
      the renderers object which defines the collection of renderers to use in pivot table and additional settings for them.
    • setRenderers

      public void setRenderers(Renderers renderers)
      Description copied from interface: PivotTable
      Sets the renderers object which defines the collection of renderers to use in pivot table and additional settings for them.

      Applies only when editable=true.

      Specified by:
      setRenderers in interface PivotTable
      Parameters:
      renderers - a renderers object
    • getHiddenProperties

      public List<String> getHiddenProperties()
      Specified by:
      getHiddenProperties in interface PivotTable
      Returns:
      the list of properties names to omit from the UI
    • setHiddenProperties

      public void setHiddenProperties(List<String> hiddenProperties)
      Description copied from interface: PivotTable
      Sets the list of properties names to omit from the UI.

      Applies only when editable=true.

      Specified by:
      setHiddenProperties in interface PivotTable
      Parameters:
      hiddenProperties - a list of properties names
    • addHiddenProperties

      public void addHiddenProperties(String... hiddenProperties)
      Description copied from interface: PivotTable
      Adds an array of properties names to omit from the UI.

      Applies only when editable=true.

      Specified by:
      addHiddenProperties in interface PivotTable
      Parameters:
      hiddenProperties - an array of properties names
    • getHiddenFromAggregations

      public List<String> getHiddenFromAggregations()
      Specified by:
      getHiddenFromAggregations in interface PivotTable
      Returns:
      list of properties names to omit from the aggregation arguments dropdowns
    • setHiddenFromAggregations

      public void setHiddenFromAggregations(List<String> hiddenFromAggregations)
      Description copied from interface: PivotTable
      Sets the list of properties names to omit from the aggregation arguments dropdowns.

      Applies only when editable=true.

      Specified by:
      setHiddenFromAggregations in interface PivotTable
      Parameters:
      hiddenFromAggregations - a list of properties names
    • addHiddenFromAggregations

      public void addHiddenFromAggregations(String... hiddenFromAggregations)
      Description copied from interface: PivotTable
      Adds an array of properties names to omit from the aggregation arguments dropdowns.

      Applies only when editable=true.

      Specified by:
      addHiddenFromAggregations in interface PivotTable
      Parameters:
      hiddenFromAggregations - an array of properties names
    • getHiddenFromDragDrop

      public List<String> getHiddenFromDragDrop()
      Specified by:
      getHiddenFromDragDrop in interface PivotTable
      Returns:
      list of properties names to omit from the drag'n'drop portion of the UI
    • setHiddenFromDragDrop

      public void setHiddenFromDragDrop(List<String> hiddenFromDragDrop)
      Description copied from interface: PivotTable
      Sets the list of properties names to omit from the drag'n'drop portion of the UI.

      Applies only when editable=true.

      Specified by:
      setHiddenFromDragDrop in interface PivotTable
      Parameters:
      hiddenFromDragDrop - a list of properties names
    • addHiddenFromDragDrop

      public void addHiddenFromDragDrop(String... hiddenFromDragDrop)
      Description copied from interface: PivotTable
      Adds an array of properties names to omit from the drag'n'drop portion of the UI.

      Applies only when editable=true.

      Specified by:
      addHiddenFromDragDrop in interface PivotTable
      Parameters:
      hiddenFromDragDrop - an array of properties names
    • getColumnOrder

      public ColumnOrder getColumnOrder()
      Specified by:
      getColumnOrder in interface PivotTable
      Returns:
      the order in which column data is provided to the renderer
    • setColumnOrder

      public void setColumnOrder(ColumnOrder columnOrder)
      Description copied from interface: PivotTable
      Set the order in which column data is provided to the renderer.

      Ordering by value orders by column total.

      Specified by:
      setColumnOrder in interface PivotTable
      Parameters:
      columnOrder - the order in which column data is provided to the renderer
    • getRowOrder

      public RowOrder getRowOrder()
      Specified by:
      getRowOrder in interface PivotTable
      Returns:
      the order in which row data is provided to the renderer
    • setRowOrder

      public void setRowOrder(RowOrder rowOrder)
      Description copied from interface: PivotTable
      Sets the order in which row data is provided to the renderer.

      Ordering by value orders by row total.

      Specified by:
      setRowOrder in interface PivotTable
      Parameters:
      rowOrder - the order in which row data is provided to the renderer
    • getMenuLimit

      public Integer getMenuLimit()
      Specified by:
      getMenuLimit in interface PivotTable
      Returns:
      maximum number of values to list in the double-click menu
    • setMenuLimit

      public void setMenuLimit(Integer menuLimit)
      Description copied from interface: PivotTable
      Sets maximum number of values to list in the double-click menu.

      Applies only when editable=true.

      Specified by:
      setMenuLimit in interface PivotTable
      Parameters:
      menuLimit - maximum number of values to list in the double-click menu
    • getAutoSortUnusedProperties

      public Boolean getAutoSortUnusedProperties()
      Specified by:
      getAutoSortUnusedProperties in interface PivotTable
      Returns:
      true if unused properties are kept sorted in the UI and false otherwise
    • setAutoSortUnusedProperties

      public void setAutoSortUnusedProperties(Boolean autoSortUnusedProperties)
      Description copied from interface: PivotTable
      Controls whether or not unused properties are kept sorted in the UI.

      Applies only when editable=true.

      Specified by:
      setAutoSortUnusedProperties in interface PivotTable
      Parameters:
      autoSortUnusedProperties - true if unused properties are kept sorted in the UI and false otherwise
    • getUnusedPropertiesVertical

      public UnusedPropertiesVertical getUnusedPropertiesVertical()
      Specified by:
      getUnusedPropertiesVertical in interface PivotTable
      Returns:
      true if unused attributes are shown always vertical, false if always horizontal. If set to a number (as is the default) then if the properties' names' combined length in characters exceeds the number then the properties will be shown vertically.
    • setUnusedPropertiesVertical

      public void setUnusedPropertiesVertical(UnusedPropertiesVertical unusedPropertiesVertical)
      Description copied from interface: PivotTable
      Controls whether or not unused properties are shown vertically instead of the default which is horizontally. true means always vertical, false means always horizontal. If set to a number (as is the default) then if the properties' names' combined length in characters exceeds the number then the properties will be shown vertically.

      Applies only when editable=true.

      Specified by:
      setUnusedPropertiesVertical in interface PivotTable
      Parameters:
      unusedPropertiesVertical - properties
    • getDataProvider

      public DataProvider getDataProvider()
      Specified by:
      getDataProvider in interface PivotTable
      Returns:
      data provider for PivotTable. Contains items which will be shown on PivotTable.
    • setDataProvider

      public void setDataProvider(DataProvider dataProvider)
      Description copied from interface: PivotTable
      Sets data provider for PivotTable. Contains items which will be shown on PivotTable.
      Specified by:
      setDataProvider in interface PivotTable
      Parameters:
      dataProvider - a data provider
    • addData

      public void addData(DataItem... dataItems)
      Description copied from interface: PivotTable
      Adds a data item to data provider.
      Specified by:
      addData in interface PivotTable
      Parameters:
      dataItems - a data item to add
    • getFilterFunction

      public JsFunction getFilterFunction()
      Specified by:
      getFilterFunction in interface PivotTable
      Returns:
      the JsFunction which defines a javascript code called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise
    • setFilterFunction

      public void setFilterFunction(JsFunction filter)
      Description copied from interface: PivotTable
      Sets the JsFunction which defines a javascript code called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise
      Specified by:
      setFilterFunction in interface PivotTable
      Parameters:
      filter - a JsFunction to use as a filter
    • getSortersFunction

      public JsFunction getSortersFunction()
      Specified by:
      getSortersFunction in interface PivotTable
      Returns:
      the JsFunction which defines a javascript code called with an property name and can return a function which can be used as an argument to Array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in "natural sort" implementation. Useful for sorting attributes like month names
    • setSortersFunction

      public void setSortersFunction(JsFunction sorters)
      Description copied from interface: PivotTable
      Sets the JsFunction which defines a javascript code called with an property name and can return a function which can be used as an argument to Array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in "natural sort" implementation. Useful for sorting attributes like month names
      Specified by:
      setSortersFunction in interface PivotTable
      Parameters:
      sorters - a JsFunction to use as a sorters
    • getRendererOptions

      public RendererOptions getRendererOptions()
      Specified by:
      getRendererOptions in interface PivotTable
      Returns:
      the object passed through to renderer as options
    • setRendererOptions

      public void setRendererOptions(RendererOptions rendererOptions)
      Description copied from interface: PivotTable
      Sets object passed through to renderer as options.
      Specified by:
      setRendererOptions in interface PivotTable
      Parameters:
      rendererOptions - object defines renderer options
    • getInclusions

      public Map<String,List<String>> getInclusions()
      Specified by:
      getInclusions in interface PivotTable
      Returns:
      map whose keys are properties names and values are lists of properties values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click
    • setInclusions

      public void setInclusions(Map<String,List<String>> inclusions)
      Description copied from interface: PivotTable
      Sets map whose keys are properties names and values are lists of properties values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides exclusions).

      Applies only when editable=true.

      Specified by:
      setInclusions in interface PivotTable
      Parameters:
      inclusions - map with properties and values included in rendering
      See Also:
    • setInclusions

      public void setInclusions(String property, List<String> inclusions)
      Description copied from interface: PivotTable
      Sets the value of inclusions map.
      Specified by:
      setInclusions in interface PivotTable
      Parameters:
      property - property name
      inclusions - a list of properties values
      See Also:
    • addInclusions

      public void addInclusions(String property, String... inclusions)
      Description copied from interface: PivotTable
      Adds a values to given key of inclusions map.
      Specified by:
      addInclusions in interface PivotTable
      Parameters:
      property - a property name
      inclusions - an array of properties values
      See Also:
    • getExclusions

      public Map<String,List<String>> getExclusions()
      Specified by:
      getExclusions in interface PivotTable
      Returns:
      map whose keys are properties names and values are lists of properties values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click
    • setExclusions

      public void setExclusions(Map<String,List<String>> exclusions)
      Description copied from interface: PivotTable
      Sets map whose keys are properties names and values are lists of properties values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click.

      Applies only when editable=true.

      Specified by:
      setExclusions in interface PivotTable
      Parameters:
      exclusions - map with properties and values excluded from rendering
      See Also:
    • setExclusions

      public void setExclusions(String property, List<String> exclusions)
      Description copied from interface: PivotTable
      Sets the value of exclusions map.
      Specified by:
      setExclusions in interface PivotTable
      Parameters:
      property - property name
      exclusions - a list of properties values
      See Also:
    • addExclusions

      public void addExclusions(String property, String... exclusions)
      Description copied from interface: PivotTable
      Adds a values to given key of exclusions map.
      Specified by:
      addExclusions in interface PivotTable
      Parameters:
      property - a property name
      exclusions - an array of properties values
      See Also:
    • getDerivedProperties

      public DerivedProperties getDerivedProperties()
      Specified by:
      getDerivedProperties in interface PivotTable
      Returns:
      object to define derived properties
    • setDerivedProperties

      public void setDerivedProperties(DerivedProperties derivedProperties)
      Description copied from interface: PivotTable
      Sets object to define derived properties.
      Specified by:
      setDerivedProperties in interface PivotTable
      Parameters:
      derivedProperties - object to define derived properties
    • getNativeJson

      public String getNativeJson()
      Specified by:
      getNativeJson in interface PivotTable
      Returns:
      additional JSON configuration as a string.
    • setNativeJson

      public void setNativeJson(String json)
      Description copied from interface: PivotTable
      Set additional JSON configuration as a string. This JSON can override configuration loaded from XML and from Component API.
      Specified by:
      setNativeJson in interface PivotTable
      Parameters:
      json - additional JSON configuration
    • getEmptyDataMessage

      public String getEmptyDataMessage()
      Specified by:
      getEmptyDataMessage in interface PivotTable
      Returns:
      the message that will be displayed in case of empty data
    • setEmptyDataMessage

      public void setEmptyDataMessage(String emptyDataMessage)
      Description copied from interface: PivotTable
      Sets the message that will be displayed in case of empty data.
      Specified by:
      setEmptyDataMessage in interface PivotTable
      Parameters:
      emptyDataMessage - the message that will be displayed in case of empty data
    • addRefreshListener

      public Subscription addRefreshListener(Consumer<PivotTable.RefreshEvent> refreshListener)
      Description copied from interface: PivotTable
      Adds a listener to the pivot table refresh events. Fired only for editable PivotTable.
      Specified by:
      addRefreshListener in interface PivotTable
      Parameters:
      refreshListener - a listener to add
      Returns:
      subscription
    • onRefresh

      protected void onRefresh(RefreshEvent e)
    • addCellClickListener

      public Subscription addCellClickListener(Consumer<PivotTable.CellClickEvent> listener)
      Description copied from interface: PivotTable
      Adds a listener to the pivot table cell click events. Fired only for table renderers (table, heatmap, table barchart, col heatmap, row heatmap).
      Specified by:
      addCellClickListener in interface PivotTable
      Parameters:
      listener - a listener to add
      Returns:
      subscription
    • onCellClick

      protected void onCellClick(CellClickEvent e)
    • setShowUI

      public void setShowUI(Boolean showUI)
      Description copied from interface: PivotTable
      Hides or shows UI elements in the editable pivot table. true by default.
      Applies only when editable=true.
      Specified by:
      setShowUI in interface PivotTable
      Parameters:
      showUI - true if UI elements should be shown and false otherwise
    • isShowUI

      public Boolean isShowUI()
      Specified by:
      isShowUI in interface PivotTable
      Returns:
      true if pivotUI() should be shown and false otherwise
    • setShowRowTotals

      public void setShowRowTotals(Boolean showRowTotals)
      Description copied from interface: PivotTable
      Set false if row totals shouldn't be shown and true otherwise. Works only for table renderers. true by default.
      Specified by:
      setShowRowTotals in interface PivotTable
      Parameters:
      showRowTotals - false if row totals shouldn't be shown and true otherwise
    • isRowTotalsShown

      public Boolean isRowTotalsShown()
      Specified by:
      isRowTotalsShown in interface PivotTable
      Returns:
      false if row totals shouldn't be shown and true otherwise
    • setShowColTotals

      public void setShowColTotals(Boolean showColTotals)
      Description copied from interface: PivotTable
      Set false if col totals shouldn't be shown and true otherwise. Works only for table renderers. true by default.
      Specified by:
      setShowColTotals in interface PivotTable
      Parameters:
      showColTotals - false if col totals shouldn't be shown and true otherwise
    • isColTotalsShown

      public Boolean isColTotalsShown()
      Specified by:
      isColTotalsShown in interface PivotTable
      Returns:
      false if col totals shouldn't be shown and true otherwise