# Package org.eclipse.jface.viewers

package org.eclipse.jface.viewers
Provides a framework for viewers, which are model-based content adapters for SWT widgets.

## Package Specification

A viewer is a model-based adapter on an SWT widget. Each viewer has four parts:

> - an input - the object that serves as the viewer's model
> - a widget - the SWT control through which the viewer's model is displayed
> - a content provider - mediates between the model and viewer
> - a label provider - maps model objects to displayable labels containing text and/or an image

This package contains the viewer framework. The viewer framework is an independent JFace module. Using it requires a knowledge of SWT, but does not require familiarity with any of the other JFace modules. The framework consists of abstract base classes for viewers (`Viewer`, `StructuredViewer`, `AbstractTreeViewer`) together with concrete viewer classes (`ListViewer`, `TreeViewer`, `TableViewer`, `TableTreeViewer`, `CheckboxTreeViewer`, and `CheckboxTableViewer`), and various lesser support classes. The concrete structured viewer classes are ready-to-use and have built-in support for drag-and-drop, filtering (`IViewerFilter` and `ViewerFilter`), and sorting (`IViewerSorter` and `ViewerSorter`); these classes may also be subclassed further if required.

In general terms, creating a viewer involves the following steps:

- instantiating a viewer on some pre-existing SWT widget,
- setting the viewer's content provider (an object implementing `IContentProvider`),
- setting the viewer's label provider (an object implementing `ILabelProvider`),
- and, finally, setting the viewer's input.

Once a viewer's input is set, the viewer becomes active. As the model changes, it is the content provider's responsibility to respond to changes to the model by telling the viewer what to change (done by calling add and remove methods on the viewer). An existing viewer may be retargeted by giving it a different object as input; the viewer is responsible for informing the content provider of these kinds of wholesale changes (`IContentProvider.inputChanged`). Also, each viewer registers with its label provider for notification of changes that would affect what the viewer displays (see `ILabelProviderListener.stateChanged`).

Note: None of the classes in this package maintain global state.

