|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.jface.preference.FieldEditor
net.sourceforge.java.util.gui.jface.preference.TableFieldEditor
A FieldEditor implementation that supports the selection of
tabular data.
| Field Summary | |
private String[] |
columnHeaders
The column headers to display in the Table |
private IStructuredContentProvider |
contentProvider
The content provider used to query the table data |
private Object |
input
The input or model object that holds the data of the TableViewer
|
private ITableLabelProvider |
labelProvider
The label provider used to convert domain objects to ui specific textual representations. |
private 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
Table sorter |
private TableViewerSorterHandler |
sorterHandler
The handler used to sort the underlying IStructuredContentProvider
|
private Table |
table
The Table used to present the selectable tabular data
|
private TableViewer |
viewer
The TableViewer used as controller |
| Fields inherited from class org.eclipse.jface.preference.FieldEditor |
HORIZONTAL_GAP, IS_VALID, VALUE |
| Constructor Summary | |
TableFieldEditor(String name,
String labelText,
Composite parent,
IStructuredContentProvider contentProvider,
ITableLabelProvider labelProvider,
String[] columnHeaders,
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(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. |
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 |
setColumnWidth(int columnIndex,
int width)
Sets the width of the column at the specified columnIndex
to the given width. |
private void |
setSelection(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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Table table
The Table used to present the selectable tabular data
private TableViewer viewer
The TableViewer used as controller
private IStructuredContentProvider contentProvider
The content provider used to query the table data
private ITableLabelProvider labelProvider
The label provider used to convert domain objects to ui specific textual representations.
private Object input
The input or model object that holds the data of the
TableViewer
private String[] columnHeaders
The column headers to display in the Table
private TableViewerSorter sorter
Table sorter
private TableViewerSorterHandler sorterHandler
The handler used to sort the underlying
IStructuredContentProvider
private int selectionColumn
The index of the column to store/retrieve the value for. If set to -1 the complete row represented as domain object is stored/retrieved. This is done by calling toString() on the respective domain object.
private Object oldValue
The last selected value of the Table
| Constructor Detail |
public TableFieldEditor(String name,
String labelText,
Composite parent,
IStructuredContentProvider contentProvider,
ITableLabelProvider labelProvider,
String[] columnHeaders,
Object input)
Creates a new 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.
1FieldEditor.getNumberOfControls()public void setSelectionColumn(int columnIndex)
Sets the selection column to the specified 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()
Gets the selection column which represents the index of the column whose
value is stored/retrieved in this 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 String getSelection()
Gets the currently selected value of this 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)
Enables or disables the sorting of the 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()
Returns true if Table sorting is enabled;
false otherwise.
true if sorting is enabled; false
otherwisesetSortingEnabled(boolean)
public void sort(int columnIndex,
boolean ascending)
Sorts the 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()
Gets the index of the column by which sorting is done. If sorting is disabled -1 is returned.
isSortAscending(),
sort(int, boolean)public boolean isSortAscending()
Returns 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)
Sets the width of the column at the specified 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 int getColumnWidth(int columnIndex)
Gets the width in pixel of the column at the specified
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)
Adjusts the horizontal span of this 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.
numColumns - the number of columnHeadersFieldEditor.adjustForNumColumns(int)
protected void doFillIntoGrid(Composite parent,
int numColumns)
Fills this TableFieldEditor's basic controls into the
given parent.
parent - 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()
Initializes this TableFieldEditor with the
preference value from the preference store.
FieldEditor.doLoad()protected void doLoadDefault()
Initializes this TableFieldEditor with the
default preference value from the preference store.
FieldEditor.doLoadDefault()protected void doStore()
Stores the preference value from this
TableFieldEditor into the preference store.
FieldEditor.doStore()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 value is
initialized (or reset to the default value) from the preference store.
private void initializeViewer()
Initializes this TableFieldEditor's
TableViewer.
private void initializeColumns()
Initializes the table columnHeaders by setting their widths and adjusting their settings.
private void setSelection(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 | ||||||||||