edu.usc.cse.desi.viewers
Class CollocContentProvider

java.lang.Object
  extended byedu.usc.cse.desi.viewers.CollocContentProvider
All Implemented Interfaces:
java.util.EventListener, org.eclipse.jface.viewers.IContentProvider, org.eclipse.jface.viewers.IStructuredContentProvider, java.beans.PropertyChangeListener

public class CollocContentProvider
extends java.lang.Object
implements org.eclipse.jface.viewers.IStructuredContentProvider, java.beans.PropertyChangeListener

This is the content provider for the table that will display the collocational constraints. It will be a table that has pull-down combo boxes for each cell so that you can decide if the components must be collocated, can be or cannot be.

Author:
NeLs Started on Sep 20, 2004

Field Summary
(package private)  java.lang.Object[] myCategoryNames
           
(package private)  DESIViewModel myModel
           
(package private)  org.eclipse.jface.viewers.TableViewer myTableViewer
           
 
Constructor Summary
CollocContentProvider()
           
 
Method Summary
 void dispose()
          When the table is killed, we must make sure to remove ourselves as a listener to everythin that we're listening to.
 java.lang.Object[] getElements(java.lang.Object arg0)
          This method returns all the components so that the LabelProvider has access to them.
 java.lang.Object[] getMyCategoryNames()
           
 void inputChanged(org.eclipse.jface.viewers.Viewer arg0, java.lang.Object oldInput, java.lang.Object newInput)
          When the input changes, the tables must be resized, all listeners on the old model must be removed and all listeners must be added on the new model.
 void propertyChange(java.beans.PropertyChangeEvent arg0)
          On a property change we must refresh the table if properties have changes, or if the number of components has changed, we must resize the table.
private  void sizeTable(DESIViewModel model, org.eclipse.swt.widgets.Table table)
          Every time something changes that should make the table resize, for instance if the number of comps changes, this method should be called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myTableViewer

org.eclipse.jface.viewers.TableViewer myTableViewer

myModel

DESIViewModel myModel

myCategoryNames

java.lang.Object[] myCategoryNames
Constructor Detail

CollocContentProvider

public CollocContentProvider()
Method Detail

getElements

public java.lang.Object[] getElements(java.lang.Object arg0)
This method returns all the components so that the LabelProvider has access to them.

Specified by:
getElements in interface org.eclipse.jface.viewers.IStructuredContentProvider
See Also:
IStructuredContentProvider.getElements(java.lang.Object)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent arg0)
On a property change we must refresh the table if properties have changes, or if the number of components has changed, we must resize the table. We must respond to component adds and removes and then resize the table. If the data of the link changes or if a link is removed or added then we must refresh the table.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

dispose

public void dispose()
When the table is killed, we must make sure to remove ourselves as a listener to everythin that we're listening to.

Specified by:
dispose in interface org.eclipse.jface.viewers.IContentProvider
See Also:
IContentProvider.dispose()

inputChanged

public void inputChanged(org.eclipse.jface.viewers.Viewer arg0,
                         java.lang.Object oldInput,
                         java.lang.Object newInput)
When the input changes, the tables must be resized, all listeners on the old model must be removed and all listeners must be added on the new model.

Specified by:
inputChanged in interface org.eclipse.jface.viewers.IContentProvider
See Also:
IContentProvider.inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)

getMyCategoryNames

public java.lang.Object[] getMyCategoryNames()
Returns:
Returns the myCategoryNames.

sizeTable

private void sizeTable(DESIViewModel model,
                       org.eclipse.swt.widgets.Table table)
Every time something changes that should make the table resize, for instance if the number of comps changes, this method should be called. It should also be called when the table viewer is first initialized. It is in charge of adding CellEditors to the TableViewer so that the contents of the table can be edited.

Parameters:
model -
table -