Ejemplo n.º 1
0
 public static Insets getBorderStyles(final CSS2Properties properties) {
   final int topStyle = getBorderStyle(properties.getBorderTopStyle());
   final int rightStyle = getBorderStyle(properties.getBorderRightStyle());
   final int bottomStyle = getBorderStyle(properties.getBorderBottomStyle());
   final int leftStyle = getBorderStyle(properties.getBorderLeftStyle());
   return new Insets(topStyle, leftStyle, bottomStyle, rightStyle);
 }
Ejemplo n.º 2
0
 public static HtmlInsets getMarginInsets(
     final CSS2Properties cssProperties, final RenderState renderState) {
   HtmlInsets insets = null;
   final String topText = cssProperties.getMarginTop();
   insets = updateTopInset(insets, topText, renderState);
   final String leftText = cssProperties.getMarginLeft();
   insets = updateLeftInset(insets, leftText, renderState);
   final String bottomText = cssProperties.getMarginBottom();
   insets = updateBottomInset(insets, bottomText, renderState);
   final String rightText = cssProperties.getMarginRight();
   insets = updateRightInset(insets, rightText, renderState);
   return insets;
 }
Ejemplo n.º 3
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;
  }
Ejemplo n.º 4
0
 /**
  * Populates {@link BorderInfo.insets}.
  *
  * @param binfo A BorderInfo with its styles already populated.
  * @param cssProperties The CSS properties object.
  * @param renderState The current render state.
  */
 public static void populateBorderInsets(
     final BorderInfo binfo, final CSS2Properties cssProperties, final RenderState renderState) {
   HtmlInsets insets = null;
   if (binfo.topStyle != HtmlValues.BORDER_STYLE_NONE) {
     final String topText = cssProperties.getBorderTopWidth();
     insets = updateTopInset(insets, topText, renderState);
   }
   if (binfo.leftStyle != HtmlValues.BORDER_STYLE_NONE) {
     final String leftText = cssProperties.getBorderLeftWidth();
     insets = updateLeftInset(insets, leftText, renderState);
   }
   if (binfo.bottomStyle != HtmlValues.BORDER_STYLE_NONE) {
     final String bottomText = cssProperties.getBorderBottomWidth();
     insets = updateBottomInset(insets, bottomText, renderState);
   }
   if (binfo.rightStyle != HtmlValues.BORDER_STYLE_NONE) {
     final String rightText = cssProperties.getBorderRightWidth();
     insets = updateRightInset(insets, rightText, renderState);
   }
   binfo.insets = insets;
 }
Ejemplo n.º 5
0
 public static HtmlInsets getBorderInsets(
     final Insets borderStyles,
     final CSS2Properties cssProperties,
     final RenderState renderState) {
   HtmlInsets insets = null;
   if (borderStyles.top != HtmlValues.BORDER_STYLE_NONE) {
     final String topText = cssProperties.getBorderTopWidth();
     insets = updateTopInset(insets, topText, renderState);
   }
   if (borderStyles.left != HtmlValues.BORDER_STYLE_NONE) {
     final String leftText = cssProperties.getBorderLeftWidth();
     insets = updateLeftInset(insets, leftText, renderState);
   }
   if (borderStyles.bottom != HtmlValues.BORDER_STYLE_NONE) {
     final String bottomText = cssProperties.getBorderBottomWidth();
     insets = updateBottomInset(insets, bottomText, renderState);
   }
   if (borderStyles.right != HtmlValues.BORDER_STYLE_NONE) {
     final String rightText = cssProperties.getBorderRightWidth();
     insets = updateRightInset(insets, rightText, renderState);
   }
   return insets;
 }