Related Packages
Package
Description
org.eclipse.jface.viewers.deferred
Provides a framework for viewers that handle deferred contents.
org.eclipse.jface.viewers.internal
Class
Description
AbstractFilteredViewerComposite<T extends ViewerFilter>
AbstractListViewer
Abstract base class for viewers that contain lists of items (such as a combo or list).
AbstractTableViewer
This is a widget independent class implementors of `Table` like widgets can use to provide a viewer on top of their widget implementations.
AbstractTreeViewer
Abstract base implementation for tree-structure-oriented viewers (trees and table trees).
AcceptAllFilter
Filter that accepts everything.
ArrayContentProvider
This implementation of `IStructuredContentProvider` handles the case where the viewer input is an unchanging array or collection of elements.
BaseLabelProvider
BaseLabelProvider is a default concrete implementation of `IBaseLabelProvider`
BoldStylerProvider
Provides `StyledString.Styler` that applies bold style on the given font.
CellEditor
Abstract base class for cell editors.
CellEditor.LayoutData
Struct-like layout data for cell editors, with reasonable defaults for all fields.
CellLabelProvider
The CellLabelProvider is an abstract implementation of a label provider for structured viewers.
CellNavigationStrategy
This class implementation the strategy how the table is navigated using the keyboard.
CheckboxCellEditor
A cell editor that manages a checkbox.
CheckboxTableViewer
A concrete viewer based on an SWT `Table` control with checkboxes on each node.
CheckboxTreeViewer
A concrete tree-structured viewer based on an SWT `Tree` control with checkboxes on each node.
CheckStateChangedEvent
Event object describing a change to the checked state of a viewer element.
ColorCellEditor
A cell editor that manages a color field.
ColumnLabelProvider
The ColumnLabelProvider is the label provider for viewers that have column support such as `TreeViewer` and `TableViewer`
ColumnLayoutData
An abstract column layout data describing the information needed (by `TableLayout`) to properly lay out a table.
ColumnPixelData
Describes the width of a table column in pixels, and whether the column is resizable.
ColumnViewer
The ColumnViewer is the abstract superclass of viewers that have columns (e.g., AbstractTreeViewer and AbstractTableViewer).
ColumnViewerEditor
This is the base for all editor implementations of Viewers.
ColumnViewerEditorActivationEvent
This event is passed on when a cell-editor is going to be activated
ColumnViewerEditorActivationListener
Parties interested in activation and deactivation of editors extend this class and implement any or all of the methods
ColumnViewerEditorActivationStrategy
This class is responsible to determine if a cell selection event is triggers an editor activation.
ColumnViewerEditorDeactivationEvent
This event is fired when an editor deactivated
ColumnViewerToolTipSupport
The ColumnViewerTooltipSupport is the class that provides tool tips for ColumnViewers.
ColumnWeightData
Describes the width of a table column in terms of a weight, a minimum width, and whether the column is resizable.
ComboBoxCellEditor
A cell editor that presents a list of items in a combo box.
ComboBoxViewerCellEditor
A cell editor that presents a list of items in a combo box.
ComboViewer
A concrete viewer based either on an SWT `Combo` control or `CCombo` control.
ContentViewer
A content viewer is a model-based adapter on a widget which accesses its model by means of a content provider and a label provider.
DecoratingLabelProvider
A decorating label provider is a label provider which combines a nested label provider and an optional decorator.
DecoratingStyledCellLabelProvider
A `DecoratingStyledCellLabelProvider` is a `DelegatingStyledCellLabelProvider` that uses a nested `DelegatingStyledCellLabelProvider.IStyledLabelProvider` to compute styled text label and image and takes a `ILabelDecorator` to decorate the label.
DecorationContext
A concrete implementation of the `IDecorationContext` interface, suitable for instantiating.
DecorationOverlayIcon
A `DecorationOverlayIcon` is an image descriptor that can be used to overlay decoration images on to the 4 corner quadrants of a base image.
DelegatingStyledCellLabelProvider
A `DelegatingStyledCellLabelProvider` is a `StyledCellLabelProvider` that delegates requests for the styled string and the image to a `DelegatingStyledCellLabelProvider.IStyledLabelProvider`.
DelegatingStyledCellLabelProvider.IStyledLabelProvider
Interface marking a label provider that provides styled text labels and images.
DialogCellEditor
An abstract cell editor that uses a dialog.
DoubleClickEvent
Event object describing a double-click.
EditingSupport
EditingSupport is the abstract superclass of the support for cell editing.
FocusCellHighlighter
FocusCellOwnerDrawHighlighter
A concrete implementation of `FocusCellHighlighter` using by setting the control into owner draw mode and highlighting the currently selected cell.
IBaseLabelProvider
A label provider maps an element of the viewer's model to an optional image and optional text string used to display the element in the viewer's control.
IBasicPropertyConstants
Predefined property names used for elements displayed in viewers.
ICellEditorListener
A listener which is notified of significant events in the life of a cell editor.
ICellEditorValidator
An interface for validating a cell editor's input.
ICellModifier
A cell modifier is used to access the data model from a cell editor in an abstract way.
ICheckable
Interface for objects that support elements with a checked state.
ICheckStateListener
A listener which is notified of changes to the checked state of items in checkbox viewers.
ICheckStateProvider
Interface to provide checked and grayed state information about data in trees or tables.
IColorDecorator
The IColorDecorator is an interface for objects that return a color to decorate either the foreground and background colors for displaying an an object.
IColorProvider
Interface to provide color representation for a given element.
IContentProvider
A content provider mediates between the viewer's model and the viewer itself.
IDecoration
Defines the result of decorating an element.
IDecorationContext
A decoration context provides additional information to a label decorator.
IDelayedLabelDecorator
A delayed label decorator is a label decorator that may not have a decoration available immediately.
IDoubleClickListener
A listener which is notified of double-click events on viewers.
IElementComparer
This interface is used to compare elements in a viewer for equality, and to provide the hash code for an element.
IFilter
Interface for filters.
IFontDecorator
The IFontDecorator is an interface for objects that return a font to decorate an object.
IFontProvider
Interface to provide font representation for a given element.
IIndexableLazyContentProvider
Adds efficient element indexing support to ILazyContentProvider.
IInputProvider
Interface common to all objects that provide an input.
IInputSelectionProvider
Interface common to all objects that provide both an input and a selection.
ILabelDecorator
A label decorator decorates the label text and image for some element.
ILabelProvider
Extends `IBaseLabelProvider` with the methods to provide the text and/or image for the label of a given element.
ILabelProviderListener
A listener which is notified when a label provider's state changes.
ILazyContentProvider
The ILazyContentProvider is the content provider for table viewers created using the SWT.VIRTUAL flag that only wish to return their contents as they are queried.
ILazyTreeContentProvider
The ILazyTreeContentProvider is the content provider for tree viewers created using the SWT.VIRTUAL flag that only wish to return their contents as they are queried.
ILazyTreePathContentProvider
The ILazyTreePathContentProvider is a tree path-based content provider for tree viewers created using the SWT.VIRTUAL flag that only wish to return their contents as they are queried.
ILightweightLabelDecorator
The `ILightweightLabelDecorator` is a decorator that decorates using a prefix, suffix and overlay image rather than doing all of the image and text management itself like an `ILabelDecorator`.
IOpenListener
A listener which is notified of open events on viewers.
IPostSelectionProvider
Selection provider extension interface to allow providers to notify about post selection changed events.
ISelection
Interface for a selection.
ISelectionChangedListener
A listener which is notified when a viewer's selection changes.
ISelectionProvider
Interface common to all objects that provide a selection.
IStructuredContentProvider
An interface to content providers for structured viewers.
IStructuredSelection
A selection containing elements.
ITableColorProvider
Interface to provide color representation for a given cell within the row for an element in a table.
ITableFontProvider
The ITableFontProvider is a font provider that provides fonts to individual cells within tables.
ITableLabelProvider
Extends `IBaseLabelProvider` with the methods to provide the text and/or image for each column of a given element.
IToolTipProvider
Interface to provide tool tip information for a given element.
ITreeContentProvider
An interface to content providers for tree-structure-oriented viewers.
ITreePathContentProvider
An interface to content providers for tree-structure-oriented viewers that provides content based on the path of elements in the tree viewer.
ITreePathLabelProvider
An extension to `ILabelProvider` that is given the path of the element being decorated, when it is available.
ITreeSelection
A selection containing tree paths.
ITreeViewerListener
A listener which is notified when a tree viewer expands or collapses a node.
IViewerLabelProvider
Extends `IBaseLabelProvider` with the methods to update the label for a given element.
LabelDecorator
The LabelDecorator is an abstract superclass of ILabelDecorators that support IDecorationContext.
LabelProvider
A label provider implementation which, by default, uses an element's `toString` value for its text and `null` for its image.
LabelProviderChangedEvent
Event object describing a label provider state change.
ListViewer
A concrete viewer based on an SWT `List` control.
NamedHandleObjectLabelProvider
A label provider for instances of `NamedHandlerObject`, which exposes the name as the label.
OpenEvent
Event object describing an open which may be generated from a selection or default selection event.
OwnerDrawLabelProvider
OwnerDrawLabelProvider is an abstract implementation of a label provider that handles custom draw.
SelectionChangedEvent
Event object describing a selection change.
StructuredSelection
A concrete implementation of the `IStructuredSelection` interface, suitable for instantiating.
StructuredViewer
Abstract base implementation for structure-oriented viewers (trees, lists, tables).
StructuredViewerInternals
This class is not part of the public API of JFace.
StructuredViewerInternals.AssociateListener
Nothing to see here.
StyledCellLabelProvider
A `StyledCellLabelProvider` supports styled labels by using owner draw.
StyledString
A mutable string with styled ranges.
StyledString.Styler
A styler will be asked to apply its styles to one ore more ranges in the `StyledString`.
TableColumnViewerLabelProvider
TableColumnViewerLabelProvider is the mapping from the table based providers to the ViewerLabelProvider.
TableLayout
A layout for a table.
TableViewer
A concrete viewer based on a SWT `Table` control.
TableViewerColumn
ViewerColumn implementation for TableViewer to enable column-specific label providers and editing support.
TableViewerEditor
This is an editor-implementation for `Table`
TableViewerFocusCellManager
This class is responsible to provide the concept of cells for `Table`.
TableViewerRow
TableViewerRow is the Table specific implementation of ViewerRow
TextCellEditor
A cell editor that manages a text entry field.
TreeColumnViewerLabelProvider
TreeViewerLabelProvider is the ViewerLabelProvider that handles TreePaths.
TreeExpansionEvent
Event object describing a tree node being expanded or collapsed.
TreeNode
A simple data structure that is useful for implemented tree models.
TreeNodeContentProvider
A content provider that expects every element to be a `TreeNode`.
TreePath
A tree path denotes a model element in a tree viewer.
TreePathViewerComparator
A viewer sorter that is provided extra context in the form of the path of the parent element of the elements being sorted.
TreePathViewerSorter
Deprecated, for removal: This API element is subject to removal in a future version.
Use `TreePathViewerComparator` instead.
TreeSelection
A concrete implementation of the `ITreeSelection` interface, suitable for instantiating.
TreeViewer
A concrete viewer based on an SWT `Tree` control.
TreeViewerColumn
ViewerColumn implementation for TreeViewer to enable column-specific label providers and editing support.
TreeViewerEditor
This is an editor implementation for `Tree`
TreeViewerFocusCellManager
This class is responsible to provide the concept of cells for `Tree`.
TreeViewerRow
TreeViewerRow is the Tree implementation of ViewerRow.
Viewer
A viewer is a model-based adapter on a widget.
ViewerCell
The ViewerCell is the JFace representation of a cell entry in a ViewerRow.
ViewerColumn
Instances of this class represent a column of a `ColumnViewer`.
ViewerComparator
A viewer comparator is used by a `StructuredViewer` to reorder the elements provided by its content provider.
ViewerDropAdapter
This adapter class provides generic drag-and-drop support for a viewer.
ViewerFilter
A viewer filter is used by a structured viewer to extract a subset of elements provided by its content provider.
ViewerLabel
The ViewerLabel is the class that is passed to a viewer to handle updates of labels.
ViewerRow
ViewerRow is the abstract superclass of the part that represents items in a Table or Tree.
ViewerSorter
Deprecated.
use `ViewerComparator` instead.