|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jface.preference.FieldEditor
org.mailster.gui.prefs.widgets.TableFieldEditor
public class TableFieldEditor
A FieldEditor implementation that supports the selection of
tabular data.
| Field Summary | |
|---|---|
private java.lang.String[] |
columnHeaders
The column headers to display in the Table
|
private org.eclipse.jface.viewers.IStructuredContentProvider |
contentProvider
The content provider used to query the table data |
private java.lang.Object |
input
The input or model object that holds the data of the TableViewer |
private org.eclipse.jface.viewers.ITableLabelProvider |
labelProvider
The label provider used to convert domain objects to ui specific textual representations. |
private java.lang.Object |
oldValue
The last selected value of the Table |
private int |
selectionColumn
The index of the column to store/retrieve the value for. |
private TableViewerSorter |
sorter
The Table sorter |
private TableViewerSorterHandler |
sorterHandler
The handler used to sort the underlying IStructuredContentProvider |
private org.eclipse.swt.widgets.Table |
table
The Table used to present the selectable tabular data |
private org.eclipse.jface.viewers.TableViewer |
viewer
The TableViewer used as controller |
| Fields inherited from class org.eclipse.jface.preference.FieldEditor |
|---|
HORIZONTAL_GAP, IS_VALID, VALUE |
| Constructor Summary | |
|---|---|
TableFieldEditor(java.lang.String name,
java.lang.String labelText,
org.eclipse.swt.widgets.Composite parent,
org.eclipse.jface.viewers.IStructuredContentProvider contentProvider,
org.eclipse.jface.viewers.ITableLabelProvider labelProvider,
java.lang.String[] columnHeaders,
java.lang.Object input)
Creates a new TableFieldEditor instance. |
|
| Method Summary | |
|---|---|
protected void |
adjustForNumColumns(int numColumns)
Adjusts the horizontal span of this TableFieldEditor's
basic controls. |
protected void |
doFillIntoGrid(org.eclipse.swt.widgets.Composite parent,
int numColumns)
Fills this TableFieldEditor's basic controls into the
given parent. |
protected void |
doLoad()
Initializes this TableFieldEditor with the preference
value from the preference store. |
protected void |
doLoadDefault()
Initializes this TableFieldEditor with the default
preference value from the preference store. |
protected void |
doStore()
Stores the preference value from this TableFieldEditor
into the preference store. |
int |
getColumnWidth(int columnIndex)
Gets the width in pixel of the column at the specified columnIndex. |
int |
getNumberOfControls()
Returns the number of controls in this TableFieldEditor. |
java.lang.String |
getSelection()
Gets the currently selected value of this TableFieldEditor. |
int |
getSelectionColumn()
Gets the selection column which represents the index of the column whose value is stored/retrieved in this TableFieldEditor. |
int |
getSortingColumn()
Gets the index of the column by which sorting is done. |
private void |
initializeColumns()
Initializes the table columnHeaders by setting their widths and adjusting their settings. |
private void |
initializeViewer()
Initializes this TableFieldEditor's
TableViewer. |
boolean |
isSortAscending()
Returns true if sorting is done in ascending order;
false if done in descending order or sorting is disabled; |
boolean |
isSortingEnabled()
Returns true if Table sorting is enabled;
false otherwise. |
void |
setColumnAlignment(int columnIndex,
int alignment)
Sets the alignment of the column at the specified columnIndex
to the given alignment. |
void |
setColumnWidth(int columnIndex,
int width)
Sets the width of the column at the specified columnIndex
to the given width. |
private void |
setSelection(java.lang.String selectionStr)
Sets the selection of this TableFieldEditor to the row or
element matching the specified selectionStr. |
void |
setSelectionColumn(int columnIndex)
Sets the selection column to the specified columnIndex. |
void |
setSortingEnabled(boolean enabled)
Enables or disables the sorting of the Table depending on
the specified enabled status. |
void |
sort(int columnIndex,
boolean ascending)
Sorts the Table by the specified columnIndex
in the specified sort order. |
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 org.eclipse.jface.preference.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, setEnabled, setFocus, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private org.eclipse.swt.widgets.Table table
Table used to present the selectable tabular data
private org.eclipse.jface.viewers.TableViewer viewer
TableViewer used as controller
private org.eclipse.jface.viewers.IStructuredContentProvider contentProvider
private org.eclipse.jface.viewers.ITableLabelProvider labelProvider
private java.lang.Object input
TableViewer
private java.lang.String[] columnHeaders
Table
private TableViewerSorter sorter
Table sorter
private TableViewerSorterHandler sorterHandler
IStructuredContentProvider
private int selectionColumn
private java.lang.Object oldValue
Table
| Constructor Detail |
|---|
public TableFieldEditor(java.lang.String name,
java.lang.String labelText,
org.eclipse.swt.widgets.Composite parent,
org.eclipse.jface.viewers.IStructuredContentProvider contentProvider,
org.eclipse.jface.viewers.ITableLabelProvider labelProvider,
java.lang.String[] columnHeaders,
java.lang.Object input)
TableFieldEditor instance.
name - the name of the preference this field editor works onlabelText - the label text of the field editorparent - the parent of the field editor's controlcontentProvider - the IStructuredContentProvider used
to query the table datalabelProvider - the ITableLabelProvider used to
convert domain objects to ui specific textual representationscolumnHeaders - an array of String objects
representing the column headersinput - the input or model object which holds the data for this
TableFieldEditor| Method Detail |
|---|
public int getNumberOfControls()
TableFieldEditor.
Returns 1 as the Table is the only control.
getNumberOfControls in class org.eclipse.jface.preference.FieldEditor1FieldEditor.getNumberOfControls()public void setSelectionColumn(int columnIndex)
columnIndex.
The index represents the column whose value is stored/retrieved in this
TableFieldEditor. If set to -1 the complete row
represented as domain object is stored/retrieved. This is done by calling
Object.toString() on the respective domain object.
columnIndex - the column whose value is stored/retrieved in this
TableFieldEditorgetSelectionColumn()public int getSelectionColumn()
TableFieldEditor. A
value of -1 means that the complete row represented as
domain object is stored/retrieved. This is done by calling
Object.toString() on the respective domain object.
TableFieldEditorsetSelectionColumn(int)public java.lang.String getSelection()
TableFieldEditor.
The value returned by this method depends on the selection column set up
as returned by getSelectionColumn(). If the selection column is
set to -1 the complete row represented as domain object is
returned by calling Object.toString() on it. Otherwise the respective
column value is queried and returned using the
ITableLabelProvider bound to this
TableFieldEditor.
String if
no selectionsetSelectionColumn(int),
getSelectionColumn()public void setSortingEnabled(boolean enabled)
Table depending on
the specified enabled status. The
IStructuredContentProvider used in this
TableFieldEditor has to implement the
ITableContentProvider
interface to enable sorting.
enabled - true to enable sorting; false
to disableisSortingEnabled()public boolean isSortingEnabled()
Table sorting is enabled;
false otherwise.
true if sorting is enabled; false
otherwisesetSortingEnabled(boolean)
public void sort(int columnIndex,
boolean ascending)
Table by the specified columnIndex
in the specified sort order. If sorting is disabled this method does
nothing.
columnIndex - the index of the column to sort byascending - true to sort in ascending,
false to sort in descending ordersetSortingEnabled(boolean),
isSortingEnabled(),
getSortingColumn(),
isSortAscending()public int getSortingColumn()
isSortAscending(),
sort(int, boolean)public boolean isSortAscending()
true if sorting is done in ascending order;
false if done in descending order or sorting is disabled;
true if sorting is done in ascending order;
false if done in descending order or sorting is
disabled;getSortingColumn(),
sort(int, boolean)
public void setColumnWidth(int columnIndex,
int width)
columnIndex
to the given width. If no TableColumn
exists at the specified columnIndex the method does
nothing.
columnIndex - the index of the column to set the width forwidth - the width of the column in pixelgetColumnWidth(int)
public void setColumnAlignment(int columnIndex,
int alignment)
columnIndex
to the given alignment. If no TableColumn
exists at the specified columnIndex the method does
nothing.
columnIndex - the index of the column to set the alignment foralignment - the alignment of the columngetColumnWidth(int)public int getColumnWidth(int columnIndex)
columnIndex. If no TableColumn exists at
the specified columnIndex the method returns 0.
columnIndex - the index of the column to get the width for
setColumnWidth(int, int)protected void adjustForNumColumns(int numColumns)
TableFieldEditor's
basic controls. The number of columnHeaders will always be equal to or
greater than the value returned by this editor's
getNumberOfControls method.
adjustForNumColumns in class org.eclipse.jface.preference.FieldEditornumColumns - the number of columnHeadersFieldEditor.adjustForNumColumns(int)
protected void doFillIntoGrid(org.eclipse.swt.widgets.Composite parent,
int numColumns)
TableFieldEditor's basic controls into the
given parent.
doFillIntoGrid in class org.eclipse.jface.preference.FieldEditorparent - the composite used as a parent for the basic controls; the
parent's layout must be a GridLayoutnumColumns - the number of columnHeadersFieldEditor.doFillIntoGrid(org.eclipse.swt.widgets.Composite,
int)protected void doLoad()
TableFieldEditor with the preference
value from the preference store.
doLoad in class org.eclipse.jface.preference.FieldEditorFieldEditor.doLoad()protected void doLoadDefault()
TableFieldEditor with the default
preference value from the preference store.
doLoadDefault in class org.eclipse.jface.preference.FieldEditorFieldEditor.doLoadDefault()protected void doStore()
TableFieldEditor
into the preference store.
doStore in class org.eclipse.jface.preference.FieldEditorFieldEditor.doStore()protected void valueChanged()
VALUE property) provided that the old and new
values are different. This hook is not called when the value
is initialized (or reset to the default value) from the preference store.
private void initializeViewer()
TableFieldEditor's
TableViewer.
private void initializeColumns()
private void setSelection(java.lang.String selectionStr)
TableFieldEditor to the row or
element matching the specified selectionStr.
selectionStr - the String that identifies the row or
element to select
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||