KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > java2html > options > JavaSourceStyleEntry


1 package de.java2html.options;
2
3 import de.java2html.util.HtmlUtilities;
4 import de.java2html.util.RGB;
5
6 /**
7  * Object defining color and other style options for output.
8  *
9  * @author Markus Gebhard
10  */

11 public class JavaSourceStyleEntry {
12   private RGB color;
13   private String JavaDoc 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 JavaDoc obj) {
28     if (!(obj instanceof JavaSourceStyleEntry)) {
29       return false;
30     }
31     JavaSourceStyleEntry other = (JavaSourceStyleEntry) obj;
32     return color.equals(other.color) && bold == other.bold && italic == other.italic;
33   }
34   
35   public int hashCode() {
36     return color.hashCode();
37   }
38
39   /**
40    * @deprecated As of Dec 21, 2003 (Markus Gebhard): object is immutable and cloning not necessary.
41    */

42   public JavaSourceStyleEntry getClone() {
43     return new JavaSourceStyleEntry(color, bold, italic);
44   }
45
46   public String JavaDoc getHtmlColor() {
47     if (htmlColor==null) {
48       htmlColor = HtmlUtilities.toHTML(getColor());
49     }
50     return htmlColor;
51   }
52
53   public RGB getColor() {
54     return color;
55   }
56
57   public boolean isBold() {
58     return bold;
59   }
60
61   public boolean isItalic() {
62     return italic;
63   }
64 }
Popular Tags