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
public abstract class OwnerDrawLabelProvider extends CellLabelProvider
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
Constructors Constructor Description OwnerDrawLabelProvider()Create a new instance of the receiver based on a column viewer.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddispose(ColumnViewer viewer, ViewerColumn column)Dispose of this label provider which was used with the given column viewer and column.protected voiderase(Event event, Object element)Handle 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 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 voidmeasure(Event event, Object element)Handle the measure event.protected abstract voidpaint(Event event, Object element)Handle 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.Since 3.4, the default implementation ofCellLabelProvider.initialize(ColumnViewer, ViewerColumn)in this class will set up the necessary owner draw callbacks automatically.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, useNativeToolTip
-
Methods inherited from class org.eclipse.jface.viewers.BaseLabelProvider
addListener, dispose, fireLabelProviderChanged, isLabelProperty, removeListener
-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
-
-
-
Method Detail
-
setUpOwnerDraw
@Deprecated public static void setUpOwnerDraw(ColumnViewer viewer)
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
public void dispose(ColumnViewer viewer, ViewerColumn column)
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
protected void initialize(ColumnViewer viewer, ViewerColumn column)
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
protected final void initialize(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. 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
public void update(ViewerCell cell)
Description copied from class:CellLabelProviderUpdate the label for cell.- Specified by:
updatein classCellLabelProvider- Parameters:
cell-ViewerCell
-
erase
protected void erase(Event event, Object element)
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:
SWT.EraseItem,SWT.COLOR_LIST_SELECTION,SWT.COLOR_LIST_SELECTION_TEXT
-
measure
protected abstract void measure(Event event, Object element)
Handle the measure event.- Parameters:
event- the measure eventelement- the model element- See Also:
SWT.MeasureItem
-
paint
protected abstract void paint(Event event, Object element)
Handle the paint event.- Parameters:
event- the paint eventelement- the model element- See Also:
SWT.PaintItem
-
setOwnerDrawEnabled
protected void setOwnerDrawEnabled(ColumnViewer viewer, ViewerColumn column, boolean enabled)
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
-
-