From: Jeremias Maerki Date: Tue, 25 Jan 2005 10:42:06 +0000 (+0000) Subject: Additional helper functions X-Git-Tag: Root_Temp_KnuthStylePageBreaking~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dcc549d859e139ca37d3807c0e653c9336329c08;p=xmlgraphics-fop.git Additional helper functions git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198312 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/Area.java b/src/java/org/apache/fop/area/Area.java index 2d32baedc..e8848dc7b 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/java/org/apache/fop/area/Area.java @@ -342,6 +342,11 @@ public class Area implements Serializable { return this.props; } + /** @return true if the area has traits */ + public boolean hasTraits() { + return (this.props != null); + } + /** * Get a trait from this area. * @@ -351,6 +356,20 @@ public class Area implements Serializable { public Object getTrait(Object oTraitCode) { return (props != null ? props.get(oTraitCode) : null); } + + /** + * Get a boolean trait from this area. + * @param oTraitCode the trait key + * @return the trait value + */ + public boolean getBooleanTrait(Object oTraitCode) { + final Object obj = getTrait(oTraitCode); + if (obj instanceof Boolean) { + return ((Boolean)obj).booleanValue(); + } else { + return false; + } + } /** * Get a trait from this area as an integer.