source: release-kits/shared/core/ant-installer/src/org/tp23/antinstaller/renderer/text/UnvalidatedTextInputRenderer.java@ 20045

Last change on this file since 20045 was 17514, checked in by oranfry, 16 years ago

changes to the way ant-installer loads and reloads the language packs, and a new attribute to the select input which triggers it to change the language to the input value

File size: 2.0 KB
Line 
1/*
2 * Copyright 2005 Paul Hinds
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.tp23.antinstaller.renderer.text;
17
18import java.io.BufferedReader;
19import java.io.IOException;
20import java.io.PrintStream;
21import java.util.ResourceBundle;
22
23import org.tp23.antinstaller.InstallerContext;
24import org.tp23.antinstaller.input.OutputField;
25import org.tp23.antinstaller.input.UnvalidatedTextInput;
26
27
28public class UnvalidatedTextInputRenderer
29 implements TextOutputFieldRenderer {
30
31 protected InstallerContext ctx;
32 public UnvalidatedTextInputRenderer() {
33 }
34
35 public void setContext(InstallerContext ctx) {
36 this.ctx = ctx;
37 }
38
39 public void renderOutput(OutputField field, BufferedReader reader, PrintStream out) throws IOException {
40 UnvalidatedTextInput iField = (UnvalidatedTextInput) field;
41 out.print(field.getDisplayText());
42
43 out.print(" [");
44 out.print(org.tp23.antinstaller.Installer.langPack.getString("_default_"));
45 out.print(":");
46 out.print(iField.getDefaultValue());
47 out.print("]");
48
49
50 //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
51 out.println();
52 String input = reader.readLine();
53 out.println();
54 if(input==null || input.equals(""))input=iField.getDefaultValue();
55 iField.setInputResult(input);
56 }
57 public boolean isAbort(){
58 return false;
59 }
60
61
62
63 /**
64 * renderError
65 *
66 * @param field InputField
67 * @param in InputStream
68 * @param out PrintStream
69 */
70 public void renderError(OutputField field, BufferedReader reader, PrintStream out) {
71 }
72}
Note: See TracBrowser for help on using the repository browser.