Package org.eclipse.jface.widgets
Class SpinnerFactory
java.lang.Object
org.eclipse.jface.widgets.AbstractWidgetFactory<F,C,Composite>
org.eclipse.jface.widgets.AbstractControlFactory<SpinnerFactory,Spinner>
org.eclipse.jface.widgets.SpinnerFactory
This class provides a convenient shorthand for creating and initializing
Spinner
. This offers several benefits over creating Spinner normal
way:
- The same factory can be used many times to create several Spinner instances
- The setters on SpinnerFactory all return "this", allowing them to be chained
Note that this class does not extend AbstractCompositeFactory
even
though Spinner extends Composite. This is because Spinner is not supposed to
be used like a Composite.
- Since:
- 3.18
-
Method Summary
Modifier and TypeMethodDescriptionbounds
(int minimum, int maximum) Sets the minimum and maximum value that the receiver will allow.increment
(int increment, int pageIncrement) Sets the amounts (which must be at least one) that the receiver's value will be modified by when the up/down arrows or the page up/down keys are pressed to the argument.limitTo
(int limit) Sets the maximum number of characters that the receiver's text field is capable of holding to be the argument.static SpinnerFactory
newSpinner
(int style) Creates a new SpinnerFactory with the given style.onModify
(ModifyListener listener) Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by calling the modifyText method.onSelect
(Consumer<SelectionEvent> consumer) Creates aSelectionListener
and registers it for the widgetSelected event.Methods inherited from class org.eclipse.jface.widgets.AbstractControlFactory
background, enabled, font, foreground, layoutData, orientation, supplyLayoutData, tooltip
Methods inherited from class org.eclipse.jface.widgets.AbstractWidgetFactory
addProperty, cast, create, data, data
-
Method Details
-
newSpinner
Creates a new SpinnerFactory with the given style. Refer toSpinner(Composite, int)
for possible styles.- Returns:
- a new SpinnerFactory instance
-
bounds
Sets the minimum and maximum value that the receiver will allow.- Parameters:
minimum
- the minimummaximum
- the maximum- Returns:
- this
- See Also:
-
increment
Sets the amounts (which must be at least one) that the receiver's value will be modified by when the up/down arrows or the page up/down keys are pressed to the argument.- Parameters:
increment
- the increment (must be greater than zero)pageIncrement
- the page increment (must be greater than zero)- Returns:
- this
- See Also:
-
limitTo
Sets the maximum number of characters that the receiver's text field is capable of holding to be the argument.- Parameters:
limit
- the limit- Returns:
- this
- See Also:
-
onSelect
Creates aSelectionListener
and registers it for the widgetSelected event. If the receiver is selected by the user the given consumer is invoked. TheSelectionEvent
is passed to the consumer.- Parameters:
consumer
- the consumer whose accept method is called- Returns:
- this
- See Also:
-
onModify
Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by calling the modifyText method.Can be called several times to add more than one ModifyListener.
- Parameters:
listener
- the listener which should be notified- Returns:
- this
- See Also:
-