verinec.adaptation.gui
Class AdaptationModule

java.lang.Object
  extended by verinec.adaptation.gui.AdaptationModule
All Implemented Interfaces:
IConfigurable, IVerinecModule

public class AdaptationModule
extends Object
implements IVerinecModule, IConfigurable

A module to integrate the translator into the GUI.

Author:
david.buchmann at unifr.ch

Nested Class Summary
(package private)  class AdaptationModule.DistributeAction
          Distribute configuration of nodes onto machines.
(package private)  class AdaptationModule.ExportAction
          Export configuration of nodes to files.
(package private)  class AdaptationModule.TransAction
          Base class for export and distribute actions.
(package private)  class AdaptationModule.TranslatorConfig
          Configuration panel for the translation module.
 
Field Summary
private  Document config
          configuration of this module.
private static String configName
          The name for the configuration data used in VerinecStudio.saveConfig(String, Document).
private  IDistributorFactory distFact
          The distributor factory instance.
private static String DISTRIBUTE_ICON
          The icon for distributing configuration.
private static String EXPORT_ICON
          The icon for exporting configuration xml.
(package private)  Logger logger
           
private  VerinecStudio studio
           
private  Translator translator
          The translator instance.
 
Constructor Summary
AdaptationModule()
          Initialise the module.
 
Method Summary
 void distributeConfig(Element e)
          Compile the configuration XML and write it out into a file.
 void exportConfig(Element e)
          Compile the configuration XML and write it out into a file.
 ConfigPanel getConfigPanel()
          Get a configuration dialog.
private  File getExportPath()
           
private  Document getModuleConfig()
          Create the stored configuration for this module.
 void load(VerinecStudio a)
          Hook the module into the gui.
 void saveConfiguration(Document conf)
          Save new configuration
 String toString()
          Return the name of this module: Distributor.
private  Document translate(Element e)
           
 void unload()
          Do clean up when module gets unloaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

Logger logger

DISTRIBUTE_ICON

private static final String DISTRIBUTE_ICON
The icon for distributing configuration. Taken from Bluecurve /usr/share/icons/Bluecurve/64x64/actions/

See Also:
Constant Field Values

EXPORT_ICON

private static final String EXPORT_ICON
The icon for exporting configuration xml. Taken from Bluecurve /usr/share/icons/Bluecurve/64x64/actions/

See Also:
Constant Field Values

studio

private VerinecStudio studio

config

private Document config
configuration of this module.


configName

private static final String configName
The name for the configuration data used in VerinecStudio.saveConfig(String, Document).

See Also:
Constant Field Values

translator

private Translator translator
The translator instance.


distFact

private IDistributorFactory distFact
The distributor factory instance.

Constructor Detail

AdaptationModule

public AdaptationModule()
                 throws VerinecException
Initialise the module. The translator is created using TranslationRepFactory.createRepository() The distributor factory is created with Distribute.createFactory()

Throws:
VerinecException - If the distributor factory or translator can not be instantiated.
Method Detail

toString

public String toString()
Return the name of this module: Distributor.

Specified by:
toString in interface IVerinecModule
Overrides:
toString in class Object
Returns:
Name of this module.

load

public void load(VerinecStudio a)
          throws VerinecException
Hook the module into the gui.

Specified by:
load in interface IVerinecModule
Parameters:
a - The main application.
Throws:
VerinecException - If initializing goes wrong.

unload

public void unload()
Do clean up when module gets unloaded.

Specified by:
unload in interface IVerinecModule

getModuleConfig

private Document getModuleConfig()
Create the stored configuration for this module. If there is none, create default config.

Returns:
A configuration document for the translation module.

getExportPath

private File getExportPath()

translate

private Document translate(Element e)
                    throws VerinecException
Throws:
VerinecException

exportConfig

public void exportConfig(Element e)
                  throws VerinecException
Compile the configuration XML and write it out into a file.

Parameters:
e - A nodes XML definition.
Throws:
VerinecException - If something goes wrong.

distributeConfig

public void distributeConfig(Element e)
                      throws VerinecException
Compile the configuration XML and write it out into a file.

Parameters:
e - A nodes XML definition.
Throws:
VerinecException - If something goes wrong.

getConfigPanel

public ConfigPanel getConfigPanel()
Get a configuration dialog. Displays the path selection for output of XML files.

Specified by:
getConfigPanel in interface IConfigurable
Returns:
null.

saveConfiguration

public void saveConfiguration(Document conf)
Save new configuration

Specified by:
saveConfiguration in interface IConfigurable
Parameters:
conf - The new configuration.

Copyright © 2005 Verinec, DIUF