Class PivotTableViewBuilder

java.lang.Object
io.jmix.pivottableflowui.action.PivotTableViewBuilder

@Component("pvttbl_PivotTableViewBuilder") @Scope("prototype") public class PivotTableViewBuilder extends Object
Prepares data and builds a view with pivot table component.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • setViewNavigators

      @Autowired public void setViewNavigators(ViewNavigators viewNavigators)
    • setMetadata

      @Autowired public void setMetadata(Metadata metadata)
    • setFetchPlanRepository

      @Autowired public void setFetchPlanRepository(FetchPlanRepository fetchPlanRepository)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setAccessManager

      @Autowired public void setAccessManager(AccessManager accessManager)
    • setMetadataTools

      @Autowired public void setMetadataTools(MetadataTools metadataTools)
    • setMessageTools

      @Autowired public void setMessageTools(MessageTools messageTools)
    • getIncludedProperties

      public List<String> getIncludedProperties()
      Returns:
      list of included properties
    • withIncludedProperties

      public PivotTableViewBuilder withIncludedProperties(List<String> includedProperties)
      Set included properties list using fluent API method. If included properties aren't set, all properties in the fetch plan will be shown, otherwise only included properties will be shown in the pivot table unless ShowPivotTableAction.setExcludedProperties(String) is not set.
      Parameters:
      includedProperties - list of included properties
      Returns:
      current instance of action
    • getExcludedProperties

      public List<String> getExcludedProperties()
      Returns:
      list of excluded properties
    • withExcludedProperties

      public PivotTableViewBuilder withExcludedProperties(List<String> excludedProperties)
      Set excluded properties list using fluent API method.
      Note, if it is used without ShowPivotTableAction.setExcludedProperties(String), excluded properties will be applied for all properties in the fetch plan.
      Parameters:
      excludedProperties - list of excluded properties
      Returns:
      current instance
    • withAdditionalProperties

      public PivotTableViewBuilder withAdditionalProperties(List<String> additionalProperties)
      Set properties which should be additionally included. Additional property doesn't applied if excluded properties list contains it.
      Parameters:
      additionalProperties - list of additional properties
      Returns:
      current instance of action
    • getAdditionalProperties

      public List<String> getAdditionalProperties()
      Returns:
      list of additionally included properties
    • withItems

      public PivotTableViewBuilder withItems(Collection<?> items)
      Sets items that should be shown in PivotTable.
      Parameters:
      items - collection of entities
      Returns:
      current instance
    • withRows

      public PivotTableViewBuilder withRows(List<String> rows)
      Sets a collection of attribute names to use as rows.
      Parameters:
      rows - a collection of attribute names to use as rows
    • withColumns

      public PivotTableViewBuilder withColumns(List<String> columns)
      Sets a collection of attribute names to use as columns.
      Parameters:
      columns - a collection of attribute names to use as columns
    • withAggregation

      public PivotTableViewBuilder withAggregation(Aggregation aggregation)
      Original property name: aggregator.

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

      Applies only when showUI=false.

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

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

      Applies only when showUI=false.

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

      public PivotTableViewBuilder withAggregationProperties(List<String> aggregationProperties)
      Original property name: vals.

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

      Applies only when showUI=true.

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

      public PivotTableViewBuilder withAggregations(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 showUI=true.

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

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

      Applies only when showUI=true.

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

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

      Applies only when showUI=true.

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

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

      Applies only when showUI=true.

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

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

      Applies only when showUI=true.

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

      public PivotTableViewBuilder withColumnOrder(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
    • withRowOrder

      public PivotTableViewBuilder withRowOrder(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
    • withMenuLimit

      public PivotTableViewBuilder withMenuLimit(Integer menuLimit)
      Sets the maximum number of values to list in the double click menu.

      Applies only when showUI=true.

      Parameters:
      menuLimit - the maximum number of values to list in the double click menu
    • withAutoSortUnusedProperties

      public PivotTableViewBuilder withAutoSortUnusedProperties(Boolean autoSortUnusedProperties)
      Original property name: autoSortUnusedAttrs.

      Sets whether unused attributes are kept sorted in the UI.

      Applies only when showUI=true.

      Parameters:
      autoSortUnusedProperties - whether unused attributes are kept sorted in the UI
    • withUnusedPropertiesVertical

      public PivotTableViewBuilder withUnusedPropertiesVertical(UnusedPropertiesVertical unusedPropertiesVertical)
      Original property name: unusedAttrsVertical.

      Sets whether 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 showUI=true.

      Parameters:
      unusedPropertiesVertical - whether unused attributes are shown vertically
    • withFilterFunction

      public PivotTableViewBuilder withFilterFunction(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
    • withSortersFunction

      public PivotTableViewBuilder withSortersFunction(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
    • withRendererOptions

      public PivotTableViewBuilder withRendererOptions(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
    • withInclusions

      public PivotTableViewBuilder withInclusions(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 withExclusions(Map)).

      Applies only when showUI=true.

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

      public PivotTableViewBuilder withExclusions(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 showUI=true.

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

      public PivotTableViewBuilder withDerivedProperties(DerivedProperties derivedProperties)
      Original property name: derivedAttributes.

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

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

      public PivotTableViewBuilder withEmptyDataMessage(String emptyDataMessage)
      If component doesn't have data to aggregate, the message will be displayed
      Parameters:
      emptyDataMessage - string with an empty data message
    • withShowUI

      public PivotTableViewBuilder withShowUI(Boolean showUI)
      Shows or hides UI.
      Parameters:
      showUI - show UI option
    • withShowRowTotals

      public PivotTableViewBuilder withShowRowTotals(Boolean showRowTotals)
      Shows or hides row totals. true by default.
      Parameters:
      showRowTotals - row totals option
    • withShowColumnTotals

      public PivotTableViewBuilder withShowColumnTotals(Boolean showColumnTotals)
      Shows or hides col totals. true by default.
      Parameters:
      showColumnTotals - column total options
    • show

      public void show()
      Navigate to PivotTableView and show PivotTable component with the set parameters
    • getPropertiesWithLocale

      protected Map<String,String> getPropertiesWithLocale()
    • isManagedProperty

      protected boolean isManagedProperty(MetaProperty metaProperty, MetaClass metaClass)
    • isPermitted

      protected boolean isPermitted(MetaClass metaClass, MetaProperty metaProperty)
    • isByteArray

      protected boolean isByteArray(MetaProperty metaProperty)
    • isUuid

      protected boolean isUuid(MetaProperty metaProperty)
    • getPropertiesFromView

      protected List<String> getPropertiesFromView(MetaClass metaClass, FetchPlan fetchPlan)
    • getBaseFetchPlan

      protected FetchPlan getBaseFetchPlan(MetaClass metaClass)
    • getEmbeddedIdProperties

      protected List<String> getEmbeddedIdProperties(MetaClass metaClass)
    • hasEmbeddedId

      protected boolean hasEmbeddedId(MetaClass metaClass)
    • getEmbeddedIdMetaClass

      @Nullable protected MetaClass getEmbeddedIdMetaClass(MetaClass metaClass)
    • removeNonExistingProperties

      protected List<String> removeNonExistingProperties(List<String> properties, MetaClass metaClass, FetchPlan fetchPlan)
    • isIdProperty

      protected boolean isIdProperty(String property, MetaClass metaClass)
      Checks if current MetaClass contains given id property.
      Parameters:
      property - property to check
      metaClass - metaClass
      Returns:
      true if MetaClass contains given id property
    • isEmbeddedIdProperty

      protected boolean isEmbeddedIdProperty(String property, MetaClass metaClass)
    • getPropertyMetaClass

      @Nullable protected MetaClass getPropertyMetaClass(MetaProperty metaProperty)
    • getPivotTableOptions

      protected PivotTableOptions getPivotTableOptions()