Class BasicTableModel.Builder<E>

java.lang.Object
swingtree.api.model.BasicTableModel.Builder<E>
All Implemented Interfaces:
Buildable<BasicTableModel>
Enclosing interface:
BasicTableModel

public static class BasicTableModel.Builder<E> extends Object implements Buildable<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 Details

    • Builder

      public Builder(Class<E> commonEntryType)
  • Method Details

    • rowCount

      public BasicTableModel.Builder<E> rowCount(BasicTableModel.RowCount 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

      public BasicTableModel.Builder<E> colCount(BasicTableModel.ColumnCount columnCount)
      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

      public BasicTableModel.Builder<E> getsEntryAt(BasicTableModel.EntryGetter<E> entryGetter)
      Accepts a lambda allowing the JTable 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

      public BasicTableModel.Builder<E> setsEntryAt(BasicTableModel.EntrySetter<E> entrySetter)
      Accepts a lambda allowing lambda which allows the user of the JTable 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

      public BasicTableModel.Builder<E> colClass(BasicTableModel.ColumnClass<E> columnClass)
      Accepts a lambda which allows the JTable 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

      public BasicTableModel.Builder<E> colClasses(Class<? extends E>... classes)
      Use this to define a fixed array of column classes.
      Parameters:
      classes - An array of column classes.
      Returns:
      This builder instance.
    • isEditableIf

      public BasicTableModel.Builder<E> isEditableIf(BasicTableModel.CellEditable cellEditable)
      Accepts a lambda allowing the JTable 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 the JTable 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

      public BasicTableModel.Builder<E> colNames(String... names)
      Use this to define a fixed array of column names.
      Parameters:
      names - An array of column names.
      Returns:
      This builder instance.
    • updateOn

      public BasicTableModel.Builder<E> updateOn(sprouts.Observable updateEvent)
      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

      public BasicTableModel build()
      Use this to build the BasicTableModel instance.
      Specified by:
      build in interface Buildable<E>
      Returns:
      The BasicTableModel instance.