1 | |
package org.jtheque.core.managers.core.application; |
2 | |
|
3 | |
import org.jtheque.core.managers.resource.ImageDescriptor; |
4 | |
import org.jtheque.core.managers.resource.ImageType; |
5 | |
import org.jtheque.utils.bean.Version; |
6 | |
import org.jtheque.utils.collections.ArrayUtils; |
7 | |
|
8 | |
import java.util.HashMap; |
9 | |
import java.util.Map; |
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | 0 | public final class XMLApplication implements Application { |
33 | |
private Version version; |
34 | |
|
35 | |
private ApplicationProperties applicationProperties; |
36 | |
|
37 | |
private ImageDescriptor icon; |
38 | |
private ImageDescriptor logo; |
39 | |
|
40 | |
private boolean displayLicence; |
41 | |
|
42 | 0 | private String[] supportedLanguages = {"fr", "en"}; |
43 | |
|
44 | 0 | private final Map<String, String> properties = new HashMap<String, String>(5); |
45 | |
|
46 | |
@Override |
47 | |
public Version getVersion(){ |
48 | 0 | return version; |
49 | |
} |
50 | |
|
51 | |
@Override |
52 | |
public String getAuthor(){ |
53 | 0 | return applicationProperties.getAuthor(); |
54 | |
} |
55 | |
|
56 | |
@Override |
57 | |
public String getName(){ |
58 | 0 | return applicationProperties.getName(); |
59 | |
} |
60 | |
|
61 | |
@Override |
62 | |
public String getSite(){ |
63 | 0 | return applicationProperties.getSite(); |
64 | |
} |
65 | |
|
66 | |
@Override |
67 | |
public String getEmail(){ |
68 | 0 | return applicationProperties.getEmail(); |
69 | |
} |
70 | |
|
71 | |
@Override |
72 | |
public String getCopyright(){ |
73 | 0 | return applicationProperties.getCopyright(); |
74 | |
} |
75 | |
|
76 | |
@Override |
77 | |
public String getLogo(){ |
78 | 0 | return logo.getImage(); |
79 | |
} |
80 | |
|
81 | |
@Override |
82 | |
public ImageType getLogoType(){ |
83 | 0 | return logo.getType(); |
84 | |
} |
85 | |
|
86 | |
@Override |
87 | |
public String getWindowIcon(){ |
88 | 0 | return icon.getImage(); |
89 | |
} |
90 | |
|
91 | |
@Override |
92 | |
public ImageType getWindowIconType(){ |
93 | 0 | return icon.getType(); |
94 | |
} |
95 | |
|
96 | |
@Override |
97 | |
public boolean isDisplayLicence(){ |
98 | 0 | return displayLicence; |
99 | |
} |
100 | |
|
101 | |
@Override |
102 | |
public String getRepository(){ |
103 | 0 | return getProperty("application.repository"); |
104 | |
} |
105 | |
|
106 | |
@Override |
107 | |
public String getMessageFileURL(){ |
108 | 0 | return getProperty("application.messages"); |
109 | |
} |
110 | |
|
111 | |
@Override |
112 | |
public String[] getSupportedLanguages(){ |
113 | 0 | return ArrayUtils.copyOf(supportedLanguages); |
114 | |
} |
115 | |
|
116 | |
@Override |
117 | |
public String getProperty(String key){ |
118 | 0 | return properties.get(key); |
119 | |
} |
120 | |
|
121 | |
@Override |
122 | |
public String getLicenceFilePath(){ |
123 | 0 | return getProperty("application.licence"); |
124 | |
} |
125 | |
|
126 | |
@Override |
127 | |
public String getFolderPath(){ |
128 | 0 | return getProperty("application.folder.path"); |
129 | |
} |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
void setProperty(String name, String value){ |
140 | 0 | properties.put(name, value); |
141 | 0 | } |
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
void displayLicence(){ |
147 | 0 | displayLicence = true; |
148 | 0 | } |
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
void setVersion(Version version){ |
156 | 0 | this.version = version; |
157 | 0 | } |
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
void setSupportedLanguages(String[] supportedLanguages){ |
165 | 0 | this.supportedLanguages = ArrayUtils.copyOf(supportedLanguages); |
166 | 0 | } |
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
void setApplicationProperties(ApplicationProperties applicationProperties){ |
174 | 0 | this.applicationProperties = applicationProperties; |
175 | 0 | } |
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
void setImages(ImageDescriptor logo, ImageDescriptor icon){ |
184 | 0 | this.logo = logo; |
185 | 0 | this.icon = icon; |
186 | 0 | } |
187 | |
} |