com.gridsystems.config.tools.console
Class BoolField

java.lang.Object
  extended by com.gridsystems.config.tools.console.Field
      extended by com.gridsystems.config.tools.console.ValueField
          extended by com.gridsystems.config.tools.console.BoolField
All Implemented Interfaces:
ConsoleViewAction

public class BoolField
extends ValueField

Specialized field for boolean values. Its execute method switches its value without extra edition.

Version:
1.0
Author:
Rodrigo Ruiz Aguayo

Field Summary
static java.lang.String FALSE
          String representation of true value.
static java.lang.String TRUE
          String representation of true value.
 
Fields inherited from class com.gridsystems.config.tools.console.ValueField
linePattern, trimmed, value, valueFormater, valuePattern, verifier
 
Fields inherited from class com.gridsystems.config.tools.console.Field
bundle
 
Constructor Summary
BoolField(java.util.ResourceBundle bundle, java.lang.String linePattern)
          Creates a new instance with the specified bundle and pattern.
 
Method Summary
 boolean execute(ConsoleConfiguratorView view)
          Switches the boolean value to its negative.
 boolean getBooleanValue()
          Obtains boolean value of this Field.
 java.lang.String getStringValue()
          Gets the field value as a string.
 void setValue(boolean b)
          Sets the value of this field.
 void setValue(java.lang.Object value)
          Sets the value of this field.
 
Methods inherited from class com.gridsystems.config.tools.console.ValueField
getContents, getKeyMapping, getValue, getVerifier, isTrimmed, readLine, setKeyMapping, setStringValue, setTrimmed, setVerifier
 
Methods inherited from class com.gridsystems.config.tools.console.Field
getString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final java.lang.String TRUE
String representation of true value.

See Also:
Constant Field Values

FALSE

public static final java.lang.String FALSE
String representation of true value.

See Also:
Constant Field Values
Constructor Detail

BoolField

public BoolField(java.util.ResourceBundle bundle,
                 java.lang.String linePattern)
Creates a new instance with the specified bundle and pattern.

Parameters:
bundle - The resource bundle
linePattern - The pattern for field display
Method Detail

setValue

public void setValue(java.lang.Object value)
Sets the value of this field.

Overrides:
setValue in class ValueField
Parameters:
value - The new value

setValue

public void setValue(boolean b)
Sets the value of this field.

Parameters:
b - The new value

getStringValue

public java.lang.String getStringValue()
Gets the field value as a string.

Overrides:
getStringValue in class ValueField
Returns:
A string containing this field value

getBooleanValue

public boolean getBooleanValue()
Obtains boolean value of this Field.

Returns:
boolean value of this field.

execute

public boolean execute(ConsoleConfiguratorView view)
Switches the boolean value to its negative. Asks the user for the new value for this field. The empty string means to maintain the current value.

To specify an empty value, in trimmed fields a blank space can be used

This method does not return until the default value or a valid one is specified.

Specified by:
execute in interface ConsoleViewAction
Overrides:
execute in class ValueField
Parameters:
view - The view where this field is located
Returns:
It always returns true, as the edition does not imply an exit from the view execution loop.
See Also:
ConsoleViewAction


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.