Ejemplo n.º 1
0
  // support page border on root area
  protected BoxStyle buildRootStyle() {
    IStyle style = pageContent.getStyle();
    if ((style != null) && !style.isEmpty()) {
      BoxStyle boxStyle = new BoxStyle();
      IStyle cs = pageContent.getComputedStyle();
      int borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_LEFT_WIDTH), width);
      if (borderWidth > 0) {
        boxStyle.setLeftBorder(
            new BorderInfo(
                cs.getProperty(IStyle.STYLE_BORDER_LEFT_COLOR),
                cs.getProperty(IStyle.STYLE_BORDER_LEFT_STYLE),
                borderWidth));
      }

      borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH), width);
      if (borderWidth > 0) {
        boxStyle.setRightBorder(
            new BorderInfo(
                cs.getProperty(IStyle.STYLE_BORDER_RIGHT_COLOR),
                cs.getProperty(IStyle.STYLE_BORDER_RIGHT_STYLE),
                borderWidth));
      }
      borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_TOP_WIDTH), width);
      if (borderWidth > 0) {
        boxStyle.setTopBorder(
            new BorderInfo(
                cs.getProperty(IStyle.STYLE_BORDER_TOP_COLOR),
                cs.getProperty(IStyle.STYLE_BORDER_TOP_STYLE),
                borderWidth));
      }

      borderWidth = getDimensionValue(cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH), width);
      if (borderWidth > 0) {
        boxStyle.setBottomBorder(
            new BorderInfo(
                cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_COLOR),
                cs.getProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE),
                borderWidth));
      }
      return boxStyle;
    }
    return boxStyle.DEFAULT;
  }