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.input;
17
18import org.tp23.antinstaller.InstallerContext;
19/**
20 * Operating System Specific input fields have different default values for Unix and Windoze
21 * TODO something more with defaults for optionally supporting more OSs
22 */
23public abstract class OSSpecific extends InputField {
24
25    private String defaultValueWin;
26
27    public String getDefaultValue(boolean correctForOS) {
28        if(InstallerContext.isUnix() || defaultValueWin == null){
29            if("".equals(defaultValue)){
30                return "";
31            }
32            return resultContainer.getDefaultFileRef(defaultValue);
33        }
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}
50