Package swingtree.api.model
Class BasicTableModel.Builder<E>
java.lang.Object
swingtree.api.model.BasicTableModel.Builder<E>
- All Implemented Interfaces:
Buildable<BasicTableModel>
- Enclosing interface:
- BasicTableModel
The class below is a functional builder for creating a lambda based implementation of the
BasicTableModel
.
This allows fo a boilerplate free functional API.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Use this to build theBasicTableModel
instance.colClass
(BasicTableModel.ColumnClass<E> columnClass) Accepts a lambda which allows theJTable
to determine the class of the column at a given index.colClasses
(Class<? extends E>... classes) Use this to define a fixed array of column classes.colCount
(BasicTableModel.ColumnCount columnCount) Use this to define the lambda which dynamically determines the column count of the table model.colName
(BasicTableModel.ColumnName columnName) Use this to define the lambda which allows theJTable
to determine the name of the column at a given index.Use this to define a fixed array of column names.getsEntryAt
(BasicTableModel.EntryGetter<E> entryGetter) Accepts a lambda allowing theJTable
to dynamically determines the value at a given row and column.isEditableIf
(BasicTableModel.CellEditable cellEditable) Accepts a lambda allowing theJTable
to determine if the cell at a given row and column is editable.rowCount
(BasicTableModel.RowCount rowCount) Use this to define the lambda which dynamically determines the row count of the table model.setsEntryAt
(BasicTableModel.EntrySetter<E> entrySetter) Accepts a lambda allowing lambda which allows the user of theJTable
to set the value at a given row and column.updateOn
(sprouts.Observable updateEvent) Use this to define the event which will be fired when the table model is updated.
-
Constructor Details
-
Builder
-
-
Method Details
-
rowCount
Use this to define the lambda which dynamically determines the row count of the table model.- Parameters:
rowCount
- The lambda which will be used to determine the row count of the table model.- Returns:
- This builder instance.
-
colCount
Use this to define the lambda which dynamically determines the column count of the table model.- Parameters:
columnCount
- The lambda which will be used to determine the column count of the table model.- Returns:
- This builder instance.
-
getsEntryAt
Accepts a lambda allowing theJTable
to dynamically determines the value at a given row and column.- Parameters:
entryGetter
- The lambda which will be used to determine the value at a given row and column.- Returns:
- This builder instance.
-
setsEntryAt
Accepts a lambda allowing lambda which allows the user of theJTable
to set the value at a given row and column.- Parameters:
entrySetter
- The lambda which will be used to set the value at a given row and column.- Returns:
- This builder instance.
-
colClass
Accepts a lambda which allows theJTable
to determine the class of the column at a given index.- Parameters:
columnClass
- The lambda which will be used to determine the class of the column at a given index.- Returns:
- This builder instance.
-
colClasses
Use this to define a fixed array of column classes.- Parameters:
classes
- An array of column classes.- Returns:
- This builder instance.
-
isEditableIf
Accepts a lambda allowing theJTable
to determine if the cell at a given row and column is editable.- Parameters:
cellEditable
- The lambda which will be used to determine if the cell at a given row and column is editable.- Returns:
- This builder instance.
-
colName
Use this to define the lambda which allows theJTable
to determine the name of the column at a given index.- Parameters:
columnName
- The lambda which will be used to determine the name of the column at a given index.- Returns:
- This builder instance.
-
colNames
Use this to define a fixed array of column names.- Parameters:
names
- An array of column names.- Returns:
- This builder instance.
-
updateOn
Use this to define the event which will be fired when the table model is updated.- Parameters:
updateEvent
- The event which will be fired when the table model is updated.- Returns:
- This builder instance.
-
build
Use this to build theBasicTableModel
instance.- Specified by:
build
in interfaceBuildable<E>
- Returns:
- The
BasicTableModel
instance.
-