Package org.eclipse.jface.viewers
Class OwnerDrawLabelProvider
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.viewers.BaseLabelProvider
org.eclipse.jface.viewers.CellLabelProvider
org.eclipse.jface.viewers.OwnerDrawLabelProvider
- All Implemented Interfaces:
IBaseLabelProvider,IToolTipProvider
- Direct Known Subclasses:
StyledCellLabelProvider
OwnerDrawLabelProvider is an abstract implementation of a label provider that
handles custom draw.
This class is intended to be subclassed by implementors.
- Since:
- 3.3
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of the receiver based on a column viewer. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose(ColumnViewer viewer, ViewerColumn column) Dispose of this label provider which was used with the given column viewer and column.protected voidHandle the erase event.protected voidinitialize(ColumnViewer viewer, ViewerColumn column) This implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)delegates toinitialize(ColumnViewer, ViewerColumn, boolean)with a value oftrueforenableOwnerDraw.protected final voidinitialize(ColumnViewer viewer, ViewerColumn column, boolean enableOwnerDraw) May be called from subclasses that overrideinitialize(ColumnViewer, ViewerColumn)but want to customize whether owner draw will be enabled.protected abstract voidHandle the measure event.protected abstract voidHandle the paint event.protected voidsetOwnerDrawEnabled(ColumnViewer viewer, ViewerColumn column, boolean enabled) Enables or disables owner draw for the given viewer and column.static voidsetUpOwnerDraw(ColumnViewer viewer) Deprecated.voidupdate(ViewerCell cell) Update the label for cell.Methods inherited from class org.eclipse.jface.viewers.CellLabelProvider
getToolTipBackgroundColor, getToolTipDisplayDelayTime, getToolTipFont, getToolTipForegroundColor, getToolTipImage, getToolTipShift, getToolTipStyle, getToolTipText, getToolTipTimeDisplayed, useNativeToolTipMethods inherited from class org.eclipse.jface.viewers.BaseLabelProvider
addListener, dispose, fireLabelProviderChanged, isLabelProperty, removeListenerMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
OwnerDrawLabelProvider
public OwnerDrawLabelProvider()Create a new instance of the receiver based on a column viewer.
-
-
Method Details
-
setUpOwnerDraw
Deprecated.Since 3.4, the default implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)in this class will set up the necessary owner draw callbacks automatically. Calls to this method can be removed.Set up the owner draw callbacks for the viewer.- Parameters:
viewer- the viewer the owner draw is set up
-
dispose
Description copied from class:CellLabelProviderDispose of this label provider which was used with the given column viewer and column. Subclasses may extend but should call the super implementation (which callsBaseLabelProvider.dispose()).- Overrides:
disposein classCellLabelProvider- Parameters:
viewer- the viewercolumn- the column, ornullif a column is not available.
-
initialize
This implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)delegates toinitialize(ColumnViewer, ViewerColumn, boolean)with a value oftrueforenableOwnerDraw. Subclasses may override this method but should either call the super implementation or, alternatively,initialize(ColumnViewer, ViewerColumn, boolean).- Overrides:
initializein classCellLabelProvider- Parameters:
viewer- the viewercolumn- the column, ornullif a column is not available.
-
initialize
May be called from subclasses that overrideinitialize(ColumnViewer, ViewerColumn)but want to customize whether owner draw will be enabled. This method callssuper.initialize(ColumnViewer, ViewerColumn), and then enables or disables owner draw by callingsetOwnerDrawEnabled(ColumnViewer, ViewerColumn, boolean).- Parameters:
viewer- the viewercolumn- the column, ornullif a column is not available.enableOwnerDraw-trueif owner draw should be enabled for the given viewer and column,falseotherwise.- Since:
- 3.4
-
update
Description copied from class:CellLabelProviderUpdate the label for cell.- Specified by:
updatein classCellLabelProvider- Parameters:
cell-ViewerCell
-
erase
Handle the erase event. The default implementation colors the background of selected areas withSWT.COLOR_LIST_SELECTIONand foregrounds withSWT.COLOR_LIST_SELECTION_TEXT. Note that this implementation causes non-native behavior on some platforms. Subclasses should override this method and not call the super implementation.- Parameters:
event- the erase eventelement- the model object- See Also:
-
measure
Handle the measure event.- Parameters:
event- the measure eventelement- the model element- See Also:
-
paint
Handle the paint event.- Parameters:
event- the paint eventelement- the model element- See Also:
-
setOwnerDrawEnabled
Enables or disables owner draw for the given viewer and column. This method will attach or remove a listener to the underlying control as necessary. This method is called frominitialize(ColumnViewer, ViewerColumn)anddispose(ColumnViewer, ViewerColumn)but may be called from subclasses to enable or disable owner draw dynamically.- Parameters:
viewer- the viewercolumn- the column, ornullif a column is not availableenabled-trueif owner draw should be enabled,falseotherwise- Since:
- 3.4
-
CellLabelProvider.initialize(ColumnViewer, ViewerColumn)in this class will set up the necessary owner draw callbacks automatically.