com.izforge.izpack.panels.userinput.console
Class ConsoleField

java.lang.Object
  extended by com.izforge.izpack.panels.userinput.field.AbstractFieldView
      extended by com.izforge.izpack.panels.userinput.console.ConsoleField
All Implemented Interfaces:
FieldView
Direct Known Subclasses:
AbstractConsoleFileField, ConsoleButtonField, ConsoleCheckField, ConsoleChoiceField, ConsoleCustomField, ConsoleDividerField, ConsoleInputField, ConsolePasswordGroupField, ConsoleSearchField, ConsoleSpacerField, ConsoleStaticText, ConsoleTitleField

public abstract class ConsoleField
extends AbstractFieldView

Console presentation of an Field.

Author:
Tim Anderson

Constructor Summary
ConsoleField(Field field, Console console, Prompt prompt)
          Constructs a ConsoleField.
 
Method Summary
abstract  boolean display()
          Displays the field.
protected  void error(String message)
          Displays an error message.
protected  Console getConsole()
          Returns the console.
protected  String getMessage(String id)
          Returns a localised message for the supplied message identifier.
protected  void print(String message)
          Prints a message to the console without a new line.
protected  void printDescription()
          Prints the field description, if one is available.
protected  void printLabel()
          Prints the field label, if one is available.
protected  void println(String message)
          Prints a message to the console with a new line.
 
Methods inherited from class com.izforge.izpack.panels.userinput.field.AbstractFieldView
getField, getSummaryKey, getVariable, isDisplayed, isReadonly, setDisplayed, setReadonly, setVariable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsoleField

public ConsoleField(Field field,
                    Console console,
                    Prompt prompt)
Constructs a ConsoleField.

Parameters:
field - the field
console - the console
prompt - the prompt
Method Detail

display

public abstract boolean display()
Displays the field.

For fields that update variables, this collects input and validates it.

Returns:
true if the field was displayed and validated successfully

printDescription

protected void printDescription()
Prints the field description, if one is available.


printLabel

protected void printLabel()
Prints the field label, if one is available.


println

protected void println(String message)
Prints a message to the console with a new line.

Parameters:
message - the message to print

print

protected void print(String message)
Prints a message to the console without a new line.

Parameters:
message - the message to print

error

protected void error(String message)
Displays an error message.

Parameters:
message - the message

getConsole

protected Console getConsole()
Returns the console.

Returns:
the console

getMessage

protected String getMessage(String id)
Returns a localised message for the supplied message identifier.

Parameters:
id - the message identifier
Returns:
the corresponding message, or id if the message does not exist


Copyright © 2018. All rights reserved.