Class SpinnerSectionBuilder.Builder<V,R>
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.builders.SpinnerSectionBuilder.Builder<V,R>
- Type Parameters:
V- type of the valueR- step after the label, chosen by the factory
- All Implemented Interfaces:
IButtonBuilder<SpinnerSectionBuilder.FinalBuilder<V>>,ICanBeNullBuilder<SpinnerSectionBuilder.FinalBuilder<V>>,IConverterBuilder<V,,SpinnerSectionBuilder.DigitsRangeBuilder<V>> ICreateBuilder<ISpinnerSection<V>>,IDigitsBuilder<SpinnerSectionBuilder.HandlerBuilder<V>>,IHandlerBuilder<V,,SpinnerSectionBuilder.FinalBuilder<V>> ILabelBuilder<R>,ILabelPropertiesBuilder<SpinnerSectionBuilder.FinalBuilder<V>>,IParentBuilder<SpinnerSectionBuilder.LabelBuilder<R>>,ISpinnerPropertiesBuilder<V,,SpinnerSectionBuilder.FinalBuilder<V>> ISupplierLabelBuilder<R>,IToolTipBuilder<SpinnerSectionBuilder.FinalBuilder<V>>,IValidationBuilder<V,,SpinnerSectionBuilder.FinalBuilder<V>> IVisibleEnableBuilder<SpinnerSectionBuilder.FinalBuilder<V>>,SpinnerSectionBuilder.ConverterBuilder<V>,SpinnerSectionBuilder.DigitsBuilder<V>,SpinnerSectionBuilder.DigitsRangeBuilder<V>,SpinnerSectionBuilder.FinalBuilder<V>,SpinnerSectionBuilder.HandlerBuilder<V>,SpinnerSectionBuilder.LabelBuilder<R>,SpinnerSectionBuilder.ParentBuilder<R>,SpinnerSectionBuilder.RangeBuilder<V>
- Enclosing class:
SpinnerSectionBuilder
public static class SpinnerSectionBuilder.Builder<V,R>
extends Object
implements SpinnerSectionBuilder.ParentBuilder<R>, SpinnerSectionBuilder.LabelBuilder<R>, SpinnerSectionBuilder.ConverterBuilder<V>, SpinnerSectionBuilder.RangeBuilder<V>, SpinnerSectionBuilder.DigitsRangeBuilder<V>, SpinnerSectionBuilder.DigitsBuilder<V>, SpinnerSectionBuilder.HandlerBuilder<V>, SpinnerSectionBuilder.FinalBuilder<V>
Builder that implements all steps.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LabelPropertiesprotected final SpinnerSection<V> -
Method Summary
Modifier and TypeMethodDescriptionaddButton(ISimpleButtonProperties buttonProperties) canBeNull(BooleanSupplier canBeNull) converter(ToDoubleFunction<V> toNumber, DoubleFunction<V> fromNumber) Sets how a value is turned into the number of the spinner and back.create()Creates the builder of a section for a value of any type; the converter step turns it into a number.createDouble(Supplier<Double> valueExtractor) Creates the builder of a section for a Double.createInteger(Supplier<Integer> valueExtractor) Creates the builder of a section for an Integer.digits(int digits) Sets the number of digits after the point; the spinner shows the value rounded to them.enabled(BooleanSupplier enabled) protected SpinnerSectionBuilder.FinalBuilder<V> getThis()Returns this builder as its final step.labelProperties(LabelProperties labelProperties) parent(org.eclipse.swt.widgets.Composite parent) Sets the smallest and the largest value.protected voidprotected voidprotected voidsetParent(org.eclipse.swt.widgets.Composite parent) spinnerProperties(SpinnerProperties<V> spinnerProperties) Sets the spinner settings.toolTip(ToolTipProperties tooltip) validation(Predicate<V> validation, String message) Sets a check of the value.visible(BooleanSupplier visible) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.IButtonBuilder
addButtonIfMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.ILabelPropertiesBuilder
labelPropertiesMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.IToolTipBuilder
toolTip, toolTipMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.IVisibleEnableBuilder
enabled, visible
-
Field Details
-
section
-
labelProperties
-
-
Method Details
-
createInteger
public static SpinnerSectionBuilder.ParentBuilder<SpinnerSectionBuilder.RangeBuilder<Integer>> createInteger(Supplier<Integer> valueExtractor) Creates the builder of a section for an Integer.- Parameters:
valueExtractor- reads the current value- Returns:
- the first step of the builder
-
createDouble
public static SpinnerSectionBuilder.ParentBuilder<SpinnerSectionBuilder.DigitsRangeBuilder<Double>> createDouble(Supplier<Double> valueExtractor) Creates the builder of a section for a Double.- Parameters:
valueExtractor- reads the current value- Returns:
- the first step of the builder
-
create
public static <V1> SpinnerSectionBuilder.ParentBuilder<SpinnerSectionBuilder.ConverterBuilder<V1>> create(Supplier<V1> valueExtractor) Creates the builder of a section for a value of any type; the converter step turns it into a number.- Type Parameters:
V1- type of the value- Parameters:
valueExtractor- reads the current value- Returns:
- the first step of the builder
-
getThis
Returns this builder as its final step. -
parent
- Specified by:
parentin interfaceIParentBuilder<V>
-
label
- Specified by:
labelin interfaceILabelBuilder<V>
-
label
- Specified by:
labelin interfaceISupplierLabelBuilder<V>
-
converter
public SpinnerSectionBuilder.DigitsRangeBuilder<V> converter(ToDoubleFunction<V> toNumber, DoubleFunction<V> fromNumber) Description copied from interface:IConverterBuilderSets how a value is turned into the number of the spinner and back.- Specified by:
converterin interfaceIConverterBuilder<V,R> - Parameters:
toNumber- turns a value into a number; gets a value that is notnullfromNumber- turns a number of the spinner back into a value- Returns:
- the next step of the builder
-
range
Description copied from interface:SpinnerSectionBuilder.RangeBuilderSets the smallest and the largest value. If minimum is greater than maximum,create()throws IllegalArgumentException.- Specified by:
rangein interfaceSpinnerSectionBuilder.DigitsRangeBuilder<V>- Specified by:
rangein interfaceSpinnerSectionBuilder.RangeBuilder<V>- Parameters:
minimum- the smallest valuemaximum- the largest value- Returns:
- the next step of the builder
-
digits
Description copied from interface:IDigitsBuilderSets the number of digits after the point; the spinner shows the value rounded to them. If digits is below 0,create()throws IllegalArgumentException.- Specified by:
digitsin interfaceIDigitsBuilder<V>- Parameters:
digits- the number of digits after the point- Returns:
- the next step of the builder
-
handler
- Specified by:
handlerin interfaceIHandlerBuilder<V,R>
-
spinnerProperties
public SpinnerSectionBuilder.FinalBuilder<V> spinnerProperties(SpinnerProperties<V> spinnerProperties) Description copied from interface:ISpinnerPropertiesBuilderSets the spinner settings. A second call replaces the settings of the first one.- Specified by:
spinnerPropertiesin interfaceISpinnerPropertiesBuilder<V,R> - Parameters:
spinnerProperties- the spinner settings- Returns:
- the next step of the builder
-
addButton
- Specified by:
addButtonin interfaceIButtonBuilder<V>
-
validation
Description copied from interface:IValidationBuilderSets a check of the value. A value that fails it is not written, and an error icon with the message as its tooltip is shown next to the spinner.- Specified by:
validationin interfaceIValidationBuilder<V,R> - Parameters:
validation- the check; gets a value that is notnullmessage- the tooltip of the error icon- Returns:
- the next step of the builder
-
canBeNull
- Specified by:
canBeNullin interfaceICanBeNullBuilder<V>
-
create
- Specified by:
createin interfaceICreateBuilder<V>
-
labelProperties
-
toolTip
-
toolTip
-
visible
-
enabled
-
setParent
protected void setParent(org.eclipse.swt.widgets.Composite parent) -
setLabel
-
setLabel
-