Class ContainerSpinnerSectionBuilder.Builder<T,V,R>
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.builders.ContainerSpinnerSectionBuilder.Builder<T,V,R>
- Type Parameters:
T- type of the object in the containerV- type of the valueR- step after the label, chosen by the factory
- All Implemented Interfaces:
ContainerSpinnerSectionBuilder.ConverterBuilder<T,,V> ContainerSpinnerSectionBuilder.DigitsBuilder<T,,V> ContainerSpinnerSectionBuilder.DigitsRangeBuilder<T,,V> ContainerSpinnerSectionBuilder.FinalBuilder<T,,V> ContainerSpinnerSectionBuilder.HandlerBuilder<T,,V> ContainerSpinnerSectionBuilder.LabelBuilder<T,,R> ContainerSpinnerSectionBuilder.ParentBuilder<T,,V, R> ContainerSpinnerSectionBuilder.RangeBuilder<T,,V> ContainerSpinnerSectionBuilder.ValueExtractorBuilder<T,,V, R> ICanBeNullBuilder<ContainerSpinnerSectionBuilder.FinalBuilder<T,,V>> IContainerButtonBuilder<ContainerSpinnerSectionBuilder.FinalBuilder<T,,V>> IContainerHandlerBuilder<T,,V, ContainerSpinnerSectionBuilder.FinalBuilder<T, V>> IContainerLabelBuilder<T,,R> IContainerVisibleEnableBuilder<T,,ContainerSpinnerSectionBuilder.FinalBuilder<T, V>> IConverterBuilder<V,,ContainerSpinnerSectionBuilder.DigitsRangeBuilder<T, V>> ICreateBuilder<ISpinnerSection<V>>,IDigitsBuilder<ContainerSpinnerSectionBuilder.HandlerBuilder<T,,V>> ILabelBuilder<R>,ILabelPropertiesBuilder<ContainerSpinnerSectionBuilder.FinalBuilder<T,,V>> IParentBuilder<ContainerSpinnerSectionBuilder.ValueExtractorBuilder<T,,V, R>> ISpinnerPropertiesBuilder<V,,ContainerSpinnerSectionBuilder.FinalBuilder<T, V>> IToolTipBuilder<ContainerSpinnerSectionBuilder.FinalBuilder<T,,V>> IValidationBuilder<V,,ContainerSpinnerSectionBuilder.FinalBuilder<T, V>> IValueExtractorBuilder<T,V, ContainerSpinnerSectionBuilder.LabelBuilder<T, R>>
- Enclosing class:
ContainerSpinnerSectionBuilder
public static class ContainerSpinnerSectionBuilder.Builder<T,V,R>
extends Object
implements ContainerSpinnerSectionBuilder.ParentBuilder<T,V,R>, ContainerSpinnerSectionBuilder.ValueExtractorBuilder<T,V,R>, ContainerSpinnerSectionBuilder.LabelBuilder<T,R>, ContainerSpinnerSectionBuilder.ConverterBuilder<T,V>, ContainerSpinnerSectionBuilder.RangeBuilder<T,V>, ContainerSpinnerSectionBuilder.DigitsRangeBuilder<T,V>, ContainerSpinnerSectionBuilder.DigitsBuilder<T,V>, ContainerSpinnerSectionBuilder.HandlerBuilder<T,V>, ContainerSpinnerSectionBuilder.FinalBuilder<T,V>
Builder that implements all steps.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BiConsumer<Integer, com.amalgamasimulation.desktop.ui.editor.sections.internal.Section> protected intprotected final LabelPropertiesprotected final ContainerSpinnerSection<T, V> -
Method Summary
Modifier and TypeMethodDescriptionaddButton(IContainerButtonProperties buttonProperties) protected voidPasses the created section to the property page.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()static <T1,V1> ContainerSpinnerSectionBuilder.ParentBuilder <T1, V1, ContainerSpinnerSectionBuilder.ConverterBuilder<T1, V1>> create(org.eclipse.core.databinding.observable.value.IObservableValue<T1> containerObservable) Creates the builder of a section for a value of any type; the converter step turns it into a number.static <T1> ContainerSpinnerSectionBuilder.ParentBuilder<T1, Double, ContainerSpinnerSectionBuilder.DigitsRangeBuilder<T1, Double>> createDouble(org.eclipse.core.databinding.observable.value.IObservableValue<T1> containerObservable) Creates the builder of a section for a Double.static <T1> ContainerSpinnerSectionBuilder.ParentBuilder<T1, Integer, ContainerSpinnerSectionBuilder.RangeBuilder<T1, Integer>> createInteger(org.eclipse.core.databinding.observable.value.IObservableValue<T1> containerObservable) 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.protected org.eclipse.core.databinding.observable.value.IObservableValue<T> Returns the container of the section.protected ContainerSpinnerSectionBuilder.FinalBuilder<T, V> getThis()Returns this builder as its final step.handler(BiConsumer<T, V> handler) labelProperties(LabelProperties labelProperties) parent(org.eclipse.swt.widgets.Composite parent) Sets the smallest and the largest value.protected voidsetEnabled(Predicate<T> enabled) protected voidprotected voidprotected voidsetPage(org.eclipse.swt.widgets.Composite parent, BiConsumer<Integer, com.amalgamasimulation.desktop.ui.editor.sections.internal.Section> actionAfterCreateSectionInProperty, int index) Places the section on a property page: the page gives the parent, the position and the action that adds the section.protected voidsetParent(org.eclipse.swt.widgets.Composite parent) protected voidsetVisible(Predicate<T> visible) spinnerProperties(SpinnerProperties<V> spinnerProperties) Sets the spinner settings.toolTip(ToolTipProperties tooltip) validation(Predicate<V> validation, String message) Sets a check of the value.valueExtractor(Function<T, V> valueExtractor) 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.IContainerButtonBuilder
addButtonIfMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.IContainerVisibleEnableBuilder
enabled, visibleMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.ILabelPropertiesBuilder
labelPropertiesMethods inherited from interface com.amalgamasimulation.desktop.ui.editor.builders.interfaces.IToolTipBuilder
toolTip, toolTip
-
Field Details
-
section
-
labelProperties
-
actionAfterCreateSectionInProperty
protected BiConsumer<Integer,com.amalgamasimulation.desktop.ui.editor.sections.internal.Section> actionAfterCreateSectionInProperty -
index
protected int index
-
-
Method Details
-
createInteger
public static <T1> ContainerSpinnerSectionBuilder.ParentBuilder<T1,Integer, createIntegerContainerSpinnerSectionBuilder.RangeBuilder<T1, Integer>> (org.eclipse.core.databinding.observable.value.IObservableValue<T1> containerObservable) Creates the builder of a section for an Integer.- Type Parameters:
T1- type of the object in the container- Parameters:
containerObservable- container with the edited object- Returns:
- the first step of the builder
-
createDouble
public static <T1> ContainerSpinnerSectionBuilder.ParentBuilder<T1,Double, createDoubleContainerSpinnerSectionBuilder.DigitsRangeBuilder<T1, Double>> (org.eclipse.core.databinding.observable.value.IObservableValue<T1> containerObservable) Creates the builder of a section for a Double.- Type Parameters:
T1- type of the object in the container- Parameters:
containerObservable- container with the edited object- Returns:
- the first step of the builder
-
create
public static <T1,V1> ContainerSpinnerSectionBuilder.ParentBuilder<T1,V1, createContainerSpinnerSectionBuilder.ConverterBuilder<T1, V1>> (org.eclipse.core.databinding.observable.value.IObservableValue<T1> containerObservable) Creates the builder of a section for a value of any type; the converter step turns it into a number.- Type Parameters:
T1- type of the object in the containerV1- type of the value- Parameters:
containerObservable- container with the edited object- Returns:
- the first step of the builder
-
getThis
Returns this builder as its final step. -
getContainer
Returns the container of the section. -
setVisible
-
setEnabled
-
parent
public ContainerSpinnerSectionBuilder.ValueExtractorBuilder<T,V, parentR> (org.eclipse.swt.widgets.Composite parent) - Specified by:
parentin interfaceIParentBuilder<T>
-
valueExtractor
public ContainerSpinnerSectionBuilder.LabelBuilder<T,R> valueExtractor(Function<T, V> valueExtractor) - Specified by:
valueExtractorin interfaceIValueExtractorBuilder<T,V, R>
-
label
- Specified by:
labelin interfaceILabelBuilder<T>
-
label
- Specified by:
labelin interfaceIContainerLabelBuilder<T,V>
-
converter
public ContainerSpinnerSectionBuilder.DigitsRangeBuilder<T,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<T,V> - 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:ContainerSpinnerSectionBuilder.RangeBuilderSets the smallest and the largest value. If minimum is greater than maximum,create()throws IllegalArgumentException.- Specified by:
rangein interfaceContainerSpinnerSectionBuilder.DigitsRangeBuilder<T,V> - Specified by:
rangein interfaceContainerSpinnerSectionBuilder.RangeBuilder<T,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<T>- Parameters:
digits- the number of digits after the point- Returns:
- the next step of the builder
-
handler
- Specified by:
handlerin interfaceIContainerHandlerBuilder<T,V, R>
-
spinnerProperties
public ContainerSpinnerSectionBuilder.FinalBuilder<T,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<T,V> - Parameters:
spinnerProperties- the spinner settings- Returns:
- the next step of the builder
-
addButton
public ContainerSpinnerSectionBuilder.FinalBuilder<T,V> addButton(IContainerButtonProperties buttonProperties) - Specified by:
addButtonin interfaceIContainerButtonBuilder<T>
-
validation
public ContainerSpinnerSectionBuilder.FinalBuilder<T,V> validation(Predicate<V> validation, String message) 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<T,V> - 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<T>
-
create
- Specified by:
createin interfaceICreateBuilder<T>
-
labelProperties
public ContainerSpinnerSectionBuilder.FinalBuilder<T,V> labelProperties(LabelProperties labelProperties) -
toolTip
-
toolTip
-
visible
-
enabled
-
setParent
protected void setParent(org.eclipse.swt.widgets.Composite parent) -
setPage
protected void setPage(org.eclipse.swt.widgets.Composite parent, BiConsumer<Integer, com.amalgamasimulation.desktop.ui.editor.sections.internal.Section> actionAfterCreateSectionInProperty, int index) Places the section on a property page: the page gives the parent, the position and the action that adds the section. -
setLabel
-
setLabel
-
addToPage
protected void addToPage()Passes the created section to the property page. Does nothing outside a page.
-