01: package de.java2html.options;
02:
03: import de.java2html.util.HtmlUtilities;
04: import de.java2html.util.RGB;
05:
06: /**
07: * Object defining color and other style options for output.
08: *
09: * @author Markus Gebhard
10: */
11: public class JavaSourceStyleEntry {
12: private RGB color;
13: private String htmlColor;
14: private boolean bold;
15: private boolean italic;
16:
17: public JavaSourceStyleEntry(RGB color) {
18: this (color, false, false);
19: }
20:
21: public JavaSourceStyleEntry(RGB color, boolean bold, boolean italic) {
22: this .color = color;
23: this .italic = italic;
24: this .bold = bold;
25: }
26:
27: public boolean equals(Object obj) {
28: if (!(obj instanceof JavaSourceStyleEntry)) {
29: return false;
30: }
31: JavaSourceStyleEntry other = (JavaSourceStyleEntry) obj;
32: return color.equals(other.color) && bold == other.bold
33: && italic == other.italic;
34: }
35:
36: public int hashCode() {
37: return color.hashCode();
38: }
39:
40: /**
41: * @deprecated As of Dec 21, 2003 (Markus Gebhard): object is immutable and cloning not necessary.
42: */
43: public JavaSourceStyleEntry getClone() {
44: return new JavaSourceStyleEntry(color, bold, italic);
45: }
46:
47: public String getHtmlColor() {
48: if (htmlColor == null) {
49: htmlColor = HtmlUtilities.toHTML(getColor());
50: }
51: return htmlColor;
52: }
53:
54: public RGB getColor() {
55: return color;
56: }
57:
58: public boolean isBold() {
59: return bold;
60: }
61:
62: public boolean isItalic() {
63: return italic;
64: }
65: }
|