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.renderer.text;
15
16import java.io.BufferedReader;
17import java.io.IOException;
18import java.io.PrintStream;
19
20import org.tp23.antinstaller.InstallerContext;
21import org.tp23.antinstaller.input.HiddenPropertyInput;
22import org.tp23.antinstaller.input.OutputField;
23
24/**
25 * Text UI Renderer for hidden properties - displays nothing
26 *
27 * @author mwilson
28 * @version $Id
29 * @since 0.7.4 patch 6
30 */
31public class HiddenPropertyInputRenderer implements TextOutputFieldRenderer
32{
33
34    public void setContext( InstallerContext ctx )
35    {
36
37    }
38
39    public void renderOutput( OutputField field, BufferedReader reader, PrintStream out ) throws IOException
40    {
41        HiddenPropertyInput propertyField = (HiddenPropertyInput) field;
42
43        if( !propertyField.isEditted() )
44        {
45            propertyField.setInputResult( propertyField.getDefaultValue() );
46        }
47    }
48
49    public void renderError( OutputField field, BufferedReader reader, PrintStream out ) throws IOException
50    {
51
52    }
53
54    public boolean isAbort()
55    {
56        return false;
57    }
58}
59