01: /*
02: * Copyright 2005 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import org.tp23.antinstaller.InstallerContext;
19:
20: /**
21: * Operating System Specific input fields have different default values for Unix and Windoze
22: * TODO something more with defaults for optionally supporting more OSs
23: */
24: public abstract class OSSpecific extends InputField {
25:
26: private String defaultValueWin;
27:
28: public String getDefaultValue(boolean correctForOS) {
29: if (InstallerContext.isUnix() || defaultValueWin == null) {
30: if ("".equals(defaultValue)) {
31: return "";
32: }
33: return resultContainer.getDefaultFileRef(defaultValue);
34: } else {
35: if ("".equals(defaultValueWin)) {
36: return "";
37: }
38: return resultContainer.getDefaultFileRef(defaultValueWin);
39: }
40: }
41:
42: public String getDefaultValueWin() {
43: return defaultValueWin;
44: }
45:
46: public void setDefaultValueWin(String defaultValueWin) {
47: this.defaultValueWin = defaultValueWin;
48: }
49: }
|