net.refractions.udig.project.ui.controls
Class FeatureTableControl

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

public class FeatureTableControl
extends java.lang.Object

A TreeViewer control for viewing a table of SimpleFeature 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 DefaultFeatureCollection. In this case the control hangs on to a reference to the DefaultFeatureCollection and populates the table entries directory from it. This method results in a single page containing all features.

TODO: Create next and first action

Since:
0.3
Author:
jdeolive

Constructor Summary
FeatureTableControl()
          Construct FeatureTableControl.
FeatureTableControl( fReader, int resPerPage)
          Construct a FeatureTableControl.
FeatureTableControl(DefaultFeatureCollection features)
          Construct FeatureTableControl.
 
Method Summary
 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.
 java.util.List<SimpleFeature> getFeatures()
          Contents of the current page of features
 int getPageSize()
          Returns the number of features viewed in the table per page.
 TableViewer getTableViewer()
          The TableViewer used is returned...
 void next()
          Moves the control to the next page of features.
protected  void nextInternal()
          Moves the control to the next page of features.
 void reset()
          Reset to start of FeatureResutls
 void setFeatures( reader)
          Set up for a one time only paged access
 void setFocus()
          Does nothing.
 void setPageSize(int resPerPage)
          Sets the number of features viewed in the table per page.
 void update()
          Updates the table control with the current set of features.
protected  void updateTable()
          Updates the table by adding/removing columns.
 
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(DefaultFeatureCollection features)
Construct FeatureTableControl.

Parameters:
features - The DefaultFeatureCollection containing the features to be displayed.

FeatureTableControl

public FeatureTableControl( fReader,
                           int resPerPage)
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.
See Also:
Control

createTableControl

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

Parameters:
parent - The to be parent of the control.
See Also:
Composite

next

public void next()
Moves the control to the next page of features. This method should only be called if the control was created from a org.geotools.data.FeatureReader.


nextInternal

protected void nextInternal()
Moves the control to the next page of features.


update

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

This method will ensure that the column information gets updated


updateTable

protected void updateTable()
Updates the table by adding/removing columns. TableViewer doesn't support updating columns based on the data set supplied so this is a way around it that works nicely.


createTableViewer

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

Parameters:
parent - Makes A TableViewer which diplays the features.
See Also:
Composite

getTableViewer

public TableViewer getTableViewer()
The TableViewer used is returned... would be used for adding listeners and various other things to the tableViewer

Returns:
TableViewer

setFocus

public void setFocus()
Does nothing.

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

getFeatures

public java.util.List<SimpleFeature> getFeatures()
Contents of the current page of features

Returns:
DefaultFeatureCollection
See Also:
DefaultFeatureCollection

setFeatures

public void setFeatures( reader)
Set up for a one time only paged access

Parameters:
reader -
See Also:
API should this throw exceptions? the answer also potentially propagates the issue and the question ... API is there a memory issue here?

reset

public void reset()
Reset to start of FeatureResutls


clear

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