Class TwinColumn<T>

java.lang.Object
com.flowingcode.vaadin.addons.twincolgrid.TwinColumn<T>
Direct Known Subclasses:
FilterableTwinColumn

public class TwinColumn<T> extends Object
Fluent helper object that delegates setters on both columns.
  • Constructor Details

    • TwinColumn

      public TwinColumn()
  • Method Details

    • setWidth

      public TwinColumn<T> setWidth(String width)
      Sets the width of the columns as a CSS-string.
      Parameters:
      width - the width to set both columns to, as a CSS-string, not null
      Returns:
      this instance, for method chaining
      See Also:
    • setFlexGrow

      public TwinColumn<T> setFlexGrow(int flexGrow)
      Sets the flex grow ratio for the columns. When set to 0, column width is fixed.
      Parameters:
      flexGrow - the flex grow ratio
      Returns:
      this instance, for method chaining
      See Also:
    • setAutoWidth

      public TwinColumn<T> setAutoWidth(boolean autoWidth)
      Enables or disables automatic width for the columns.
      Parameters:
      autoWidth - whether to enable or disable automatic width on both columns
      Returns:
      this instance, for method chaining
      See Also:
    • setKey

      public TwinColumn<T> setKey(String key)
      Sets the user-defined identifier to map the columns.
      Parameters:
      key - the identifier key, can't be null
      Returns:
      this instance, for method chaining
      See Also:
    • setComparator

      public TwinColumn<T> setComparator(Comparator<T> comparator)
      Sets a comparator to use with in-memory sorting with both columns.
      Parameters:
      comparator - the comparator to use when sorting data in both columns
      Returns:
      this instance, for method chaining
      See Also:
    • setComparator

      public <V extends Comparable<? super V>> TwinColumn<T> setComparator(ValueProvider<T,V> keyExtractor)
      Sets a comparator to use with in-memory sorting with both columns based on the return type of the given ValueProvider.
      Type Parameters:
      V - the value of the column
      Parameters:
      keyExtractor - the value provider used to extract the Comparable sort key
      Returns:
      this instance, for method chaining
      See Also:
    • setSortProperty

      public TwinColumn<T> setSortProperty(String... properties)
      Sets strings describing back end properties to be used when sorting the columns.
      Parameters:
      properties - the array of strings describing backend properties
      Returns:
      this instance, for method chaining
      See Also:
    • setSortOrderProvider

      public TwinColumn<T> setSortOrderProvider(SortOrderProvider provider)
      Sets the sort orders when sorting the columns. The sort order provider is a function which provides QuerySortOrder objects to describe how to sort by the columns.
      Parameters:
      provider - the function to use when generating sort orders with the given direction
      Returns:
      this instance, for method chaining
      See Also:
    • setSortable

      public TwinColumn<T> setSortable(boolean sortable)
      Sets whether the user can sort the columns or not.
      Parameters:
      sortable - true if the columns can be sorted by the user; false if not
      Returns:
      this instance, for method chaining
      See Also:
    • setHeader

      public TwinColumn<T> setHeader(String labelText)
      Sets a header text to both columns.
      Parameters:
      labelText - the text to be shown at the columns headers
      Returns:
      this instance, for method chaining
      See Also:
    • setFooter

      public TwinColumn<T> setFooter(String labelText)
      Sets a footer text to both columns.
      Parameters:
      labelText - the text to be shown at the columns footers
      Returns:
      this instance, for method chaining
      See Also:
    • setHeader

      public TwinColumn<T> setHeader(Supplier<Component> headerComponentSupplier)
      Sets a header component to both columns.
      Parameters:
      headerComponentSupplier - a supplier that instantiates the component to be used in the header of each column
      Returns:
      this instance, for method chaining
      See Also:
    • setFooter

      public TwinColumn<T> setFooter(Supplier<Component> footerComponentSupplier)
      Sets a footer component to both columns.
      Parameters:
      footerComponentSupplier - a supplier that instantiates the component to be used in the footer of each column
      Returns:
      this instance, for method chaining
      See Also:
    • setClassNameGenerator

      public TwinColumn<T> setClassNameGenerator(SerializableFunction<T,String> classNameGenerator)
      Sets the function that is used for generating CSS class names for cells in both columns.
      Parameters:
      classNameGenerator - the class name generator to set, not null
      Returns:
      this instance, for method chaining
      Throws:
      NullPointerException - if classNameGenerator is null
      See Also: