001: package com.memoire.vainstall.tui;
002:
003: import java.io.*;
004: import com.memoire.vainstall.*;
005:
006: public class TuiLicenseStep extends TuiDefaultStep implements
007: VALicenseStep {
008: private boolean accepted_ = false;
009:
010: public TuiLicenseStep() {
011: super ();
012: }
013:
014: public void setText(InputStream lic) {
015: TuiWizard.clear();
016: TuiWizard.title();
017: TuiWizard.println(VAGlobals.i18n("TuiLicenseStep_License"));
018: TuiWizard.separator();
019: TuiWizard.println("");
020:
021: if (lic == null) {
022: TuiWizard.println(VAGlobals
023: .i18n("TuiLicenseStep_NoLicense"));
024: } else {
025: if (!TuiWizard.skip) {
026: try {
027: LineNumberReader in = new LineNumberReader(
028: new InputStreamReader(lic, "UTF-8"));
029: String line = in.readLine();
030: int n = 3;
031: while (line != null) {
032: line = line.replace('\014', ' ');
033: TuiWizard.println(line);
034: n++;
035: if (n % 21 == 0) {
036: TuiWizard.enter();
037:
038: TuiWizard.clear();
039: TuiWizard.title();
040: TuiWizard.println(VAGlobals
041: .i18n("TuiLicenseStep_License"));
042: TuiWizard.separator();
043: TuiWizard.println("");
044: n = 3;
045: }
046: line = in.readLine();
047: }
048: in.close();
049:
050: if (n % 21 != 0) {
051: while (n % 21 != 0) {
052: TuiWizard.println("");
053: n++;
054: }
055: TuiWizard.enter();
056: }
057: } catch (IOException ex) {
058: }
059: }
060:
061: TuiWizard.clear();
062: TuiWizard.title();
063: TuiWizard.println(VAGlobals.i18n("TuiLicenseStep_License"));
064: TuiWizard.separator();
065: for (int i = 3; i < 22; i++)
066: TuiWizard.println("");
067: TuiWizard.info();
068: TuiWizard.println(VAGlobals
069: .i18n("TuiLicenseStep_WantAcceptLicense"));
070: TuiWizard.separator();
071: accepted_ = TuiWizard.confirm();
072:
073: if (accepted_) {
074: TuiWizard.clear();
075: TuiWizard.title();
076: TuiWizard.println(VAGlobals
077: .i18n("TuiLicenseStep_License"));
078: TuiWizard.separator();
079: TuiWizard.println("");
080: TuiWizard.println(VAGlobals
081: .i18n("TuiLicenseStep_YouAcceptedLicense"));
082: for (int i = 5; i < 22; i++)
083: TuiWizard.println("");
084: TuiWizard.info();
085: TuiWizard.println(VAGlobals
086: .i18n("TuiLicenseStep_Continue"));
087: } else {
088: TuiWizard.clear();
089: TuiWizard.title();
090: TuiWizard.println(VAGlobals
091: .i18n("TuiLicenseStep_License"));
092: TuiWizard.separator();
093: TuiWizard.println("");
094: TuiWizard.println(VAGlobals
095: .i18n("TuiLicenseStep_RefusedLicense"));
096: TuiWizard.print(VAGlobals.i18n("TuiLicenseStep_You"));
097: TuiWizard.info();
098: TuiWizard.print(VAGlobals.i18n("TuiLicenseStep_Must"));
099: TuiWizard.normal();
100: TuiWizard.println(VAGlobals
101: .i18n("TuiLicenseStep_CancelAndDelete"));
102: for (int i = 6; i < 22; i++)
103: TuiWizard.println("");
104: TuiWizard.info();
105: TuiWizard.println(VAGlobals
106: .i18n("TuiLicenseStep_Cancel"));
107: }
108: }
109: }
110:
111: public boolean isLicenseAccepted() {
112: return accepted_;
113: }
114: }
|