01: package org.tp23.antinstaller.renderer.text;
02:
03: import java.io.BufferedReader;
04: import java.io.InputStreamReader;
05:
06: import org.tp23.antinstaller.InstallException;
07: import org.tp23.antinstaller.InstallerContext;
08: import org.tp23.antinstaller.page.Page;
09: import org.tp23.antinstaller.renderer.RendererFactory;
10:
11: /**
12: * Language selection for the TextUI
13: * @author teknopaul
14: *
15: */
16: public class LangSelectTextUI {
17:
18: public void init(InstallerContext ctx) {
19: Page next = ctx.getInstaller().getLangPage();
20: try {
21: AbstractTextPageRenderer renderer = RendererFactory
22: .getTextPageRenderer(next);
23: renderer.setContext(ctx);
24: renderer.init(new BufferedReader(new InputStreamReader(
25: System.in)), System.out);
26: ctx.setCurrentPage(next);
27: renderer.renderPage(next);
28: if (next.isAbort()) {
29: // what here?
30: }
31: } catch (ClassNotFoundException e) {
32: ctx.log("Code error page type not supported: "
33: + next.getClass().getName());
34: if (ctx.getInstaller().isVerbose()) {
35: ctx.log(e);
36: }
37: } catch (InstallException e) {
38: ctx.log("InstallException: " + e.getMessage());
39: if (ctx.getInstaller().isVerbose()) {
40: ctx.log(e);
41: }
42: }
43:
44: }
45: }
|