public class TelesalesTableViewer
extends org.eclipse.jface.viewers.StructuredViewer
implements org.eclipse.jface.viewers.ICheckable
This class is not intended to be sub-classed outside the viewer framework. It is designed to be instantiated with a pre-existing SWT table control and configured with a domain-specific content provider, table label provider, element filter (optional), and element sorter (optional).
Label providers for table viewers must implement either the ITableLabelProvider or the ILabelProvider interface (see TableViewer.setLabelProvider for more details).
Modifier and Type | Field and Description |
---|---|
static java.lang.String | COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
TelesalesTableViewer(org.eclipse.swt.widgets.Composite parent)
Creates a table viewer on a newly-created table control under the given parent.
|
TelesalesTableViewer(org.eclipse.swt.widgets.Composite parent, int style)
Creates a table viewer on a newly-created table control under the given parent.
|
TelesalesTableViewer(org.eclipse.swt.widgets.Table table)
Creates a table viewer on the given table control.
|
Modifier and Type | Method and Description |
---|---|
void | activateColumn(int col)
Activates the cell editor for the given column.
|
void | activateDefaultColumn()
Activates the default cell editor for the default column.
|
void | add(java.lang.Object element)
Adds the given element to this table viewer.
|
void | add(java.lang.Object[] elements)
Adds the given elements to this table viewer.
|
void | addCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
Adds a listener for changes to the checked state of elements in this viewer.
|
void | cancelEditing()
Cancels a currently active cell editor.
|
void | disableSorter()
This method disables the sorter set using setSorter.
|
protected org.eclipse.swt.widgets.Widget | doFindInputItem(java.lang.Object element)
Returns the widget in this viewer's control which represents the given element if it is the viewer's input.
|
protected org.eclipse.swt.widgets.Widget | doFindItem(java.lang.Object element)
Returns the widget in this viewer's control which represent the given element.
|
protected void | doUpdateItem(org.eclipse.swt.widgets.Widget widget, java.lang.Object element, boolean fullMap)
Copies the attributes of the given element into the given SWT item.
|
void | editElement(java.lang.Object element, int column)
Starts editing the given element.
|
void | enableSorter()
This method enables the disabled sorter.
|
org.eclipse.jface.viewers.CellEditor | getActiveCell()
Returns the active cell editor.
|
java.lang.String | getActiveCellProperty()
Returns the cell property value of the active cell editor.
|
org.eclipse.jface.viewers.CellEditor[] | getCellEditors()
Returns the cell editors of this table viewer.
|
org.eclipse.jface.viewers.ICellModifier | getCellModifier()
Returns the cell modifier of this table viewer.
|
boolean | getChecked(java.lang.Object element)
Returns the checked state of the given element.
|
java.lang.Object[] | getColumnProperties()
Returns the column properties of this table viewer.
|
org.eclipse.swt.widgets.Control | getControl()
Gets table control.
|
boolean | getDefaultElement()
Gets the default element of a table row.
|
java.lang.Object | getElementAt(int index)
Returns the element with the given index from this table viewer.
|
org.eclipse.jface.viewers.IBaseLabelProvider | getLabelProvider()
The table viewer implementation of this Viewer framework method returns the label provider, which in the case of table viewers will be an instance of either ITableLabelProvider or ILabelProvider.
|
protected java.util.List | getSelectionFromWidget()
Retrieves the selection, as a List, from the underlying widget.
|
org.eclipse.swt.widgets.Table | getTable()
Returns this table viewer's table control.
|
void | handleSelect(org.eclipse.swt.events.SelectionEvent event) |
protected void | hookControl(org.eclipse.swt.widgets.Control control)
Adds event listener hooks to the given control.
|
protected int | indexForElement(java.lang.Object element)
Returns the index where the item should be inserted.
|
protected void | inputChanged(java.lang.Object input, java.lang.Object oldInput)
Internal hook method called when the input to this viewer is initially set or subsequently changed.
|
void | insert(java.lang.Object element, int position)
Inserts the given element into this table viewer at the given position.
|
protected void | internalRefresh(java.lang.Object element)
Refreshes this viewer starting at the given element.
|
protected void | internalRefresh(java.lang.Object element, boolean updateLabels)
Refreshes this viewer starting at the given element.
|
boolean | isCellEditorActive()
Returns whether there is an active cell editor.
|
void | remove(java.lang.Object element)
Removes the given element from this table viewer.
|
void | remove(java.lang.Object[] elements)
Removes the given elements from this table viewer.
|
void | removeCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
Removes the given check state listener from this viewer.
|
void | reveal(java.lang.Object element)
Ensures that the given element is visible, scrolling the viewer if necessary.
|
void | setAllChecked(boolean state)
Sets to the given value the checked state for all elements in this viewer.
|
void | setCellEditors(org.eclipse.jface.viewers.CellEditor[] editors)
Sets the cell editors of this table viewer.
|
void | setCellModifier(org.eclipse.jface.viewers.ICellModifier modifier)
Sets the cell modifier of this table viewer.
|
boolean | setChecked(java.lang.Object element, boolean state)
Sets the checked state for the given element in this viewer.
|
void | setColumnProperties(java.lang.String[] columnProperties)
Sets the column properties of this table viewer.
|
void | setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)
The table viewer implementation of this Viewer framework method ensures that the given label provider is an instance of either ITableLabelProvider or ILabelProvider.
|
protected void | setSelectionToWidget(java.util.List list, boolean revealList)
Parlays the given list of selected elements into selections on this viewer's control.
|
public static final java.lang.String COPYRIGHT
public TelesalesTableViewer(org.eclipse.swt.widgets.Composite parent)
public TelesalesTableViewer(org.eclipse.swt.widgets.Composite parent, int style)
public TelesalesTableViewer(org.eclipse.swt.widgets.Table table)
public void add(java.lang.Object[] elements)
This method should be called (by the content provider) when elements have been added to the model. This is in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
public void addCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
public void add(java.lang.Object element)
This method should be called (by the content provider) when a single element has been added to the model. This is 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.
public void cancelEditing()
protected org.eclipse.swt.widgets.Widget doFindInputItem(java.lang.Object element)
This method is internal to the framework; subclasses should not call this method.
protected org.eclipse.swt.widgets.Widget doFindItem(java.lang.Object element)
This method is internal to the framework; subclasses should not call this method.
protected void doUpdateItem(org.eclipse.swt.widgets.Widget widget, java.lang.Object element, boolean fullMap)
This method is internal to the framework; subclasses should not call this method.
public void editElement(java.lang.Object element, int column)
public org.eclipse.jface.viewers.CellEditor[] getCellEditors()
public org.eclipse.jface.viewers.ICellModifier getCellModifier()
public boolean getChecked(java.lang.Object element)
public java.lang.Object[] getColumnProperties()
public org.eclipse.swt.widgets.Control getControl()
public java.lang.Object getElementAt(int index)
This method is internal to the framework.
public org.eclipse.jface.viewers.IBaseLabelProvider getLabelProvider()
protected java.util.List getSelectionFromWidget()
public org.eclipse.swt.widgets.Table getTable()
public void handleSelect(org.eclipse.swt.events.SelectionEvent event)
protected void hookControl(org.eclipse.swt.widgets.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 int indexForElement(java.lang.Object element)
protected void inputChanged(java.lang.Object input, java.lang.Object oldInput)
The default implementation does nothing. subclasses may override this method to do something when a viewer's input is set. A typical use is populate the viewer.
public void insert(java.lang.Object element, int position)
This method should be called (by the content provider) when elements have been added to the model. This is in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
protected void internalRefresh(java.lang.Object element)
protected void internalRefresh(java.lang.Object element, boolean updateLabels)
The default implementation simply calls internalRefresh(element), ignoring updateLabels.
If this method is overridden to do the actual refresh, then internalRefresh(Object element) should simply call internalRefresh(element, true).
public boolean isCellEditorActive()
public void remove(java.lang.Object[] elements)
This method should be called (by the content provider) when elements have been removed from the model. This is in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
public void removeCheckStateListener(org.eclipse.jface.viewers.ICheckStateListener listener)
public void remove(java.lang.Object element)
This method should be called (by the content provider) when a single element has been removed from the model. This is 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.
public void reveal(java.lang.Object element)
public void setAllChecked(boolean state)
public boolean setChecked(java.lang.Object element, boolean state)
public void setCellEditors(org.eclipse.jface.viewers.CellEditor[] editors)
public void setCellModifier(org.eclipse.jface.viewers.ICellModifier modifier)
public void setColumnProperties(java.lang.String[] columnProperties)
public void setLabelProvider(org.eclipse.jface.viewers.IBaseLabelProvider labelProvider)
protected void setSelectionToWidget(java.util.List list, boolean revealList)
Subclasses should override to set their selection based on the given list of elements.
public void activateColumn(int col)
public void activateDefaultColumn()
public boolean getDefaultElement()
public void disableSorter()
public void enableSorter()
public java.lang.String getActiveCellProperty()
public org.eclipse.jface.viewers.CellEditor getActiveCell()