com.izforge.izpack.installer.console
Class AbstractConsolePanel

java.lang.Object
  extended by com.izforge.izpack.installer.console.AbstractConsolePanel
All Implemented Interfaces:
ConsolePanel
Direct Known Subclasses:
AbstractTextConsolePanel, NoOpConsolePanel

public abstract class AbstractConsolePanel
extends Object
implements ConsolePanel

Abstract implementation of the ConsolePanel interface.

Author:
Tim Anderson

Constructor Summary
AbstractConsolePanel(PanelView<ConsolePanel> panel)
          Constructs an AbstractConsolePanel.
 
Method Summary
 void createInstallationRecord(IXMLElement rootElement)
          Create th auto-xml
 boolean generateOptions(InstallData installData, Options options)
          Generates a properties file for each input field or variable.
 String getI18nStringForClass(String subkey, InstallData installData)
          Search for a proper translation key belonging to the panel implementation.
 String getI18nStringForClass(String subkey, String alternateClass, InstallData installData)
          Search for a proper translation key belonging to the panel implementation.
protected  Panel getPanel()
          Returns the panel.
 boolean handlePanelValidationResult(boolean valid)
          Do some user interaction on the console depending on the result of a panel validation.
protected  void printHeadLine(InstallData installData, Console console)
           
protected  boolean promptEndPanel(InstallData installData, Console console)
          Prompts to end the console panel.
protected  boolean promptRerunPanel(InstallData installData, Console console)
          Prompts to re-run the panel or quit.
 boolean run(InstallData installData, Console console)
          Runs the panel in an interactive console.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.izforge.izpack.installer.console.ConsolePanel
run
 

Constructor Detail

AbstractConsolePanel

public AbstractConsolePanel(PanelView<ConsolePanel> panel)
Constructs an AbstractConsolePanel.

Parameters:
panel - the parent panel/view. May be null
Method Detail

generateOptions

public boolean generateOptions(InstallData installData,
                               Options options)
Description copied from interface: ConsolePanel
Generates a properties file for each input field or variable.

Specified by:
generateOptions in interface ConsolePanel
Parameters:
installData - the installation data
options - the options file to write to
Returns:
true if the generation is successful, otherwise false

promptEndPanel

protected boolean promptEndPanel(InstallData installData,
                                 Console console)
Prompts to end the console panel.

If the panel is valid, this displays a prompt to continue, quit, or redisplay. On redisplay, it invokes run(InstallData, Console).
If the panel is invalid, this invokes promptRerunPanel(InstallData, Console).

Parameters:
installData - the installation date
console - the console to use
Returns:
true to continue, false to quit. If redisplaying the panel, the result of run(InstallData, Console) is returned

promptRerunPanel

protected boolean promptRerunPanel(InstallData installData,
                                   Console console)
Prompts to re-run the panel or quit.

This displays a prompt to redisplay the panel or quit. On redisplay, it invokes run(InstallData, Console).

Parameters:
installData - the installation date
console - the console to use
Returns:
true to re-display, false to quit. If redisplaying the panel, the result of run(InstallData, Console) is returned

getPanel

protected Panel getPanel()
Returns the panel.

Returns:
the panel, or null if no panel/view was supplied at construction

createInstallationRecord

public void createInstallationRecord(IXMLElement rootElement)
Description copied from interface: ConsolePanel
Create th auto-xml

Specified by:
createInstallationRecord in interface ConsolePanel

run

public boolean run(InstallData installData,
                   Console console)
Description copied from interface: ConsolePanel
Runs the panel in an interactive console.

Specified by:
run in interface ConsolePanel
Parameters:
installData - the installation data
console - the console
Returns:
true if the panel ran successfully, otherwise false

printHeadLine

protected void printHeadLine(InstallData installData,
                             Console console)

handlePanelValidationResult

public boolean handlePanelValidationResult(boolean valid)
Description copied from interface: ConsolePanel
Do some user interaction on the console depending on the result of a panel validation. This is necessary to inform the user on the console about the forbidden progress and to prevent failing the installer in case the panel data validator treats the data to be wrong. Instead the user should be asked whether to redisplay the input fields to fix the wrong values.

Specified by:
handlePanelValidationResult in interface ConsolePanel
Parameters:
valid - whether the validation has been successful
Returns:
false - let the installer fail, true - let the installer continue to run
See Also:
DataValidator

getI18nStringForClass

public String getI18nStringForClass(String subkey,
                                    InstallData installData)
Search for a proper translation key belonging to the panel implementation.

Parameters:
subkey - the subkey for the string which should be returned
Returns:
the founded string

getI18nStringForClass

public String getI18nStringForClass(String subkey,
                                    String alternateClass,
                                    InstallData installData)
Search for a proper translation key belonging to the panel implementation.

Parameters:
subkey - the subkey for the string which should be returned
alternateClass - the short name of the class which should be used if no string is present with the runtime class name
Returns:
the founded string


Copyright © 2018. All rights reserved.