Commons

org.topcased.facilities.widgets
Class ComboViewer

java.lang.Object
  extended by org.eclipse.jface.viewers.Viewer
      extended by org.eclipse.jface.viewers.ContentViewer
          extended by org.eclipse.jface.viewers.StructuredViewer
              extended by org.eclipse.jface.viewers.AbstractListViewer
                  extended by org.topcased.facilities.widgets.ComboViewer
All Implemented Interfaces:
org.eclipse.jface.viewers.IInputProvider, org.eclipse.jface.viewers.IInputSelectionProvider, org.eclipse.jface.viewers.IPostSelectionProvider, org.eclipse.jface.viewers.ISelectionProvider

public final class ComboViewer
extends org.eclipse.jface.viewers.AbstractListViewer

A concrete viewer based either on an SWT Combo control or CCombo 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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewer
org.eclipse.jface.viewers.StructuredViewer.ColorAndFontCollector, org.eclipse.jface.viewers.StructuredViewer.ColorAndFontCollectorWithProviders
 
Field Summary
 
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
 
Constructor Summary
ComboViewer(org.eclipse.swt.custom.CCombo list)
          Creates a combo viewer on the given CCombo control.
ComboViewer(org.eclipse.swt.widgets.Combo list)
          Creates a combo viewer on the given combo control.
ComboViewer(org.eclipse.swt.widgets.Composite parent)
          Creates a combo viewer on a newly-created combo control under the given parent.
ComboViewer(org.eclipse.swt.widgets.Composite parent, int style)
          Creates a combo viewer on a newly-created combo control under the given parent.
 
Method Summary
 org.eclipse.swt.custom.CCombo getCCombo()
          Returns this list viewer's list control.
 org.eclipse.swt.widgets.Combo getCombo()
          Returns this list viewer's list control.
 org.eclipse.swt.widgets.Control getControl()
           
protected  void listAdd(java.lang.String string, int index)
           
protected  void listDeselectAll()
           
protected  int listGetItemCount()
           
protected  int[] listGetSelectionIndices()
           
protected  void listRemove(int index)
           
protected  void listRemoveAll()
           
protected  void listSetItem(int index, java.lang.String string)
           
protected  void listSetItems(java.lang.String[] labels)
           
protected  void listSetSelection(int[] ixs)
           
protected  void listShowSelection()
           
 void reveal(java.lang.Object element)
          Do nothing -- combos only display the selected element, so there is no way we can ensure that the given element is visible without changing the selection.
 
Methods inherited from class org.eclipse.jface.viewers.AbstractListViewer
add, add, doFindInputItem, doFindItem, doUpdateItem, getElementAt, getLabelProvider, getSelectionFromWidget, indexForElement, inputChanged, insert, internalRefresh, listGetTopIndex, listSetTopIndex, remove, remove, setLabelProvider, setSelectionToWidget
 
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
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, setComparator, setComparer, setContentProvider, setFilters, setInput, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMap
 
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getInput, 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(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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

ComboViewer

public ComboViewer(org.eclipse.swt.custom.CCombo list)
Creates a combo viewer on the given CCombo control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
list - the CCombo control
Method Detail

listAdd

protected void listAdd(java.lang.String string,
                       int index)
Specified by:
listAdd in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listAdd(java.lang.String, int)

listSetItem

protected void listSetItem(int index,
                           java.lang.String string)
Specified by:
listSetItem in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listSetItem(int, java.lang.String)

listGetSelectionIndices

protected int[] listGetSelectionIndices()
Specified by:
listGetSelectionIndices in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listGetSelectionIndices()

listGetItemCount

protected int listGetItemCount()
Specified by:
listGetItemCount in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listGetItemCount()

listSetItems

protected void listSetItems(java.lang.String[] labels)
Specified by:
listSetItems in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listSetItems(java.lang.String[])

listRemoveAll

protected void listRemoveAll()
Specified by:
listRemoveAll in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listRemoveAll()

listRemove

protected void listRemove(int index)
Specified by:
listRemove in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listRemove(int)

getControl

public org.eclipse.swt.widgets.Control getControl()
Specified by:
getControl in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.getControl()

getCCombo

public org.eclipse.swt.custom.CCombo getCCombo()
Returns this list viewer's list control.

Returns:
the list control
Throws:
java.lang.IllegalArgumentException -
  • ERROR_INVALID_ARGUMENT - if this viewer has been created on a combo control

getCombo

public org.eclipse.swt.widgets.Combo getCombo()
Returns this list viewer's list control.

Returns:
the list control
Throws:
java.lang.IllegalArgumentException -
  • ERROR_INVALID_ARGUMENT - if this viewer has been created on a CCombo control

reveal

public void reveal(java.lang.Object element)
Do nothing -- combos only display the selected element, so there is no way we can ensure that the given element is visible without changing the selection. Method defined on StructuredViewer.

Specified by:
reveal in class org.eclipse.jface.viewers.StructuredViewer
See Also:
StructuredViewer.reveal(java.lang.Object)

listSetSelection

protected void listSetSelection(int[] ixs)
Specified by:
listSetSelection in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listSetSelection(int[])

listDeselectAll

protected void listDeselectAll()
Specified by:
listDeselectAll in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listDeselectAll()

listShowSelection

protected void listShowSelection()
Specified by:
listShowSelection in class org.eclipse.jface.viewers.AbstractListViewer
See Also:
AbstractListViewer.listShowSelection()

Commons

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.