Eclipse Platform
Luna (4.4)

Package org.eclipse.jface.viewers

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

See: Description

Package org.eclipse.jface.viewers Description

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:

    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.

    Eclipse Platform
    Luna (4.4)

    Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.