|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jface.viewers.Viewer org.eclipse.jface.viewers.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.
A viewer's model consists of elements, represented by objects. A viewer defines and implements generic infrastructure for handling model input, updates, and selections in terms of elements. Input is obtained by querying an IContentProvider which returns elements. The elements themselves are not displayed directly. They are mapped to labels, containing text and/or an image, using the viewer's ILabelProvider.
Implementing a concrete content viewer typically involves the following steps:
Field Summary |
Fields inherited from class org.eclipse.jface.viewers.Viewer |
WIDGET_DATA_KEY |
Constructor Summary | |
protected | ContentViewer()
Creates a content viewer with no input, no content provider, and a default label provider. |
Method Summary | |
IContentProvider | getContentProvider()
Returns the content provider used by this viewer, or null if this view does not yet have a content provider. |
Object | getInput()
The ContentViewer implementation of this IInputProvider method returns the current input of this viewer, or null if none. |
IBaseLabelProvider | getLabelProvider()
Returns the label provider used by this viewer. |
protected void | handleDispose(DisposeEvent event)
Handles a dispose event on this viewer's control. |
protected void | handleLabelProviderChanged(LabelProviderChangedEvent event)
Handles a label provider changed event. |
protected void | hookControl(Control control)
Adds event listener hooks to the given control. |
protected void | labelProviderChanged()
Notifies that the label provider has changed. |
void | setContentProvider(IContentProvider contentProvider)
Sets the content provider used by this viewer. |
void | setInput(Object input)
The ContentViewer implementation of this Viewer method invokes inputChanged on the content provider and then the inputChanged hook method. |
void | setLabelProvider(IBaseLabelProvider labelProvider)
Sets the label provider for this viewer. |
Methods inherited from class org.eclipse.jface.viewers.Viewer |
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getControl, getData, getSelection, handleHelpRequest, inputChanged, refresh, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection, setSelection |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ContentViewer()
Method Detail |
public IContentProvider getContentProvider()
The ContentViewer implementation of this method returns the content provider recorded is an internal state variable. Overriding this method is generally not required; however, if overriding in a subclass, super.getContentProvider must be invoked.
public Object getInput()
public IBaseLabelProvider getLabelProvider()
The ContentViewer implementation of this method returns the label provider recorded in an internal state variable; if none has been set (with setLabelProvider) a SimpleLabelProvider will be created, remembered, and returned. Overriding this method is generally not required; however, if overriding in a subclass, super.getLabelProvider must be invoked.
protected void handleDispose(DisposeEvent event)
The ContentViewer implementation of this method disposes of this viewer's label provider and content provider (if it has one). Subclasses should override this method to perform any additional cleanup of resources; however, overriding methods must invoke super.handleDispose.
protected void handleLabelProviderChanged(LabelProviderChangedEvent event)
The ContentViewer implementation of this method calls labelProviderChanged() to cause a complete refresh of the viewer. Subclasses may reimplement or extend.
protected void hookControl(Control control)
All subclasses must call this method when their control is first established.
The ContentViewer implementation of this method hooks dispose events for the given control. Subclasses may override if they need to add other control hooks; however, super.hookControl must be invoked.
protected void labelProviderChanged()
The ContentViewer implementation of this method calls refresh(). Subclasses may reimplement or extend.
public void setContentProvider(IContentProvider contentProvider)
The ContentViewer implementation of this method records the content provider in an internal state variable. Overriding this method is generally not required; however, if overriding in a subclass, super.setContentProvider must be invoked.
public void setInput(Object input)
public void setLabelProvider(IBaseLabelProvider labelProvider)
The ContentViewer implementation of this method ensures that the given label provider is connected to this viewer and the former label provider is disconnected from this viewer. Overriding this method is generally not required; however, if overriding in a subclass, super.setLabelProvider must be invoked.
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.