# Class ScaleFieldEditor

java.lang.Object
org.eclipse.jface.preference.FieldEditor
org.eclipse.jface.preference.ScaleFieldEditor

public class ScaleFieldEditor extends FieldEditor
A field editor for an integer type preference. This class may be used as is, or subclassed as required.

Since:
  3.0

## Field Summary

Fields
Modifier and Type
Field
Description
`protected Scale`
`scale`
The scale, or `null` if none.

### Fields inherited from class FieldEditor

`HORIZONTAL_GAP, IS_VALID, VALUE`

## Constructor Summary

Constructors
Constructor
Description
`ScaleFieldEditor(String name, String labelText, Composite parent)`
Creates a scale field editor.
`ScaleFieldEditor(String name, String labelText, Composite parent, int min, int max, int increment, int pageIncrement)`
Creates a scale field editor with particular scale values.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`adjustForNumColumns(int numColumns)`
Adjusts the horizontal span of this field editor's basic controls.
`protected void`
`doFillIntoGrid(Composite parent, int numColumns)`
Fills this field editor's basic controls into the given parent.
`protected void`
`doLoad()`
Initializes this field editor with the preference value from the preference store.
`protected void`
`doLoadDefault()`
Initializes this field editor with the default preference value from the preference store.
`protected void`
`doStore()`
Stores the preference value from this field editor into the preference store.
`int`
`getIncrement()`
Returns the value that will be used for Scale.setIncrement(int).
`int`
`getMaximum()`
Returns the value that will be used for Scale.setMaximum(int).
`int`
`getMinimum()`
Returns the value that will be used for Scale.setMinimum(int).
`int`
`getNumberOfControls()`
Returns the number of basic controls this field editor consists of.
`int`
`getPageIncrement()`
Returns the value that will be used for Scale.setPageIncrement(int).
`Scale`
`getScaleControl()`
Returns this field editor's scale control.
`void`
`setEnabled(boolean enabled, Composite parent)`
Bug 470866 fix
`void`
`setFocus()`
Sets the focus to this field editor.
`void`
`setIncrement(int increment)`
Set the value to be used for Scale.setIncrement(int) and update the scale.
`void`
`setMaximum(int max)`
Set the value to be used for Scale.setMaximum(int) and update the scale.
`void`
`setMinimum(int min)`
Set the value to be used for Scale.setMinumum(int) and update the scale.
`void`
`setPageIncrement(int pageIncrement)`
Set the value to be used for Scale.setPageIncrement(int) and update the scale.
`protected void`
`valueChanged()`
Informs this field editor's listener, if it has one, about a change to the value (`VALUE` property) provided that the old and new values are different.

### Methods inherited from class FieldEditor

`applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### scale

protected Scale scale
The scale, or `null` if none.

## Constructor Details

### ScaleFieldEditor

public ScaleFieldEditor(String name, String labelText, Composite parent)
Creates a scale field editor.

Parameters:
  `name` - the name of the preference this field editor works on
  `labelText` - the label text of the field editor
  `parent` - the parent of the field editor's control

### ScaleFieldEditor

public ScaleFieldEditor(String name, String labelText, Composite parent, int min, int max, int increment, int pageIncrement)
Creates a scale field editor with particular scale values.

Parameters:
  `name` - the name of the preference this field editor works on
  `labelText` - the label text of the field editor
  `parent` - the parent of the field editor's control
  `min` - the value used for Scale.setMinimum(int).
  `max` - the value used for Scale.setMaximum(int).
  `increment` - the value used for Scale.setIncrement(int).
  `pageIncrement` - the value used for Scale.setPageIncrement(int).

## Method Details

### adjustForNumColumns

protected void adjustForNumColumns(int numColumns)
Description copied from class: `FieldEditor`
Adjusts the horizontal span of this field editor's basic controls.

Subclasses must implement this method to adjust the horizontal span of controls so they appear correct in the given number of columns.

The number of columns will always be equal to or greater than the value returned by this editor's `getNumberOfControls` method.

Specified by:
  `adjustForNumColumns` in class `FieldEditor`
Parameters:
  `numColumns` - the number of columns

### doFillIntoGrid

protected void doFillIntoGrid(Composite parent, int numColumns)
Description copied from class: `FieldEditor`
Fills this field editor's basic controls into the given parent.

Subclasses must implement this method to create the controls for this field editor.

Note this method may be called by the constructor, so it must not access fields on the receiver object because they will not be fully initialized.

Specified by:
  `doFillIntoGrid` in class `FieldEditor`
Parameters:
  `parent` - the composite used as a parent for the basic controls; the parent's layout must be a `GridLayout`
  `numColumns` - the number of columns

### doLoad

protected void doLoad()
Description copied from class: `FieldEditor`
Initializes this field editor with the preference value from the preference store.

Subclasses must implement this method to properly initialize the field editor.

Specified by:
  `doLoad` in class `FieldEditor`

### doLoadDefault

protected void doLoadDefault()
Description copied from class: `FieldEditor`
Initializes this field editor with the default preference value from the preference store.

Subclasses must implement this method to properly initialize the field editor.

Specified by:
  `doLoadDefault` in class `FieldEditor`

### doStore

protected void doStore()
Description copied from class: `FieldEditor`
Stores the preference value from this field editor into the preference store.

Subclasses must implement this method to save the entered value into the preference store.

Specified by:
  `doStore` in class `FieldEditor`

### getIncrement

public int getIncrement()
Returns the value that will be used for Scale.setIncrement(int).

Returns:
  the value.
See Also:
  - `Scale.setIncrement(int)`

### getMaximum

public int getMaximum()
Returns the value that will be used for Scale.setMaximum(int).

Returns:
  the value.
See Also:
  - `Scale.setMaximum(int)`

### getMinimum

public int getMinimum()
Returns the value that will be used for Scale.setMinimum(int).

Returns:
  the value.
See Also:
  - `Scale.setMinimum(int)`

### getNumberOfControls

public int getNumberOfControls()
Description copied from class: `FieldEditor`
Returns the number of basic controls this field editor consists of.

Specified by:
  `getNumberOfControls` in class `FieldEditor`
Returns:
  the number of controls

### getPageIncrement

public int getPageIncrement()
Returns the value that will be used for Scale.setPageIncrement(int).

Returns:
  the value.
See Also:
  - `Scale.setPageIncrement(int)`

### getScaleControl

public Scale getScaleControl()
Returns this field editor's scale control.

Returns:
  the scale control, or `null` if no scale field is created yet

### setFocus

public void setFocus()
Description copied from class: `FieldEditor`
Sets the focus to this field editor.

The default implementation of this framework method does nothing. Subclasses may reimplement.

Overrides:
  `setFocus` in class `FieldEditor`

### setIncrement

public void setIncrement(int increment)
Set the value to be used for Scale.setIncrement(int) and update the scale.

Parameters:
  `increment` - a value greater than 0.
See Also:
  - `Scale.setIncrement(int)`

### setMaximum

public void setMaximum(int max)
Set the value to be used for Scale.setMaximum(int) and update the scale.

Parameters:
  `max` - a value greater than 0.
See Also:
  - `Scale.setMaximum(int)`

### setMinimum

public void setMinimum(int min)
Set the value to be used for Scale.setMinumum(int) and update the scale.

Parameters:
  `min` - a value greater than 0.
See Also:
  - `Scale.setMinimum(int)`

### setPageIncrement

public void setPageIncrement(int pageIncrement)
Set the value to be used for Scale.setPageIncrement(int) and update the scale.

Parameters:
  `pageIncrement` - a value greater than 0.
See Also:
  - `Scale.setPageIncrement(int)`

### valueChanged

protected void valueChanged()
Informs this field editor's listener, if it has one, about a change to the value (`VALUE` property) provided that the old and new values are different.

This hook is not called when the scale is initialized (or reset to the default value) from the preference store.

### setEnabled

public void setEnabled(boolean enabled, Composite parent)
Bug 470866 fix

Overrides:
  `setEnabled` in class `FieldEditor`
Parameters:
  `enabled` - The enabled state.
  `parent` - The parent of the controls in the group. Used to create the controls if required.