Eclipse Platform Release 3.7

## 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

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
`OwnerDrawLabelProvider()` Create a new instance of the receiver based on a column viewer.

Method Summary
`void` `dispose(ColumnViewer viewer, ViewerColumn column)` Dispose of this label provider which was used with the given column viewer and column.
`protected void` `erase(Event event, Object element)` Handle the erase event.
`protected void` `initialize(ColumnViewer viewer, ViewerColumn column)` This implementation of `CellLabelProvider.initialize(ColumnViewer, ViewerColumn)` delegates to `initialize(ColumnViewer, ViewerColumn, boolean)` with a value of `true` for `enableOwnerDraw`.
`protected void` `initialize(ColumnViewer viewer, ViewerColumn column, boolean enableOwnerDraw)` May be called from subclasses that override `initialize(ColumnViewer, ViewerColumn)` but want to customize whether owner draw will be enabled.
`protected abstract void` `measure(Event event, Object element)` Handle the measure event.
`protected abstract void` `paint(Event event, Object element)` Handle the paint event.
`protected void` `setOwnerDrawEnabled(ColumnViewer viewer, ViewerColumn column, boolean enabled)` Enables or disables owner draw for the given viewer and column.
`static void` `setUpOwnerDraw(ColumnViewer viewer)` Deprecated. Since 3.4, the default implementation of `CellLabelProvider.initialize(ColumnViewer, ViewerColumn)` in this class will set up the necessary owner draw callbacks automatically. Calls to this method can be removed.
`void` `update(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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OwnerDrawLabelProvider

    public OwnerDrawLabelProvider()

  Create a new instance of the receiver based on a column viewer.

Method Detail

### setUpOwnerDraw

    public static void setUpOwnerDraw(ColumnViewer viewer)

  Deprecated. Since 3.4, the default implementation of `CellLabelProvider.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: `CellLabelProvider`
  Dispose of this label provider which was used with the given column viewer and column. Subclasses may extend but should call the super implementation (which calls `BaseLabelProvider.dispose()`).

  Overrides:
    `dispose` in class `CellLabelProvider`
  Parameters:
    `viewer` - the viewer
    `column` - the column, or `null` if a column is not available.

### initialize

    protected void initialize(ColumnViewer viewer,
                              ViewerColumn column)

  This implementation of `CellLabelProvider.initialize(ColumnViewer, ViewerColumn)` delegates to `initialize(ColumnViewer, ViewerColumn, boolean)` with a value of `true` for `enableOwnerDraw`. Subclasses may override this method but should either call the super implementation or, alternatively, `initialize(ColumnViewer, ViewerColumn, boolean)`.

  Overrides:
    `initialize` in class `CellLabelProvider`
  Parameters:
    `viewer` - the viewer
    `column` - the column, or `null` if a column is not available.

### initialize

    protected final void initialize(ColumnViewer viewer,
                                    ViewerColumn column,
                                    boolean enableOwnerDraw)

  May be called from subclasses that override `initialize(ColumnViewer, ViewerColumn)` but want to customize whether owner draw will be enabled. This method calls `super.initialize(ColumnViewer, ViewerColumn)`, and then enables or disables owner draw by calling `setOwnerDrawEnabled(ColumnViewer, ViewerColumn, boolean)`.

  Parameters:
    `viewer` - the viewer
    `column` - the column, or `null` if a column is not available.
    `enableOwnerDraw` - `true` if owner draw should be enabled for the given viewer and column, `false` otherwise.
  Since:
    3.4

### update

    public void update(ViewerCell cell)

  Description copied from class: `CellLabelProvider`
  Update the label for cell.

  Specified by:
    `update` in class `CellLabelProvider`
  Parameters:
    `cell` - `ViewerCell`

### erase

    protected void erase(Event event,
                         Object element)

  Handle the erase event. The default implementation colors the background of selected areas with `SWT.COLOR_LIST_SELECTION` and foregrounds with `SWT.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 event
    `element` - 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 event
    `element` - the model element
  See Also:
    `SWT.MeasureItem`

### paint

    protected abstract void paint(Event event,
                                  Object element)

  Handle the paint event.

  Parameters:
    `event` - the paint event
    `element` - 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 from `initialize(ColumnViewer, ViewerColumn)` and `dispose(ColumnViewer, ViewerColumn)` but may be called from subclasses to enable or disable owner draw dynamically.

  Parameters:
    `viewer` - the viewer
    `column` - the column, or `null` if a column is not available
    `enabled` - `true` if owner draw should be enabled, `false` otherwise
  Since:
    3.4

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.