Class PivotScreenBuilder

java.lang.Object
io.jmix.pivottable.action.list.PivotScreenBuilder

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

  • Constructor Details

    • PivotScreenBuilder

      public PivotScreenBuilder(ListComponent target)
  • Method Details

    • setMetadata

      @Autowired protected void setMetadata(Metadata metadata)
    • setFetchPlanRepository

      @Autowired protected void setFetchPlanRepository(FetchPlanRepository fetchPlanRepository)
    • setMessages

      @Autowired protected void setMessages(Messages messages)
    • setAccessManager

      @Autowired protected 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 PivotScreenBuilder 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 ShowPivotAction.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 PivotScreenBuilder withExcludedProperties(List<String> excludedProperties)
      Set excluded properties list using fluent API method.
      Note, if it is used without ShowPivotAction.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 PivotScreenBuilder 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
    • getNativeJson

      public String getNativeJson()
      Returns:
      configuration json of pivot table
    • withNativeJson

      public PivotScreenBuilder withNativeJson(String nativeJson)
      Set native json using fluent API method. Using native json you can configure pivot table with initial values. For instance, for non-editable pivot table:
       
       {
       	"cols": ["localized property", "localized property"],
       	"rows": ["localized property"],
       	"editable": false,
       	"renderer": "heatmap",
       	"aggregation": {
       		"id": "d8fc3fdf-730d-c94f-a0c8-72a9ce3dcb3a",
       		"mode": "sumOverSum",
       		"properties": ["localized property", "localized property"]
          }
       }
       
       
      for editable pivot table:
       
       {
       	"cols": ["localized property"],
       	"rows": ["localized property"],
       	"editable": true,
       	"renderers": {
       		"selectedRenderer": "barChart"
          },
       	"autoSortUnusedProperties": true,
       	"aggregationProperties": ["localized property", "localized property"],
       	"aggregations": {
       		"selectedAggregation": "count",
       		"aggregations": [{
       			"id": "647780f0-c6d0-6ade-a63a-542b5c8cdbd5",
       			"mode": "count",
       			"caption": "Count"
              }, {
       			"id": "c2663238-2654-67f0-2dec-add6962d867c",
       			"mode": "sumOverSum"
              }]
          }
       }
       
       
      Parameters:
      nativeJson - configuration json of pivot table
      Returns:
      current instance of action
    • withItems

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

      public Screen build()
      Returns:
      created screen
    • 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

      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

      protected MetaClass getPropertyMetaClass(MetaProperty metaProperty)