1 package be
.nikiroo
.jvcard
.resources
;
3 import java
.io
.IOException
;
5 import java
.util
.MissingResourceException
;
6 import java
.util
.ResourceBundle
;
8 import be
.nikiroo
.utils
.resources
.Bundle
;
11 * All colour information must come from here.
13 * TODO: delete this class, and think about a better way to get BG/FG colours...
17 public class ColorBundle
extends Bundle
<ColorOption
> {
18 public ColorBundle() {
19 super(ColorOption
.class, Target
.colors
, null);
23 protected void writeHeader(Writer writer
) throws IOException
{
24 ColorOption
.writeHeader(writer
);
28 protected void writeValue(Writer writer
, ColorOption id
) throws IOException
{
29 String name
= id
.name() + "_FG";
31 if (containsKey(name
))
32 value
= getString(name
).trim();
34 writeValue(writer
, name
, value
);
36 name
= id
.name() + "_BG";
38 if (containsKey(name
))
39 value
= getString(name
).trim();
41 writeValue(writer
, name
, value
);
45 protected void resetMap(ResourceBundle bundle
) {
49 for (ColorOption field
: type
.getEnumConstants()) {
51 // String value = bundle.getString(field.name());
52 // this.map.put(field.name(), value == null ? null :
54 setString(field
.name() + "_FG",
55 bundle
.getString(field
.name() + "_FG"));
56 setString(field
.name() + "_BG",
57 bundle
.getString(field
.name() + "_BG"));
58 } catch (MissingResourceException e
) {
65 public String
getStringX(ColorOption id
, String suffix
) {
66 String key
= id
.name()
67 + (suffix
== null ?
"" : "_" + suffix
.toUpperCase());
69 return getString(key
);