Class AbstractBuilder<M,V,I extends ValueInput,B extends Builder<M,V,B>>
- java.lang.Object
-
- net.officefloor.gef.configurer.internal.AbstractBuilder<M,V,I,B>
-
- All Implemented Interfaces:
Builder<M,V,B>
,ColumnRenderer<M,V>
,ValueRendererFactory<M,I>
- Direct Known Subclasses:
ChoiceBuilderImpl
,ClassBuilderImpl
,FlagBuilderImpl
,ListBuilderImpl
,MappingBuilderImpl
,MultipleBuilderImpl
,OptionalBuilderImpl
,ResourceBuilderImpl
,SelectBuilderImpl
,TextBuilderImpl
public abstract class AbstractBuilder<M,V,I extends ValueInput,B extends Builder<M,V,B>> extends java.lang.Object implements Builder<M,V,B>, ValueRendererFactory<M,I>, ColumnRenderer<M,V>
AbstractValueRenderer
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description AbstractBuilder(java.lang.String label)
Instantiate.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <R> void
configureTableColumn(javafx.scene.control.TableView<R> table, javafx.scene.control.TableColumn<R,V> column, javafx.util.Callback<java.lang.Integer,javafx.beans.value.ObservableValue<V>> callback)
Allow overriding to configure theTableColumn
.protected javafx.beans.property.Property<V>
createCellProperty()
Creates theProperty
for theTableCell
.CellRenderer<M,V>
createCellRenderer(ValueRendererContext<M> context)
Creates theValueRenderer
for the cell.protected javafx.scene.Node
createErrorFeedback(I valueInput, javafx.beans.property.Property<java.lang.Throwable> errorProperty)
Creates the error feedbackNode
.protected abstract I
createInput(ValueInputContext<M,V> context)
Creates the inputValueInput
for theObservableValue
.protected javafx.scene.Node
createLabel(java.lang.String labelText, I valueInput)
Creates the labelNode
.<R> javafx.scene.control.TableColumn<R,V>
createTableColumn(javafx.scene.control.TableView<R> table, javafx.util.Callback<java.lang.Integer,javafx.beans.value.ObservableValue<V>> callback)
Creates theTableColumn
.ValueRenderer<M,I>
createValueRenderer(ValueRendererContext<M> context)
Creates theValueRenderer
.protected java.lang.Throwable
getError(I valueInput, javafx.beans.property.ReadOnlyProperty<java.lang.Throwable> error)
Obtains the error.protected java.lang.String
getLabel()
Obtains the label.B
init(java.util.function.Function<M,V> getInitialValue)
Configures obtaining the initial value.boolean
isEditable()
Indicates if the column is editable.B
setValue(ValueLoader<M,V> valueLoader)
Specifies theValueLoader
to load the value to the model.B
validate(ValueValidator<M,V> validator)
Validates the text value.
-
-
-
Method Detail
-
createInput
protected abstract I createInput(ValueInputContext<M,V> context)
Creates the inputValueInput
for theObservableValue
.- Parameters:
context
-ValueInputContext
.- Returns:
ValueInput
to configure theObservableValue
.
-
createLabel
protected javafx.scene.Node createLabel(java.lang.String labelText, I valueInput)
Creates the labelNode
.- Parameters:
labelText
- Label text.valueInput
-ValueInput
.- Returns:
- Label
Node
.
-
createErrorFeedback
protected javafx.scene.Node createErrorFeedback(I valueInput, javafx.beans.property.Property<java.lang.Throwable> errorProperty)
Creates the error feedbackNode
.- Parameters:
valueInput
-ValueInput
.errorProperty
- ErrorProperty
.- Returns:
- Error feedback
Node
.
-
getError
protected java.lang.Throwable getError(I valueInput, javafx.beans.property.ReadOnlyProperty<java.lang.Throwable> error)
Obtains the error.- Parameters:
valueInput
-ValueInput
.error
-Throwable
error. May benull
if no error.- Returns:
Throwable
error ornull
if no error.
-
createCellProperty
protected javafx.beans.property.Property<V> createCellProperty()
Creates theProperty
for theTableCell
.- Returns:
Property
for theTableCell
.
-
configureTableColumn
protected <R> void configureTableColumn(javafx.scene.control.TableView<R> table, javafx.scene.control.TableColumn<R,V> column, javafx.util.Callback<java.lang.Integer,javafx.beans.value.ObservableValue<V>> callback)
Allow overriding to configure theTableColumn
.- Type Parameters:
R
- Row object type.- Parameters:
table
-TableView
that will contain theTableColumn
.column
-TableColumn
.callback
-Callback
.
-
getLabel
protected java.lang.String getLabel()
Obtains the label.- Returns:
- Label.
-
init
public B init(java.util.function.Function<M,V> getInitialValue)
Description copied from interface:Builder
Configures obtaining the initial value.
-
validate
public B validate(ValueValidator<M,V> validator)
Description copied from interface:Builder
Validates the text value.- Specified by:
validate
in interfaceBuilder<M,V,I extends ValueInput>
- Parameters:
validator
-ValueValidator
.- Returns:
this
.
-
setValue
public B setValue(ValueLoader<M,V> valueLoader)
Description copied from interface:Builder
Specifies theValueLoader
to load the value to the model.- Specified by:
setValue
in interfaceBuilder<M,V,I extends ValueInput>
- Parameters:
valueLoader
-ValueLoader
to load the value to the model.- Returns:
this
.
-
createValueRenderer
public ValueRenderer<M,I> createValueRenderer(ValueRendererContext<M> context)
Description copied from interface:ValueRendererFactory
Creates theValueRenderer
.- Specified by:
createValueRenderer
in interfaceValueRendererFactory<M,V>
- Parameters:
context
-ValueRendererContext
.- Returns:
ValueRenderer
.
-
createTableColumn
public <R> javafx.scene.control.TableColumn<R,V> createTableColumn(javafx.scene.control.TableView<R> table, javafx.util.Callback<java.lang.Integer,javafx.beans.value.ObservableValue<V>> callback)
Description copied from interface:ColumnRenderer
Creates theTableColumn
.- Specified by:
createTableColumn
in interfaceColumnRenderer<M,V>
- Type Parameters:
R
- Row object type.- Parameters:
table
-TableView
to contain theTableColumn
.callback
-Callback
.- Returns:
TableColumn
.
-
isEditable
public boolean isEditable()
Description copied from interface:ColumnRenderer
Indicates if the column is editable.- Specified by:
isEditable
in interfaceColumnRenderer<M,V>
- Returns:
true
if column is editable.
-
createCellRenderer
public CellRenderer<M,V> createCellRenderer(ValueRendererContext<M> context)
Description copied from interface:ColumnRenderer
Creates theValueRenderer
for the cell.- Specified by:
createCellRenderer
in interfaceColumnRenderer<M,V>
- Parameters:
context
-ValueRendererContext
.- Returns:
ValueRenderer
.
-
-