Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.ui.io.source
Class AbstractProviderSource<P extends ImportProvider>

java.lang.Object
  extended by eu.esdihumboldt.hale.ui.io.source.AbstractSource<P>
      extended by eu.esdihumboldt.hale.ui.io.source.AbstractProviderSource<P>
Type Parameters:
P - the supported IOProvider type
All Implemented Interfaces:
ImportSource<P>
Direct Known Subclasses:
AbstractWFSSource, FileSource, PresetsSource, URLSource

public abstract class AbstractProviderSource<P extends ImportProvider>
extends AbstractSource<P>

Abstract ImportSource implementation offering provider selection.

Since:
2.5
Author:
Simon Templer

Nested Class Summary
 
Nested classes/interfaces inherited from interface eu.esdihumboldt.hale.ui.io.ImportSource
ImportSource.SourceConfiguration<P extends ImportProvider>
 
Constructor Summary
AbstractProviderSource()
           
 
Method Summary
protected  org.eclipse.jface.viewers.ComboViewer createProviders(org.eclipse.swt.widgets.Composite parent)
          Create the provider selector combo viewer.
protected  org.eclipse.jface.viewers.ComboViewer getProviders()
          Get the provider selector combo viewer.
protected abstract  LocatableInputSupplier<? extends InputStream> getSource()
          Get the source to configure the import provider with.
protected abstract  boolean isValidSource()
          Determines if the current page state will result in a valid source for the import provider.
protected  void onProviderSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
          Called when the provider selection changes.
 boolean updateConfiguration(P provider)
          Configures the provider with the input supplier obtained using getSource() as source.
protected  void updateContentType()
          Update the content type.

The default implementation only calls updateProvider().
protected  void updateProvider()
          Update the provider selector when the content type has changed.
protected  void updateState(boolean updateContentType)
          Update the page state.
 
Methods inherited from class eu.esdihumboldt.hale.ui.io.source.AbstractSource
dispose, getConfiguration, getPage, onActivate, setConfiguration, setPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface eu.esdihumboldt.hale.ui.io.ImportSource
createControls
 

Constructor Detail

AbstractProviderSource

public AbstractProviderSource()
Method Detail

createProviders

protected org.eclipse.jface.viewers.ComboViewer createProviders(org.eclipse.swt.widgets.Composite parent)
Create the provider selector combo viewer. Once created it can be retrieved using getProviders(). This should be called in ImportSource.createControls(Composite).

Parameters:
parent - the parent composite
Returns:
the created combo viewer

onProviderSelectionChanged

protected void onProviderSelectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Called when the provider selection changes.

Parameters:
event - the selection changed event

getProviders

protected org.eclipse.jface.viewers.ComboViewer getProviders()
Get the provider selector combo viewer.

Returns:
the combo viewer with the I/O providers

updateProvider

protected void updateProvider()
Update the provider selector when the content type has changed. This is based on the content type stored in the source configuration.


updateState

protected void updateState(boolean updateContentType)
Update the page state. This includes setting a provider factory on the wizard if applicable and setting the complete state of the page.

This should be called in ImportSource.createControls(Composite) to initialize the page state.

Parameters:
updateContentType - if true the content type and the supported providers will be updated before updating the page state

updateContentType

protected void updateContentType()
Update the content type.

The default implementation only calls updateProvider(). Subclasses may add logic to change the content type in the source configuration.


updateConfiguration

public boolean updateConfiguration(P provider)
Configures the provider with the input supplier obtained using getSource() as source.

Specified by:
updateConfiguration in interface ImportSource<P extends ImportProvider>
Overrides:
updateConfiguration in class AbstractSource<P extends ImportProvider>
Parameters:
provider - the I/O provider to update
Returns:
if the source is valid and updating the provider was successful
See Also:
AbstractSource.updateConfiguration(ImportProvider), getSource()

getSource

protected abstract LocatableInputSupplier<? extends InputStream> getSource()
Get the source to configure the import provider with.

Returns:
the input supplier as source for the import provider or null if no valid source can be created
See Also:
isValidSource()

isValidSource

protected abstract boolean isValidSource()
Determines if the current page state will result in a valid source for the import provider. Used among others to determine the complete state of the wizard page.

Returns:
if the source is valid
See Also:
getSource()

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d