001: package com.memoire.vainstall.tui;
002:
003: import com.memoire.vainstall.*;
004:
005: public class TuiUpgradeStep extends TuiDefaultStep implements
006: VAUpgradeStep {
007: private String version_ = "...";
008: private String status_ = "...";
009: private String directory_ = "...";
010: private boolean first_ = true;
011: private boolean confirmed_ = true;
012:
013: public TuiUpgradeStep() {
014: TuiWizard.clear();
015: TuiWizard.title();
016:
017: switch (VAGlobals.OPERATION) {
018: case VAGlobals.UPDATE:
019: case VAGlobals.INSTALL:
020: TuiWizard.println(VAGlobals
021: .i18n("TuiUpgradeStep_Upgrade35"));
022: break;
023: default:
024: TuiWizard
025: .println(VAGlobals.i18n("TuiUpgradeStep_UpgradeN"));
026: break;
027: }
028:
029: TuiWizard.separator();
030: TuiWizard.println("");
031:
032: for (int i = 6; i < 22; i++)
033: TuiWizard.println("");
034: TuiWizard.info();
035: }
036:
037: private void refresh() {
038: if (first_)
039: TuiWizard.clear();
040: else if (TuiWizard.ansi)
041: TuiWizard.print("\033[00;00H");
042:
043: if (first_ || !TuiWizard.ansi) {
044: TuiWizard.title();
045:
046: switch (VAGlobals.OPERATION) {
047: case VAGlobals.UPDATE:
048: case VAGlobals.INSTALL:
049: TuiWizard.println(VAGlobals
050: .i18n("TuiUpgradeStep_Upgrade5"));
051: break;
052: case VAGlobals.UNINSTALL:
053: TuiWizard.println(VAGlobals
054: .i18n("TuiUpgradeStep_Upgrade2"));
055: break;
056: default:
057: TuiWizard.println(VAGlobals
058: .i18n("TuiUpgradeStep_UpgradeN"));
059: break;
060: }
061:
062: TuiWizard.separator();
063: TuiWizard.println("");
064: } else {
065: TuiWizard.print("\033[06;00H");
066: TuiWizard.normal();
067: }
068:
069: TuiWizard.println(VAGlobals
070: .i18n("TuiUpgradeStep_PreviousVersionFound")
071: + version_);
072: TuiWizard.println(VAGlobals
073: .i18n("TuiUpgradeStep_InstallationDirectory")
074: + directory_);
075: TuiWizard.println(status_);
076:
077: if (first_ || !TuiWizard.ansi) {
078: TuiWizard.println("");
079: for (int i = 6; i < 21; i++)
080: TuiWizard.println("");
081: } else
082: TuiWizard.print("\033[20;00H");
083: }
084:
085: public void version(String msg) {
086: version_ = msg;
087: refresh();
088: }
089:
090: public void status(String msg) {
091: status_ = msg;
092: refresh();
093: }
094:
095: public void directory(String msg) {
096: directory_ = msg;
097: refresh();
098: }
099:
100: public boolean isConfirmUpgrade() {
101: return confirmed_;
102: }
103:
104: public void setChoiceEnabled(boolean b) {
105: if (b) {
106: TuiWizard.info();
107: TuiWizard.println(VAGlobals
108: .i18n("TuiUpgradeStep_WantToUpgrade"));
109: TuiWizard.separator();
110: confirmed_ = TuiWizard.confirm();
111: }
112: }
113: }
|