1 /*
2  * Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * 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 */
14package org.tp23.antinstaller.input;
15
16import org.tp23.antinstaller.InstallerContext;
17import org.tp23.antinstaller.ValidationException;
18
19/**
20 * @author mwilson
21 * @version $Id
22 * @since 0.7.4 patch 6
23 */
24public class HiddenPropertyInput extends InputField
25{
26
27    public HiddenPropertyInput()
28    {
29    }
30
31    public void setValue( String propValue )
32    {
33        //Use default value to allow updates when page re-displayed
34        setDefaultValue( propValue );
35    }
36
37    /**
38     * Called to validate the non-existent user input
39     */
40    public boolean validate( InstallerContext cxt ) throws ValidationException
41    {
42        return true;
43    }
44
45    /**
46     * Used by checkConfig to validate the configuration file.
47     * Not used at runtime.
48     *
49     * @return boolean
50     */
51    public boolean validateObject()
52    {
53
54        final String typeName = "hidden";
55        if( getProperty() == null )
56        {
57            System.out.println( typeName + ": property must be set" );
58            return false;
59        }
60        if( getDefaultValue() == null )
61        {
62            System.out.println( typeName + ": value must be set" );
63            return false;
64        }
65        return true;
66    }
67}
68