|
|||||||||
| Home >> All >> com >> port80 >> eclipse >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.port80.eclipse.util
Class HexColorFieldEditor

java.lang.Objectorg.eclipse.jface.preference.FieldEditor
com.port80.eclipse.util.HexColorFieldEditor
- public class HexColorFieldEditor
- extends org.eclipse.jface.preference.FieldEditor
A preference field editor to enter color RGB value in hex. Modified from StringFieldEditor. Unfortunately, StringFieldEditor.oldValue is private and make it difficult to just extend StringFieldEditor and override doLoad() ... etc.
| Field Summary | |
private boolean |
emptyStringAllowed
Indicates whether the empty string is legal; true by default. |
private java.lang.String |
errorMessage
The error message, or null if none. |
private boolean |
isValid
Cached valid state. |
protected java.lang.String |
oldValue
Old text value. |
private org.eclipse.swt.widgets.Text |
textField
The text field, or null if none. |
private int |
textLimit
Text limit of text field in characters; initially unlimited. |
static int |
UNLIMITED
Text limit constant (value -1) indicating unlimited
text limit and width. |
private int |
widthInChars
Width of text field in characters; initially unlimited. |
| Fields inherited from class org.eclipse.jface.preference.FieldEditor |
HORIZONTAL_GAP, IS_VALID, VALUE |
| Constructor Summary | |
HexColorFieldEditor()
Constructor for HexColorFieldEditor. |
|
HexColorFieldEditor(java.lang.String name,
java.lang.String labelText,
org.eclipse.swt.widgets.Composite parent)
Creates a string field editor of unlimited width. |
|
HexColorFieldEditor(java.lang.String name,
java.lang.String labelText,
int width,
org.eclipse.swt.widgets.Composite parent)
Creates a string field editor. |
|
| Method Summary | |
protected void |
adjustForNumColumns(int numColumns)
Adjusts the horizontal span of this field editor's basic controls. |
protected boolean |
checkState()
Checks whether the text input field contains a valid value or not. |
void |
dispose()
Disposes the SWT resources used by this field editor. |
protected boolean |
doCheckState()
Hook for subclasses to do additional specific state checks. |
protected void |
doFillIntoGrid(org.eclipse.swt.widgets.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. |
java.lang.String |
getErrorMessage()
Returns the error message that will be displayed when and if an error occurs. |
int |
getNumberOfControls()
Returns the number of basic controls this field editor consists of. |
java.lang.String |
getStringValue()
Returns the field editor's value. |
protected org.eclipse.swt.widgets.Text |
getTextControl()
Returns this field editor's text control. |
org.eclipse.swt.widgets.Text |
getTextControl(org.eclipse.swt.widgets.Composite parent)
Returns this field editor's text control. |
(package private) void |
handleFocusLost()
|
boolean |
isEmptyStringAllowed()
Returns whether an empty string is a valid value. |
boolean |
isValid()
Returns whether this field editor contains a valid value. |
protected void |
refreshValidState()
Refreshes this field editor's valid state after a value change and fires an IS_VALID property change event if
warranted. |
void |
setEmptyStringAllowed(boolean b)
Sets whether the empty string is a valid value or not. |
void |
setErrorMessage(java.lang.String message)
Sets the error message that will be displayed when and if an error occurs. |
void |
setFocus()
Sets the focus to this field editor. |
void |
setStringValue(java.lang.String value)
Sets this field editor's value. |
void |
setTextLimit(int limit)
Sets this text field's text limit. |
protected void |
setValid(boolean isvalid)
|
void |
showErrorMessage()
Shows the error message set via setErrorMessage. |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
UNLIMITED
public static int UNLIMITED
- Text limit constant (value
-1) indicating unlimited text limit and width.
oldValue
protected java.lang.String oldValue
- Old text value.
isValid
private boolean isValid
- Cached valid state.
textField
private org.eclipse.swt.widgets.Text textField
- The text field, or
nullif none.
widthInChars
private int widthInChars
- Width of text field in characters; initially unlimited.
textLimit
private int textLimit
- Text limit of text field in characters; initially unlimited.
errorMessage
private java.lang.String errorMessage
- The error message, or
nullif none.
emptyStringAllowed
private boolean emptyStringAllowed
- Indicates whether the empty string is legal;
trueby default.
| Constructor Detail |
HexColorFieldEditor
public HexColorFieldEditor()
- Constructor for HexColorFieldEditor.
HexColorFieldEditor
public HexColorFieldEditor(java.lang.String name, java.lang.String labelText, int width, org.eclipse.swt.widgets.Composite parent)
- Creates a string field editor.
Use the method
setTextLimitto limit the text. - Since:
- 2.0
HexColorFieldEditor
public HexColorFieldEditor(java.lang.String name, java.lang.String labelText, org.eclipse.swt.widgets.Composite parent)
- Creates a string field editor of unlimited width.
Use the method
setTextLimitto limit the text.
| Method Detail |
getErrorMessage
public java.lang.String getErrorMessage()
- Returns the error message that will be displayed when and if
an error occurs.
getNumberOfControls
public int getNumberOfControls()
- Description copied from class:
org.eclipse.jface.preference.FieldEditor - Returns the number of basic controls this field editor consists of.
getStringValue
public java.lang.String getStringValue()
- Returns the field editor's value.
getTextControl
public org.eclipse.swt.widgets.Text getTextControl(org.eclipse.swt.widgets.Composite parent)
- Returns this field editor's text control.
The control is created if it does not yet exist
isEmptyStringAllowed
public boolean isEmptyStringAllowed()
- Returns whether an empty string is a valid value.
isValid
public boolean isValid()
- Description copied from class:
org.eclipse.jface.preference.FieldEditor - Returns whether this field editor contains a valid value.
The default implementation of this framework method returns
true. Subclasses wishing to perform validation should override both this method andrefreshValidState.
setEmptyStringAllowed
public void setEmptyStringAllowed(boolean b)
- Sets whether the empty string is a valid value or not.
setErrorMessage
public void setErrorMessage(java.lang.String message)
- Sets the error message that will be displayed when and if
an error occurs.
setFocus
public void setFocus()
- Description copied from class:
org.eclipse.jface.preference.FieldEditor - Sets the focus to this field editor.
The default implementation of this framework method does nothing. Subclasses may reimplement.
setStringValue
public void setStringValue(java.lang.String value)
- Sets this field editor's value.
setTextLimit
public void setTextLimit(int limit)
- Sets this text field's text limit.
showErrorMessage
public void showErrorMessage()
- Shows the error message set via
setErrorMessage.
dispose
public void dispose()
- Description copied from class:
org.eclipse.jface.preference.FieldEditor - Disposes the SWT resources used by this field editor.
adjustForNumColumns
protected void adjustForNumColumns(int numColumns)
- Description copied from class:
org.eclipse.jface.preference.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
getNumberOfControlsmethod.
checkState
protected boolean checkState()
- Checks whether the text input field contains a valid value or not.
doCheckState
protected boolean doCheckState()
- Hook for subclasses to do additional specific state checks.
The default implementation of this framework method does nothing and returns
true. Subclasses should override this method to specific state checks.
doFillIntoGrid
protected void doFillIntoGrid(org.eclipse.swt.widgets.Composite parent, int numColumns)
- Fills this field editor's basic controls into the given parent.
The string field implementation of this
FieldEditorframework method contributes the text field. Subclasses may override but must callsuper.doFillIntoGrid.
doLoad
protected void doLoad()
- Description copied from class:
org.eclipse.jface.preference.FieldEditor - Initializes this field editor with the preference value from
the preference store.
Subclasses must implement this method to properly initialize the field editor.
doLoadDefault
protected void doLoadDefault()
- Description copied from class:
org.eclipse.jface.preference.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.
doStore
protected void doStore()
- Description copied from class:
org.eclipse.jface.preference.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.
getTextControl
protected org.eclipse.swt.widgets.Text getTextControl()
- Returns this field editor's text control.
refreshValidState
protected void refreshValidState()
- Description copied from class:
org.eclipse.jface.preference.FieldEditor - Refreshes this field editor's valid state after a value change
and fires an
IS_VALIDproperty change event if warranted.The default implementation of this framework method does nothing. Subclasses wishing to perform validation should override both this method and
isValid.
setValid
protected void setValid(boolean isvalid)
valueChanged
protected void valueChanged()
- Informs this field editor's listener, if it has one, about a change
to the value (
VALUEproperty) provided that the old and new values are different.This hook is not called when the text is initialized (or reset to the default value) from the preference store.
handleFocusLost
void handleFocusLost()
|
|||||||||
| Home >> All >> com >> port80 >> eclipse >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC