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 | */
|
---|
16 | package org.tp23.antinstaller.input;
|
---|
17 |
|
---|
18 |
|
---|
19 | import org.tp23.antinstaller.InstallerContext;
|
---|
20 | import org.tp23.antinstaller.ValidationException;
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 | /**
|
---|
25 | *
|
---|
26 | * <p>This "Input type" is strictly for Output! Unlike all the other
|
---|
27 | * concrete classes in this package CommentOutputs refer to text
|
---|
28 | * that will be printed but nothing will be collected from
|
---|
29 | * the user.</p>
|
---|
30 | * The text outputted in Comments will have property values resolved
|
---|
31 | * if they are in the format ${property.name}
|
---|
32 | * @author Paul Hinds
|
---|
33 | * @version $Id: CommentOutput.java,v 1.2 2006/03/24 18:25:58 teknopaul Exp $
|
---|
34 | */
|
---|
35 | public class CommentOutput
|
---|
36 | extends OutputField {
|
---|
37 |
|
---|
38 | private String bold;
|
---|
39 | private String title;
|
---|
40 |
|
---|
41 | public CommentOutput() {
|
---|
42 | }
|
---|
43 |
|
---|
44 | public String getBold() {
|
---|
45 | return bold;
|
---|
46 | }
|
---|
47 |
|
---|
48 | public void setBold(String bold) {
|
---|
49 | this.bold = bold;
|
---|
50 | }
|
---|
51 |
|
---|
52 | public String getTitle() {
|
---|
53 | return title;
|
---|
54 | }
|
---|
55 |
|
---|
56 | public void setTitle(String title) {
|
---|
57 | this.title = title;
|
---|
58 | }
|
---|
59 |
|
---|
60 | public String getDisplayText() {
|
---|
61 | return resultContainer.getDefaultValue(super.getDisplayText()) ;
|
---|
62 | }
|
---|
63 |
|
---|
64 | public String getExplanatoryText() {
|
---|
65 | return resultContainer.getDefaultValue(super.getExplanatoryText());
|
---|
66 | }
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Called to validate the user input
|
---|
70 | */
|
---|
71 | public boolean validate(InstallerContext cxt) throws ValidationException{
|
---|
72 | return true;
|
---|
73 | }
|
---|
74 |
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Used by checkConfig to validate the configuration file.
|
---|
78 | * Not used at runtime.
|
---|
79 | * @return boolean
|
---|
80 | */
|
---|
81 | public boolean validateObject() {
|
---|
82 | // null accepted now if only using explanatory text
|
---|
83 | // if(getDisplayText() == null){
|
---|
84 | // System.out.println("Comment:displayText must be set");
|
---|
85 | // return false;
|
---|
86 | // }
|
---|
87 | if(!InputField.optionalBoolean(getBold())){
|
---|
88 | System.out.println("Comment:bold must be true or false or null:" + getBold());
|
---|
89 | return false;
|
---|
90 | }
|
---|
91 | if(!InputField.optionalBoolean(getTitle())){
|
---|
92 | System.out.println("Comment:title must be true or false or null:" + getTitle());
|
---|
93 | return false;
|
---|
94 | }
|
---|
95 | return true;
|
---|
96 | }
|
---|
97 | }
|
---|