* @param direction The direction for which the border-style is needed.
* @return The specified border-style property.
*/
public org.axsl.common.value.BorderStyle getBorderStyle(final FObj fobj,
final FoContext context, final Compass direction) {
AbstractBorderStyle abstractBorderStyle = null;
/* Try the most explicit setting first, e.g "border-top-style". */
FoProperty rawPropertyType = AbstractBorderStyle.rawPropertyType(
direction);
abstractBorderStyle = (AbstractBorderStyle) getProperty(
rawPropertyType);
if (abstractBorderStyle != null) {
return abstractBorderStyle.getValue(context, direction, fobj);
}
/* Now try the low-level shorthand, that is, "border-style". */
PdBorderStyle borderStyle = null;
borderStyle = (PdBorderStyle) getProperty(FoProperty.BORDER_STYLE);
if (borderStyle != null) {
return borderStyle.getValue(context, direction, fobj);
}
/* Now try the high-level shorthand, that is, "border". */
final AbstractBorder border = (AbstractBorder) getProperty(
FoProperty.BORDER);
if (border != null) {
//TODO: This needs to adjust the direction
abstractBorderStyle = border.getBorderStyle();
return abstractBorderStyle.getValue(context, direction, fobj);
}
/* If none of those work, we try an explicit setting for the
* corresponding direction. */
final Compass otherDirection = getWritingMode(fobj,
context).getCorresponding(direction);
rawPropertyType = AbstractBorderStyle.rawPropertyType(
otherDirection);
abstractBorderStyle = (AbstractBorderStyle) getProperty(
rawPropertyType);
if (abstractBorderStyle != null) {
return abstractBorderStyle.getValue(context, direction, fobj);
}
/* The border-style properties are not inherited, so return the
* initial value. */
return AbstractBorderStyle.getValueNoInstance();