net.refractions.udig.ui
Class FeatureTableControl

java.lang.Object
  extended by net.refractions.udig.ui.FeatureTableControl

public class FeatureTableControl
extends java.lang.Object

A TreeViewer control for viewing a table of Feature attributes.

This object can be created in two ways. The first is using a FeatureReader. This method reads in Features a page at a time and populates the table entries. The page size can be set by calling FeatureTableControl#setPageSize(int).

The second way is using a FeatureCollection. In this case the control hangs on to a reference to the FeatureCollection and populates the table entries directory from it. This method results in a single page containing all features.

TODO: make this a virtual table that only loads the visible region.

Since:
0.3
Author:
jdeolive

Constructor Summary
FeatureTableControl()
          Construct FeatureTableControl.
FeatureTableControl(Composite parent, FeatureCollection features)
          Construct a FeatureTableControl.
 
Method Summary
 void addSelectionChangedListener(ISelectionChangedListener listener)
           
 void clear()
          Don't display nothing :-)
 void createTableControl(Composite parent)
          Creates the table control.
protected  void createTableViewer(Composite parent)
          Creates the table control itself.
 Control getControl()
          Returns the control representing the table control.
 FeatureCollection getFeatures()
          Contents of the current page of features
 int getPageSize()
          Returns the number of features viewed in the table per page.
 ISelection getSelection()
           
 void message(java.lang.String text)
           
 void removeSelectionChangedListener(ISelectionChangedListener listener)
           
 void setFeatures(FeatureCollection features)
          Set up for a single page of content
 void setFocus()
          Does nothing.
 void setPageSize(int resPerPage)
          Sets the number of features viewed in the table per page.
 void setSelection(ISelection selection)
           
 void update()
          Updates the table control with the current set of features.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureTableControl

public FeatureTableControl()
Construct FeatureTableControl.

Must call setFeatures before use.


FeatureTableControl

public FeatureTableControl(Composite parent,
                           FeatureCollection features)
Construct a FeatureTableControl.

Parameters:
fReader - The FeatureReader that returns the actual features.
resPerPage - Results per page to be shown in the table.
Method Detail

setPageSize

public void setPageSize(int resPerPage)
Sets the number of features viewed in the table per page.

Parameters:
resPerPage - positive integer.

getPageSize

public int getPageSize()
Returns the number of features viewed in the table per page.

Returns:
positive integer.

getControl

public Control getControl()
Returns the control representing the table control.

Returns:
The internal table viewer control.

createTableControl

public void createTableControl(Composite parent)
Creates the table control.

Parameters:
parent - The to be parent of the control.

update

public void update()
Updates the table control with the current set of features.

This method will ensure that the column information gets updated


createTableViewer

protected void createTableViewer(Composite parent)
Creates the table control itself.

Parameters:
parent -

setFocus

public void setFocus()
Does nothing.

See Also:
org.eclipse.ui.IWorkbenchPart#setFocus()

getFeatures

public FeatureCollection getFeatures()
Contents of the current page of features

Returns:

setFeatures

public void setFeatures(FeatureCollection features)
Set up for a single page of content


clear

public void clear()
Don't display nothing :-)


message

public void message(java.lang.String text)

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)

getSelection

public ISelection getSelection()

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)

setSelection

public void setSelection(ISelection selection)