jeters.components
Class DefaultCUI

java.lang.Object
  extended by jeters.components.DefaultCUI
All Implemented Interfaces:
Component, Configurable, UIComponent

public class DefaultCUI
extends java.lang.Object
implements UIComponent, Configurable

the default implementation of a (very basic) command line UI component for JETERS. For a graphical UI, see DefaultGUI.


Constructor Summary
DefaultCUI()
           
 
Method Summary
 java.lang.String confirmChanges(java.lang.String label, java.lang.String oldVersion, java.lang.String newVersion, java.lang.String descriptionOfChanges)
          allows the user to accept/decline changes made by a replacer component (i.e. an implementation of ReplacerComponent).
 NamedDataSet getConfiguration()
          this method is called to retrieve the current configuration for this component.
 void output(java.lang.String message)
           
 NamedDataSet request(UIRequest... requests)
          way for other components to communicate with the user via the UI
 void setConfiguration(NamedDataSet configurationSet)
          sets the configuration for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCUI

public DefaultCUI()
Method Detail

confirmChanges

public java.lang.String confirmChanges(java.lang.String label,
                                       java.lang.String oldVersion,
                                       java.lang.String newVersion,
                                       java.lang.String descriptionOfChanges)
Description copied from interface: UIComponent
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, ...). This parameter can be "", but not null.
oldVersion - the text before the replacer's actions. This parameter can be "", but not null.
newVersion - the text after the replacer's actions. This parameter can be "", but not null.
descriptionOfChanges - an explanation of the differences between oldVersion and newVersion provided by the replacer component. This parameter can be "", but not null.
Returns:
String object containing the corrected text as the user wants it, may also be different from both oldVersion and newVersion. Not null.

request

public NamedDataSet request(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 UIRequest-objects (can use vararg-syntax). Neither the array nor the array's entries may be null.
Returns:
the user's replies to the requests, as a NamedDataSet.
The name of a reply must equal the name of the answered request. 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.

output

public void output(java.lang.String message)

getConfiguration

public NamedDataSet getConfiguration()
Description copied from interface: Configurable
this method is called to retrieve the current configuration for this component. It will e.g. be used for generating the configuration file.

Specified by:
getConfiguration in interface Configurable
Returns:
configuration data, null is allowed (doesn't make much sense however)

setConfiguration

public void setConfiguration(NamedDataSet configurationSet)
Description copied from interface: Configurable
sets the configuration for this object. If setConfiguration is not called, the component must work properly nevertheless, using default settings.

Specified by:
setConfiguration in interface Configurable
Parameters:
configurationSet - the configuration data to be used by the component if null, the object has to use default settings