01: /*
02: * Copyright 2005 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: */
16: package org.tp23.antinstaller.input;
17:
18: import org.tp23.antinstaller.InstallerContext;
19: import org.tp23.antinstaller.ValidationException;
20:
21: /**
22: *
23: * <p>Free text input type </p>
24: * @author Paul Hinds
25: * @version $Id: UnvalidatedTextInput.java,v 1.1.1.1 2005/10/18 18:20:54 teknopaul Exp $
26: */
27: public class UnvalidatedTextInput extends InputField {
28:
29: public UnvalidatedTextInput() {
30: }
31:
32: public void setValue(String dir) {
33: setInputResult(dir);
34: }
35:
36: /**
37: * Called to validate the user input
38: */
39: public boolean validate(InstallerContext cxt)
40: throws ValidationException {
41: return true;
42: }
43:
44: /**
45: * Used by checkConfig to validate the configuration file.
46: * Not used at runtime.
47: * @return boolean
48: */
49: public boolean validateObject() {
50: if (getDisplayText() == null) {
51: System.out.println("Simple:displayText must be set");
52: return false;
53: }
54: if (getProperty() == null) {
55: System.out.println("Simple:property must be set");
56: return false;
57: }
58: if (getDefaultValue() == null) {
59: System.out.println("Simple:defualtValue must be set");
60: return false;
61: }
62: return true;
63: }
64: }
|