1 21 package org.lobobrowser.html.style; 22 23 import java.awt.Color ; 24 import org.lobobrowser.html.domimpl.*; 25 import org.lobobrowser.util.gui.ColorFactory; 26 27 public class TableRenderState extends StyleSheetRenderState { 28 public TableRenderState(RenderState prevRenderState, HTMLElementImpl element) { 29 super(prevRenderState, element); 30 } 31 32 public Color getTextBackgroundColor() { 33 return super.getTextBackgroundColor(); 34 } 35 36 protected int getDefaultDisplay() { 37 return DISPLAY_TABLE; 38 } 39 40 private BackgroundInfo backgroundInfo = INVALID_BACKGROUND_INFO; 41 42 public void invalidate() { 43 super.invalidate(); 44 this.backgroundInfo = INVALID_BACKGROUND_INFO; 45 } 46 47 public BackgroundInfo getBackgroundInfo() { 48 BackgroundInfo binfo = this.backgroundInfo; 49 if(binfo != INVALID_BACKGROUND_INFO) { 50 return binfo; 51 } 52 binfo = super.getBackgroundInfo(); 54 HTMLTableElementImpl element = (HTMLTableElementImpl) this.element; 55 if(binfo == null || binfo.backgroundColor == null) { 56 String bgColor = element.getBgColor(); 57 if(bgColor != null && !"".equals(bgColor)) { 58 Color bgc = ColorFactory.getInstance().getColor(bgColor); 59 if(binfo == null) { 60 binfo = new BackgroundInfo(); 61 } 62 binfo.backgroundColor = bgc; 63 } 64 } 65 if(binfo == null || binfo.backgroundImage == null) { 66 String background = element.getAttribute("background"); 67 if(background != null && !"".equals(background)) { 68 if(binfo == null) { 69 binfo = new BackgroundInfo(); 70 } 71 binfo.backgroundImage = background; 72 } 73 } 74 this.backgroundInfo = binfo; 75 return binfo; 76 } 77 } 78 | Popular Tags |