1 21 24 package org.lobobrowser.html.renderer; 25 26 import java.awt.Color ; 27 import java.awt.Component ; 28 import java.awt.Dimension ; 29 30 import javax.swing.*; 31 32 import org.lobobrowser.html.domimpl.*; 33 34 import java.util.logging.*; 35 36 abstract class BaseControl extends JComponent implements UIControl { 37 private static final Logger logger = Logger.getLogger(BaseControl.class.getName()); 38 protected static final Dimension ZERO_DIMENSION = new Dimension (0, 0); 39 protected final HTMLElementImpl controlElement; 40 protected RUIControl ruicontrol; 41 42 45 public BaseControl(HTMLElementImpl modelNode) { 46 this.controlElement = modelNode; 47 } 48 49 public Component getComponent() { 50 return this; 51 } 52 53 public void setRUIControl(RUIControl ruicontrol) { 54 this.ruicontrol = ruicontrol; 55 } 56 57 public int getVAlign() { 58 return RElement.VALIGN_BASELINE; 59 } 60 61 65 protected void invalidateAndRepaint() { 66 RUIControl rc = this.ruicontrol; 67 if(rc == null) { 68 logger.severe("invalidateAndPaint(): RUIControl not set."); 69 return; 70 } 71 if(rc.isValid()) { 72 rc.relayout(); 73 } 74 } 75 76 79 public Color getBackgroundColor() { 80 return this.getBackground(); 81 } 82 } 83 | Popular Tags |