Interface Table.Column<E>

Type Parameters:
E - row item type
All Superinterfaces:
Component.HasCaption, Component.HasDescription, Component.HasXmlDescriptor, HasFormatter, HasHtmlCaption
All Known Subinterfaces:
GroupTable.GroupColumn<E>
All Known Implementing Classes:
AbstractTable.ColumnImpl, GroupTableImpl.GroupColumnImpl
Enclosing interface:
Table<E>

public static interface Table.Column<E> extends Component.HasXmlDescriptor, HasHtmlCaption, HasFormatter
Table column.

Use Table.addColumn(Object) and Table.addColumn(Object, int) methods to create and add column to the Table.

  • Method Details

    • getId

      Object getId()
      Returns a column identifier. It could be a String or an instance of MetaPropertyPath.
      Returns:
      id of a column
    • getStringId

      String getStringId()
      Returns a column identifier as a String. If the id is an instance of MetaPropertyPath, then the MetaPropertyPath.toPathString() will be returned.
      Returns:
      a column identifier as a string
    • getMetaPropertyPath

      @Nullable MetaPropertyPath getMetaPropertyPath()
      Returns:
      the instance of MetaPropertyPath representing a relative path to a property from certain MetaClass or null
    • getMetaPropertyPathNN

      MetaPropertyPath getMetaPropertyPathNN()
      Returns:
      the instance of MetaPropertyPath representing a relative path to a property from certain MetaClass
    • getOwner

      @Nullable Table<E> getOwner()
      Returns:
      the Table this column belongs to
    • setOwner

      void setOwner(@Nullable Table<E> owner)
      Parameters:
      owner - the Table this column belongs to
    • setColumnGenerator

      default void setColumnGenerator(Function<E,Component> columnGenerator)
      Intended to install instance from screen controller. For instance:
            @Install(to = "filesTable.content", subject = "columnGenerator")
            private Object filesTableContentColumnGenerator(DataGrid.ColumnGeneratorEvent<File> event) {
                LinkButton linkButton = uiComponents.create(LinkButton.class);
                linkButton.setCaption("Open content screen");
                linkButton.addClickListener(this::onLinkClickListener);
                return linkButton;
            }
       
      Parameters:
      columnGenerator - column generator instance
    • getValueProvider

      @Nullable Function<E,Object> getValueProvider()
      Returns:
      a value provider or null
    • setValueProvider

      void setValueProvider(@Nullable Function<E,Object> valueProvider)
      Sets value provider for the column. Value provider can be called 0 or more times depending on visibility of a cell and value type. Return type must be the same as type of the column.
      Parameters:
      valueProvider - a callback interface for providing column values from a given source
    • getValueDescription

      @Nullable String getValueDescription()
      Returns:
      a hint which is displayed in a popup when a user hovers the mouse cursor on the aggregated value
    • setValueDescription

      void setValueDescription(@Nullable String valueDescription)
      Defines a hint which is displayed in a popup when a user hovers the mouse cursor on the aggregated value. For the operations listed above (SUM, AVG, COUNT, MIN, MAX), popup hints are already available by default.
      Parameters:
      valueDescription - a hint
      See Also:
    • isEditable

      boolean isEditable()
      Returns whether editing is allowed for the corresponding column in the table.
      Returns:
      whether editing is allowed for the corresponding column in the table
    • setEditable

      @StudioProperty(defaultValue="false") void setEditable(boolean editable)
      Sets whether editing is allowed for the corresponding column in the table. NOTE: changing this property at runtime is not supported.
      Parameters:
      editable - whether editing is allowed for the corresponding column in the table
    • getAlignment

      @Nullable Table.ColumnAlignment getAlignment()
      Returns:
      a text alignment of column cells
    • setAlignment

      @StudioProperty(name="align", type=ENUMERATION, defaultValue="LEFT", options={"LEFT","CENTER","RIGHT"}) void setAlignment(@Nullable Table.ColumnAlignment alignment)
      Sets a text alignment of column cells. The default alignment is Table.ColumnAlignment.LEFT.
      Parameters:
      alignment - a text alignment of column cells
    • getWidth

      @Nullable Integer getWidth()
      Returns default column width. May contain only numeric values in pixels.
      Returns:
      default column width
    • setWidth

      @StudioProperty(defaultValue="0") @PositiveOrZero void setWidth(@Nullable Integer width)
      Sets default column width. May contain only numeric values in pixels.
      Parameters:
      width - default column width
    • isCollapsed

      boolean isCollapsed()
      Returns:
      true if the column is currently hidden, false otherwise
    • setCollapsed

      @StudioProperty(defaultValue="false") void setCollapsed(boolean collapsed)
      Hides or shows the column. By default columns are visible before explicitly hiding them.
      Parameters:
      collapsed - true to hide the column, false to show
    • isSortable

      boolean isSortable()
      Returns whether the user can sort the data by this column.
      Returns:
      true if the column is sortable by the user, false otherwise
    • setSortable

      @StudioProperty(defaultValue="true") void setSortable(boolean sortable)
      Sets whether this column is sortable by the user. The Table can be sorted by a sortable column by clicking or tapping the column's default header.
      Parameters:
      sortable - true if the user should be able to sort the column, false otherwise
      See Also:
    • getMaxTextLength

      @Nullable Integer getMaxTextLength()
      Returns:
      the maximum number of characters in a cell
    • setMaxTextLength

      @StudioProperty(defaultValue="0") void setMaxTextLength(@Nullable Integer maxTextLength)
      Limits the number of characters in a cell. If the difference between the actual and the maximum allowed number of characters does not exceed the 10 character threshold, the extra characters remain unhidden. To see the entire record, users need to click on its visible part.
      Parameters:
      maxTextLength - the maximum number of characters in a cell
      See Also:
    • getAggregation

      @Nullable AggregationInfo getAggregation()
      Returns:
      an aggregation info
    • setAggregation

      void setAggregation(@Nullable AggregationInfo aggregation)
      Sets an aggregation info in order to perform aggregation for this column.
      Parameters:
      aggregation - aggregation info
    • isAggregationEditable

      boolean isAggregationEditable()
      When the aggregation is editable in conjunction with using the Table.setAggregationDistributionProvider(AggregationDistributionProvider) method, this allows users to implement algorithms for distributing data between table rows.
      Returns:
      whether aggregation info is editable
    • setExpandRatio

      @StudioProperty(name="expandRatio", defaultValue="-1.0") void setExpandRatio(float ratio)
      Sets the ratio with which the column expands. The default value is -1.

      By default (without expand ratios) the excess space is divided proportionally to columns natural widths.

      Parameters:
      ratio - the expand ratio of this column. 0 to not have it expand at all. A negative number to clear the expand value.
    • getExpandRatio

      float getExpandRatio()
      Returns:
      the ratio with which the column expands
    • addClickListener

      Subscription addClickListener(Consumer<Table.Column.ClickEvent<E>> listener)
      Adds a click listener for column.
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener