Class SpinnerProperties<V>
java.lang.Object
com.amalgamasimulation.desktop.ui.editor.sections.descriptors.SpinnerProperties<V>
- Type Parameters:
V- type of the value
Settings of the spinner in a spinner section: width, steps, read-only mode and enablement.
- Author:
- Ionov Ivan
-
Method Summary
Modifier and TypeMethodDescriptionvoidcopy(SpinnerProperties<V> spinnerProperties) Copies all settings except the section state from other settings.enabled(boolean enabled) Enables or disables the spinner: typing and the arrows.enabled(BooleanSupplier enabled) Sets a condition that enables the spinner.Returns the step of the arrows and the Up and Down keys.Returns the step of the Page Up and Page Down keys.intgetWidth()Returns the width of the spinner.Sets the step of the arrows and the Up and Down keys.booleanReturns whether the spinner should be enabled.booleanReturns whether typing is turned off.static <V> SpinnerProperties<V> Creates spinner settings with default values.pageIncrement(V pageIncrement) Sets the step of the Page Up and Page Down keys.readOnly(boolean readOnly) Turns typing off; the arrows and keys still change the value.sectionEnabled(boolean sectionEnabled) Sets the state of the section that holds the spinner.width(int width) Sets the width of the spinner.
-
Method Details
-
newInstance
Creates spinner settings with default values.- Type Parameters:
V- type of the value- Returns:
- new settings
-
getWidth
public int getWidth()Returns the width of the spinner.- Returns:
- the width in pixels
-
width
Sets the width of the spinner.- Parameters:
width- the width in pixels- Returns:
- this instance
-
getIncrement
Returns the step of the arrows and the Up and Down keys.- Returns:
- the step, or
nullfor the spinner default
-
increment
Sets the step of the arrows and the Up and Down keys. A step smaller than one unit of the last digit (below 0.1 with one digit after the point) is rounded to 0, and the spinner keeps its previous step.- Parameters:
increment- the step in units of the value, ornullfor the spinner default- Returns:
- this instance
-
getPageIncrement
Returns the step of the Page Up and Page Down keys.- Returns:
- the step, or
nullfor the spinner default
-
pageIncrement
Sets the step of the Page Up and Page Down keys. A step smaller than one unit of the last digit (below 0.1 with one digit after the point) is rounded to 0, and the spinner keeps its previous step.- Parameters:
pageIncrement- the step in units of the value, ornullfor the spinner default- Returns:
- this instance
-
isReadOnly
public boolean isReadOnly()Returns whether typing is turned off.- Returns:
- true if the value can be changed only with the arrows and keys
-
readOnly
Turns typing off; the arrows and keys still change the value. Applies only when the spinner is created.- Parameters:
readOnly- true to turn typing off- Returns:
- this instance
-
isEnabled
public boolean isEnabled()Returns whether the spinner should be enabled. Takes into account both its own setting and the section state.- Returns:
- true if the spinner should be enabled
-
enabled
Enables or disables the spinner: typing and the arrows. The section buttons are not affected.- Parameters:
enabled- true to enable the spinner- Returns:
- this instance
-
enabled
Sets a condition that enables the spinner. It is checked again on each section update.- Parameters:
enabled- the condition- Returns:
- this instance
-
sectionEnabled
Sets the state of the section that holds the spinner.- Parameters:
sectionEnabled- true if the section is enabled- Returns:
- this instance
-
copy
Copies all settings except the section state from other settings.- Parameters:
spinnerProperties- the settings to copy from
-