Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.about / org.gvsig.about.impl / src / main / java / org / gvsig / about / impl / DefaultAboutProject.java @ 42024

History | View | Annotate | Download (2.53 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.about.impl;
23

    
24
import java.net.URL;
25
import java.util.HashMap;
26
import java.util.Map;
27

    
28
import org.gvsig.about.AboutProject;
29

    
30
/**
31
 * @author gvSIG Team
32
 * @version $Id$
33
 * 
34
 */
35
public class DefaultAboutProject implements AboutProject {
36

    
37
    protected String name;
38
    protected URL description;
39
    protected URL icon;
40
    private DefaultAboutManager manager;
41
    private Map<String, String> vars;
42

    
43
    public DefaultAboutProject(DefaultAboutManager manager, String name,
44
        URL description, URL icon) {
45
        this(manager, name, description, icon, null);
46
    }
47

    
48
    public DefaultAboutProject(DefaultAboutManager manager, String name,
49
        URL description, URL icon, Map<String, String> vars) {
50
        this.manager = manager;
51
        this.name = name;
52
        this.description = description;
53
        this.icon = icon;
54
        this.vars = new HashMap<String, String>();
55
        if (vars != null) {
56
            this.vars.putAll(vars);
57
        }
58
    }
59

    
60
    public void set(String name, String value) {
61
        this.vars.put(name, value);
62
    }
63

    
64
    public String getName() {
65
        return this.name;
66
    }
67

    
68
    public URL getDescription() {
69
        return this.description;
70
    }
71

    
72
    public URL getIcon() {
73
        return this.icon;
74
    }
75

    
76
    @Override
77
    public String toString() {
78
        return this.name;
79
    }
80

    
81
    public String getInformationPage() {
82
        String description = null;
83

    
84
        if (this.description != null) {
85
            description = manager.getStringFromUrl(this.description, this.vars);
86
        }
87
        if (description == null) {
88
            return "<html><body></body></html>";
89
        }
90
        return description;
91
    }
92

    
93
}