Interface EntityTableModel.ColumnPreferences

Enclosing interface:
EntityTableModel<E extends EntityEditModel>

public static interface EntityTableModel.ColumnPreferences
Represents preferences for an Attribute based table column.
  • Field Details

  • Method Details

    • attribute

      Attribute<?> attribute()
      Returns:
      the column attribute
    • index

      int index()
      Returns:
      the column index, -1 if not visible
    • visible

      boolean visible()
      Returns:
      true if this column is visible, false if hidden
    • width

      int width()
      Returns:
      the column width in pixels
    • toJSONObject

      org.json.JSONObject toJSONObject()
      Returns:
      a JSONObject representation of this column preferences instance
    • columnPreferences

      static EntityTableModel.ColumnPreferences columnPreferences(Attribute<?> attribute, int index, int width)
      Creates a new EntityTableModel.ColumnPreferences instance.
      Parameters:
      attribute - the attribute
      index - the column index, -1 if not visible
      width - the column width
      Returns:
      a new EntityTableModel.ColumnPreferences instance.
    • toString

      static String toString(Map<Attribute<?>,EntityTableModel.ColumnPreferences> columnPreferences)
      Parameters:
      columnPreferences - the column preferences mapped to their respective attribute
      Returns:
      a string encoding of the given preferences
    • fromString

      static Map<Attribute<?>,EntityTableModel.ColumnPreferences> fromString(Collection<Attribute<?>> attributes, String preferencesString)
      Parameters:
      attributes - the attributes
      preferencesString - the preferences encoded as as string
      Returns:
      a map containing the EntityTableModel.ColumnPreferences instances parsed from the given string
    • apply

      static void apply(EntityTableModel<?> tableModel, Collection<Attribute<?>> columnAttributes, String preferencesString, BiConsumer<Attribute<?>,Integer> setColumnWidth)
      Applies the given column preferences to the given table model
      Parameters:
      tableModel - the table model to apply the preferences to
      columnAttributes - the available column attributes
      preferencesString - the preferences string
      setColumnWidth - sets the column width