org.mockcentral.editor.viewers
Class TableViewerAdapter

java.lang.Object
  extended by org.mockcentral.editor.viewers.TableViewerAdapter
All Implemented Interfaces:
org.mockcentral.editor.nodes.IMockCentralGroupNodeModelObserver

public class TableViewerAdapter
extends java.lang.Object
implements org.mockcentral.editor.nodes.IMockCentralGroupNodeModelObserver

An adapter class that wraps a TableViewer and implements the IMockCentralGroupNodeModelObserver interface.

Author:
David Hutchinson

Constructor Summary
TableViewerAdapter(org.eclipse.swt.widgets.Table table, org.eclipse.jface.viewers.ITableLabelProvider labelProvider)
          Creates the embedded TableViewer and sets its content provider to a new instance of the TableContentProvider class, sets the TableViewer's ITableLabelProvider if the supplied label provider argument is not null.
 
Method Summary
 void addDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener listener)
          Adds an IDoubleClickListener to the TableViewer.
 void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Adds an ISelectionChangedListener to the TableViewer.
 void childrenChanged()
           
 int getItemCount()
          Returns the item count for the Table.
 java.lang.Object getSelection()
          Returns the current selection in the TableViewer.
 int getSelectionIndex()
          Returns the index of the current selection in the TableViewer .
 org.eclipse.jface.viewers.TableViewer getViewer()
          Returns the TableViewer.
 void removeDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener listener)
          Removes an IDoubleClickListener from the TableViewer.
 void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Removes an ISelectionChangedListener from the TableViewer.
 void setInput(java.lang.Object input)
          Adapter method to set the input for the TableViewer.
 int size()
          Returns the number of items in the Table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableViewerAdapter

public TableViewerAdapter(org.eclipse.swt.widgets.Table table,
                          org.eclipse.jface.viewers.ITableLabelProvider labelProvider)
Creates the embedded TableViewer and sets its content provider to a new instance of the TableContentProvider class, sets the TableViewer's ITableLabelProvider if the supplied label provider argument is not null.

Parameters:
table - the Table widget with which to create the TableViewer.
labelProvider - the ITableLabelProvider to use, or null if none.
Method Detail

setInput

public void setInput(java.lang.Object input)
Adapter method to set the input for the TableViewer.

Parameters:
input - the input for the TableViewer.

getViewer

public org.eclipse.jface.viewers.TableViewer getViewer()
Returns the TableViewer.

Returns:
the TableViewer.

addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Adds an ISelectionChangedListener to the TableViewer.

Parameters:
listener - the ISelectionChangedListener to add.

removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Removes an ISelectionChangedListener from the TableViewer.

Parameters:
listener - the ISelectionChangedListener to remove.

addDoubleClickListener

public void addDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener listener)
Adds an IDoubleClickListener to the TableViewer.

Parameters:
listener - the IDoubleClickListener to add.

removeDoubleClickListener

public void removeDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener listener)
Removes an IDoubleClickListener from the TableViewer.

Parameters:
listener - the IDoubleClickListener to remove.

childrenChanged

public void childrenChanged()
Specified by:
childrenChanged in interface org.mockcentral.editor.nodes.IMockCentralGroupNodeModelObserver

getSelection

public java.lang.Object getSelection()
Returns the current selection in the TableViewer.

Returns:
the current selection in the TableViewer.

getSelectionIndex

public int getSelectionIndex()
Returns the index of the current selection in the TableViewer .

Returns:
the index of the current selection in the TableViewer .

size

public int size()
Returns the number of items in the Table.

Returns:
the number of items in the Table.

getItemCount

public int getItemCount()
Returns the item count for the Table.

Returns:
the item count for the Table.