|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.viewers.Viewer
org.eclipse.jface.viewers.ContentViewer
org.eclipse.jface.viewers.StructuredViewer
org.eclipse.jface.viewers.ColumnViewer
The ColumnViewer is the abstract superclass of viewers that have columns
(e.g., AbstractTreeViewer and AbstractTableViewer). Concrete subclasses of
ColumnViewer should implement a matching concrete subclass of
ViewerColumn.
This class is not intended to be subclassed outside of the JFace
viewers framework.
| Nested Class Summary |
|---|
| Nested classes inherited from class org.eclipse.jface.viewers.StructuredViewer |
|---|
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders |
| Field Summary |
|---|
| Fields inherited from class org.eclipse.jface.viewers.Viewer |
|---|
WIDGET_DATA_KEY |
| Constructor Summary | |
|---|---|
ColumnViewer()
Create a new instance of the receiver. |
|
| Method Summary | |
|---|---|
protected void |
applyEditorValue()
Apply the value of the active cell editor if one is active. |
void |
cancelEditing()
Cancels a currently active cell editor if one is active. |
protected abstract ColumnViewerEditor |
createViewerEditor()
Creates the viewer editor used for editing cell contents. |
protected abstract int |
doGetColumnCount()
Returns the number of columns contained in the receiver. |
void |
editElement(Object element,
int column)
Starts editing the given element at the given column index. |
CellEditor[] |
getCellEditors()
Return the CellEditors for the receiver, or null if no
cell editors are set.
|
ICellModifier |
getCellModifier()
Returns the cell modifier of this viewer, or null if none
has been set.
|
Object[] |
getColumnProperties()
Returns the column properties of this table viewer. |
ColumnViewerEditor |
getColumnViewerEditor()
|
protected abstract Widget |
getColumnViewerOwner(int columnIndex)
Returns the column widget at the given column index. |
protected Item |
getItem(int x,
int y)
Returns the item at the given display-relative coordinates, or null if there is no item at that location or
the underlying SWT-Control is not made up of Item
(e.g ListViewer)
The default implementation of this method returns null.
|
protected abstract Item |
getItemAt(Point point)
Returns the Item at the given widget-relative coordinates, or
null if there is no item at the given coordinates. |
CellLabelProvider |
getLabelProvider(int columnIndex)
Returns the label provider associated with the column at the given index or null if no column with this index is known. |
protected Object[] |
getRawChildren(Object parent)
Returns the children of the given parent without sorting and filtering them. |
protected ViewerRow |
getViewerRow(Point point)
Returns the viewer row at the given widget-relative coordinates. |
protected abstract ViewerRow |
getViewerRowFromItem(Widget item)
Returns a ViewerRow associated with the given row widget. |
protected void |
hookControl(Control control)
Adds event listener hooks to the given control. |
protected void |
hookEditingSupport(Control control)
Hook up the editing support. |
boolean |
isCellEditorActive()
Returns whether there is an active cell editor. |
void |
refresh(Object element)
Refreshes this viewer starting with the given element. |
void |
refresh(Object element,
boolean updateLabels)
Refreshes this viewer starting with the given element. |
void |
setCellEditors(CellEditor[] editors)
Sets the cell editors of this column viewer. |
void |
setCellModifier(ICellModifier modifier)
Sets the cell modifier for this column viewer. |
void |
setColumnProperties(String[] columnProperties)
Sets the column properties of this column viewer. |
void |
setColumnViewerEditor(ColumnViewerEditor columnViewerEditor)
|
void |
setLabelProvider(IBaseLabelProvider labelProvider)
The column viewer implementation of this Viewer framework
method ensures that the given label provider is an instance of
ITableLabelProvider, ILabelProvider, or
CellLabelProvider.
|
protected void |
triggerEditorActivationEvent(ColumnViewerEditorActivationEvent event)
Invoking this method fires an editor activation event which tries to enable the editor but before this event is passed to ColumnViewerEditorActivationStrategy to see if this event should
really trigger editor activation |
void |
update(Object element,
String[] properties)
Updates the given element's presentation when one or more of its properties changes. |
| Methods inherited from class org.eclipse.jface.viewers.ContentViewer |
|---|
getContentProvider, getInput, getLabelProvider, labelProviderChanged |
| Methods inherited from class org.eclipse.jface.viewers.Viewer |
|---|
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getControl, getData, handleHelpRequest, inputChanged, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider |
|---|
addSelectionChangedListener, removeSelectionChangedListener, setSelection |
| Constructor Detail |
public ColumnViewer()
| Method Detail |
protected void hookControl(Control control)
ContentViewerAll subclasses must call this method when their control is first established.
The ContentViewer implementation of this method hooks
dispose events for the given control.
Subclasses may override if they need to add other control hooks;
however, super.hookControl must be invoked.
hookControl in class StructuredViewerprotected void hookEditingSupport(Control control)
control - the control you want to hook onprotected abstract ColumnViewerEditor createViewerEditor()
null if this viewer does not
support editing cell contents.protected ViewerRow getViewerRow(Point point)
point - the widget-relative coordinates of the viewer row
null if no row is found at
the given coordinatesprotected abstract ViewerRow getViewerRowFromItem(Widget item)
ViewerRow associated with the given row widget. Implementations
may re-use the same instance for different row widgets; callers can only use the viewer
row locally and until the next call to this method.
item - the row widget
protected abstract Widget getColumnViewerOwner(int columnIndex)
columnIndex - the column index
protected abstract Item getItemAt(Point point)
Item at the given widget-relative coordinates, or
null if there is no item at the given coordinates.
point - the widget-relative coordinates
Item at the coordinates or null if
there is no item at the given coordinates
protected Item getItem(int x,
int y)
StructuredViewernull if there is no item at that location or
the underlying SWT-Control is not made up of Item
(e.g ListViewer)
The default implementation of this method returns null.
getItem in class StructuredViewerx - horizontal coordinatey - vertical coordinate
null if there is no item at the given
coordinatespublic void setLabelProvider(IBaseLabelProvider labelProvider)
Viewer framework
method ensures that the given label provider is an instance of
ITableLabelProvider, ILabelProvider, or
CellLabelProvider.
If the label provider is an ITableLabelProvider, then it
provides a separate label text and image for each column. Implementers of
ITableLabelProvider may also implement
ITableColorProvider and/or ITableFontProvider to provide
colors and/or fonts.
If the label provider is an ILabelProvider, then it
provides only the label text and image for the first column, and any
remaining columns are blank. Implementers of ILabelProvider
may also implement IColorProvider and/or IFontProvider to
provide colors and/or fonts.
setLabelProvider in class StructuredViewerpublic void cancelEditing()
protected void applyEditorValue()
public void editElement(Object element,
int column)
element - the model elementcolumn - the column indexpublic CellEditor[] getCellEditors()
null if no
cell editors are set.
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
ViewerColumn.setEditingSupport(EditingSupport),
EditingSupportpublic ICellModifier getCellModifier()
null if none
has been set.
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
nullViewerColumn.setEditingSupport(EditingSupport),
EditingSupportpublic Object[] getColumnProperties()
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
ViewerColumn.setEditingSupport(EditingSupport),
EditingSupportpublic boolean isCellEditorActive()
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
true if there is an active cell editor, and
false otherwiseViewerColumn.setEditingSupport(EditingSupport),
EditingSupportpublic void refresh(Object element)
StructuredViewer
Unlike the update methods, this handles structural changes
to the given element (e.g. addition or removal of children). If only the
given element needs updating, it is more efficient to use the
update methods.
refresh in class StructuredViewerelement - the element
public void refresh(Object element,
boolean updateLabels)
StructuredViewerrefresh(boolean updateLabels).
Unlike the update methods, this handles structural changes
to the given element (e.g. addition or removal of children). If only the
given element needs updating, it is more efficient to use the
update methods.
refresh in class StructuredViewerelement - the elementupdateLabels - true to update labels for existing elements,
false to only update labels as needed, assuming
that labels for existing elements are unchanged.
public void update(Object element,
String[] properties)
StructuredViewer
This does not handle structural changes (e.g. addition or removal of
elements), and does not update any other related elements (e.g. child
elements). To handle structural changes, use the refresh
methods instead.
This should be called when an element has changed in the model, in order to have the viewer accurately reflect the model. This method only affects the viewer, not the model.
Specifying which properties are affected may allow the viewer to optimize
the update. For example, if the label provider is not affected by changes
to any of these properties, an update may not actually be required.
Specifying properties as null forces a full
update of the element.
If the viewer has a sorter which is affected by a change to one of the
properties, the element's position is updated to maintain the sort order.
Note that resorting does not happen if properties is
null.
If the viewer has a filter which is affected by a change to one of the properties, the element may appear or disappear if the change affects whether or not the element is filtered out.
update in class StructuredViewerelement - the elementproperties - the properties that have changed, or null to
indicate unknownpublic void setCellEditors(CellEditor[] editors)
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
editors - the list of cell editorsViewerColumn.setEditingSupport(EditingSupport),
EditingSupportpublic void setCellModifier(ICellModifier modifier)
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
modifier - the cell modifierViewerColumn.setEditingSupport(EditingSupport),
EditingSupportpublic void setColumnProperties(String[] columnProperties)
Since 3.3, an alternative API is available, see
ViewerColumn.setEditingSupport(EditingSupport) for a more
flexible way of editing values in a column viewer.
columnProperties - the list of column propertiesViewerColumn.setEditingSupport(EditingSupport),
EditingSupportprotected abstract int doGetColumnCount()
public CellLabelProvider getLabelProvider(int columnIndex)
null if no column with this index is known.
columnIndex - the column index
null if no column with this index is knownprotected void triggerEditorActivationEvent(ColumnViewerEditorActivationEvent event)
ColumnViewerEditorActivationStrategy to see if this event should
really trigger editor activation
event - the activation eventpublic void setColumnViewerEditor(ColumnViewerEditor columnViewerEditor)
columnViewerEditor - the new column viewer editorpublic ColumnViewerEditor getColumnViewerEditor()
protected Object[] getRawChildren(Object parent)
StructuredViewer
Returns an empty array if the given parent is null.
getRawChildren in class StructuredViewerparent - the parent element
|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.