Package com.helger.pdflayout.spec
Class BorderSpec
- java.lang.Object
-
- com.helger.pdflayout.spec.BorderSpec
-
- All Implemented Interfaces:
Serializable
@Immutable @MustImplementEqualsAndHashcode public class BorderSpec extends Object implements Serializable
This class represents a border around a single element. Each side can be styled separately.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static BorderSpecBORDER0Represents no border at all.
-
Constructor Summary
Constructors Constructor Description BorderSpec(BorderStyleSpec aBorder)Constructor.BorderSpec(BorderStyleSpec aBorderY, BorderStyleSpec aBorderX)Constructor.BorderSpec(BorderStyleSpec aBorderTop, BorderStyleSpec aBorderRight, BorderStyleSpec aBorderBottom, BorderStyleSpec aBorderLeft)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareAllBordersEqual()static BorderSpecbottom(BorderStyleSpec aBottom)booleanequals(Object o)BorderStyleSpecgetBottom()floatgetBottomWidth()BorderSpecgetCloneWithBottom(BorderStyleSpec aBottom)BorderSpecgetCloneWithLeft(BorderStyleSpec aLeft)BorderSpecgetCloneWithRight(BorderStyleSpec aRight)BorderSpecgetCloneWithTop(BorderStyleSpec aTop)BorderStyleSpecgetLeft()floatgetLeftWidth()BorderStyleSpecgetRight()floatgetRightWidth()BorderStyleSpecgetTop()floatgetTopWidth()floatgetXSumWidth()floatgetYSumWidth()booleanhasAllBorders()booleanhasAnyBorder()inthashCode()static BorderSpecleft(BorderStyleSpec aLeft)static BorderSpecright(BorderStyleSpec aRight)static BorderSpectop(BorderStyleSpec aTop)StringtoString()
-
-
-
Field Detail
-
BORDER0
public static final BorderSpec BORDER0
Represents no border at all.
-
-
Constructor Detail
-
BorderSpec
public BorderSpec(@Nullable BorderStyleSpec aBorder)
Constructor.- Parameters:
aBorder- The border to set for all sides (left, top, right, bottom). Maybenull.
-
BorderSpec
public BorderSpec(@Nullable BorderStyleSpec aBorderY, @Nullable BorderStyleSpec aBorderX)
Constructor.- Parameters:
aBorderY- The border to set for top and bottom. Maybenull.aBorderX- The border to set for left and right. Maybenull.
-
BorderSpec
public BorderSpec(@Nullable BorderStyleSpec aBorderTop, @Nullable BorderStyleSpec aBorderRight, @Nullable BorderStyleSpec aBorderBottom, @Nullable BorderStyleSpec aBorderLeft)
Constructor.- Parameters:
aBorderTop- The border to set for top. Maybenull.aBorderRight- The border to set for right. Maybenull.aBorderBottom- The border to set for bottom. Maybenull.aBorderLeft- The border to set for left. Maybenull.
-
-
Method Detail
-
hasAllBorders
public final boolean hasAllBorders()
- Returns:
trueif all borders are defined,falseotherwise.
-
hasAnyBorder
public final boolean hasAnyBorder()
- Returns:
trueif at least one border is defined,falseif no border is defined at all.
-
areAllBordersEqual
public boolean areAllBordersEqual()
- Returns:
trueif all border sides are equal. This istruefornullborders as well as for defined borders.
-
getTop
@Nullable public final BorderStyleSpec getTop()
- Returns:
- The top border style. May be
null.
-
getRight
@Nullable public final BorderStyleSpec getRight()
- Returns:
- The right border style. May be
null.
-
getBottom
@Nullable public final BorderStyleSpec getBottom()
- Returns:
- The bottom border style. May be
null.
-
getLeft
@Nullable public final BorderStyleSpec getLeft()
- Returns:
- The left border style. May be
null.
-
getTopWidth
public final float getTopWidth()
- Returns:
- The top border width.
-
getRightWidth
public final float getRightWidth()
- Returns:
- The right border width.
-
getBottomWidth
public final float getBottomWidth()
- Returns:
- The bottom border width.
-
getLeftWidth
public final float getLeftWidth()
- Returns:
- The left border width.
-
getXSumWidth
public final float getXSumWidth()
- Returns:
- The sum of left and right border width.
-
getYSumWidth
public final float getYSumWidth()
- Returns:
- The sum of left and right border width.
-
getCloneWithTop
@Nonnull public BorderSpec getCloneWithTop(@Nullable BorderStyleSpec aTop)
-
getCloneWithRight
@Nonnull public BorderSpec getCloneWithRight(@Nullable BorderStyleSpec aRight)
-
getCloneWithBottom
@Nonnull public BorderSpec getCloneWithBottom(@Nullable BorderStyleSpec aBottom)
-
getCloneWithLeft
@Nonnull public BorderSpec getCloneWithLeft(@Nullable BorderStyleSpec aLeft)
-
top
@Nonnull public static BorderSpec top(@Nullable BorderStyleSpec aTop)
-
right
@Nonnull public static BorderSpec right(@Nullable BorderStyleSpec aRight)
-
bottom
@Nonnull public static BorderSpec bottom(@Nullable BorderStyleSpec aBottom)
-
left
@Nonnull public static BorderSpec left(@Nullable BorderStyleSpec aLeft)
-
-