Package is.codion.swing.framework.model
Class SwingEntityColumnFactory
java.lang.Object
is.codion.swing.framework.model.SwingEntityColumnFactory
- All Implemented Interfaces:
FilteredTableModel.ColumnFactory<Attribute<?>>
public class SwingEntityColumnFactory
extends Object
implements FilteredTableModel.ColumnFactory<Attribute<?>>
Provides table columns based on an entity definition.
-
Constructor Summary
ConstructorsConstructorDescriptionSwingEntityColumnFactory
(EntityDefinition entityDefinition) Instantiates a new SwingEntityColumnFactory -
Method Summary
Modifier and TypeMethodDescriptionprotected final Comparator<?>
attributeComparator
(Attribute<?> attribute) Returns a comparator for the given attribute.protected Optional<FilteredTableColumn<Attribute<?>>>
createColumn
(AttributeDefinition<?> attributeDefinition, int modelIndex) Creates a column for the given attribute.final List<FilteredTableColumn<Attribute<?>>>
-
Constructor Details
-
SwingEntityColumnFactory
Instantiates a new SwingEntityColumnFactory- Parameters:
entityDefinition
- the entity definition
-
-
Method Details
-
createColumns
- Specified by:
createColumns
in interfaceFilteredTableModel.ColumnFactory<Attribute<?>>
- Returns:
- the columns, may not be empty
-
createColumn
protected Optional<FilteredTableColumn<Attribute<?>>> createColumn(AttributeDefinition<?> attributeDefinition, int modelIndex) Creates a column for the given attribute.- Parameters:
attributeDefinition
- the attribute definitionmodelIndex
- the column model index- Returns:
- the column or an empty Optional in case no column should be created for the given attribute
-
attributeComparator
Returns a comparator for the given attribute.- Parameters:
attribute
- the attribute- Returns:
- the comparator
-