Class ColumnPreferences

java.lang.Object
org.vaadin.addons.antlerflow.grid.columns.ColumnPreferences

public final class ColumnPreferences extends Object
Identifies grid columns and converts a user's column visibility preference to and from the line-based wire format exchanged with the browser.

Each line holds one column: +id for a visible column, -id for a hidden one. The client element stores the preference in localStorage as JSON; this format is only used between server and client.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> String
    columnId(com.vaadin.flow.component.grid.Grid.Column<T> column, int index)
    Returns a stable identifier for the column: its key, otherwise its header text, otherwise its position.
    Decodes the wire format into column id to visibility entries.
    static String
    encode(Map<String,Boolean> visibility)
    Encodes column id to visibility entries in the wire format.
    static <T> String
    label(com.vaadin.flow.component.grid.Grid.Column<T> column, int index)
    Returns the label shown for the column in the column selector.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • columnId

      public static <T> String columnId(com.vaadin.flow.component.grid.Grid.Column<T> column, int index)
      Returns a stable identifier for the column: its key, otherwise its header text, otherwise its position. Set a column key (Grid.Column.setKey(String)) for identifiers that survive header renames and column reordering.
    • label

      public static <T> String label(com.vaadin.flow.component.grid.Grid.Column<T> column, int index)
      Returns the label shown for the column in the column selector.
    • encode

      public static String encode(Map<String,Boolean> visibility)
      Encodes column id to visibility entries in the wire format.
    • decode

      public static Map<String,Boolean> decode(String raw)
      Decodes the wire format into column id to visibility entries. Malformed lines are ignored, so a corrupted or outdated preference never breaks the grid.