public abstract class AbstractListViewer extends StructuredViewer
ListViewer
,
ComboViewer
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
WIDGET_DATA_KEY
Constructor and Description |
---|
AbstractListViewer() |
Modifier and Type | Method and Description |
---|---|
void |
add(Object element)
Adds the given element to this list viewer.
|
void |
add(Object[] elements)
Adds the given elements to this list viewer.
|
protected Widget |
doFindInputItem(Object element)
Returns the widget in this viewer's control which represents the given
element if it is the viewer's input.
|
protected Widget |
doFindItem(Object element)
Returns the widget in this viewer's control which represent the given
element.
|
protected void |
doUpdateItem(Widget data,
Object element,
boolean fullMap)
Copies the attributes of the given element into the given SWT item.
|
Object |
getElementAt(int index)
Returns the element with the given index from this list viewer.
|
IBaseLabelProvider |
getLabelProvider()
The list viewer implementation of this
Viewer framework
method returns the label provider, which in the case of list
viewers will be an instance of ILabelProvider . |
protected List |
getSelectionFromWidget()
Retrieves the selection, as a
List , from the underlying
widget. |
protected int |
indexForElement(Object element) |
protected void |
inputChanged(Object input,
Object oldInput)
Internal hook method called when the input to this viewer is
initially set or subsequently changed.
|
void |
insert(Object element,
int position)
Inserts the given element into this list viewer at the given position.
|
protected void |
internalRefresh(Object element)
Refreshes this viewer starting at the given element.
|
protected abstract void |
listAdd(String string,
int index)
Adds the given string to the underlying widget at the given index
|
protected abstract void |
listDeselectAll()
Deselects all selected items in the underlying widget.
|
protected abstract int |
listGetItemCount()
Returns the number of items contained in the underlying widget.
|
protected abstract int[] |
listGetSelectionIndices()
Returns the zero-relative indices of the items which are currently
selected in the underlying widget.
|
protected int |
listGetTopIndex()
Returns the index of the item currently at the top of the viewable area.
|
protected abstract void |
listRemove(int index)
Removes the item from the underlying widget at the given
zero-relative index.
|
protected abstract void |
listRemoveAll()
Removes all of the items from the underlying widget.
|
protected abstract void |
listSetItem(int index,
String string)
Sets the text of the item at the given index in the underlying widget.
|
protected abstract void |
listSetItems(String[] labels)
Sets the underlying widget's items to be the given array of items.
|
protected abstract void |
listSetSelection(int[] ixs)
Selects the items at the given zero-relative indices in the underlying widget.
|
protected void |
listSetTopIndex(int index)
Sets the index of the item to be at the top of the viewable area.
|
protected abstract void |
listShowSelection()
Shows the selection.
|
void |
remove(Object element)
Removes the given element from this list viewer.
|
void |
remove(Object[] elements)
Removes the given elements from this list viewer.
|
void |
setLabelProvider(IBaseLabelProvider labelProvider)
The list viewer implementation of this
Viewer framework
method ensures that the given label provider is an instance of
ILabelProvider . |
protected void |
setSelectionToWidget(List in,
boolean reveal)
Parlays the given list of selected elements into selections on this
viewer's control.
|
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertContentProviderType, assertElementsNotNull, associate, buildLabel, disassociate, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getItem, getRawChildren, getRoot, getSelection, getSortedChildren, getSorter, handleDispose, handleDoubleSelect, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, hookControl, internalRefresh, internalUpdate, mapElement, needsRefilter, preservingSelection, refresh, refresh, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, reveal, setComparator, setComparer, setContentProvider, setFilters, setInput, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMap
getContentProvider, getInput, labelProviderChanged
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getControl, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSelectionChangedListener, removeSelectionChangedListener, setSelection
protected abstract void listAdd(String string, int index)
string
- the string to addindex
- position to insert the string intoprotected abstract void listSetItem(int index, String string)
index
- index to modifystring
- new textprotected abstract int[] listGetSelectionIndices()
Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.
protected abstract int listGetItemCount()
protected abstract void listSetItems(String[] labels)
labels
- the array of label textprotected abstract void listRemoveAll()
protected abstract void listRemove(int index)
index
- the index for the itemprotected abstract void listSetSelection(int[] ixs)
Indices that are out of range and duplicate indices are ignored. If the receiver is single-select and multiple indices are specified, then all indices are ignored.
ixs
- the indices of the items to selectprotected abstract void listShowSelection()
protected abstract void listDeselectAll()
public void add(Object[] elements)
This method should be called (by the content provider) when elements have been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
elements
- the elements to addpublic void insert(Object element, int position)
This method should be called (by the content provider) when elements have been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
element
- the elementposition
- a 0-based position relative to the model, or -1 to indicate
the last positionpublic void add(Object element)
This method should be called (by the content provider) when a single element has been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model. Note that there is another method for efficiently processing the simultaneous addition of multiple elements.
element
- the elementprotected Widget doFindInputItem(Object element)
StructuredViewer
This method is internal to the framework; subclassers should not call this method.
doFindInputItem
in class StructuredViewer
null
if noneprotected Widget doFindItem(Object element)
StructuredViewer
This method is internal to the framework; subclassers should not call this method.
doFindItem
in class StructuredViewer
null
if noneprotected void doUpdateItem(Widget data, Object element, boolean fullMap)
StructuredViewer
fullMap
.
If fullMap
is true
then the current mapping
from element to widgets is removed and the new mapping is added. If
full map is false
then only the new map gets installed.
Installing only the new map is necessary in cases where only the order of
elements changes but not the set of elements.
This method is internal to the framework; subclassers should not call this method.
doUpdateItem
in class StructuredViewer
element
- elementfullMap
- true
if mappings are added and removed, and
false
if only the new map gets installedpublic Object getElementAt(int index)
null
if the index is out of range.index
- the zero-based indexnull
if the
index is out of rangepublic IBaseLabelProvider getLabelProvider()
Viewer
framework
method returns the label provider, which in the case of list
viewers will be an instance of ILabelProvider
.getLabelProvider
in class ContentViewer
protected List getSelectionFromWidget()
StructuredViewer
List
, from the underlying
widget.getSelectionFromWidget
in class StructuredViewer
protected int indexForElement(Object element)
element
- the element to insertprotected void inputChanged(Object input, Object oldInput)
Viewer
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.
inputChanged
in class Viewer
input
- the new input of this viewer, or null
if noneoldInput
- the old input element or null
if there
was previously no inputprotected void internalRefresh(Object element)
StructuredViewer
internalRefresh
in class StructuredViewer
element
- the elementprotected int listGetTopIndex()
Default implementation returns -1.
protected void listSetTopIndex(int index)
Default implementation does nothing.
index
- the given index. -1 for none. index will always refer to a valid index.public void remove(Object[] elements)
This method should be called (by the content provider) when elements have been removed from the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
elements
- the elements to removepublic void remove(Object element)
This method should be called (by the content provider) when a single element has been removed from the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model. Note that there is another method for efficiently processing the simultaneous removal of multiple elements.
element
- the elementpublic void setLabelProvider(IBaseLabelProvider labelProvider)
Viewer
framework
method ensures that the given label provider is an instance of
ILabelProvider
.
The optional interfaces IColorProvider
and
IFontProvider
have no effect for this type of viewersetLabelProvider
in class StructuredViewer
labelProvider
- the label provider, or null
if noneprotected void setSelectionToWidget(List in, boolean reveal)
StructuredViewer
Subclasses should override to set their selection based on the given list of elements.
setSelectionToWidget
in class StructuredViewer
in
- list of selected elements (element type: Object
)
or null
if the selection is to be clearedreveal
- true
if the selection is to be made visible,
and false
otherwise
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.