From dcc549d859e139ca37d3807c0e653c9336329c08 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Tue, 25 Jan 2005 10:42:06 +0000 Subject: [PATCH] Additional helper functions git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198312 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/Area.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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. -- 2.39.5