|
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
A viewer is a model-based adapter on a widget.
A viewer can be created as an adapter on a pre-existing control (e.g., creating a ListViewer on an existing List control). All viewers also provide a convenience constructor for creating the control.
Implementing a concrete viewer typically involves the following steps:
Field Summary | |
protected static String | WIDGET_DATA_KEY
Unique key for associating element data with widgets. |
Constructor Summary | |
protected | Viewer()
Creates a new viewer. |
Method Summary | |
void | addHelpListener(HelpListener listener)
Adds a listener for help requests in this viewer. |
void | addSelectionChangedListener(ISelectionChangedListener listener)
Adds a listener for selection changes in this selection provider. |
protected void | fireHelpRequested(HelpEvent event)
Notifies any help listeners that help has been requested. |
protected void | fireSelectionChanged(SelectionChangedEvent event)
Notifies any selection changed listeners that the viewer's selection has changed. |
abstract Control | getControl()
Returns the primary control associated with this viewer. |
Object | getData(String key)
Returns the value of the property with the given name, or null if the property is not found. |
abstract Object | getInput()
Returns the input. |
abstract ISelection | getSelection()
Returns the current selection for this provider. |
protected void | handleHelpRequest(HelpEvent event)
Handles a help request from the underlying SWT control. |
protected void | inputChanged(Object input,
Object oldInput)
Internal hook method called when the input to this viewer is initially set or subsequently changed. |
abstract void | refresh()
Refreshes this viewer completely with information freshly obtained from this viewer's model. |
void | removeHelpListener(HelpListener listener)
Removes the given help listener from this viewer. |
void | removeSelectionChangedListener(ISelectionChangedListener listener)
Removes the given selection change listener from this selection provider. |
Item | scrollDown(int x,
int y)
Scrolls the viewer's control down by one item from the given display-relative coordinates. |
Item | scrollUp(int x,
int y)
Scrolls the viewer's control up by one item from the given display-relative coordinates. |
void | setData(String key,
Object value)
Sets the value of the property with the given name to the given value, or to null if the property is to be removed. |
abstract void | setInput(Object input)
Sets or clears the input for this viewer. |
void | setSelection(ISelection selection)
The viewer implementation of this ISelectionProvider method make the new selection for this viewer without making it visible. |
abstract void | setSelection(ISelection selection,
boolean reveal)
Sets a new selection for this viewer and optionally makes it visible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final String WIDGET_DATA_KEY
Constructor Detail |
protected Viewer()
Method Detail |
public void addHelpListener(HelpListener listener)
public void addSelectionChangedListener(ISelectionChangedListener listener)
protected void fireHelpRequested(HelpEvent event)
protected void fireSelectionChanged(SelectionChangedEvent event)
public abstract Control getControl()
public Object getData(String key)
The default implementation performs a (linear) search of an internal table. Overriding this method is generally not required if the number of different keys is small. If a more efficient representation of a viewer's properties is required, override both getData and setData.
public abstract Object getInput()
public abstract ISelection getSelection()
protected void handleHelpRequest(HelpEvent event)
protected void inputChanged(Object input, Object oldInput)
The default implementation does nothing. Subclassers may override this method to do something when a viewer's input is set. A typical use is populate the viewer.
public abstract void refresh()
public void removeHelpListener(HelpListener listener)
public void removeSelectionChangedListener(ISelectionChangedListener listener)
public Item scrollDown(int x, int y)
public Item scrollUp(int x, int y)
public void setData(String key, Object value)
The default implementation records properties in an internal table which is searched linearly. Overriding this method is generally not required if the number of different keys is small. If a more efficient representation of a viewer's properties is required, override both getData and setData.
public abstract void setInput(Object input)
public void setSelection(ISelection selection)
This method is equivalent to setSelection(selection,false).
public abstract void setSelection(ISelection selection, boolean reveal)
Subclasses must implement this method.
|
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.