Package org.apache.fop.layoutmgr
Class Keep
- java.lang.Object
-
- org.apache.fop.layoutmgr.Keep
-
public final class Keep extends java.lang.ObjectObject representing a keep constraint, corresponding to the XSL-FO keep properties.
-
-
Field Summary
Fields Modifier and Type Field Description private intcontextstatic KeepKEEP_ALWAYSkeep alwaysstatic KeepKEEP_AUTOkeep autoprivate intstrengthprivate static intSTRENGTH_ALWAYSThe integer value for "always" keep strength.private static intSTRENGTH_AUTOThe integer value for "auto" keep strength.
-
Constructor Summary
Constructors Modifier Constructor Description privateKeep(int strength, int context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Keepcompare(Keep other)Compare this Keep instance to another one, and return the stronger one if the context is the sameintgetContext()Returns the context of this keep.static KeepgetKeep(KeepProperty keepProperty)Obtain a Keep instance corresponding to the givenKeepPropertyprivate static intgetKeepContextPriority(int context)private static intgetKeepStrength(Property keep)intgetPenalty()booleanisAuto()java.lang.StringtoString()private voidupdate(Property keep, int context)
-
-
-
Field Detail
-
STRENGTH_AUTO
private static final int STRENGTH_AUTO
The integer value for "auto" keep strength.- See Also:
- Constant Field Values
-
STRENGTH_ALWAYS
private static final int STRENGTH_ALWAYS
The integer value for "always" keep strength.- See Also:
- Constant Field Values
-
KEEP_AUTO
public static final Keep KEEP_AUTO
keep auto
-
KEEP_ALWAYS
public static final Keep KEEP_ALWAYS
keep always
-
strength
private int strength
-
context
private int context
-
-
Method Detail
-
getKeepStrength
private static int getKeepStrength(Property keep)
-
getKeep
public static Keep getKeep(KeepProperty keepProperty)
Obtain a Keep instance corresponding to the givenKeepProperty- Parameters:
keepProperty- theKeepProperty- Returns:
- a new instance corresponding to the given property
-
update
private void update(Property keep, int context)
-
isAuto
public boolean isAuto()
- Returns:
trueif the keep property was specified as "auto"
-
getContext
public int getContext()
Returns the context of this keep.- Returns:
- one of
Constants.EN_LINE,Constants.EN_COLUMNorConstants.EN_PAGE
-
getPenalty
public int getPenalty()
- Returns:
- the penalty value corresponding to the strength of this Keep
-
getKeepContextPriority
private static int getKeepContextPriority(int context)
-
compare
public Keep compare(Keep other)
Compare this Keep instance to another one, and return the stronger one if the context is the same- Parameters:
other- the instance to compare to- Returns:
- the winning Keep instance
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-