* The "background-position-vertical" property.
*/
public Length backgroundPositionVertical;
-
-
+
+
private FopImage fopimage;
-
-
- /** the "before" edge */
+
+
+ /** the "before" edge */
public static final int BEFORE = 0;
- /** the "after" edge */
+ /** the "after" edge */
public static final int AFTER = 1;
- /** the "start" edge */
+ /** the "start" edge */
public static final int START = 2;
- /** the "end" edge */
+ /** the "end" edge */
public static final int END = 3;
-
+
public static class BorderInfo {
private int mStyle; // Enum for border style
private Color mColor; // Border color
mWidth = width;
mColor = color;
}
-
+
public int getStyle() {
return this.mStyle;
}
-
+
public Color getColor() {
return this.mColor;
}
-
+
public CondLengthProperty getWidth() {
return this.mWidth;
}
return mWidth.getLengthValue();
}
}
-
+
/** {@inheritDoc} */
public String toString() {
StringBuffer sb = new StringBuffer("BorderInfo");
* Construct a CommonBorderPaddingBackground object.
*/
public CommonBorderPaddingBackground() {
-
}
-
+
/**
* Construct a CommonBorderPaddingBackground object.
*
* @throws PropertyException if there's an error while binding the properties
*/
public CommonBorderPaddingBackground(PropertyList pList) throws PropertyException {
-
+
backgroundAttachment = pList.get(Constants.PR_BACKGROUND_ATTACHMENT).getEnum();
backgroundColor = pList.get(Constants.PR_BACKGROUND_COLOR).getColor(
pList.getFObj().getUserAgent());
Constants.PR_BACKGROUND_POSITION_HORIZONTAL).getLength();
backgroundPositionVertical = pList.get(
Constants.PR_BACKGROUND_POSITION_VERTICAL).getLength();
-
+
//Additional processing: preload image
String url = ImageFactory.getURL(backgroundImage);
FOUserAgent userAgent = pList.getFObj().getUserAgent();
} else {
// load dimensions
if (!fopimage.load(FopImage.DIMENSIONS)) {
- Property.log.error("Cannot read background image dimensions: "
+ Property.log.error("Cannot read background image dimensions: "
+ backgroundImage);
}
}
//TODO Report to caller so he can decide to throw an exception
}
- initBorderInfo(pList, BEFORE,
- Constants.PR_BORDER_BEFORE_COLOR,
- Constants.PR_BORDER_BEFORE_STYLE,
- Constants.PR_BORDER_BEFORE_WIDTH,
+ initBorderInfo(pList, BEFORE,
+ Constants.PR_BORDER_BEFORE_COLOR,
+ Constants.PR_BORDER_BEFORE_STYLE,
+ Constants.PR_BORDER_BEFORE_WIDTH,
Constants.PR_PADDING_BEFORE);
- initBorderInfo(pList, AFTER,
- Constants.PR_BORDER_AFTER_COLOR,
- Constants.PR_BORDER_AFTER_STYLE,
- Constants.PR_BORDER_AFTER_WIDTH,
+ initBorderInfo(pList, AFTER,
+ Constants.PR_BORDER_AFTER_COLOR,
+ Constants.PR_BORDER_AFTER_STYLE,
+ Constants.PR_BORDER_AFTER_WIDTH,
Constants.PR_PADDING_AFTER);
- initBorderInfo(pList, START,
- Constants.PR_BORDER_START_COLOR,
- Constants.PR_BORDER_START_STYLE,
- Constants.PR_BORDER_START_WIDTH,
+ initBorderInfo(pList, START,
+ Constants.PR_BORDER_START_COLOR,
+ Constants.PR_BORDER_START_STYLE,
+ Constants.PR_BORDER_START_WIDTH,
Constants.PR_PADDING_START);
- initBorderInfo(pList, END,
- Constants.PR_BORDER_END_COLOR,
- Constants.PR_BORDER_END_STYLE,
- Constants.PR_BORDER_END_WIDTH,
+ initBorderInfo(pList, END,
+ Constants.PR_BORDER_END_COLOR,
+ Constants.PR_BORDER_END_STYLE,
+ Constants.PR_BORDER_END_WIDTH,
Constants.PR_PADDING_END);
}
- private void initBorderInfo(PropertyList pList, int side,
+ private void initBorderInfo(PropertyList pList, int side,
int colorProp, int styleProp, int widthProp, int paddingProp)
throws PropertyException {
padding[side] = pList.get(paddingProp).getCondLength();
pList.get(colorProp).getColor(ua)), side);
}
}
-
+
/**
* Sets a border.
* @param info the border information
public void setBorderInfo(BorderInfo info, int side) {
this.borderInfo[side] = info;
}
-
+
/**
* @param side the side to retrieve
* @return the border info for a side
return this.borderInfo[side];
}
}
-
+
/**
* Set padding.
* @param source the padding info to copy from
public void setPadding(CommonBorderPaddingBackground source) {
this.padding = source.padding;
}
-
+
/**
* @return the background image as a preloaded FopImage, null if there is
* no background image.
public FopImage getFopImage() {
return this.fopimage;
}
-
+
/**
* @param bDiscard indicates whether the .conditionality component should be
* considered (start of a reference-area)
return padding[side].getLengthValue(context);
}
}
-
+
/**
* Returns the CondLengthProperty for the padding on one side.
* @param side the side
}
/**
- * Return all the border and padding width in the inline progression
+ * Return all the border and padding width in the inline progression
* dimension.
* @param bDiscard the discard flag.
* @param context for percentage evaluation.
* @return all the padding and border width.
*/
public int getIPPaddingAndBorder(boolean bDiscard, PercentBaseContext context) {
- return getPaddingStart(bDiscard, context)
- + getPaddingEnd(bDiscard, context)
- + getBorderStartWidth(bDiscard)
- + getBorderEndWidth(bDiscard);
+ return getPaddingStart(bDiscard, context)
+ + getPaddingEnd(bDiscard, context)
+ + getBorderStartWidth(bDiscard)
+ + getBorderEndWidth(bDiscard);
}
-
+
/**
- * Return all the border and padding height in the block progression
+ * Return all the border and padding height in the block progression
* dimension.
* @param bDiscard the discard flag.
* @param context for percentage evaluation
*/
public int getBPPaddingAndBorder(boolean bDiscard, PercentBaseContext context) {
return getPaddingBefore(bDiscard, context) + getPaddingAfter(bDiscard, context)
- + getBorderBeforeWidth(bDiscard) + getBorderAfterWidth(bDiscard);
+ + getBorderBeforeWidth(bDiscard) + getBorderAfterWidth(bDiscard);
}
/** {@inheritDoc} */
+ getBorderStartWidth(false) + ", " + getBorderEndWidth(false) + ")\n"
+ "Border Colors: (" + getBorderColor(BEFORE) + ", " + getBorderColor(AFTER) + ", "
+ getBorderColor(START) + ", " + getBorderColor(END) + ")\n"
- + "Padding: (" + getPaddingBefore(false, null) + ", " + getPaddingAfter(false, null)
+ + "Padding: (" + getPaddingBefore(false, null) + ", " + getPaddingAfter(false, null)
+ ", " + getPaddingStart(false, null) + ", " + getPaddingEnd(false, null) + ")\n";
}
/** @return true if border is non-zero. */
public boolean hasBorder() {
- return ((getBorderBeforeWidth(false) + getBorderAfterWidth(false)
+ return ((getBorderBeforeWidth(false) + getBorderAfterWidth(false)
+ getBorderStartWidth(false) + getBorderEndWidth(false)) > 0);
}
/**
* @param context for percentage based evaluation.
- * @return true if padding is non-zero.
+ * @return true if padding is non-zero.
*/
public boolean hasPadding(PercentBaseContext context) {
- return ((getPaddingBefore(false, context) + getPaddingAfter(false, context)
+ return ((getPaddingBefore(false, context) + getPaddingAfter(false, context)
+ getPaddingStart(false, context) + getPaddingEnd(false, context)) > 0);
}
-
+
/** @return true if there are any borders defined. */
public boolean hasBorderInfo() {
return (borderInfo[BEFORE] != null || borderInfo[AFTER] != null