Example #1
0
  public static BorderInfo getBorderInfo(
      final CSS2Properties properties, final RenderState renderState) {
    final BorderInfo binfo = new BorderInfo();

    binfo.topStyle = getBorderStyle(properties.getBorderTopStyle());
    binfo.rightStyle = getBorderStyle(properties.getBorderRightStyle());
    binfo.bottomStyle = getBorderStyle(properties.getBorderBottomStyle());
    binfo.leftStyle = getBorderStyle(properties.getBorderLeftStyle());

    final ColorFactory cf = ColorFactory.getInstance();
    final String topColorSpec = properties.getBorderTopColor();
    if (topColorSpec != null) {
      binfo.topColor = cf.getColor(topColorSpec);
    }
    final String rightColorSpec = properties.getBorderRightColor();
    if (rightColorSpec != null) {
      binfo.rightColor = cf.getColor(rightColorSpec);
    }
    final String bottomColorSpec = properties.getBorderBottomColor();
    if (bottomColorSpec != null) {
      binfo.bottomColor = cf.getColor(bottomColorSpec);
    }
    final String leftColorSpec = properties.getBorderLeftColor();
    if (leftColorSpec != null) {
      binfo.leftColor = cf.getColor(leftColorSpec);
    }

    HtmlValues.populateBorderInsets(binfo, properties, renderState);

    return binfo;
  }
 protected RenderState createRenderState(RenderState prevRenderState) {
   String face = this.getAttribute("face");
   String size = this.getAttribute("size");
   String color = this.getAttribute("color");
   if (face != null) {
     prevRenderState = new FontNameRenderState(prevRenderState, face);
   }
   if (size != null) {
     int fontNumber = HtmlValues.getFontNumberOldStyle(size, prevRenderState);
     float fontSize = HtmlValues.getFontSize(fontNumber);
     prevRenderState = new FontSizeRenderState(prevRenderState, fontSize);
     prevRenderState = new BaseFontRenderState(prevRenderState, fontNumber);
   }
   if (color != null) {
     prevRenderState =
         new ColorRenderState(prevRenderState, ColorFactory.getInstance().getColor(color));
   }
   return prevRenderState;
 }