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.renderer.text;
17
18import java.io.BufferedReader;
19import java.io.IOException;
20import java.io.PrintStream;
21
22import org.tp23.antinstaller.InstallerContext;
23import org.tp23.antinstaller.input.CommentOutput;
24import org.tp23.antinstaller.input.OutputField;
25
26
27public class CommentOutputRenderer
28    implements TextOutputFieldRenderer {
29    protected InstallerContext ctx;
30    
31    public CommentOutputRenderer() {
32    }
33
34    public void setContext(InstallerContext ctx) {
35        this.ctx = ctx;
36    }
37
38    public void renderOutput(OutputField field, BufferedReader reader, PrintStream out) throws IOException {
39        CommentOutput comField = (CommentOutput) field;
40        String text = field.getDisplayText();
41        if(text == null){
42            return;
43        }
44
45        if( OutputField.isTrue(comField.getBold()) ){
46            text = text.toUpperCase();
47        }
48        else if( OutputField.isTrue(comField.getTitle()) ){
49            text = text.toUpperCase();
50        }
51
52        out.println(text);
53    }
54    public boolean isAbort(){
55        return false;
56    }
57
58
59
60    /**
61     * renderError
62     *
63     * @param field InputField
64     * @param out PrintStream
65     */
66    public void renderError(OutputField field, BufferedReader reader, PrintStream out) {
67    }
68}
69