KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > renderer > UIControlWrapper


1 package org.lobobrowser.html.renderer;
2
3 import java.awt.*;
4
5 import org.lobobrowser.html.*;
6
7 class UIControlWrapper implements UIControl {
8     private final Component component;
9     private final HtmlObject htmlObject;
10     
11     public UIControlWrapper(HtmlObject ho) {
12         this.htmlObject = ho;
13         Component c;
14         if(ho == null) {
15             c = new BrokenComponent();
16         }
17         else {
18             c = ho.getComponent();
19         }
20         this.component = c;
21     }
22
23     public void reset(int availWidth, int availHeight) {
24         this.htmlObject.reset(availWidth, availHeight);
25     }
26     
27     public Component getComponent() {
28         return this.component;
29     }
30     
31     public int getVAlign() {
32         return RElement.VALIGN_BASELINE;
33     }
34
35     public Color getBackgroundColor() {
36         return this.component.getBackground();
37     }
38
39     public Dimension getPreferredSize() {
40         return this.component.getPreferredSize();
41     }
42
43     public void invalidate() {
44         // Calls its AWT parent's invalidate, but I guess that's OK.
45
this.component.invalidate();
46     }
47
48     public boolean paintSelection(Graphics g, boolean inSelection,
49             RenderableSpot startPoint, RenderableSpot endPoint) {
50         // Does not paint selection
51
return inSelection;
52     }
53
54     public void setBounds(int x, int y, int width, int height) {
55         this.component.setBounds(x, y, width, height);
56     }
57
58     public void setRUIControl(RUIControl ruicontrol) {
59         // Not doing anything with this.
60
}
61     
62     public void paint(Graphics g) {
63         this.component.paint(g);
64     }
65 }
66
Popular Tags