Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityTableModel.ColumnPreferences
- Enclosing interface:
- EntityTableModel<E extends EntityEditModel>
public static interface EntityTableModel.ColumnPreferences
Represents preferences for an Attribute based table column.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Represents preferences for aColumnConditionModel
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
apply
(EntityTableModel<?> tableModel, Collection<Attribute<?>> columnAttributes, String preferencesString, BiConsumer<Attribute<?>, Integer> setColumnWidth) Applies the given column preferences to the given table modelAttribute<?>
columnPreferences
(Attribute<?> attribute, int index, int width) Creates a newEntityTableModel.ColumnPreferences
instance.static Map<Attribute<?>,
EntityTableModel.ColumnPreferences> fromString
(Collection<Attribute<?>> attributes, String preferencesString) int
index()
org.json.JSONObject
static String
toString
(Map<Attribute<?>, EntityTableModel.ColumnPreferences> columnPreferences) boolean
visible()
int
width()
-
Field Details
-
COLUMNS_KEY
The key identifying column preferences- See Also:
-
WIDTH_KEY
The key for the 'width' property- See Also:
-
INDEX_KEY
The key for the 'index' property- See Also:
-
-
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 newEntityTableModel.ColumnPreferences
instance.- Parameters:
attribute
- the attributeindex
- the column index, -1 if not visiblewidth
- the column width- Returns:
- a new
EntityTableModel.ColumnPreferences
instance.
-
toString
- 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 attributespreferencesString
- 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 tocolumnAttributes
- the available column attributespreferencesString
- the preferences stringsetColumnWidth
- sets the column width
-