01: /*
02: * Licensed under the Apache License, Version 2.0 (the "License");
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at
05: *
06: * http://www.apache.org/licenses/LICENSE-2.0
07: *
08: * Unless required by applicable law or agreed to in writing, software
09: * distributed under the License is distributed on an "AS IS" BASIS,
10: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11: * See the License for the specific language governing permissions and
12: * limitations under the License.
13: */
14: package org.tp23.antinstaller.input;
15:
16: import org.tp23.antinstaller.InstallerContext;
17: import org.tp23.antinstaller.ValidationException;
18:
19: /**
20: * @author mwilson
21: * @version $Id
22: * @since 0.7.4 patch 6
23: */
24: public class HiddenPropertyInput extends InputField {
25:
26: public HiddenPropertyInput() {
27: }
28:
29: public void setValue(String propValue) {
30: //Use default value to allow updates when page re-displayed
31: setDefaultValue(propValue);
32: }
33:
34: /**
35: * Called to validate the non-existent user input
36: */
37: public boolean validate(InstallerContext cxt)
38: throws ValidationException {
39: return true;
40: }
41:
42: /**
43: * Used by checkConfig to validate the configuration file.
44: * Not used at runtime.
45: *
46: * @return boolean
47: */
48: public boolean validateObject() {
49:
50: final String typeName = "hidden";
51: if (getProperty() == null) {
52: System.out.println(typeName + ": property must be set");
53: return false;
54: }
55: if (getDefaultValue() == null) {
56: System.out.println(typeName + ": value must be set");
57: return false;
58: }
59: return true;
60: }
61: }
|