Class JmixPivotTable<T>

java.lang.Object
com.vaadin.flow.component.Component
io.jmix.pivottableflowui.kit.component.JmixPivotTable<T>
Type Parameters:
T - type of items contained
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable
Direct Known Subclasses:
PivotTable

@Tag("jmix-pivot-table") @JsModule("./src/pivot-table/jmix-pivot-table.js") public class JmixPivotTable<T> extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize
Base component for implementing pivot table.
See Also:
  • Field Details

    • DATA_ITEM_ID_PROPERTY_NAME

      protected static final String DATA_ITEM_ID_PROPERTY_NAME
      See Also:
    • jmixPivotTableItems

      protected JmixPivotTableItems<T> jmixPivotTableItems
    • jmixPivotTableItemsChangeRegistration

      protected com.vaadin.flow.shared.Registration jmixPivotTableItemsChangeRegistration
    • options

      protected PivotTableOptions options
    • serializer

      protected JmixPivotTableSerializer serializer
    • clientReady

      protected volatile boolean clientReady
    • functions

      protected final List<JmixPivotTable.PendingJsFunction> functions
    • synchronizeOptionsExecution

      protected com.vaadin.flow.internal.StateTree.ExecutionRegistration synchronizeOptionsExecution
    • synchronizeItemsExecution

      protected com.vaadin.flow.internal.StateTree.ExecutionRegistration synchronizeItemsExecution
  • Constructor Details

    • JmixPivotTable

      public JmixPivotTable()
  • Method Details

    • getItems

      public JmixPivotTableItems<T> getItems()
    • addRefreshEventListener

      public com.vaadin.flow.shared.Registration addRefreshEventListener(com.vaadin.flow.component.ComponentEventListener<PivotTableRefreshEvent> listener)
      Adds a listener to the pivot table refresh events. Fired only for editable PivotTable.
      Parameters:
      listener - a listener to add
      Returns:
      subscription
    • addCellClickListener

      public com.vaadin.flow.shared.Registration addCellClickListener(com.vaadin.flow.component.ComponentEventListener<PivotTableCellClickEvent<T>> listener)
      Adds a listener to the pivot table cell click events. Fired only for table renderers (table, heatmap, table barchart, col heatmap, row heatmap).
      Parameters:
      listener - a listener to add
      Returns:
      subscription
    • getProperties

      public Map<String,String> getProperties()
      Returns:
      map of properties and their localized values
    • setProperties

      public void setProperties(Map<String,String> properties)
      Sets properties and their localized values
      Parameters:
      properties - map with properties and their localized values
    • addProperties

      public void addProperties(Map<String,String> properties)
      Adds properties and their localized values
      Parameters:
      properties - map with properties and their localized values
    • addProperty

      public void addProperty(String property, String value)
      Adds property and its localized value
      Parameters:
      property - property name
      value - property localized value
    • getRows

      public List<String> getRows()
      Returns:
      a collection of attribute names to use as rows
    • setRows

      public void setRows(List<String> rows)
      Sets a collection of attribute names to use as rows.
      Parameters:
      rows - a collection of attribute names to use as rows
    • addRows

      public void addRows(String... rows)
      Adds an array of attribute names to use as rows.
      Parameters:
      rows - an array of attribute names to add
    • getColumns

      public List<String> getColumns()
      Returns:
      a collection of attribute names to use as cols
    • setColumns

      public void setColumns(List<String> columns)
      Sets a collection of attribute names to use as cols.
      Parameters:
      columns - a collection of attribute names to use as cols
    • addColumns

      public void addColumns(String... columns)
      Adds an array of attribute names to use as cols.
      Parameters:
      columns - an array of attribute names to add
    • getAggregation

      public Aggregation getAggregation()
      Returns:
      an object which will aggregate results per cell
    • setAggregation

      public void setAggregation(Aggregation aggregation)
      Original property name: aggregator.

      Sets a descriptor of an object which will aggregate results per cell (see documentation).

      Applies only when this.isShowUI() == false.

      Parameters:
      aggregation - an object which will aggregate results per cell
    • getRenderer

      public Renderer getRenderer()
      Returns:
      an object which will generate output from pivot data structure
    • setRenderer

      public void setRenderer(Renderer renderer)
      Sets a descriptor of an object which will generate output from pivot data structure (see documentation).

      Applies only when this.isShowUI() == false.

      Parameters:
      renderer - an object which will generate output from pivot data structure
    • getAggregationProperties

      public List<String> getAggregationProperties()
      Returns:
      attribute names to prepopulate in vals area
    • setAggregationProperties

      public void setAggregationProperties(List<String> aggregationProperties)
      Original property name: vals.

      Sets attribute names to prepopulate in vals area (gets passed to aggregator generating function).

      Applies only when this.isShowUI() == true.

      Parameters:
      aggregationProperties - attribute names to prepopulate in vals area
    • addAggregationProperties

      public void addAggregationProperties(String... aggregationProperties)
      Original property name: vals.

      Adds attribute names to prepopulate in vals area (gets passed to aggregator generating function).

      Applies only when this.isShowUI() == true.

      Parameters:
      aggregationProperties - attribute names to prepopulate in vals area
    • getAggregations

      public Aggregations getAggregations()
      Returns:
      an object that represents a list of generators for aggregation functions in dropdown
    • setAggregations

      public void setAggregations(Aggregations aggregations)
      Original property name: aggregators.

      Sets an object that represents a list of generators for aggregation functions in dropdown (see documentation).

      Applies only when this.isShowUI() == true.

      Parameters:
      aggregations - an object that represents a list of generators for aggregation functions in dropdown
    • getRenderers

      public Renderers getRenderers()
      Returns:
      n object that represents a list of rendering functions
    • setRenderers

      public void setRenderers(Renderers renderers)
      Sets an object that represents a list of rendering functions (see documentation).

      Applies only when this.isShowUI() == true.

      Parameters:
      renderers - n object that represents a list of rendering functions
    • getHiddenProperties

      public List<String> getHiddenProperties()
      Returns:
      attribute names to omit from the UI
    • setHiddenProperties

      public void setHiddenProperties(List<String> hiddenProperties)
      Sets attribute names to omit from the UI.

      Applies only when this.isShowUI() == true.

      Parameters:
      hiddenProperties - attribute names to omit from the UI
    • addHiddenProperties

      public void addHiddenProperties(String... hiddenProperties)
      Adds attribute names to omit from the UI.

      Applies only when this.isShowUI() == true.

      Parameters:
      hiddenProperties - attribute names to omit from the UI
    • getHiddenFromAggregations

      public List<String> getHiddenFromAggregations()
      Returns:
      attribute names to omit from the aggregation arguments dropdowns
    • setHiddenFromAggregations

      public void setHiddenFromAggregations(List<String> hiddenFromAggregations)
      Sets attribute names to omit from the aggregation arguments dropdowns.

      Applies only when this.isShowUI() == true.

      Parameters:
      hiddenFromAggregations - attribute names to omit from the aggregation arguments dropdowns
    • addHiddenFromAggregations

      public void addHiddenFromAggregations(String... hiddenFromAggregations)
      Adds attribute names to omit from the aggregation arguments dropdowns.

      Applies only when this.isShowUI() == true.

      Parameters:
      hiddenFromAggregations - attribute names to omit from the aggregation arguments dropdowns
    • getHiddenFromDragDrop

      public List<String> getHiddenFromDragDrop()
      Returns:
      attribute names to omit from the drag'n'drop portion of the UI
    • setHiddenFromDragDrop

      public void setHiddenFromDragDrop(List<String> hiddenFromDragDrop)
      Sets attribute names to omit from the drag'n'drop portion of the UI.

      Applies only when this.isShowUI() == true.

      Parameters:
      hiddenFromDragDrop - attribute names to omit from the drag'n'drop portion of the UI
    • addHiddenFromDragDrop

      public void addHiddenFromDragDrop(String... hiddenFromDragDrop)
      Adds attribute names to omit from the drag'n'drop portion of the UI.

      Applies only when this.isShowUI() == true.

      Parameters:
      hiddenFromDragDrop - attribute names to omit from the drag'n'drop portion of the UI
    • getColumnOrder

      public Order getColumnOrder()
      Returns:
      the order in which column data is provided to the renderer
    • setColumnOrder

      public void setColumnOrder(Order columnOrder)
      Sets the order in which column data is provided to the renderer.

      Ordering by value orders by column total.

      Parameters:
      columnOrder - the order in which column data is provided to the renderer
    • getRowOrder

      public Order getRowOrder()
      Returns:
      the order in which row data is provided to the renderer
    • setRowOrder

      public void setRowOrder(Order rowOrder)
      Sets the order in which row data is provided to the renderer.

      Ordering by value orders by row total.

      Parameters:
      rowOrder - the order in which row data is provided to the renderer
    • getMenuLimit

      public Integer getMenuLimit()
      Returns:
      the maximum number of values to list in the attribute values dialog
    • setMenuLimit

      public void setMenuLimit(Integer menuLimit)
      Sets the maximum number of values to list in the attribute values dialog

      Applies only when this.isShowUI() == true.

      Parameters:
      menuLimit - the maximum number of values to list in the attribute values dialog
    • getAutoSortUnusedProperties

      public Boolean getAutoSortUnusedProperties()
      Returns:
      whether or not unused attributes are kept sorted in the UI
    • setAutoSortUnusedProperties

      public void setAutoSortUnusedProperties(Boolean autoSortUnusedProperties)
      Original property name: autoSortUnusedAttrs.

      Sets whether or not unused attributes are kept sorted in the UI.

      Applies only when this.isShowUI() == true.

      Parameters:
      autoSortUnusedProperties - whether or not unused attributes are kept sorted in the UI
    • getUnusedPropertiesVertical

      public UnusedPropertiesVertical getUnusedPropertiesVertical()
      Returns:
      whether or not unused attributes are shown vertically
    • setUnusedPropertiesVertical

      public void setUnusedPropertiesVertical(UnusedPropertiesVertical unusedPropertiesVertical)
      Original property name: unusedAttrsVertical.

      Sets whether or not unused attributes 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 attributes' names' combined length in characters exceeds the number then the attributes will be shown vertically.

      Applies only when this.isShowUI() == true.

      Parameters:
      unusedPropertiesVertical - whether or not unused attributes are shown vertically
    • getFilterFunction

      public JsFunction getFilterFunction()
      Returns:
      a filter function that is called on each record
    • setFilterFunction

      public void setFilterFunction(JsFunction filter)
      Original property name: filter.

      Sets a filter function that is called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise.

      Parameters:
      filter - a filter function that is called on each record
    • getSortersFunction

      public JsFunction getSortersFunction()
      Returns:
      a sorter function
    • setSortersFunction

      public void setSortersFunction(JsFunction sorters)
      Original property name: sorters.

      Sets a sorter function that is called with an attribute 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.

      Parameters:
      sorters - a sorter function
    • getRendererOptions

      public RendererOptions getRendererOptions()
      Returns:
      an object that is passed through to renderer as options
    • setRendererOptions

      public void setRendererOptions(RendererOptions rendererOptions)
      Sets an object that is passed through to renderer as options.
      Parameters:
      rendererOptions - an object that is passed through to renderer as options
    • getInclusions

      public Map<String,List<String>> getInclusions()
      Returns:
      a map whose keys are attribute names and values are arrays of attribute values
      See Also:
    • setInclusions

      public void setInclusions(Map<String,List<String>> inclusions)
      Sets a map whose keys are attribute names and values are arrays of attribute values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides getExclusions()).

      Applies only when this.isShowUI() == true.

      Parameters:
      inclusions - a map whose keys are attribute names and values are arrays of attribute values
      See Also:
    • setInclusions

      public void setInclusions(String property, List<String> inclusions)
      Sets a list whose values are arrays of attribute values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides getExclusions()).

      Applies only when this.isShowUI() == true.

      Parameters:
      property - a property for which set inclusions
      inclusions - a list of property values
      See Also:
    • addInclusions

      public void addInclusions(String property, String... inclusions)
      Adds property values to a given property which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides getExclusions()).

      Applies only when this.isShowUI() == true.

      Parameters:
      property - a property for which set inclusions
      inclusions - an array of property values
      See Also:
    • getExclusions

      public Map<String,List<String>> getExclusions()
      Returns:
      a map whose keys are attribute names and values are arrays of attribute values
    • setExclusions

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

      Applies only when this.isShowUI() == true.

      Parameters:
      exclusions - a map whose keys are attribute names and values are arrays of attribute values
      See Also:
    • setExclusions

      public void setExclusions(String property, List<String> exclusions)
      Sets a list whose values are arrays of attribute values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click.

      Applies only when this.isShowUI() == true.

      Parameters:
      property - a property for which set exclusions
      exclusions - a map whose keys are attribute names and values are arrays of attribute values
      See Also:
    • addExclusions

      public void addExclusions(String property, String... exclusions)
      Adds property values to a given property which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click.

      Applies only when this.isShowUI() == true.

      Parameters:
      property - a property for which set exclusions
      exclusions - a map whose keys are attribute names and values are arrays of attribute values
      See Also:
    • getDerivedProperties

      public DerivedProperties getDerivedProperties()
      Returns:
      an object that represents derived properties
    • setDerivedProperties

      public void setDerivedProperties(DerivedProperties derivedProperties)
      Original property name: derivedAttributes.

      Sets an object that represents derived properties (see documentation).

      Parameters:
      derivedProperties - an object that represents derived properties
    • setEmptyDataMessage

      public void setEmptyDataMessage(String emptyDataMessage)
      Sets the message that will be displayed in case of empty data.
      Parameters:
      emptyDataMessage - the message that will be displayed in case of empty data
    • getEmptyDataMessage

      public String getEmptyDataMessage()
      Returns:
      the message that will be displayed in case of empty data
    • setShowUI

      public void setShowUI(Boolean showUI)
      Show pivot table in the UI mode.
      Parameters:
      showUI - true if pivot table UI is shown, false if not.
    • isShowUI

      public Boolean isShowUI()
      Returns:
      true if pivot table UI is shown, false if not.
    • setShowRowTotals

      public void setShowRowTotals(Boolean showRowTotals)
      Shows an additional column of totals for each row
      Parameters:
      showRowTotals - true if row totals are shown, false if not.
    • isShowRowTotals

      public Boolean isShowRowTotals()
      Returns:
      true if row totals are shown, false if not.
    • setShowColumnTotals

      public void setShowColumnTotals(Boolean showColumnTotals)
      Shows an additional column of totals for each col
      Parameters:
      showColumnTotals - true if col totals are shown, false if not.
    • isShowColumnTotals

      public Boolean isShowColumnTotals()
      Returns:
      true if col totals are shown, false if not.
    • setItems

      public void setItems(JmixPivotTableItems<T> items)
      Sets the JmixPivotTableItems instance to use as data provider.
      Parameters:
      items - the JmixPivotTableItems instance to use
    • initComponent

      protected void initComponent()
    • createOptions

      protected PivotTableOptions createOptions()
    • createSerializer

      protected JmixPivotTableSerializer createSerializer()
    • initComponentListeners

      protected void initComponentListeners()
    • onOptionsChange

      protected void onOptionsChange(PivotTableOptionsObservable.ObjectChangeEvent event)
    • onRefresh

      protected void onRefresh(PivotTableRefreshEvent event)
    • updateOptionsAfterRefresh

      protected void updateOptionsAfterRefresh(PivotTableRefreshEventDetail detail)
    • requestUpdateOptions

      protected void requestUpdateOptions()
    • requestUpdateItems

      protected void requestUpdateItems()
    • performUpdateOptions

      protected void performUpdateOptions(com.vaadin.flow.internal.ExecutionContext context)
    • performUpdateItems

      protected void performUpdateItems(com.vaadin.flow.internal.ExecutionContext context)
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • ready

      @ClientCallable protected void ready()
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • callPendingJsFunction

      protected void callPendingJsFunction(String function, elemental.json.JsonObject resultJson)
      Execute JavaScript function with the resultJson passed. Execution will be delayed till the client-side is ready.
      Parameters:
      function - JavaScript function to execute
      resultJson - resultJson
    • callJsFunction

      protected void callJsFunction(String function, elemental.json.JsonObject resultJson)