Overview

 
Package  Use  Tree  Deprecated  Index  Help 
Eclipse Platform
Release 3.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

org.eclipse.jface.viewers
Class ComboViewer

java.lang.Object
  extended byorg.eclipse.jface.viewers.Viewer
      extended byorg.eclipse.jface.viewers.ContentViewer
          extended byorg.eclipse.jface.viewers.StructuredViewer
              extended byorg.eclipse.jface.viewers.AbstractListViewer
                  extended byorg.eclipse.jface.viewers.ComboViewer

All Implemented Interfaces:
IInputProvider, IInputSelectionProvider, IPostSelectionProvider, ISelectionProvider


public final class ComboViewer
extends AbstractListViewer

A concrete viewer based on an SWT Combo control. This class is intended as an alternative to the JFace ListViewer, which displays its content in a combo box rather than a list. Wherever possible, this class attempts to behave like ListViewer.

This class is designed to be instantiated with a pre-existing SWT combo control and configured with a domain-specific content provider, label provider, element filter (optional), and element sorter (optional).

Since:
3.0
See Also:
ListViewer


Field Summary
 
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
 
Constructor Summary
ComboViewer(Combo list)
          Creates a combo viewer on the given combo control.
ComboViewer(Composite parent)
          Creates a combo viewer on a newly-created combo control under the given parent.
ComboViewer(Composite parent, int style)
          Creates a combo viewer on a newly-created combo control under the given parent.
 
Method Summary
 Combo getCombo()
          Returns this list viewer's list control.
 Control getControl()
          Returns the primary control associated with this viewer.
protected  void listAdd(String string, int index)
          Adds the given string to the underlying widget at the given index
protected  void listDeselectAll()
          Deselects all selected items in the underlying widget.
protected  int listGetItemCount()
          Returns the number of items contained in the underlying widget.
protected  int[] listGetSelectionIndices()
          Returns the zero-relative indices of the items which are currently selected in the underlying widget.
protected  void listRemove(int index)
          Removes the item from the underlying widget at the given zero-relative index.
protected  void listRemoveAll()
          Removes all of the items from the underlying widget.
protected  void listSetItem(int index, String string)
          Sets the text of the item at the given index in the underlying widget.
protected  void listSetItems(String[] labels)
          Sets the underlying widget's items to be the given array of items.
protected  void listSetSelection(int[] ixs)
          Selects the items at the given zero-relative indices in the underlying widget.
protected  void listShowSelection()
          Shows the selection.
 void reveal(Object element)
          Ensures that the given element is visible, scrolling the viewer if necessary.
 
Methods inherited from class org.eclipse.jface.viewers.AbstractListViewer
add, add, doFindInputItem, doFindItem, doUpdateItem, getElementAt, getLabelProvider, getSelectionFromWidget, indexForElement, inputChanged, internalRefresh, remove, remove, setLabelProvider, setSelectionToWidget
 
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, associate, disassociate, equals, filter, findItem, fireDoubleClick, fireOpen, firePostSelectionChanged, getComparer, getFilteredChildren, getFilters, getItem, getRawChildren, getRoot, getSelection, getSortedChildren, getSorter, handleDoubleSelect, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, hookControl, internalRefresh, mapElement, needsRefilter, preservingSelection, refresh, refresh, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparer, setContentProvider, setInput, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMap
 
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, handleDispose, labelProviderChanged
 
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
 

Constructor Detail

 

 

ComboViewer

public ComboViewer(Composite parent)

Creates a combo viewer on a newly-created combo control under the given parent. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
parent - the parent control


 

 

ComboViewer

public ComboViewer(Composite parent,
                   int style)

Creates a combo viewer on a newly-created combo control under the given parent. The combo control is created using the given SWT style bits. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
parent - the parent control
style - the SWT style bits


 

 

ComboViewer

public ComboViewer(Combo list)

Creates a combo viewer on the given combo control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
list - the combo control
Method Detail

 

 

listAdd

protected void listAdd(String string,
                       int index)

Description copied from class: AbstractListViewer
Adds the given string to the underlying widget at the given index

Specified by:
listAdd in class AbstractListViewer

Parameters:
string - the string to add
index - position to insert the string into


 

 

listSetItem

protected void listSetItem(int index,
                           String string)

Description copied from class: AbstractListViewer
Sets the text of the item at the given index in the underlying widget.

Specified by:
listSetItem in class AbstractListViewer

Parameters:
index - index to modify
string - new text


 

 

listGetSelectionIndices

protected int[] listGetSelectionIndices()

Description copied from class: AbstractListViewer
Returns the zero-relative indices of the items which are currently selected in the underlying widget. The array is empty if no items are selected.

Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.

Specified by:
listGetSelectionIndices in class AbstractListViewer

Returns:
the array of indices of the selected items


 

 

listGetItemCount

protected int listGetItemCount()

Description copied from class: AbstractListViewer
Returns the number of items contained in the underlying widget.

Specified by:
listGetItemCount in class AbstractListViewer

Returns:
the number of items


 

 

listSetItems

protected void listSetItems(String[] labels)

Description copied from class: AbstractListViewer
Sets the underlying widget's items to be the given array of items.

Specified by:
listSetItems in class AbstractListViewer

Parameters:
labels - the array of label text


 

 

listRemoveAll

protected void listRemoveAll()

Description copied from class: AbstractListViewer
Removes all of the items from the underlying widget.

Specified by:
listRemoveAll in class AbstractListViewer


 

 

listRemove

protected void listRemove(int index)

Description copied from class: AbstractListViewer
Removes the item from the underlying widget at the given zero-relative index.

Specified by:
listRemove in class AbstractListViewer

Parameters:
index - the index for the item


 

 

getControl

public Control getControl()

Description copied from class: Viewer
Returns the primary control associated with this viewer.

Specified by:
getControl in class AbstractListViewer


 

 

getCombo

public Combo getCombo()

Returns this list viewer's list control.

Returns:
the list control


 

 

reveal

public void reveal(Object element)

Description copied from class: StructuredViewer
Ensures that the given element is visible, scrolling the viewer if necessary. The selection is unchanged.

Specified by:
reveal in class StructuredViewer

Parameters:
element - the element to reveal


 

 

listSetSelection

protected void listSetSelection(int[] ixs)

Description copied from class: AbstractListViewer
Selects the items at the given zero-relative indices in the underlying widget. The current selection is cleared before the new items are selected.

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.

Specified by:
listSetSelection in class AbstractListViewer

Parameters:
ixs - the indices of the items to select


 

 

listDeselectAll

protected void listDeselectAll()

Description copied from class: AbstractListViewer
Deselects all selected items in the underlying widget.

Specified by:
listDeselectAll in class AbstractListViewer


 

 

listShowSelection

protected void listShowSelection()

Description copied from class: AbstractListViewer
Shows the selection. If the selection is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the selection is visible.

Specified by:
listShowSelection in class AbstractListViewer


 

Overview

 
Package  Use  Tree  Deprecated  Index  Help 
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.