source: release-kits/shared/ant-installer/src/org/tp23/antinstaller/input/InputField.java@ 17578

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

more HCI changes to the installer: an animated activity indicator during install, better target names for the greenstone2 installers

File size: 2.7 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.input;
17
18import java.util.MissingResourceException;
19import java.util.ResourceBundle;
20import org.tp23.antinstaller.Installer;
21
22/**
23 *
24 * <p>Object representation of an inputField XML Element </p>
25 * <p>Also used to hold data of the results of the installer questions </p>
26 * @author Paul Hinds
27 * @version $Id: InputField.java,v 1.4 2006/12/07 02:50:27 teknopaul Exp $
28 */
29public abstract class InputField
30 extends OutputField {
31
32 private String property;
33 protected String defaultValue;
34
35 /**
36 * Flag to indicate that the user has already editted this field
37 */
38 private boolean editted = false;
39 private Installer i = new Installer();
40
41 public InputField() {
42 }
43
44 public String getDisplayText() {
45 if( org.tp23.antinstaller.Installer.langPack != null){
46 try {
47 String r = org.tp23.antinstaller.Installer.langPack.getString(getProperty().replaceAll(" ","_") + ".displayText");
48 return r;
49 } catch (MissingResourceException e) {}
50 }
51 return displayText;
52 }
53 public String getExplanatoryText() {
54 if( org.tp23.antinstaller.Installer.langPack != null ) {
55 try {
56 return org.tp23.antinstaller.Installer.langPack.getString(getProperty().replaceAll(" ","_") + ".explanatoryText");
57 } catch (MissingResourceException e) {
58 // ignore and return null explanatoryText is optional
59 }
60 }
61 return explanatoryText;
62 }
63
64 /**
65 * Returns the input result if there is one and if this is a PropertyField
66 * @return String
67 */
68 public String getInputResult() {
69 return resultContainer.getProperty(property);
70 }
71
72 public void setInputResult(String inputResult) {
73 resultContainer.setProperty(property, inputResult);
74 }
75 public boolean isEditted() {
76 return editted;
77 }
78 public void setEditted(boolean editted) {
79 this.editted = editted;
80 }
81 public void setResultContainer(ResultContainer resultContainer) {
82 this.resultContainer = resultContainer;
83 }
84
85 public String getProperty() {
86 return property;
87 }
88
89 public void setProperty(String property) {
90 this.property = property;
91 }
92
93 public String getDefaultValue() {
94 return resultContainer.getDefaultValue(defaultValue);
95 }
96
97 public void setDefaultValue(String defaultValue) {
98 this.defaultValue = defaultValue;
99 }
100
101
102}
Note: See TracBrowser for help on using the repository browser.