net.refractions.udig.catalog.service.database
Class TableSelectionTab

java.lang.Object
  extended by net.refractions.udig.catalog.service.database.TableSelectionTab
All Implemented Interfaces:
Tab

public class TableSelectionTab
extends java.lang.Object
implements Tab

A composite that helps a user select a set of tables in a database. It provides various methods to for filtering the tables.

Since:
1.1.0
Author:
jesse

Nested Class Summary
 class TableSelectionTab.FilteringContentProvider
          Filters the input based on the textbox and the button states in TableSelectionTab
 class TableSelectionTab.TableLabelProvider
          Displays the postgis table name in the first column and the geometry type in the second.
 
Constructor Summary
TableSelectionTab(DatabaseServiceDialect dialect)
           
 
Method Summary
 void addListener(Listener modifyListener)
          Fires an SWT.Modify method when something has changed that may change the state of the tab as recognizable by calling Tab.getParams(Map) and Tab.getResourceIDs(Map).
 Control createControl(Composite parent, int style)
          Creates the control.
  getParams(java.util.Map<java.lang.String,java.io.Serializable> params)
          Returns the connection parameters as known by the caller.
 java.util.Collection<java.net.URL> getResourceIDs(java.util.Map<java.lang.String,java.io.Serializable> params)
          Return the ids of the selected IGeoResource (if needed)
 void init()
          Called when the containing page has just been shown.
 boolean leavingPage()
          Called by the PostgisConnectionPage as the page is about to be left if the tab is active
 void setTableInput(java.util.Collection<TableDescriptor> tables)
          Sets the input in the table viewer so it will display the collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableSelectionTab

public TableSelectionTab(DatabaseServiceDialect dialect)
Method Detail

init

public void init()
Description copied from interface: Tab
Called when the containing page has just been shown. The tab should clear cached information

Specified by:
init in interface Tab

createControl

public Control createControl(Composite parent,
                             int style)
Creates the control. The style is the style passed to the main composite.

Parameters:
parent - the parent composite
style - the style to pass to the top level composite.
Returns:
the top level control

setTableInput

public void setTableInput(java.util.Collection<TableDescriptor> tables)
Sets the input in the table viewer so it will display the collection

Parameters:
tables - the table information to display.

getParams

public  getParams(java.util.Map<java.lang.String,java.io.Serializable> params)
Description copied from interface: Tab
Returns the connection parameters as known by the caller.

Specified by:
getParams in interface Tab
Parameters:
params - the basic parameters for connecting to a database. The tab can augment the params.
Returns:
An error message or a map of connection parameters if all goes right.

leavingPage

public boolean leavingPage()
Description copied from interface: Tab
Called by the PostgisConnectionPage as the page is about to be left if the tab is active

There are two main use cases for this method. The first is to save settings for the next time the wizard is visited. The other is to perform some checks or do some loading that is too expensive to do every time isPageComplete() is called. For example a database wizard page might try to connect to the database in this method rather than isPageComplete() because it is such an expensive method to call.

If an expensive method is called make sure to run it in the container:

getContainer().run(true, cancelable, runnable);

Specified by:
leavingPage in interface Tab
Returns:
true if it is acceptable to leave the page false if the page must not be left

getResourceIDs

public java.util.Collection<java.net.URL> getResourceIDs(java.util.Map<java.lang.String,java.io.Serializable> params)
Description copied from interface: Tab
Return the ids of the selected IGeoResource (if needed)

Specified by:
getResourceIDs in interface Tab
Parameters:
params - the params used for connecting to the database. It must be a valid set of Postgis params.
Returns:
the ids of the selected IGeoResources

addListener

public void addListener(Listener modifyListener)
Description copied from interface: Tab
Fires an SWT.Modify method when something has changed that may change the state of the tab as recognizable by calling Tab.getParams(Map) and Tab.getResourceIDs(Map). When an event is fired the owner of the tab should call Tab.getParams(Map) and Tab.getResourceIDs(Map) again.

Specified by:
addListener in interface Tab