net.sf.jeters.components
Class DefaultGUI

java.lang.Object
  extended by net.sf.jeters.util.AssistedComponent
      extended by net.sf.jeters.components.DefaultGUI
All Implemented Interfaces:
Component, UIComponent, UIComponent_HomeView, Configurable, Translatable

public class DefaultGUI
extends AssistedComponent
implements UIComponent_HomeView

the default implementation of a graphical UI component for JETERS. For a command line UI, see DefaultCLI.

Author:
Tobias Knerr

Constructor Summary
DefaultGUI()
           
 
Method Summary
 java.lang.String confirmChanges(java.lang.String label, java.lang.String oldVersion, java.lang.String newVersion, java.lang.String descriptionOfChanges, boolean allowCancel)
          allows the user to accept/decline changes made by a replacer component (i.e. an implementation of ReplacerComponent).
 void presentHomeView(ComponentManager componentManager)
          This method is called when the program starts and every time a replacement series is completed.
 net.sf.jeters.componentInterface.dataStructs.NamedDataSet request(net.sf.jeters.componentInterface.dataStructs.UIRequest... requests)
          way for other components to communicate with the user via the UI
 void setConfiguration(Configuration configuration)
          sets the configuration for this object.
 void setLanguageResourceBundle(java.util.ResourceBundle langRB)
          sets the ResourceBundle that contains the messages to use
 
Methods inherited from class net.sf.jeters.util.AssistedComponent
getConfiguration, str, str
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGUI

public DefaultGUI()
Method Detail

presentHomeView

public void presentHomeView(ComponentManager componentManager)
Description copied from interface: UIComponent_HomeView
This method is called when the program starts and every time a replacement series is completed. It is a possibility to provide a starting window, where the user can do some or all of the following: It is recommended (but not required) to prevent the user from choosing a set of components which are not compatible with each other (e.g. a replacer component generating only PlainText together with an output component requiring MediaWikiText).

Specified by:
presentHomeView in interface UIComponent_HomeView
Parameters:
componentManager - ComponentManager that will provide information about active and available components; if the user can exchange components using the home view, these changes have to be applied to the component manager.

confirmChanges

public java.lang.String confirmChanges(java.lang.String label,
                                       java.lang.String oldVersion,
                                       java.lang.String newVersion,
                                       java.lang.String descriptionOfChanges,
                                       boolean allowCancel)
allows the user to accept/decline changes made by a replacer component (i.e. an implementation of ReplacerComponent). UIComponents should at least offer the possibility of choosing between the old and the new version of the text. Additionally, they can allow manual editing.

Specified by:
confirmChanges in interface UIComponent
Parameters:
label - a kind of "name" (filename, article title, ...); can be "", but not null.
oldVersion - the text before the replacer's actions; can be "", but not null.
newVersion - the text after the replacer's actions; can be "", but not null.
descriptionOfChanges - an explanation of the differences between oldVersion and newVersion provided by the replacer component; can be "", but not null.
allowCancel - if false, cancelling must not be possible; if true, possibility depends on UI
Returns:
String containing the corrected text as the user wants it, may also be different from both oldVersion and newVersion; null indicates that the user chose to cancel the editing process and is only possible if allowCancel == true.

request

public net.sf.jeters.componentInterface.dataStructs.NamedDataSet request(net.sf.jeters.componentInterface.dataStructs.UIRequest... requests)
Description copied from interface: UIComponent
way for other components to communicate with the user via the UI

Specified by:
request in interface UIComponent
Parameters:
requests - array of UIRequests (can use vararg-syntax). Neither the array nor the array's entries may be null.
Returns:
user's replies to the requests, as a NamedDataSet.
The name of a reply must equal the name of the answered request. null has a special meaning here: It indicates that the user intentionally cancels the request. Otherwise, null must not be returned! If getting proper replies fails, return a NamedDataSet that is empty or contains at least those replies which were properly entered.

setConfiguration

public void setConfiguration(Configuration configuration)
Description copied from interface: Configurable
sets the configuration for this object. The referenced configuration will not change after being passed to configurationSet. However, it is possible that setConfiguration is called again. This will not happen during execution of other component methods. Any config passed to setConfiguration is guaranteed to include at least those configuration entries that were included in a previous getConfiguration result, thus you needn't check for missing entries. The object must not rely on this method being called. Instead, it then has to work with a default configuration.

Specified by:
setConfiguration in interface Configurable
Overrides:
setConfiguration in class AssistedComponent
Parameters:
configuration - configuration to be used by the component; not null

setLanguageResourceBundle

public void setLanguageResourceBundle(java.util.ResourceBundle langRB)
Description copied from interface: Translatable
sets the ResourceBundle that contains the messages to use

Specified by:
setLanguageResourceBundle in interface Translatable
Overrides:
setLanguageResourceBundle in class AssistedComponent
Parameters:
langRB - ResourceBundle to retrieve Strings from