Statistics
| Revision:

root / trunk / frameworks / _fwAndami / src / com / iver / andami / iconthemes / IconThemeInfo.java @ 11513

History | View | Annotate | Download (3.82 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
package com.iver.andami.iconthemes;
43

    
44
import java.io.File;
45
import java.util.zip.ZipFile;
46

    
47

    
48
/**
49
 * Contains information about a theme. It includes the name, the description,
50
 * the version and the resource (the physical entity which contains the theme).
51
 * 
52
 * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
53
 *
54
 */
55
public class IconThemeInfo {
56
        private String name=null;
57
        private String description=null;
58
        private String version="1.0";
59
        private Object resource=null;
60
        
61
        /**
62
         * Gets the theme name.
63
         * 
64
         * @return The name of this theme.
65
         */
66
        public String getName() {
67
                return name;
68
        }
69
        
70
        /**
71
         * Sets the theme name.
72
         * 
73
         * @param themeName
74
         */
75
        public void setName(String themeName) {
76
                name = themeName;
77
        }
78
        
79
        /**
80
         * Gets the theme description.
81
         * 
82
         * @return The description of this theme.
83
         */
84
        public String getDescription() {
85
                return description;
86
        }
87
        
88
        /**
89
         * Sets the theme description. It should be a short description
90
         * (around 20-30 words), including the highlights of the theme,
91
         * the author and maybe its email address or a link the the theme's
92
         * homepage. 
93
         * 
94
         * @param description
95
         */
96
        public void setDescription(String description) {
97
                this.description = description;
98
        }
99
        
100
        /**
101
         * Returns the theme version. It defaults to "1.0".
102
         * 
103
         * @return The version of this theme.
104
         */
105
        public String getVersion() {
106
                return version;
107
        }
108

    
109
        /**
110
         * Set the theme version. 
111
         * 
112
         * @param version
113
         */
114
        public void setVersion(String version) {
115
                this.version = version;
116
        }
117
        
118
        /**
119
         * Gets the Object which contains physically contains this theme on disk.
120
         * It may be a ZipFile or JarFile, or a directory.
121
         * 
122
         * @return
123
         */
124
        public Object getResource() {
125
                return resource;
126
        }
127
        
128
        /**
129
         * Gets the Object which contains physically contains this theme on disk.
130
         * It may be a ZipFile or JarFile, or a directory.
131
         * 
132
         * @return
133
         */
134
        public String getResourceName() {
135
                if (resource instanceof ZipFile) {
136
                        return ((ZipFile)resource).getName();
137
                }
138
                else if (resource instanceof File) {
139
                        return ((File)resource).getPath();
140
                }
141
                return "";
142
        }
143
        
144
        /**
145
         * Sets the file which contains physically contains this theme on disk.
146
         * It may be a ZipFile or JarFile, or a directory.
147
         * 
148
         * @return
149
         */
150
        public void setResource(Object resource) {
151
                this.resource = resource;
152
        }
153
        
154
        public String toString() {
155
                StringBuffer buffer = new StringBuffer();
156
                buffer.append("\nName: ");
157
                buffer.append(getName());
158
                buffer.append("\nDescription: ");
159
                buffer.append(getDescription());
160
                buffer.append("\nVersion: ");
161
                buffer.append(getVersion());
162
                buffer.append("\nResource: ");
163
                buffer.append(getResourceName());
164
                return buffer.toString();
165
        }
166
}