diff options
Diffstat (limited to 'src/java/org/apache/fop/fo')
117 files changed, 1028 insertions, 676 deletions
diff --git a/src/java/org/apache/fop/fo/ElementMapping.java b/src/java/org/apache/fop/fo/ElementMapping.java index 1651f23a6..befb65eff 100644 --- a/src/java/org/apache/fop/fo/ElementMapping.java +++ b/src/java/org/apache/fop/fo/ElementMapping.java @@ -30,7 +30,7 @@ import org.apache.xmlgraphics.util.QName; /** * Abstract base class for Element Mappings (including FO Element Mappings) - * which provide the framework of valid elements and attibutes for a given + * which provide the framework of valid elements and attributes for a given * namespace. */ public abstract class ElementMapping { @@ -38,7 +38,7 @@ public abstract class ElementMapping { public static final String DEFAULT = "<default>"; /** The HashMap table of formatting objects defined by the ElementMapping */ - protected HashMap foObjs = null; + protected HashMap<String, Maker> foObjs = null; //Please don't change that to java.util.Map as that can break extensions. /** The namespace for the ElementMapping */ @@ -49,7 +49,7 @@ public abstract class ElementMapping { * * @return Table of Maker objects for this ElementMapping */ - public HashMap getTable() { + public HashMap<String, Maker> getTable() { if (foObjs == null) { initialize(); } diff --git a/src/java/org/apache/fop/fo/ElementMappingRegistry.java b/src/java/org/apache/fop/fo/ElementMappingRegistry.java index 4a6904f73..cf14fa281 100644 --- a/src/java/org/apache/fop/fo/ElementMappingRegistry.java +++ b/src/java/org/apache/fop/fo/ElementMappingRegistry.java @@ -48,12 +48,14 @@ public class ElementMappingRegistry { * Table mapping element names to the makers of objects * representing formatting objects. */ - protected Map fobjTable = new java.util.HashMap(); + protected Map<String, Map<String, Maker>> fobjTable + = new java.util.HashMap<String, Map<String, Maker>>(); /** * Map of mapped namespaces and their associated ElementMapping instances. */ - protected Map namespaces = new java.util.HashMap(); + protected Map<String, ElementMapping> namespaces + = new java.util.HashMap<String, ElementMapping>(); /** * Main constructor. Adds all default element mapping as well as detects ElementMapping @@ -70,10 +72,10 @@ public class ElementMappingRegistry { */ private void setupDefaultMappings() { // add mappings from available services - Iterator providers = Service.providers(ElementMapping.class, false); + Iterator<String> providers = Service.providerNames(ElementMapping.class); if (providers != null) { while (providers.hasNext()) { - String mapping = (String)providers.next(); + String mapping = providers.next(); try { addElementMapping(mapping); } catch (IllegalArgumentException e) { @@ -129,13 +131,13 @@ public class ElementMappingRegistry { */ public Maker findFOMaker(String namespaceURI, String localName, Locator locator) throws FOPException { - Map table = (Map)fobjTable.get(namespaceURI); + Map<String, Maker> table = fobjTable.get(namespaceURI); Maker fobjMaker = null; if (table != null) { - fobjMaker = (Maker)table.get(localName); + fobjMaker = table.get(localName); // try default if (fobjMaker == null) { - fobjMaker = (Maker)table.get(ElementMapping.DEFAULT); + fobjMaker = table.get(ElementMapping.DEFAULT); } } diff --git a/src/java/org/apache/fop/fo/FOElementMapping.java b/src/java/org/apache/fop/fo/FOElementMapping.java index 0a7e40955..8069880c6 100644 --- a/src/java/org/apache/fop/fo/FOElementMapping.java +++ b/src/java/org/apache/fop/fo/FOElementMapping.java @@ -44,7 +44,7 @@ public class FOElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); // Declarations and Pagination and Layout Formatting Objects foObjs.put("root", new RootMaker()); diff --git a/src/java/org/apache/fop/fo/FOEventHandler.java b/src/java/org/apache/fop/fo/FOEventHandler.java index 238a4ced6..e280af2d7 100644 --- a/src/java/org/apache/fop/fo/FOEventHandler.java +++ b/src/java/org/apache/fop/fo/FOEventHandler.java @@ -40,11 +40,10 @@ import org.apache.fop.fo.flow.PageNumberCitation; import org.apache.fop.fo.flow.PageNumberCitationLast; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.fo.flow.table.TableBody; -import org.apache.fop.fo.flow.table.TableFooter; -import org.apache.fop.fo.flow.table.TableHeader; -import org.apache.fop.fo.flow.table.TablePart; import org.apache.fop.fo.flow.table.TableCell; import org.apache.fop.fo.flow.table.TableColumn; +import org.apache.fop.fo.flow.table.TableFooter; +import org.apache.fop.fo.flow.table.TableHeader; import org.apache.fop.fo.flow.table.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index bbe3ce3a3..c9c04aa4e 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -69,7 +69,7 @@ public abstract class FONode implements Cloneable { protected Locator locator; /** Logger for fo-tree related messages **/ - protected static Log log = LogFactory.getLog(FONode.class); + protected static final Log log = LogFactory.getLog(FONode.class); /** * Base constructor @@ -633,8 +633,9 @@ public abstract class FONode implements Cloneable { * this method only in exceptional conditions because this method may perform quite extensive * information gathering inside the FO tree. * @return a String containing context information - * @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done! */ + // [GA] remove deprecation - no alternative specified + // @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done! public String getContextInfo() { StringBuffer sb = new StringBuffer(); if (getLocalName() != null) { @@ -797,8 +798,9 @@ public abstract class FONode implements Cloneable { /** * This method is overridden by extension elements and allows the extension element to return - * a {@link ContentHandlerFactory}. This factory can create ContentHandler implementations that handle - * foreign XML content by either building up a specific DOM, a Java object or something else. + * a {@link ContentHandlerFactory}. This factory can create ContentHandler implementations that + * handle foreign XML content by either building up a specific DOM, a Java object or something + * else. * * @return the <code>ContentHandlerFactory</code> or <code>null</code> if not applicable */ diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java index 07fb20fd8..c711a76c0 100644 --- a/src/java/org/apache/fop/fo/FOPropertyMapping.java +++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java @@ -72,16 +72,20 @@ import org.apache.fop.fo.properties.XMLLangShorthandParser; * This class creates and returns an array of Property.Maker instances * indexed by the PR_* propId from Constants.java. * - * @todo Check multi-threading safety of the statics below + * TODO Check multi-threading safety of the statics below */ public final class FOPropertyMapping implements Constants { - private static Map s_htPropNames = new HashMap(); - private static Map s_htSubPropNames = new HashMap(); - private static Map s_htPropIds = new HashMap(); - private static PropertyMaker[] s_generics = null; + private FOPropertyMapping() { + } + + private static Map propNames = new HashMap(); // CSOK: VisibilityModifier + private static Map subPropNames = new HashMap(); // CSOK: VisibilityModifier + private static Map propIds = new HashMap(); // CSOK: VisibilityModifier + + private static PropertyMaker[] generics = null; // CSOK: VisibilityModifier - // The rest is only used during the building of the s_generics array. + // The rest is only used during the building of the generics array. private Property[] enums = null; private PropertyMaker genericColor = null; @@ -154,7 +158,7 @@ public final class FOPropertyMapping implements Constants { genericPadding.setInherited(false); genericPadding.setDefault("0pt"); genericPadding.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); - genericPadding.addShorthand(s_generics[PR_PADDING]); + genericPadding.addShorthand(generics[PR_PADDING]); // GenericCondBorderWidth genericCondBorderWidth = new CondLengthProperty.Maker(0); @@ -235,15 +239,15 @@ public final class FOPropertyMapping implements Constants { /** * Add a property maker to the generics array. - * Also creates the name <-> id mapping in s_htPropNames and s_htPropIds. + * Also creates the name <-> id mapping in propNames and propIds. * * @param name the name of the property maker. * @param maker the maker. */ private static void addPropertyMaker(String name, PropertyMaker maker) { - s_generics[maker.getPropId()] = maker; - s_htPropNames.put(name, new Integer(maker.getPropId())); - s_htPropIds.put(new Integer(maker.getPropId()), name); + generics[maker.getPropId()] = maker; + propNames.put(name, new Integer(maker.getPropId())); + propIds.put(new Integer(maker.getPropId()), name); } /** @@ -252,8 +256,8 @@ public final class FOPropertyMapping implements Constants { * @param id Id for the subproperty from CP_* in Constants.java. */ private static void addSubpropMakerName(String name, int id) { - s_htSubPropNames.put(name, new Integer(id)); - s_htPropIds.put(new Integer(id), name); + subPropNames.put(name, new Integer(id)); + propIds.put(new Integer(id), name); } /** @@ -278,9 +282,9 @@ public final class FOPropertyMapping implements Constants { */ public static PropertyMaker[] getGenericMappings() { - if (s_generics == null) { + if (generics == null) { /* this method was never called before */ - s_generics = new PropertyMaker[PROPERTY_COUNT + 1]; + generics = new PropertyMaker[PROPERTY_COUNT + 1]; FOPropertyMapping gp = new FOPropertyMapping(); /* Create the shorthand first. They are @@ -328,7 +332,7 @@ public final class FOPropertyMapping implements Constants { addSubpropMakerName("precedence", CP_PRECEDENCE); } - return s_generics; + return generics; } /** @@ -338,7 +342,7 @@ public final class FOPropertyMapping implements Constants { */ public static int getPropertyId(String name) { if (name != null) { - Integer i = (Integer) s_htPropNames.get(name); + Integer i = (Integer) propNames.get(name); if (i != null) { return i.intValue(); } @@ -353,7 +357,7 @@ public final class FOPropertyMapping implements Constants { */ public static int getSubPropertyId(String name) { if (name != null) { - Integer i = (Integer) s_htSubPropNames.get(name); + Integer i = (Integer) subPropNames.get(name); if (i != null) { return i.intValue(); } @@ -369,10 +373,10 @@ public final class FOPropertyMapping implements Constants { public static String getPropertyName(int id) { if (((id & Constants.COMPOUND_MASK) == 0) || ((id & Constants.PROPERTY_MASK) == 0)) { - return (String) s_htPropIds.get(new Integer(id)); + return (String) propIds.get(new Integer(id)); } else { - return s_htPropIds.get(new Integer(id & Constants.PROPERTY_MASK)) - + "." + s_htPropIds.get(new Integer(id & Constants.COMPOUND_MASK)); + return propIds.get(new Integer(id & Constants.PROPERTY_MASK)) + + "." + propIds.get(new Integer(id & Constants.COMPOUND_MASK)); } } @@ -403,7 +407,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("fixed", getEnumProperty(EN_FIXED, "FIXED")); m.addEnum("absolute", getEnumProperty(EN_ABSOLUTE, "ABSOLUTE")); m.setDefault("auto"); - m.addShorthand(s_generics[PR_POSITION]); + m.addShorthand(generics[PR_POSITION]); addPropertyMaker("absolute-position", m); // top @@ -551,7 +555,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("volume", m); } - private void createBorderPaddingBackgroundProperties() { + private void createBorderPaddingBackgroundProperties() { // CSOK: MethodLength PropertyMaker m; BorderWidthPropertyMaker bwm; CorrespondingPropertyMaker corr; @@ -606,7 +610,7 @@ public final class FOPropertyMapping implements Constants { m.addKeyword("center", "50%"); m.addKeyword("right", "100%"); m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL); - m.addShorthand(s_generics[PR_BACKGROUND_POSITION]); + m.addShorthand(generics[PR_BACKGROUND_POSITION]); addPropertyMaker("background-position-horizontal", m); // background-position-vertical @@ -617,7 +621,7 @@ public final class FOPropertyMapping implements Constants { m.addKeyword("center", "50%"); m.addKeyword("bottom", "100%"); m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL); - m.addShorthand(s_generics[PR_BACKGROUND_POSITION]); + m.addShorthand(generics[PR_BACKGROUND_POSITION]); addPropertyMaker("background-position-vertical", m); // border-before-color @@ -745,9 +749,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_TOP]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_TOP]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_BEFORE_COLOR, PR_BORDER_BEFORE_COLOR, PR_BORDER_START_COLOR); @@ -756,9 +760,9 @@ public final class FOPropertyMapping implements Constants { // border-top-style m = new EnumProperty.Maker(PR_BORDER_TOP_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_TOP]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_TOP]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_BEFORE_STYLE, PR_BORDER_BEFORE_STYLE, PR_BORDER_START_STYLE); @@ -768,9 +772,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_TOP_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_TOP_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_TOP]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_TOP]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_BEFORE_WIDTH, PR_BORDER_BEFORE_WIDTH, PR_BORDER_START_WIDTH); @@ -781,9 +785,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_BOTTOM]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_BOTTOM]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_AFTER_COLOR, PR_BORDER_AFTER_COLOR, PR_BORDER_END_COLOR); @@ -792,9 +796,9 @@ public final class FOPropertyMapping implements Constants { // border-bottom-style m = new EnumProperty.Maker(PR_BORDER_BOTTOM_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_BOTTOM]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_BOTTOM]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_AFTER_STYLE, PR_BORDER_AFTER_STYLE, PR_BORDER_END_STYLE); @@ -804,9 +808,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_BOTTOM_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_BOTTOM_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_BOTTOM]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_BOTTOM]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_AFTER_WIDTH, PR_BORDER_AFTER_WIDTH, PR_BORDER_END_WIDTH); @@ -817,9 +821,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_LEFT]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_LEFT]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_START_COLOR, PR_BORDER_END_COLOR, PR_BORDER_AFTER_COLOR); @@ -828,9 +832,9 @@ public final class FOPropertyMapping implements Constants { // border-left-style m = new EnumProperty.Maker(PR_BORDER_LEFT_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_LEFT]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_LEFT]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_START_STYLE, PR_BORDER_END_STYLE, PR_BORDER_AFTER_STYLE); @@ -840,9 +844,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_LEFT_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_LEFT_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_LEFT]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_LEFT]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_START_WIDTH, PR_BORDER_END_WIDTH, PR_BORDER_AFTER_WIDTH); @@ -853,9 +857,9 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericColor); m.setInherited(false); m.setDefault("black"); - m.addShorthand(s_generics[PR_BORDER_RIGHT]); - m.addShorthand(s_generics[PR_BORDER_COLOR]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_RIGHT]); + m.addShorthand(generics[PR_BORDER_COLOR]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_END_COLOR, PR_BORDER_START_COLOR, PR_BORDER_BEFORE_COLOR); @@ -864,9 +868,9 @@ public final class FOPropertyMapping implements Constants { // border-right-style m = new EnumProperty.Maker(PR_BORDER_RIGHT_STYLE); m.useGeneric(genericBorderStyle); - m.addShorthand(s_generics[PR_BORDER_RIGHT]); - m.addShorthand(s_generics[PR_BORDER_STYLE]); - m.addShorthand(s_generics[PR_BORDER]); + m.addShorthand(generics[PR_BORDER_RIGHT]); + m.addShorthand(generics[PR_BORDER_STYLE]); + m.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(m); corr.setCorresponding(PR_BORDER_END_STYLE, PR_BORDER_START_STYLE, PR_BORDER_BEFORE_STYLE); @@ -876,9 +880,9 @@ public final class FOPropertyMapping implements Constants { bwm = new BorderWidthPropertyMaker(PR_BORDER_RIGHT_WIDTH); bwm.useGeneric(genericBorderWidth); bwm.setBorderStyleId(PR_BORDER_RIGHT_STYLE); - bwm.addShorthand(s_generics[PR_BORDER_RIGHT]); - bwm.addShorthand(s_generics[PR_BORDER_WIDTH]); - bwm.addShorthand(s_generics[PR_BORDER]); + bwm.addShorthand(generics[PR_BORDER_RIGHT]); + bwm.addShorthand(generics[PR_BORDER_WIDTH]); + bwm.addShorthand(generics[PR_BORDER]); corr = new CorrespondingPropertyMaker(bwm); corr.setCorresponding(PR_BORDER_END_WIDTH, PR_BORDER_START_WIDTH, PR_BORDER_BEFORE_WIDTH); @@ -964,7 +968,7 @@ public final class FOPropertyMapping implements Constants { m = new FontFamilyProperty.Maker(PR_FONT_FAMILY); m.setInherited(true); m.setDefault("sans-serif,Symbol,ZapfDingbats"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-family", m); // font-selection-strategy @@ -990,7 +994,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("larger", getEnumProperty(EN_LARGER, "LARGER")); m.addEnum("smaller", getEnumProperty(EN_SMALLER, "SMALLER")); m.setPercentBase(LengthBase.INH_FONTSIZE); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-size", m); // font-stretch @@ -1024,7 +1028,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("oblique", getEnumProperty(EN_OBLIQUE, "OBLIQUE")); m.addEnum("backslant", getEnumProperty(EN_BACKSLANT, "BACKSLANT")); m.setDefault("normal"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-style", m); // font-variant @@ -1033,7 +1037,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("normal", getEnumProperty(EN_NORMAL, "NORMAL")); m.addEnum("small-caps", getEnumProperty(EN_SMALL_CAPS, "SMALL_CAPS")); m.setDefault("normal"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-variant", m); // font-weight @@ -1053,7 +1057,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("800", getEnumProperty(EN_800, "800")); m.addEnum("900", getEnumProperty(EN_900, "900")); m.setDefault("400"); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("font-weight", m); } @@ -1064,14 +1068,14 @@ public final class FOPropertyMapping implements Constants { m = new StringProperty.Maker(PR_COUNTRY); m.setInherited(true); m.setDefault("none"); - m.addShorthand(s_generics[PR_XML_LANG]); + m.addShorthand(generics[PR_XML_LANG]); addPropertyMaker("country", m); // language m = new StringProperty.Maker(PR_LANGUAGE); m.setInherited(true); m.setDefault("none"); - m.addShorthand(s_generics[PR_XML_LANG]); + m.addShorthand(generics[PR_XML_LANG]); addPropertyMaker("language", m); // script @@ -1114,7 +1118,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_TOP); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-top", m); @@ -1122,7 +1126,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_BOTTOM); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-bottom", m); @@ -1130,7 +1134,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_LEFT); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-left", m); @@ -1138,7 +1142,7 @@ public final class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_MARGIN_RIGHT); m.setInherited(false); m.setDefault("0pt"); - m.addShorthand(s_generics[PR_MARGIN]); + m.addShorthand(generics[PR_MARGIN]); m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH); addPropertyMaker("margin-right", m); @@ -1218,7 +1222,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("static", getEnumProperty(EN_STATIC, "STATIC")); m.addEnum("relative", getEnumProperty(EN_RELATIVE, "RELATIVE")); m.setDefault("static"); - m.addShorthand(s_generics[PR_POSITION]); + m.addShorthand(generics[PR_POSITION]); addPropertyMaker("relative-position", m); } @@ -1242,7 +1246,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("mathematical", getEnumProperty(EN_MATHEMATICAL, "MATHEMATICAL")); m.setDefault("auto"); m.setPercentBase(LengthBase.ALIGNMENT_ADJUST); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); addPropertyMaker("alignment-adjust", m); // alignment-baseline @@ -1261,7 +1265,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("hanging", getEnumProperty(EN_HANGING, "HANGING")); m.addEnum("mathematical", getEnumProperty(EN_MATHEMATICAL, "MATHEMATICAL")); m.setDefault("auto"); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); addPropertyMaker("alignment-baseline", m); // baseline-shift @@ -1271,7 +1275,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("sub", getEnumProperty(EN_SUB, "SUB")); m.addEnum("super", getEnumProperty(EN_SUPER, "SUPER")); m.setDefault("baseline"); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); m.setPercentBase(LengthBase.CUSTOM_BASE); addPropertyMaker("baseline-shift", m); @@ -1303,7 +1307,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("text-after-edge", getEnumProperty(EN_TEXT_AFTER_EDGE, "TEXT_AFTER_EDGE")); m.addEnum("text-before-edge", getEnumProperty(EN_TEXT_BEFORE_EDGE, "TEXT_BEFORE_EDGE")); m.setDefault("auto"); - m.addShorthand(s_generics[PR_VERTICAL_ALIGN]); + m.addShorthand(generics[PR_VERTICAL_ALIGN]); addPropertyMaker("dominant-baseline", m); // relative-align @@ -1315,7 +1319,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("relative-align", m); } - private void createAreaDimensionProperties() { + private void createAreaDimensionProperties() { // CSOK: MethodLength PropertyMaker m; LengthProperty.Maker l; DimensionPropertyMaker pdim; @@ -1464,8 +1468,10 @@ public final class FOPropertyMapping implements Constants { m = new EnumProperty.Maker(PR_SCALING_METHOD); m.setInherited(false); m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO")); - m.addEnum("integer-pixels", getEnumProperty(EN_INTEGER_PIXELS, "INTEGER_PIXELS")); - m.addEnum("resample-any-method", getEnumProperty(EN_RESAMPLE_ANY_METHOD, "RESAMPLE_ANY_METHOD")); + m.addEnum("integer-pixels", + getEnumProperty(EN_INTEGER_PIXELS, "INTEGER_PIXELS")); + m.addEnum("resample-any-method", + getEnumProperty(EN_RESAMPLE_ANY_METHOD, "RESAMPLE_ANY_METHOD")); m.setDefault("auto"); addPropertyMaker("scaling-method", m); @@ -1484,7 +1490,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("fox:block-progression-unit", l); } - private void createBlockAndLineProperties() { + private void createBlockAndLineProperties() { // CSOK: MethodLength PropertyMaker m; // hyphenation-keep @@ -1517,7 +1523,7 @@ public final class FOPropertyMapping implements Constants { m.addKeyword("normal", "1.2"); m.setPercentBase(LengthBase.FONTSIZE); m.setDefault("normal", true); - m.addShorthand(s_generics[PR_FONT]); + m.addShorthand(generics[PR_FONT]); addPropertyMaker("line-height", m); // line-height-shift-adjustment @@ -1543,9 +1549,11 @@ public final class FOPropertyMapping implements Constants { m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE")); m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE")); m.addEnum("treat-as-space", getEnumProperty(EN_TREAT_AS_SPACE, "TREAT_AS_SPACE")); - m.addEnum("treat-as-zero-width-space", getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE, "TREAT_AS_ZERO_WIDTH_SPACE")); + m.addEnum("treat-as-zero-width-space", + getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE, + "TREAT_AS_ZERO_WIDTH_SPACE")); m.setDefault("treat-as-space"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("linefeed-treatment", m); // white-space-treatment @@ -1553,11 +1561,17 @@ public final class FOPropertyMapping implements Constants { m.setInherited(true); m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE")); m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE")); - m.addEnum("ignore-if-before-linefeed", getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED, "IGNORE_IF_BEFORE_LINEFEED")); - m.addEnum("ignore-if-after-linefeed", getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED, "IGNORE_IF_AFTER_LINEFEED")); - m.addEnum("ignore-if-surrounding-linefeed", getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED, "IGNORE_IF_SURROUNDING_LINEFEED")); + m.addEnum("ignore-if-before-linefeed", + getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED, + "IGNORE_IF_BEFORE_LINEFEED")); + m.addEnum("ignore-if-after-linefeed", + getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED, + "IGNORE_IF_AFTER_LINEFEED")); + m.addEnum("ignore-if-surrounding-linefeed", + getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED, + "IGNORE_IF_SURROUNDING_LINEFEED")); m.setDefault("ignore-if-surrounding-linefeed"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("white-space-treatment", m); // text-align TODO: make it a StringProperty with enums. @@ -1637,7 +1651,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericBoolean); m.setInherited(true); m.setDefault("true"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("white-space-collapse", m); // wrap-option @@ -1646,7 +1660,7 @@ public final class FOPropertyMapping implements Constants { m.addEnum("wrap", getEnumProperty(EN_WRAP, "WRAP")); m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP")); m.setDefault("wrap"); - m.addShorthand(s_generics[PR_WHITE_SPACE]); + m.addShorthand(generics[PR_WHITE_SPACE]); addPropertyMaker("wrap-option", m); } @@ -1750,9 +1764,11 @@ public final class FOPropertyMapping implements Constants { m.setInherited(false); m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO")); m.addEnum("perceptual", getEnumProperty(EN_PERCEPTUAL, "PERCEPTUAL")); - m.addEnum("relative-colorimetric", getEnumProperty(EN_RELATIVE_COLOMETRIC, "RELATIVE_COLOMETRIC")); + m.addEnum("relative-colorimetric", getEnumProperty(EN_RELATIVE_COLOMETRIC, + "RELATIVE_COLOMETRIC")); m.addEnum("saturation", getEnumProperty(EN_SATURATION, "SATURATION")); - m.addEnum("absolute-colorimetric", getEnumProperty(EN_ABSOLUTE_COLORMETRIC, "ABSOLUTE_COLORMETRIC")); + m.addEnum("absolute-colorimetric", getEnumProperty(EN_ABSOLUTE_COLORMETRIC, + "ABSOLUTE_COLORMETRIC")); m.setDefault("auto"); addPropertyMaker("rendering-intent", m); } @@ -1804,13 +1820,13 @@ public final class FOPropertyMapping implements Constants { // break-after m = new EnumProperty.Maker(PR_BREAK_AFTER); m.useGeneric(genericBreak); - m.addShorthand(s_generics[PR_PAGE_BREAK_AFTER]); + m.addShorthand(generics[PR_PAGE_BREAK_AFTER]); addPropertyMaker("break-after", m); // break-before m = new EnumProperty.Maker(PR_BREAK_BEFORE); m.useGeneric(genericBreak); - m.addShorthand(s_generics[PR_PAGE_BREAK_BEFORE]); + m.addShorthand(generics[PR_PAGE_BREAK_BEFORE]); addPropertyMaker("break-before", m); // keep-together @@ -1818,7 +1834,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericKeep); m.setInherited(true); m.setDefault("auto"); - m.addShorthand(s_generics[PR_PAGE_BREAK_INSIDE]); + m.addShorthand(generics[PR_PAGE_BREAK_INSIDE]); addPropertyMaker("keep-together", m); // keep-with-next @@ -1826,7 +1842,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericKeep); m.setInherited(false); m.setDefault("auto"); - m.addShorthand(s_generics[PR_PAGE_BREAK_AFTER]); + m.addShorthand(generics[PR_PAGE_BREAK_AFTER]); addPropertyMaker("keep-with-next", m); // keep-with-previous @@ -1834,7 +1850,7 @@ public final class FOPropertyMapping implements Constants { m.useGeneric(genericKeep); m.setInherited(false); m.setDefault("auto"); - m.addShorthand(s_generics[PR_PAGE_BREAK_BEFORE]); + m.addShorthand(generics[PR_PAGE_BREAK_BEFORE]); addPropertyMaker("keep-with-previous", m); // orphans @@ -2240,7 +2256,8 @@ public final class FOPropertyMapping implements Constants { m.setInherited(false); m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO")); m.addEnum("paginate", getEnumProperty(EN_PAGINATE, "PAGINATE")); - m.addEnum("bounded-in-one-dimension", getEnumProperty(EN_BOUNDED_IN_ONE_DIMENSION, "BOUNDED_IN_ONE_DIMENSION")); + m.addEnum("bounded-in-one-dimension", getEnumProperty(EN_BOUNDED_IN_ONE_DIMENSION, + "BOUNDED_IN_ONE_DIMENSION")); m.addEnum("unbounded", getEnumProperty(EN_UNBOUNDED, "UNBOUNDED")); m.setDefault("auto"); addPropertyMaker("media-usage", m); @@ -2330,7 +2347,7 @@ public final class FOPropertyMapping implements Constants { // border-separation m = new LengthPairProperty.Maker(PR_BORDER_SEPARATION); m.setInherited(true); - m.addShorthand(s_generics[PR_BORDER_SPACING]); + m.addShorthand(generics[PR_BORDER_SPACING]); sub = new LengthProperty.Maker(CP_BLOCK_PROGRESSION_DIRECTION); sub.setDefault("0pt"); @@ -2577,7 +2594,7 @@ public final class FOPropertyMapping implements Constants { addPropertyMaker("z-index", m); } - private void createShorthandProperties() { + private void createShorthandProperties() { // CSOK: MethodLength PropertyMaker m; // background diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index 08ffa40a3..5db11f731 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -489,10 +489,10 @@ public class FOText extends FONode implements CharSequence { private class TextCharIterator extends CharIterator { - int currentPosition = 0; + private int currentPosition = 0; - boolean canRemove = false; - boolean canReplace = false; + private boolean canRemove = false; + private boolean canReplace = false; /** {@inheritDoc} */ public boolean hasNext() { diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index c848eb4f1..451481eb8 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -398,7 +398,9 @@ public class FOTreeBuilder extends DefaultHandler { FOValidationEventProducer eventProducer = FOValidationEventProducer.Provider.get( userAgent.getEventBroadcaster()); - eventProducer.unknownFormattingObject(this, currentFObj.getName(), + String name = (currentFObj != null ? currentFObj.getName() + : "{" + namespaceURI + "}" + localName); + eventProducer.unknownFormattingObject(this, name, new QName(namespaceURI, localName), getEffectiveLocator()); } diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 133d932bc..34e29a58a 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -44,7 +44,7 @@ import org.apache.fop.fo.properties.PropertyMaker; public abstract class FObj extends FONode implements Constants { /** the list of property makers */ - private static final PropertyMaker[] propertyListTable + private static final PropertyMaker[] PROPERTY_LIST_TABLE = FOPropertyMapping.getGenericMappings(); /** @@ -108,7 +108,7 @@ public abstract class FObj extends FONode implements Constants { * @return the requested Property Maker */ public static PropertyMaker getPropertyMakerFor(int propId) { - return propertyListTable[propId]; + return PROPERTY_LIST_TABLE[propId]; } /** {@inheritDoc} */ @@ -255,7 +255,7 @@ public abstract class FObj extends FONode implements Constants { /** * Check if this formatting object generates reference areas. * @return true if generates reference areas - * @todo see if needed + * TODO see if needed */ public boolean generatesReferenceAreas() { return false; @@ -610,7 +610,7 @@ public abstract class FObj extends FONode implements Constants { return (super.toString() + "[@id=" + this.id + "]"); } - /** Basic {@link FONodeIterator} implementation */ + /** Basic {@link FONode.FONodeIterator} implementation */ public class FObjIterator implements FONodeIterator { private static final int F_NONE_ALLOWED = 0; diff --git a/src/java/org/apache/fop/fo/InlineCharIterator.java b/src/java/org/apache/fop/fo/InlineCharIterator.java deleted file mode 100644 index f71753dde..000000000 --- a/src/java/org/apache/fop/fo/InlineCharIterator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.fo; - -import org.apache.fop.fo.properties.CommonBorderPaddingBackground; -import org.apache.fop.util.CharUtilities; -import java.util.NoSuchElementException; - -/** - * A recursive char iterator that indicates boundaries by returning - * an EOT char. - */ -public class InlineCharIterator extends RecursiveCharIterator { - private boolean startBoundary = false; - private boolean endBoundary = false; - - /** - * @param fobj the object for whose character contents and for whose - * descendant's character contents should be iterated - * @param bpb the CommonBorderPaddingBackground properties to be applied - */ - public InlineCharIterator(FObj fobj, CommonBorderPaddingBackground bpb) { - super(fobj); - checkBoundaries(bpb); - } - - - private void checkBoundaries(CommonBorderPaddingBackground bpb) { - /* Current understanding is that an <fo:inline> is always a boundary for - * whitespace collapse if it has a border or not - startBoundary = (bpb.getBorderStartWidth(false) > 0 - || bpb.getPaddingStart(false, null) > 0); // TODO do we need context here? - endBoundary = (bpb.getBorderEndWidth(false) > 0 - || bpb.getPaddingEnd(false, null) > 0); // TODO do we need context here? - */ - startBoundary = true; - endBoundary = true; - } - - /** - * @return true if there are more characters - */ - public boolean hasNext() { - if (startBoundary) { - return true; - } - return (super.hasNext() || endBoundary); - /* If super.hasNext() returns false, - * we return true if we are going to return a "boundary" signal - * else false. - */ - } - - /** - * @return the next character - * @throws NoSuchElementException if there are no more characters - */ - public char nextChar() throws NoSuchElementException { - if (startBoundary) { - startBoundary = false; - return CharUtilities.CODE_EOT; - } - try { - return super.nextChar(); - } catch (NoSuchElementException e) { - // Underlying has nothing more to return - // Check end boundary char - if (endBoundary) { - endBoundary = false; - return CharUtilities.CODE_EOT; - } else { - throw e; - } - } - } -} - diff --git a/src/java/org/apache/fop/fo/NullCharIterator.java b/src/java/org/apache/fop/fo/NullCharIterator.java index 2b2a2a9a0..db872caec 100644 --- a/src/java/org/apache/fop/fo/NullCharIterator.java +++ b/src/java/org/apache/fop/fo/NullCharIterator.java @@ -28,6 +28,10 @@ public class NullCharIterator extends CharIterator { private static CharIterator instance; + /** + * Obtain the singleton instance of the null character iterator. + * @return the char iterator + */ public static CharIterator getInstance() { if (instance == null) { instance = new NullCharIterator(); diff --git a/src/java/org/apache/fop/fo/PropertyListMaker.java b/src/java/org/apache/fop/fo/PropertyListMaker.java index e48541af5..ef8978b0c 100644 --- a/src/java/org/apache/fop/fo/PropertyListMaker.java +++ b/src/java/org/apache/fop/fo/PropertyListMaker.java @@ -23,6 +23,13 @@ package org.apache.fop.fo; * A PropertyListMaker is a factory that creates PropertyLists. */ public interface PropertyListMaker { + + /** + * Make a property list. + * @param fobj the FO from which the new property list is associated + * @param parentPropertyList the parent property list + * @return the new property list + */ PropertyList make(FObj fobj, PropertyList parentPropertyList); } diff --git a/src/java/org/apache/fop/fo/StaticPropertyList.java b/src/java/org/apache/fop/fo/StaticPropertyList.java index 5e6559e84..c3ab95b91 100644 --- a/src/java/org/apache/fop/fo/StaticPropertyList.java +++ b/src/java/org/apache/fop/fo/StaticPropertyList.java @@ -14,6 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* $Id$ */ + package org.apache.fop.fo; import org.apache.fop.fo.expr.PropertyException; @@ -62,14 +65,14 @@ public class StaticPropertyList extends PropertyList { /** * Override PropertyList.get() and provides fast caching of previously * retrieved property values. - * @param propId The property ID + * {@inheritDoc} */ public Property get(int propId, boolean bTryInherit, boolean bTryDefault) - throws PropertyException - { + throws PropertyException { Property p = values[propId]; if (p == null) { - p = values[propId] = super.get(propId, bTryInherit, bTryDefault); + p = super.get(propId, bTryInherit, bTryDefault); + values[propId] = p; } return p; } diff --git a/src/java/org/apache/fop/fo/ValidationException.java b/src/java/org/apache/fop/fo/ValidationException.java index 103c5fcc8..2285fbd19 100644 --- a/src/java/org/apache/fop/fo/ValidationException.java +++ b/src/java/org/apache/fop/fo/ValidationException.java @@ -26,10 +26,20 @@ import org.xml.sax.Locator; * Exception thrown during FO tree validation. */ public class ValidationException extends FOPException { + + /** + * Construct a validation exception instance. + * @param message a message + */ public ValidationException(String message) { super(message); } + /** + * Construct a validation exception instance. + * @param message a message + * @param locator a locator + */ public ValidationException(String message, Locator locator) { super(message, locator); } diff --git a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java index eb68b2a23..5307e75b0 100644 --- a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java +++ b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java @@ -47,8 +47,9 @@ public class BodyStartFunction extends FunctionBase { */ public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException { - Numeric distance = - pInfo.getPropertyList().get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric(); + Numeric distance + = pInfo.getPropertyList() + .get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric(); PropertyList pList = pInfo.getPropertyList(); while (pList != null && !(pList.getFObj() instanceof ListItem)) { diff --git a/src/java/org/apache/fop/fo/expr/NumericOp.java b/src/java/org/apache/fop/fo/expr/NumericOp.java index 9fe35d96d..a2b203330 100644 --- a/src/java/org/apache/fop/fo/expr/NumericOp.java +++ b/src/java/org/apache/fop/fo/expr/NumericOp.java @@ -19,8 +19,8 @@ package org.apache.fop.fo.expr; -import org.apache.fop.datatypes.PercentBaseContext; import org.apache.fop.datatypes.Numeric; +import org.apache.fop.datatypes.PercentBaseContext; /** * This class contains static methods to evaluate operations on Numeric @@ -30,7 +30,11 @@ import org.apache.fop.datatypes.Numeric; * The evaluation of the operation can then occur when getNumericValue() is * called. */ -public class NumericOp { +public final class NumericOp { + + private NumericOp() { + } + /** * Add the two operands and return a new Numeric representing the result. * @param op1 The first operand. @@ -47,11 +51,23 @@ public class NumericOp { } } - public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Add the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Can't subtract Numerics of different dimensions"); } - return numeric(op1.getNumericValue(context) + op2.getNumericValue(context), op1.getDimension()); + return numeric(op1.getNumericValue(context) + + op2.getNumericValue(context), op1.getDimension()); } /** @@ -71,11 +87,23 @@ public class NumericOp { } } - public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Subtract the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Can't subtract Numerics of different dimensions"); } - return numeric(op1.getNumericValue(context) - op2.getNumericValue(context), op1.getDimension()); + return numeric(op1.getNumericValue(context) + - op2.getNumericValue(context), op1.getDimension()); } /** @@ -95,7 +123,18 @@ public class NumericOp { } } - public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Multiply the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { return numeric(op1.getNumericValue(context) * op2.getNumericValue(context), op1.getDimension() + op2.getDimension()); } @@ -118,7 +157,18 @@ public class NumericOp { } } - public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Divide the two operands with a percentage context + * and return a new Numeric representing the result. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { return numeric(op1.getNumericValue(context) / op2.getNumericValue(context), op1.getDimension() - op2.getDimension()); } @@ -128,6 +178,7 @@ public class NumericOp { * @param op1 The first operand. * @param op2 The second operand. * @return A new Numeric object representing the absolute value. + * @throws PropertyException if a property exception occurs */ public static Numeric modulo(Numeric op1, Numeric op2) throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { @@ -137,14 +188,26 @@ public class NumericOp { } } - public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { - return numeric(op1.getNumericValue(context) % op2.getNumericValue(context), op1.getDimension()); + /** + * Return the remainder of a division of the two operand Numeric. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { + return numeric(op1.getNumericValue(context) + % op2.getNumericValue(context), op1.getDimension()); } /** * Return the absolute value of a Numeric. * @param op the operand. * @return a new Numeric object representing the absolute value of the operand. + * @throws PropertyException if a property exception occurs */ public static Numeric abs(Numeric op) throws PropertyException { if (op.isAbsolute()) { @@ -154,6 +217,14 @@ public class NumericOp { } } + /** + * Return the absolute value of a Numeric. + * @param op the operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ public static Numeric abs2(Numeric op, PercentBaseContext context) throws PropertyException { return numeric(Math.abs(op.getNumericValue(context)), op.getDimension()); } @@ -162,6 +233,7 @@ public class NumericOp { * Return the negation of a Numeric. * @param op the operand. * @return a new Numeric object representing the negation of the operand. + * @throws PropertyException if a property exception occurs */ public static Numeric negate(Numeric op) throws PropertyException { if (op.isAbsolute()) { @@ -171,8 +243,17 @@ public class NumericOp { } } + + /** + * Return the negation of a Numeric. + * @param op the operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ public static Numeric negate2(Numeric op, PercentBaseContext context) throws PropertyException { - return numeric(- op.getNumericValue(context), op.getDimension()); + return numeric(-op.getNumericValue(context), op.getDimension()); } /** @@ -190,7 +271,17 @@ public class NumericOp { } } - public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Return the larger of the two Numerics. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Arguments to max() must have same dimensions"); } @@ -212,7 +303,17 @@ public class NumericOp { } } - public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException { + /** + * Return the smaller of the two Numerics. + * @param op1 The first operand. + * @param op2 The second operand. + * @param context a percent base context + * @return A Numeric representing the result. + * @throws PropertyException If the dimension of the operand is different + * from the dimension of this Numeric. + */ + public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context) + throws PropertyException { if (op1.getDimension() != op2.getDimension()) { throw new PropertyException("Arguments to min() must have same dimensions"); } @@ -221,8 +322,8 @@ public class NumericOp { /** * Create a new absolute numeric with the specified value and dimension. - * @param value - * @param dimension + * @param value of numeric + * @param dimension of numeric * @return a new absolute numeric. */ private static Numeric numeric(double value, int dimension) { diff --git a/src/java/org/apache/fop/fo/expr/PropertyInfo.java b/src/java/org/apache/fop/fo/expr/PropertyInfo.java index 2bce0793f..0463e2e1d 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyInfo.java +++ b/src/java/org/apache/fop/fo/expr/PropertyInfo.java @@ -58,6 +58,7 @@ public class PropertyInfo { * a percent specification. * Propagates to the Maker. * @return The PercentBase object or null if percentLengthOK()=false. + * @throws PropertyException if a property exception occurs */ public PercentBase getPercentBase() throws PropertyException { PercentBase pcbase = getFunctionPercentBase(); @@ -66,6 +67,7 @@ public class PropertyInfo { /** * @return the current font-size value as base units (milli-points). + * @throws PropertyException if a property exception occurs */ public Length currentFontSize() throws PropertyException { return plist.get(Constants.PR_FONT_SIZE).getLength(); diff --git a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java b/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java index 7d846eefc..89a387753 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java +++ b/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java @@ -82,7 +82,7 @@ class PropertyTokenizer { currentTokenStartIndex = exprIndex; boolean bSawDecimal; recognizeOperator = true; - for (;;) { + while ( true ) { if (exprIndex >= exprLength) { currentToken = TOK_EOF; return; @@ -272,8 +272,11 @@ class PropertyTokenizer { } private void scanRestOfName() { - while (++exprIndex < exprLength - && isNameChar(expr.charAt(exprIndex))) { } + while ( ++exprIndex < exprLength ) { + if ( !isNameChar ( expr.charAt ( exprIndex ) ) ) { + break; + } + } } /** @@ -330,7 +333,7 @@ class PropertyTokenizer { * decimal digit (0-9). * @param c The character to check */ - private static final boolean isDigit(char c) { + private static boolean isDigit(char c) { return DIGITS.indexOf(c) >= 0; } @@ -339,7 +342,7 @@ class PropertyTokenizer { * hexadecimal digit (0-9, A-F, a-f). * @param c The character to check */ - private static final boolean isHexDigit(char c) { + private static boolean isHexDigit(char c) { return HEX_CHARS.indexOf(c) >= 0; } @@ -348,15 +351,16 @@ class PropertyTokenizer { * as defined by XSL (space, newline, CR, tab). * @param c The character to check */ - private static final boolean isSpace(char c) { + private static boolean isSpace(char c) { switch (c) { case ' ': case '\r': case '\n': case '\t': return true; + default: + return false; } - return false; } /** @@ -364,7 +368,7 @@ class PropertyTokenizer { * start character, ie. can start a NAME as defined by XSL. * @param c The character to check */ - private static final boolean isNameStartChar(char c) { + private static boolean isNameStartChar(char c) { return NAME_START_CHARS.indexOf(c) >= 0 || c >= 0x80; } @@ -373,7 +377,7 @@ class PropertyTokenizer { * character, ie. can occur in a NAME as defined by XSL. * @param c The character to check */ - private static final boolean isNameChar(char c) { + private static boolean isNameChar(char c) { return NAME_START_CHARS.indexOf(c) >= 0 || NAME_CHARS.indexOf(c) >= 0 || c >= 0x80; } diff --git a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java b/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java index a4e257546..883070056 100644 --- a/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java +++ b/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java @@ -33,14 +33,23 @@ import org.apache.fop.fo.properties.TableColLength; * or getValue() is called. */ public class RelativeNumericProperty extends Property implements Length { + /** ADDITION */ public static final int ADDITION = 1; + /** SUBTRACTION */ public static final int SUBTRACTION = 2; + /** MULTIPLY */ public static final int MULTIPLY = 3; + /** DIVIDE */ public static final int DIVIDE = 4; + /** MODULO */ public static final int MODULO = 5; + /** NEGATE */ public static final int NEGATE = 6; + /** ABS */ public static final int ABS = 7; + /** MAX */ public static final int MAX = 8; + /** MIN */ public static final int MIN = 9; // Used in the toString() method, indexed by operation id. @@ -145,6 +154,7 @@ public class RelativeNumericProperty extends Property implements Length { /** * Return the dimension of the expression + * @return numeric value as dimension */ public int getDimension() { return dimension; @@ -153,6 +163,7 @@ public class RelativeNumericProperty extends Property implements Length { /** * Return false since an expression is only created when there is relative * numerics involved. + * @return true if expression is absolute */ public boolean isAbsolute() { return false; @@ -160,6 +171,7 @@ public class RelativeNumericProperty extends Property implements Length { /** * Cast this numeric as a Length. + * @return numeric value as length */ public Length getLength() { if (dimension == 1) { @@ -169,6 +181,7 @@ public class RelativeNumericProperty extends Property implements Length { return null; } + /** @return numeric value */ public Numeric getNumeric() { return this; } @@ -272,7 +285,8 @@ public class RelativeNumericProperty extends Property implements Length { return "min(" + op1 + ", " + op2 + ")"; case ABS: return "abs(" + op1 + ")"; + default: + return "unknown operation " + operation; } - return "unknown operation " + operation; } } diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java index f9a556167..80a569c90 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java @@ -37,17 +37,18 @@ public class ExtensionElementMapping extends ElementMapping { /** The FOP extension namespace URI */ public static final String URI = "http://xmlgraphics.apache.org/fop/extensions"; - private static final Set propertyAttributes = new java.util.HashSet(); + private static final Set<String> PROPERTY_ATTRIBUTES + = new java.util.HashSet<String>(); static { //These are FOP's standard extension properties (fox:*) - propertyAttributes.add("block-progression-unit"); - propertyAttributes.add("widow-content-limit"); - propertyAttributes.add("orphan-content-limit"); - propertyAttributes.add("internal-destination"); - propertyAttributes.add("disable-column-balancing"); + PROPERTY_ATTRIBUTES.add("block-progression-unit"); + PROPERTY_ATTRIBUTES.add("widow-content-limit"); + PROPERTY_ATTRIBUTES.add("orphan-content-limit"); + PROPERTY_ATTRIBUTES.add("internal-destination"); + PROPERTY_ATTRIBUTES.add("disable-column-balancing"); //These are FOP's extension properties for accessibility - propertyAttributes.add("alt-text"); + PROPERTY_ATTRIBUTES.add("alt-text"); } /** @@ -62,7 +63,7 @@ public class ExtensionElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("outline", new UnknownXMLObj.Maker(URI)); foObjs.put("label", new UnknownXMLObj.Maker(URI)); foObjs.put("destination", new DestinationMaker()); @@ -92,7 +93,7 @@ public class ExtensionElementMapping extends ElementMapping { if (!URI.equals(attributeName.getNamespaceURI())) { throw new IllegalArgumentException("The namespace URIs don't match"); } - return propertyAttributes.contains(attributeName.getLocalName()); + return PROPERTY_ATTRIBUTES.contains(attributeName.getLocalName()); } } diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionObj.java b/src/java/org/apache/fop/fo/extensions/ExtensionObj.java index da732f421..4329f1a7e 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionObj.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionObj.java @@ -47,13 +47,15 @@ public abstract class ExtensionObj extends FObj { */ public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) - throws FOPException - { - // Empty + throws FOPException { } /** * Create a default property list for this element. + * @param parent the parent property list + * @param foEventHandler an event handler + * @return property list + * @throws FOPException in case of exception */ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException { diff --git a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java b/src/java/org/apache/fop/fo/extensions/ExternalDocument.java index 233714bd7..a6f5e7680 100644 --- a/src/java/org/apache/fop/fo/extensions/ExternalDocument.java +++ b/src/java/org/apache/fop/fo/extensions/ExternalDocument.java @@ -82,13 +82,18 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr } } + /** + * @throws FOPException in case of processing exception + * @see org.apache.fop.fo.FONode#startOfNode() + */ protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().startExternalDocument(this); } /** - * @see org.apache.fop.fo.FONode#endOfNode + * @throws FOPException in case of processing exception + * @see org.apache.fop.fo.FONode#endOfNode() */ protected void endOfNode() throws FOPException { getFOEventHandler().endExternalDocument(this); @@ -96,8 +101,11 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr } /** + * @param loc a locator + * @param nsURI a namespace uri or null + * @param localName a local name + * @throws ValidationException if invalid child * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - XSL/FOP: empty */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { @@ -162,17 +170,26 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr return textAlign; } - /** @see org.apache.fop.fo.FONode#getNamespaceURI() */ + /** + * @return namespace uri + * @see org.apache.fop.fo.FONode#getNamespaceURI() + */ public String getNamespaceURI() { return ExtensionElementMapping.URI; } - /** @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */ + /** + * @return namespace prefix + * @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() + */ public String getNormalNamespacePrefix() { return "fox"; } - /** @see org.apache.fop.fo.FONode#getLocalName() */ + /** + * @return local name + * @see org.apache.fop.fo.FONode#getLocalName() + */ public String getLocalName() { return "external-document"; } diff --git a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java b/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java index 7704c8de7..4798f5500 100644 --- a/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/InternalElementMapping.java @@ -34,7 +34,7 @@ public class InternalElementMapping extends ElementMapping { /** The FOP extension namespace URI */ public static final String URI = "http://xmlgraphics.apache.org/fop/internal"; - private static final Set PROPERTY_ATTRIBUTES = new java.util.HashSet(); + private static final Set<String> PROPERTY_ATTRIBUTES = new java.util.HashSet<String>(); static { //These are FOP's extension properties for accessibility @@ -53,7 +53,7 @@ public class InternalElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); } } diff --git a/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java index e5ab93c35..d1c671dbe 100644 --- a/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java @@ -44,7 +44,7 @@ public class OldExtensionElementMapping extends ElementMapping { */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("outline", new UnknownXMLObj.Maker(URI)); foObjs.put("label", new UnknownXMLObj.Maker(URI)); } diff --git a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java index 2cc451b64..6103345cf 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java @@ -53,7 +53,7 @@ public class BatikExtensionElementMapping extends ElementMapping { * Batik classes that apparently need it (error messages, perhaps) * @return an XML parser classname */ - private final String getAParserClassName() { + private String getAParserClassName() { try { //TODO Remove when Batik uses JAXP instead of SAX directly. SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -63,6 +63,7 @@ public class BatikExtensionElementMapping extends ElementMapping { } } + /** initialize mapping */ protected void initialize() { if (foObjs == null && batikAvail) { // this sets the parser that will be used @@ -72,7 +73,7 @@ public class BatikExtensionElementMapping extends ElementMapping { XMLResourceDescriptor.setXMLParserClassName( getAParserClassName()); - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("batik", new SE()); foObjs.put(DEFAULT, new SVGMaker()); } catch (Throwable t) { diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java b/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java index 6556c7251..67f6567c9 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java +++ b/src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java @@ -105,7 +105,7 @@ public class SVGDOMContentHandlerFactory implements ContentHandlerFactory { Class clazz = Class.forName( "org.apache.batik.dom.svg12.SVG12DOMImplementation"); return (DOMImplementation)clazz.getMethod( - "getDOMImplementation", null).invoke(null, null); + "getDOMImplementation", (Class[])null).invoke(null, (Object[])null); } catch (Exception e) { return SVGDOMImplementation.getDOMImplementation(); } diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java index 167baf723..7120dbb59 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java @@ -80,7 +80,7 @@ public class SVGElementMapping extends ElementMapping { XMLResourceDescriptor.setXMLParserClassName( getAParserClassName()); - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("svg", new SE()); foObjs.put(DEFAULT, new SVGMaker()); } catch (Throwable t) { diff --git a/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java b/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java index ff84ee11f..a6befd710 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java @@ -45,7 +45,7 @@ public class RDFElementMapping extends ElementMapping { /** {@inheritDoc} */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("RDF", new RDFElementMaker()); } } diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java b/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java index b2b3570f2..d934dc2b1 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java @@ -45,7 +45,7 @@ public class XMPElementMapping extends ElementMapping { /** {@inheritDoc} */ protected void initialize() { if (foObjs == null) { - foObjs = new HashMap(); + foObjs = new HashMap<String, Maker>(); foObjs.put("xmpmeta", new XMPMetaElementMaker()); } } diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java b/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java index 224741294..6dcc31385 100644 --- a/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java +++ b/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java @@ -33,6 +33,8 @@ import org.xml.sax.SAXException; */ public class XMPMetadata implements ExtensionAttachment, Serializable, XMLizable { + private static final long serialVersionUID = 591347206217931578L; + /** The category URI for this extension attachment. */ public static final String CATEGORY = XMPConstants.XMP_NAMESPACE; diff --git a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java index 0f4575c5b..7bc0ff00c 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java @@ -109,7 +109,9 @@ public abstract class AbstractPageNumberCitation extends FObj } /** {@inheritDoc} */ - public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + public void processNode + (String elementName, Locator locator, Attributes attlist, PropertyList pList) + throws FOPException { super.processNode(elementName, locator, attlist, pList); if (!inMarker() && (refId == null || "".equals(refId))) { missingPropertyError("ref-id"); diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index e3176464d..66e06db83 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -330,7 +330,8 @@ public class Block extends FObjMixed implements BreakPropertySet, StructurePoint /** * @return the "fox:disable-column-balancing" property, one of - * {@link Constants#EN_TRUE}, {@link Constants#EN_FALSE} + * {@link org.apache.fop.fo.Constants#EN_TRUE}, + * {@link org.apache.fop.fo.Constants#EN_FALSE} */ public int getDisableColumnBalancing() { return disableColumnBalancing; diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index 2a8d73002..57cb6e5c6 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -219,7 +219,8 @@ public class BlockContainer extends FObj implements BreakPropertySet { /** * @return the "fox:disable-column-balancing" property, one of - * {@link Constants#EN_TRUE}, {@link Constants#EN_FALSE} + * {@link org.apache.fop.fo.Constants#EN_TRUE}, + * {@link org.apache.fop.fo.Constants#EN_FALSE} */ public int getDisableColumnBalancing() { return disableColumnBalancing; diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java index 815b30393..5d8fcdc2c 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/java/org/apache/fop/fo/flow/Float.java @@ -38,7 +38,7 @@ public class Float extends FObj { // private int clear; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index e73701c3b..51d2581cd 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -76,9 +76,9 @@ public class Footnote extends FObj { /** * {@inheritDoc} * <br>XSL Content Model: (inline,footnote-body) - * @todo implement additional constraint: A fo:footnote is not permitted + * TODO implement additional constraint: A fo:footnote is not permitted * to have a fo:float, fo:footnote, or fo:marker as a descendant. - * @todo implement additional constraint: A fo:footnote is not + * TODO implement additional constraint: A fo:footnote is not * permitted to have as a descendant a fo:block-container that * generates an absolutely positioned area. */ diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index e6e8e9c01..d9ae63ec8 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -120,7 +120,8 @@ public class Inline extends InlineLevel implements StructurePointerPropertySet { } else if (!isBlockOrInlineItem(nsURI, localName)) { invalidChildError(loc, nsURI, localName); } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) { - invalidChildError(loc, getParent().getName(), nsURI, getName(), "rule.inlineContent"); + invalidChildError(loc, getParent().getName(), nsURI, getName(), + "rule.inlineContent"); } else { blockOrInlineItemFound = true; } diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index c25fc8cab..54027514c 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -30,7 +30,7 @@ import org.apache.fop.fo.properties.LengthRangeProperty; * <code>fo:leader</code></a> object. * The main property of <code>fo:leader</code> is leader-pattern. * The following patterns are treated: rule, space, dots and use-content. - * @todo implement validateChildNode() + * TODO implement validateChildNode() */ public class Leader extends InlineLevel { // The value of properties relevant for fo:leader. diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index f748bc15a..c4a2aa64b 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -119,7 +119,7 @@ public class ListItem extends FObj implements BreakPropertySet { /** * {@inheritDoc} - * @todo see if can/should rely on base class for this + * TODO see if can/should rely on base class for this * (i.e., add to childNodes instead) */ public void addChildNode(FONode child) { diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index 01863c0c7..4588a9df3 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; -import java.util.Collections; import java.util.Map; import org.xml.sax.Attributes; @@ -111,7 +110,7 @@ public class Marker extends FObjMixed { * <br><i>Additionally: "An fo:marker may contain any formatting objects that * are permitted as a replacement of any fo:retrieve-marker that retrieves * the fo:marker's children."</i> - * @todo implement "additional" constraint, possibly within fo:retrieve-marker + * TODO implement "additional" constraint, possibly within fo:retrieve-marker */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { @@ -199,17 +198,25 @@ public class Marker extends FObjMixed { name = attributes.getLocalName(i); value = attributes.getValue(i); - this.attribs[i] = - MarkerAttribute.getInstance(namespace, qname, name, value); + this.attribs[i] + = MarkerAttribute.getInstance(namespace, qname, name, value); } } - /** Null implementation; not used by this type of {@link PropertyList} */ + /** + * Null implementation; not used by this type of {@link PropertyList}. + * @param propId the propert id + * @param value the property value + */ public void putExplicit(int propId, Property value) { //nop } - /** Null implementation; not used by this type of {@link PropertyList} */ + /** + * Null implementation; not used by this type of {@link PropertyList}. + * @param propId the propert id + * @return the property id + */ public Property getExplicit(int propId) { return null; } @@ -259,7 +266,11 @@ public class Marker extends FObjMixed { } } - /** Default implementation; not used */ + /** + * Default implementation; not used. + * @param index a type index + * @return type string + */ public String getType(int index) { return "CDATA"; } @@ -305,12 +316,21 @@ public class Marker extends FObjMixed { return index; } - /** Default implementation; not used */ + /** + * Default implementation; not used + * @param name a type name + * @param namespace a type namespace + * @return type string + */ public String getType(String name, String namespace) { return "CDATA"; } - /** Default implementation; not used */ + /** + * Default implementation; not used + * @param qname a type name + * @return type string + */ public String getType(String qname) { return "CDATA"; } @@ -337,12 +357,16 @@ public class Marker extends FObjMixed { /** Convenience inner class */ public static final class MarkerAttribute { - private static PropertyCache attributeCache = - new PropertyCache(MarkerAttribute.class); + private static PropertyCache attributeCache + = new PropertyCache(MarkerAttribute.class); + /** namespace */ protected String namespace; + /** qualfied name */ protected String qname; + /** local name */ protected String name; + /** value */ protected String value; /** diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/java/org/apache/fop/fo/flow/MultiCase.java index b2d630ba7..ac965dffb 100644 --- a/src/java/org/apache/fop/fo/flow/MultiCase.java +++ b/src/java/org/apache/fop/fo/flow/MultiCase.java @@ -27,7 +27,7 @@ import org.apache.fop.fo.PropertyList; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_multi-case"> * <code>fo:multi-case</code></a> object. - * @todo implement validateChildNode() + * TODO implement validateChildNode() */ public class MultiCase extends FObj { // The value of properties relevant for fo:multi-case. @@ -38,7 +38,7 @@ public class MultiCase extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java index 091934203..3e2e57d97 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java @@ -37,11 +37,11 @@ public class MultiProperties extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; // used for input FO validation - boolean hasMultiPropertySet = false; - boolean hasWrapper = false; + private boolean hasMultiPropertySet = false; + private boolean hasWrapper = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java index 96e73ec97..6e7c6a3e0 100644 --- a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java @@ -37,7 +37,7 @@ public class MultiPropertySet extends FObj { // private ToBeImplementedProperty activeState; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java index 1db72159e..aa18d6cdf 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java @@ -39,7 +39,7 @@ public class MultiSwitch extends FObj { // private CommonAccessibility commonAccessibility; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/MultiToggle.java b/src/java/org/apache/fop/fo/flow/MultiToggle.java index aacfda8eb..10766680e 100644 --- a/src/java/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/java/org/apache/fop/fo/flow/MultiToggle.java @@ -39,7 +39,7 @@ public class MultiToggle extends FObj { // public ToBeImplementedProperty prSwitchTo; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Base constructor diff --git a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java index c58ecc628..3fe977b21 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java @@ -16,6 +16,7 @@ */ /* $Id$ */ + package org.apache.fop.fo.flow; import org.apache.fop.fo.FONode; @@ -50,7 +51,9 @@ public class RetrieveTableMarker extends AbstractRetrieveMarker { * <i>NOTE: An <code>fo:retrieve-table-marker</code> is only permitted as a descendant * of an <code>fo:table-header</code> or an <code>fo:table-footer</code>.</i> */ - public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + public void processNode + (String elementName, Locator locator, Attributes attlist, PropertyList pList) + throws FOPException { if (findAncestor(FO_TABLE_HEADER) < 0 && findAncestor(FO_TABLE_FOOTER) < 0) { invalidChildError(locator, getParent().getName(), FO_URI, getName(), diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index 74072da87..7fb412521 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -76,7 +76,8 @@ public class Wrapper extends FObjMixed { try { FONode.validateChildNode(this.parent, loc, nsURI, localName); } catch (ValidationException vex) { - invalidChildError(loc, getName(), FO_URI, localName, "rule.wrapperInvalidChildForParent"); + invalidChildError(loc, getName(), FO_URI, localName, + "rule.wrapperInvalidChildForParent"); } blockOrInlineItemFound = true; } else { diff --git a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java b/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java index 1f73f5f10..9f3ed195d 100644 --- a/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java +++ b/src/java/org/apache/fop/fo/flow/table/ColumnNumberManager.java @@ -77,8 +77,7 @@ public class ColumnNumberManager { for (int i = 0; i < pendingSpans.size(); i++) { pSpan = (PendingSpan) pendingSpans.get(i); if (pSpan != null) { - pSpan.rowsLeft--; - if (pSpan.rowsLeft == 0) { + if ( pSpan.decrRowsLeft() == 0 ) { pendingSpans.set(i, null); } else { usedColumnIndices.set(i); diff --git a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java b/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java index 5ff01b7fa..b5cd56d47 100644 --- a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java +++ b/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java @@ -36,20 +36,23 @@ import org.apache.fop.layoutmgr.table.CollapsingBorderModel; */ public class ConditionalBorder { + /** normal border */ public static final int NORMAL = 0; + /** leading and trailing border */ public static final int LEADING_TRAILING = 1; + /** all the rest */ public static final int REST = 2; /** Normal case, no break. */ - BorderSpecification normal; + BorderSpecification normal; // CSOK: VisibilityModifier /** Special case: the cell is at the top or the bottom of the page. */ - BorderSpecification leadingTrailing; + BorderSpecification leadingTrailing; // CSOK: VisibilityModifier /** Special case: break inside the cell. */ - BorderSpecification rest; + BorderSpecification rest; // CSOK: VisibilityModifier /** The model used to resolve borders. */ private CollapsingBorderModel collapsingBorderModel; diff --git a/src/java/org/apache/fop/fo/flow/table/GridUnit.java b/src/java/org/apache/fop/fo/flow/table/GridUnit.java index 229a7177f..37f3df37c 100644 --- a/src/java/org/apache/fop/fo/flow/table/GridUnit.java +++ b/src/java/org/apache/fop/fo/flow/table/GridUnit.java @@ -65,13 +65,13 @@ public class GridUnit { private byte flags = 0; /** the border-before specification */ - ConditionalBorder borderBefore; + ConditionalBorder borderBefore; // CSOK: VisibilityModifier /** the border-after specification */ - ConditionalBorder borderAfter; + ConditionalBorder borderAfter; // CSOK: VisibilityModifier /** the border-start specification */ - BorderSpecification borderStart; + BorderSpecification borderStart; // CSOK: VisibilityModifier /** the border-end specification */ - BorderSpecification borderEnd; + BorderSpecification borderEnd; // CSOK: VisibilityModifier /** The border model helper associated with the table */ protected CollapsingBorderModel collapsingBorderModel; diff --git a/src/java/org/apache/fop/fo/flow/table/PendingSpan.java b/src/java/org/apache/fop/fo/flow/table/PendingSpan.java index 321684fae..0a5a2b41a 100644 --- a/src/java/org/apache/fop/fo/flow/table/PendingSpan.java +++ b/src/java/org/apache/fop/fo/flow/table/PendingSpan.java @@ -27,7 +27,7 @@ class PendingSpan { /** * member variable holding the number of rows left */ - int rowsLeft; + private int rowsLeft; /** * Constructor @@ -37,4 +37,22 @@ class PendingSpan { public PendingSpan(int rows) { rowsLeft = rows; } + + /** @return number of rows spanned */ + public int getRowsLeft() { + return rowsLeft; + } + + /** + * Decrement rows spanned. + * @return number of rows spanned after decrementing + */ + public int decrRowsLeft() { + if ( rowsLeft > 0 ) { + return --rowsLeft; + } else { + return 0; + } + } + }
\ No newline at end of file diff --git a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java index 9326d6cd4..529a6acc2 100644 --- a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java +++ b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java @@ -85,6 +85,10 @@ public class PrimaryGridUnit extends GridUnit { return (TablePart) node; } + /** + * Get cell's layout manager. + * @return the cell's layout manager + */ public TableCellLayoutManager getCellLM() { assert cellLM != null; return cellLM; @@ -109,6 +113,10 @@ public class PrimaryGridUnit extends GridUnit { this.elements = elements; } + /** + * Obtain the Knuth elements. + * @return a list of Knuth elements + */ public List getElements() { return this.elements; } @@ -247,6 +255,10 @@ public class PrimaryGridUnit extends GridUnit { return this.rows; } + /** + * Add a row. + * @param row the row to be added + */ public void addRow(GridUnit[] row) { if (rows == null) { rows = new java.util.ArrayList(); diff --git a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java index 919e73bfb..634460ec4 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java @@ -30,7 +30,7 @@ import org.apache.fop.fo.ValidationException; /** * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-and-caption"> * <code>fo:table-and-caption</code></a> property. - * @todo needs implementation + * TODO needs implementation */ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { // The value of properties relevant for fo:table-and-caption. @@ -50,7 +50,7 @@ public class TableAndCaption extends FObj /*implements BreakPropertySet*/ { // private int textAlign; // End of property values - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** used for FO validation */ private boolean tableCaptionFound = false; diff --git a/src/java/org/apache/fop/fo/flow/table/TableCaption.java b/src/java/org/apache/fop/fo/flow/table/TableCaption.java index bbc9b52bc..fc5d3d5b7 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCaption.java @@ -49,7 +49,7 @@ public class TableCaption extends FObj { /** used for FO validation */ private boolean blockItemFound = false; - static boolean notImplementedWarningGiven = false; + private static boolean notImplementedWarningGiven = false; /** * Create a TableCaption instance with the given {@link FONode} diff --git a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java index 9b4fe755f..41eab578f 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java @@ -30,14 +30,26 @@ import org.apache.fop.fo.FONode; */ public abstract class TableCellContainer extends TableFObj implements ColumnNumberManagerHolder { + /** list of pending spans */ protected List pendingSpans; + /** column number manager */ protected ColumnNumberManager columnNumberManager; + /** + * Construct table cell container. + * @param parent the parent node of the cell container + */ public TableCellContainer(FONode parent) { super(parent); } + /** + * Add cell to current row. + * @param cell a table cell to add + * @param firstRow true is first row + * @throws FOPException if exception occurs + */ protected void addTableCellChild(TableCell cell, boolean firstRow) throws FOPException { int colNumber = cell.getColumnNumber(); int colSpan = cell.getNumberColumnsSpanned(); diff --git a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java index d6abf609e..792151360 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java +++ b/src/java/org/apache/fop/fo/flow/table/TableEventProducer.java @@ -32,7 +32,10 @@ import org.apache.fop.fo.expr.PropertyException; public interface TableEventProducer extends EventProducer { /** Provider class for the event producer. */ - class Provider { + static final class Provider { + + private Provider() { + } /** * Returns an event producer. diff --git a/src/java/org/apache/fop/fo/flow/table/TableFObj.java b/src/java/org/apache/fop/fo/flow/table/TableFObj.java index ab8676cb3..fce82dcff 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableFObj.java +++ b/src/java/org/apache/fop/fo/flow/table/TableFObj.java @@ -50,12 +50,12 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty private Numeric borderStartPrecedence; private String ptr; - ConditionalBorder borderBefore; - ConditionalBorder borderAfter; - BorderSpecification borderStart; - BorderSpecification borderEnd; + ConditionalBorder borderBefore; // CSOK: VisibilityModifier + ConditionalBorder borderAfter; // CSOK: VisibilityModifier + BorderSpecification borderStart; // CSOK: VisibilityModifier + BorderSpecification borderEnd; // CSOK: VisibilityModifier - CollapsingBorderModel collapsingBorderModel; + CollapsingBorderModel collapsingBorderModel; // CSOK: VisibilityModifier /** * Create a TableFObj instance that is a child @@ -205,9 +205,10 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty int foId = propertyList.getFObj().getNameId(); if (i <= 0) { if (foId == FO_TABLE_CELL || foId == FO_TABLE_COLUMN) { - ColumnNumberManagerHolder parent = - (ColumnNumberManagerHolder) propertyList.getParentFObj(); - ColumnNumberManager columnIndexManager = parent.getColumnNumberManager(); + ColumnNumberManagerHolder parent + = (ColumnNumberManagerHolder) propertyList.getParentFObj(); + ColumnNumberManager columnIndexManager + = parent.getColumnNumberManager(); i = columnIndexManager.getCurrentColumnNumber(); } else { /* very exceptional case: @@ -216,10 +217,10 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty */ i = 1; } - TableEventProducer eventProducer = - TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster()); + TableEventProducer eventProducer = TableEventProducer.Provider.get( + fo.getUserAgent().getEventBroadcaster()); eventProducer.forceNextColumnNumber(this, propertyList.getFObj().getName(), - val, i, propertyList.getFObj().getLocator()); + val, i, propertyList.getFObj().getLocator()); } return NumberProperty.getInstance(i); } @@ -229,7 +230,8 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty } /** {@inheritDoc} */ - public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { + public void processNode(String elementName, Locator locator, Attributes attlist, + PropertyList pList) throws FOPException { super.processNode(elementName, locator, attlist, pList); Table table = getTable(); if (!inMarker() && !table.isSeparateBorderModel()) { diff --git a/src/java/org/apache/fop/fo/flow/table/TablePart.java b/src/java/org/apache/fop/fo/flow/table/TablePart.java index 5b04cddc7..3ab92cc94 100644 --- a/src/java/org/apache/fop/fo/flow/table/TablePart.java +++ b/src/java/org/apache/fop/fo/flow/table/TablePart.java @@ -46,10 +46,9 @@ public abstract class TablePart extends TableCellContainer { // private int visibility; // End of property values - /** - * used for validation - */ + /** table rows found */ protected boolean tableRowsFound = false; + /** table cells found */ protected boolean tableCellsFound = false; private boolean firstRow = true; @@ -124,6 +123,10 @@ public abstract class TablePart extends TableCellContainer { return this; } + /** + * Finish last row group. + * @throws ValidationException if content validation exception + */ protected void finishLastRowGroup() throws ValidationException { if (!inMarker()) { RowGroupBuilder rowGroupBuilder = getTable().getRowGroupBuilder(); @@ -214,6 +217,7 @@ public abstract class TablePart extends TableCellContainer { rowGroups.add(rowGroup); } + /** @return list of row groups */ public List getRowGroups() { return rowGroups; } diff --git a/src/java/org/apache/fop/fo/flow/table/TableRow.java b/src/java/org/apache/fop/fo/flow/table/TableRow.java index 2feb45d86..dd9f7c6d4 100644 --- a/src/java/org/apache/fop/fo/flow/table/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/table/TableRow.java @@ -144,7 +144,6 @@ public class TableRow extends TableCellContainer implements BreakPropertySet { return (TablePart) parent; } - /** {@inheritDoc} */ boolean isTableRow() { return true; } diff --git a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java index dce36f95c..51b24b314 100644 --- a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java @@ -34,7 +34,9 @@ import org.apache.fop.fo.PropertyList; public abstract class AbstractPageSequence extends FObj { // The value of properties relevant for fo:page-sequence. + /** initial page number */ protected Numeric initialPageNumber; + /** forced page count */ protected int forcePageCount; private String format; private int letterValue; @@ -45,6 +47,7 @@ public abstract class AbstractPageSequence extends FObj { private PageNumberGenerator pageNumberGenerator; + /** starting page number */ protected int startingPageNumber = 0; /** diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java index 1385bccc9..9c68043ff 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -41,7 +41,7 @@ import org.apache.fop.fo.ValidationException; */ public class Declarations extends FObj { - private Map colorProfiles = null; + private Map<String, ColorProfile> colorProfiles = null; /** * @param parent FONode that is the parent of this object @@ -98,7 +98,7 @@ public class Declarations extends FObj { private void addColorProfile(ColorProfile cp) { if (colorProfiles == null) { - colorProfiles = new java.util.HashMap(); + colorProfiles = new java.util.HashMap<String, ColorProfile>(); } if (colorProfiles.get(cp.getColorProfileName()) != null) { // duplicate names @@ -132,7 +132,7 @@ public class Declarations extends FObj { public ColorProfile getColorProfile(String cpName) { ColorProfile profile = null; if (this.colorProfiles != null) { - profile = (ColorProfile)this.colorProfiles.get(cpName); + profile = this.colorProfiles.get(cpName); } return profile; } diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 482ec83c4..c4189d0c4 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -44,8 +44,8 @@ import org.apache.fop.fo.ValidationException; */ public class LayoutMasterSet extends FObj { - private Map simplePageMasters; - private Map pageSequenceMasters; + private Map<String, SimplePageMaster> simplePageMasters; + private Map<String, PageSequenceMaster> pageSequenceMasters; /** * Create a LayoutMasterSet instance that is a child of the given @@ -65,8 +65,8 @@ public class LayoutMasterSet extends FObj { /** {@inheritDoc} */ protected void startOfNode() throws FOPException { getRoot().setLayoutMasterSet(this); - simplePageMasters = new java.util.HashMap(); - pageSequenceMasters = new java.util.HashMap(); + simplePageMasters = new java.util.HashMap<String, SimplePageMaster>(); + pageSequenceMasters = new java.util.HashMap<String, PageSequenceMaster>(); } /** {@inheritDoc} */ @@ -98,18 +98,13 @@ public class LayoutMasterSet extends FObj { */ private void checkRegionNames() throws ValidationException { // (user-entered) region-name to default region map. - Map allRegions = new java.util.HashMap(); - for (Iterator spm = simplePageMasters.values().iterator(); - spm.hasNext();) { - SimplePageMaster simplePageMaster - = (SimplePageMaster)spm.next(); - Map spmRegions = simplePageMaster.getRegions(); - for (Iterator e = spmRegions.values().iterator(); - e.hasNext();) { - Region region = (Region) e.next(); + Map<String, String> allRegions = new java.util.HashMap<String, String>(); + for (SimplePageMaster simplePageMaster : simplePageMasters.values()) { + Map<String, Region> spmRegions = simplePageMaster.getRegions(); + for (Region region : spmRegions.values()) { if (allRegions.containsKey(region.getRegionName())) { String defaultRegionName - = (String) allRegions.get(region.getRegionName()); + = allRegions.get(region.getRegionName()); if (!defaultRegionName.equals(region.getDefaultRegionName())) { getFOValidationEventProducer().regionNameMappedToMultipleRegionClasses(this, region.getRegionName(), @@ -118,7 +113,7 @@ public class LayoutMasterSet extends FObj { } } allRegions.put(region.getRegionName(), - region.getDefaultRegionName()); + region.getDefaultRegionName()); } } } @@ -155,7 +150,7 @@ public class LayoutMasterSet extends FObj { * @return the requested simple-page-master */ public SimplePageMaster getSimplePageMaster(String masterName) { - return (SimplePageMaster)this.simplePageMasters.get(masterName); + return this.simplePageMasters.get(masterName); } /** @@ -185,7 +180,7 @@ public class LayoutMasterSet extends FObj { * @return the requested PageSequenceMaster instance */ public PageSequenceMaster getPageSequenceMaster(String masterName) { - return (PageSequenceMaster)this.pageSequenceMasters.get(masterName); + return this.pageSequenceMasters.get(masterName); } /** @@ -194,9 +189,8 @@ public class LayoutMasterSet extends FObj { * @return true when the region name specified has a region in this LayoutMasterSet */ public boolean regionNameExists(String regionName) { - for (Iterator e = simplePageMasters.values().iterator(); - e.hasNext();) { - if (((SimplePageMaster)e.next()).regionNameExists(regionName)) { + for (SimplePageMaster spm : simplePageMasters.values()) { + if (spm.regionNameExists(regionName)) { return true; } } diff --git a/src/java/org/apache/fop/fo/pagination/PageProductionException.java b/src/java/org/apache/fop/fo/pagination/PageProductionException.java index bb09db6f4..39060f3d4 100644 --- a/src/java/org/apache/fop/fo/pagination/PageProductionException.java +++ b/src/java/org/apache/fop/fo/pagination/PageProductionException.java @@ -98,7 +98,7 @@ public class PageProductionException extends RuntimeException { } /** {@inheritDoc} */ - public Class getExceptionClass() { + public Class<PageProductionException> getExceptionClass() { return PageProductionException.class; } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 26812166d..ee78bb8ba 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -48,7 +48,7 @@ public class PageSequence extends AbstractPageSequence { // the set of flows includes StaticContent flows also /** Map of flows to their flow name (flow-name, Flow) */ - private Map/*<String, Flow>*/ flowMap; + private Map<String, Flow> flowMap; /** * The currentSimplePageMaster is either the page master for the @@ -96,7 +96,7 @@ public class PageSequence extends AbstractPageSequence { /** {@inheritDoc} */ protected void startOfNode() throws FOPException { super.startOfNode(); - flowMap = new java.util.HashMap/*<String, Flow>*/(); + flowMap = new java.util.HashMap<String, Flow>(); this.simplePageMaster = getRoot().getLayoutMasterSet().getSimplePageMaster(masterReference); @@ -151,7 +151,7 @@ public class PageSequence extends AbstractPageSequence { /** * {@inheritDoc} - * @todo see if addChildNode() should also be called for fo's other than + * TODO see if addChildNode() should also be called for fo's other than * fo:flow. */ public void addChildNode(FONode child) throws FOPException { @@ -167,7 +167,7 @@ public class PageSequence extends AbstractPageSequence { break; case FO_STATIC_CONTENT: addFlow((StaticContent)child); - flowMap.put(((StaticContent)child).getFlowName(), child); + flowMap.put(((Flow)child).getFlowName(), (Flow)child); break; default: super.addChildNode(child); @@ -239,7 +239,7 @@ public class PageSequence extends AbstractPageSequence { } /** @return the flow map for this page-sequence */ - public Map getFlowMap() { + public Map<String, Flow> getFlowMap() { return this.flowMap; } @@ -254,10 +254,9 @@ public class PageSequence extends AbstractPageSequence { * @return the SimplePageMaster to use for this page * @throws PageProductionException if there's a problem determining the page master */ - public SimplePageMaster getNextSimplePageMaster(int page, - boolean isFirstPage, - boolean isLastPage, - boolean isBlank) throws PageProductionException { + public SimplePageMaster getNextSimplePageMaster + (int page, boolean isFirstPage, boolean isLastPage, boolean isBlank) + throws PageProductionException { if (pageSequenceMaster == null) { return simplePageMaster; diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 705b955e9..5b71525d3 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -44,7 +44,7 @@ public class PageSequenceMaster extends FObj { // End of property values private LayoutMasterSet layoutMasterSet; - private List subSequenceSpecifiers; + private List<SubSequenceSpecifier> subSequenceSpecifiers; private SubSequenceSpecifier currentSubSequence; private int currentSubSequenceNumber = -1; @@ -76,7 +76,7 @@ public class PageSequenceMaster extends FObj { /** {@inheritDoc} */ protected void startOfNode() throws FOPException { - subSequenceSpecifiers = new java.util.ArrayList(); + subSequenceSpecifiers = new java.util.ArrayList<SubSequenceSpecifier>(); layoutMasterSet = parent.getRoot().getLayoutMasterSet(); layoutMasterSet.addPageSequenceMaster(masterName, this); } @@ -121,8 +121,7 @@ public class PageSequenceMaster extends FObj { currentSubSequenceNumber++; if (currentSubSequenceNumber >= 0 && currentSubSequenceNumber < subSequenceSpecifiers.size()) { - return (SubSequenceSpecifier)subSequenceSpecifiers - .get(currentSubSequenceNumber); + return subSequenceSpecifiers.get(currentSubSequenceNumber); } return null; } @@ -134,8 +133,8 @@ public class PageSequenceMaster extends FObj { currentSubSequenceNumber = -1; currentSubSequence = null; if (subSequenceSpecifiers != null) { - for (int i = 0; i < subSequenceSpecifiers.size(); i++) { - ((SubSequenceSpecifier)subSequenceSpecifiers.get(i)).reset(); + for (SubSequenceSpecifier subSequenceSpecifier : subSequenceSpecifiers) { + subSequenceSpecifier.reset(); } } } @@ -150,7 +149,7 @@ public class PageSequenceMaster extends FObj { if (!success) { if (currentSubSequenceNumber > 0) { currentSubSequenceNumber--; - currentSubSequence = (SubSequenceSpecifier)subSequenceSpecifiers + currentSubSequence = subSequenceSpecifiers .get(currentSubSequenceNumber); } else { currentSubSequence = null; diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 6f94418be..a3c259aa7 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -31,7 +31,6 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.ValidationException; -import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; /** @@ -48,7 +47,8 @@ public abstract class Region extends FObj { private int writingMode; // End of property values - private SimplePageMaster layoutMaster; + /** the parent {@link SimplePageMaster} */ + protected final SimplePageMaster layoutMaster; /** * Base constructor @@ -103,11 +103,9 @@ public abstract class Region extends FObj { /** * @param pageRefRect reference dimension of the page area. - * @param spm the simple page master this region belongs to. * @return the rectangle for the viewport area */ - public abstract Rectangle getViewportRectangle(FODimension pageRefRect - , SimplePageMaster spm); + public abstract Rectangle getViewportRectangle(FODimension pageRefRect); /** * Returns the default region name (xsl-region-before, xsl-region-start, diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java index 841bff0d6..bab5d46b8 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.java @@ -44,7 +44,7 @@ public class RegionAfter extends RegionBA { } /** {@inheritDoc} */ - public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) { + public Rectangle getViewportRectangle (FODimension reldims) { /* Special rules apply to resolving extent as values are resolved relative * to the page size and reference orientation. */ @@ -52,7 +52,8 @@ public class RegionAfter extends RegionBA { PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); PercentBaseContext neighbourContext; Rectangle vpRect; - if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { + if (layoutMaster.getWritingMode() == EN_LR_TB + || layoutMaster.getWritingMode() == EN_RL_TB) { neighbourContext = pageWidthContext; vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(pageHeightContext) , reldims.ipd, getExtent().getValue(pageHeightContext)); @@ -62,7 +63,7 @@ public class RegionAfter extends RegionBA { , getExtent().getValue(pageWidthContext), reldims.ipd); } if (getPrecedence() == EN_FALSE) { - adjustIPD(vpRect, spm.getWritingMode(), neighbourContext); + adjustIPD(vpRect, layoutMaster.getWritingMode(), neighbourContext); } return vpRect; } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java index 71ea26818..4aa29ec90 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java @@ -25,7 +25,7 @@ import java.awt.Rectangle; // FOP import org.apache.fop.datatypes.FODimension; import org.apache.fop.datatypes.LengthBase; -import org.apache.fop.datatypes.SimplePercentBaseContext; +import org.apache.fop.datatypes.PercentBaseContext; import org.apache.fop.fo.FONode; /** @@ -49,31 +49,16 @@ public class RegionBefore extends RegionBA { } /** {@inheritDoc} */ - public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) { + public Rectangle getViewportRectangle (FODimension reldims) { /* Special rules apply to resolving extent as values are resolved relative * to the page size and reference orientation. */ - SimplePercentBaseContext pageWidthContext; - SimplePercentBaseContext pageHeightContext; - if (spm.getReferenceOrientation() % 180 == 0) { - pageWidthContext = new SimplePercentBaseContext(null, - LengthBase.CUSTOM_BASE, - spm.getPageWidth().getValue()); - pageHeightContext = new SimplePercentBaseContext(null, - LengthBase.CUSTOM_BASE, - spm.getPageHeight().getValue()); - } else { - // invert width and height since top left are rotated by 90 (cl or ccl) - pageWidthContext = new SimplePercentBaseContext(null, - LengthBase.CUSTOM_BASE, - spm.getPageHeight().getValue()); - pageHeightContext = new SimplePercentBaseContext(null, - LengthBase.CUSTOM_BASE, - spm.getPageWidth().getValue()); - } - SimplePercentBaseContext neighbourContext; + PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE); + PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); + PercentBaseContext neighbourContext; Rectangle vpRect; - if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { + if (layoutMaster.getWritingMode() == EN_LR_TB + || layoutMaster.getWritingMode() == EN_RL_TB) { neighbourContext = pageWidthContext; vpRect = new Rectangle(0, 0, reldims.ipd, getExtent().getValue(pageHeightContext)); } else { @@ -81,7 +66,7 @@ public class RegionBefore extends RegionBA { vpRect = new Rectangle(0, 0, getExtent().getValue(pageWidthContext), reldims.ipd); } if (getPrecedence() == EN_FALSE) { - adjustIPD(vpRect, spm.getWritingMode(), neighbourContext); + adjustIPD(vpRect, layoutMaster.getWritingMode(), neighbourContext); } return vpRect; } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index 165bb4734..5eed36061 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -96,7 +96,7 @@ public class RegionBody extends Region { } /** {@inheritDoc} */ - public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) { + public Rectangle getViewportRectangle (FODimension reldims) { /* Special rules apply to resolving margins in the page context. * Contrary to normal margins in this case top and bottom margin * are resolved relative to the height. In the property subsystem @@ -106,12 +106,14 @@ public class RegionBody extends Region { * Also the values are resolved relative to the page size * and reference orientation. */ - PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CONTAINING_BLOCK_WIDTH); - PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CONTAINING_BLOCK_WIDTH); + PercentBaseContext pageWidthContext + = getPageWidthContext(LengthBase.CONTAINING_BLOCK_WIDTH); + PercentBaseContext pageHeightContext + = getPageHeightContext(LengthBase.CONTAINING_BLOCK_WIDTH); int start; int end; - if (spm.getWritingMode() == EN_LR_TB) { // Left-to-right + if (layoutMaster.getWritingMode() == EN_LR_TB) { // Left-to-right start = commonMarginBlock.marginLeft.getValue(pageWidthContext); end = commonMarginBlock.marginRight.getValue(pageWidthContext); } else { // all other supported modes are right-to-left diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/java/org/apache/fop/fo/pagination/RegionEnd.java index 8b348ed5d..2533763a5 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.java @@ -44,7 +44,7 @@ public class RegionEnd extends RegionSE { } /** {@inheritDoc} */ - public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) { + public Rectangle getViewportRectangle (FODimension reldims) { /* Special rules apply to resolving extent as values are resolved relative * to the page size and reference orientation. */ @@ -52,7 +52,8 @@ public class RegionEnd extends RegionSE { PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); PercentBaseContext neighbourContext; Rectangle vpRect; - if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { + if (layoutMaster.getWritingMode() == EN_LR_TB + || layoutMaster.getWritingMode() == EN_RL_TB) { neighbourContext = pageHeightContext; vpRect = new Rectangle(reldims.ipd - getExtent().getValue(pageWidthContext), 0, getExtent().getValue(pageWidthContext), reldims.bpd); @@ -62,7 +63,7 @@ public class RegionEnd extends RegionSE { vpRect = new Rectangle(reldims.ipd - getExtent().getValue(pageHeightContext), 0, reldims.bpd, getExtent().getValue(pageHeightContext)); } - adjustIPD(vpRect, spm.getWritingMode(), neighbourContext); + adjustIPD(vpRect, layoutMaster.getWritingMode(), neighbourContext); return vpRect; } diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java index afe9ddfe1..fdb423c51 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java @@ -44,7 +44,7 @@ public class RegionStart extends RegionSE { } /** {@inheritDoc} */ - public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) { + public Rectangle getViewportRectangle (FODimension reldims) { /* Special rules apply to resolving extent as values are resolved relative * to the page size and reference orientation. */ @@ -52,14 +52,15 @@ public class RegionStart extends RegionSE { PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); PercentBaseContext neighbourContext; Rectangle vpRect; - if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { + if (layoutMaster.getWritingMode() == EN_LR_TB + || layoutMaster.getWritingMode() == EN_RL_TB) { neighbourContext = pageHeightContext; vpRect = new Rectangle(0, 0, getExtent().getValue(pageWidthContext), reldims.bpd); } else { neighbourContext = pageWidthContext; vpRect = new Rectangle(0, 0, reldims.bpd, getExtent().getValue(pageHeightContext)); } - adjustIPD(vpRect, spm.getWritingMode(), neighbourContext); + adjustIPD(vpRect, layoutMaster.getWritingMode(), neighbourContext); return vpRect; } diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index 9b4c6544f..629d7d59d 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -48,7 +48,7 @@ public class RepeatablePageMasterAlternatives extends FObj private int numberConsumed = 0; - private List conditionalPageMasterRefs; + private List<ConditionalPageMasterReference> conditionalPageMasterRefs; private boolean hasPagePositionLast = false; private boolean hasPagePositionOnly = false; @@ -68,7 +68,7 @@ public class RepeatablePageMasterAlternatives extends FObj /** {@inheritDoc} */ protected void startOfNode() throws FOPException { - conditionalPageMasterRefs = new java.util.ArrayList(); + conditionalPageMasterRefs = new java.util.ArrayList<ConditionalPageMasterReference>(); assert parent.getName().equals("fo:page-sequence-master"); //Validation by the parent PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent; @@ -128,9 +128,7 @@ public class RepeatablePageMasterAlternatives extends FObj numberConsumed++; } - for (int i = 0; i < conditionalPageMasterRefs.size(); i++) { - ConditionalPageMasterReference cpmr - = (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i); + for (ConditionalPageMasterReference cpmr : conditionalPageMasterRefs) { if (cpmr.isValid(isOddPage, isFirstPage, isLastPage, isBlankPage)) { return cpmr.getMasterReference(); } diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index fcbb54abd..fb69dc2f1 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -47,8 +47,8 @@ public class Root extends FObj { private LayoutMasterSet layoutMasterSet; private Declarations declarations; private BookmarkTree bookmarkTree = null; - private List destinationList; - private List pageSequences; + private List<Destination> destinationList; + private List<PageSequence> pageSequences; // temporary until above list populated private boolean pageSequenceFound = false; @@ -77,11 +77,12 @@ public class Root extends FObj { */ public Root(FONode parent) { super(parent); - pageSequences = new java.util.ArrayList(); + pageSequences = new java.util.ArrayList<PageSequence>(); } /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { + super.bind(pList); mediaUsage = pList.get(PR_MEDIA_USAGE).getEnum(); } @@ -144,7 +145,11 @@ public class Root extends FObj { } - /** @inheritDoc */ + /** + * @param loc location in the source file + * @param child the {@link FONode} to validate against + * @throws ValidationException if the incoming node is not a valid child for the given FO + */ protected void validateChildNode(Locator loc, FONode child) throws ValidationException { if (child instanceof AbstractPageSequence) { pageSequenceFound = true; @@ -207,7 +212,8 @@ public class Root extends FObj { * @param additionalPages the total pages generated by the sequence (for statistics) * @throws IllegalArgumentException for negative additional page counts */ - public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) { + public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) + throws IllegalArgumentException { if (additionalPages >= 0) { totalPagesGenerated += additionalPages; @@ -238,7 +244,7 @@ public class Root extends FObj { return null; } if (currentIndex < (pageSequences.size() - 1)) { - return (PageSequence)pageSequences.get(currentIndex + 1); + return pageSequences.get(currentIndex + 1); } else { return null; } @@ -290,7 +296,7 @@ public class Root extends FObj { */ public void addDestination(Destination destination) { if (destinationList == null) { - destinationList = new java.util.ArrayList(); + destinationList = new java.util.ArrayList<Destination>(); } destinationList.add(destination); } diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 8c95e1b8a..bd186db78 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -56,7 +56,7 @@ public class SimplePageMaster extends FObj { /** * Page regions (regionClass, Region) */ - private Map regions; + private Map<String, Region> regions; // used for node validation private boolean hasRegionBody = false; @@ -99,7 +99,7 @@ public class SimplePageMaster extends FObj { } //Well, there are only 5 regions so we can save a bit of memory here - regions = new HashMap(5); + regions = new HashMap<String, Region>(5); } /** {@inheritDoc} */ @@ -135,7 +135,7 @@ public class SimplePageMaster extends FObj { } else if (hasRegionEnd) { nodesOutOfOrderError(loc, "fo:region-before", "fo:region-end"); } else { - hasRegionBody = true; + hasRegionBefore = true; } } else if (localName.equals("region-after")) { if (!hasRegionBody) { @@ -192,8 +192,7 @@ public class SimplePageMaster extends FObj { * @param region region to add */ protected void addRegion(Region region) { - String key = String.valueOf(region.getNameId()); - regions.put(key, region); + regions.put(String.valueOf(region.getNameId()), region); } /** @@ -240,14 +239,14 @@ public class SimplePageMaster extends FObj { * @return the region, null if it doesn't exist */ public Region getRegion(int regionId) { - return (Region) regions.get(String.valueOf(regionId)); + return regions.get(String.valueOf(regionId)); } /** * Returns a Map of regions associated with this simple-page-master * @return the regions */ - public Map getRegions() { + public Map<String, Region> getRegions() { return regions; } @@ -258,9 +257,7 @@ public class SimplePageMaster extends FObj { * @return True if a region with this name exists */ protected boolean regionNameExists(String regionName) { - for (Iterator regenum = regions.values().iterator(); - regenum.hasNext();) { - Region r = (Region) regenum.next(); + for (Region r : regions.values()) { if (r.getRegionName().equals(regionName)) { return true; } diff --git a/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java b/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java index aa2c2bb8b..2bb891cd9 100644 --- a/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java +++ b/src/java/org/apache/fop/fo/pagination/SubSequenceSpecifier.java @@ -28,6 +28,7 @@ public interface SubSequenceSpecifier { /** * Returns the name of the next page master. + * * @param isOddPage True if the next page number is odd * @param isFirstPage True if the next page is the first * @param isLastPage True if the next page is the last diff --git a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java b/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java index 709fdf7f2..3c0118181 100644 --- a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java +++ b/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java @@ -57,7 +57,8 @@ public class BackgroundPositionShorthand extends ListProperty { * specified, <code>background-position-vertical</code> is set * to "50%". */ - public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { + public Property make(PropertyList propertyList, String value, FObj fo) + throws PropertyException { Property p = super.make(propertyList, value, fo); if (p.getList().size() == 1) { /* only background-position-horizontal specified diff --git a/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java b/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java index 37cb2119c..7822db3f8 100644 --- a/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java @@ -29,6 +29,7 @@ import org.apache.fop.fo.expr.PropertyException; */ public class BorderSpacingShorthandParser extends GenericShorthandParser { + /** {@inheritDoc} */ protected Property convertValueForProperty(int propId, Property property, PropertyMaker maker, PropertyList propertyList) throws PropertyException { diff --git a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java b/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java index 7c2854759..d2bab22ab 100644 --- a/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java @@ -28,7 +28,8 @@ import org.apache.fop.fo.expr.PropertyException; * border width described in 7.7.20. */ public class BorderWidthPropertyMaker extends LengthProperty.Maker { - int borderStyleId = 0; + + private int borderStyleId = 0; /** * Create a length property which check the value of the border-*-style @@ -41,7 +42,7 @@ public class BorderWidthPropertyMaker extends LengthProperty.Maker { /** * Set the propId of the style property for the same side. - * @param borderStyleId + * @param borderStyleId the border style id */ public void setBorderStyleId(int borderStyleId) { this.borderStyleId = borderStyleId; @@ -53,10 +54,8 @@ public class BorderWidthPropertyMaker extends LengthProperty.Maker { * {@inheritDoc} */ - public Property get(int subpropId, PropertyList propertyList, - boolean bTryInherit, boolean bTryDefault) - throws PropertyException - { + public Property get(int subpropId, PropertyList propertyList, boolean bTryInherit, + boolean bTryDefault) throws PropertyException { Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault); diff --git a/src/java/org/apache/fop/fo/properties/BreakPropertySet.java b/src/java/org/apache/fop/fo/properties/BreakPropertySet.java index 2babe0f19..c70bc9fb2 100644 --- a/src/java/org/apache/fop/fo/properties/BreakPropertySet.java +++ b/src/java/org/apache/fop/fo/properties/BreakPropertySet.java @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,5 +29,5 @@ public interface BreakPropertySet { /** @return the "break-before" property. */ int getBreakBefore(); - + } diff --git a/src/java/org/apache/fop/fo/properties/CharacterProperty.java b/src/java/org/apache/fop/fo/properties/CharacterProperty.java index c078da0c7..ebded4b50 100644 --- a/src/java/org/apache/fop/fo/properties/CharacterProperty.java +++ b/src/java/org/apache/fop/fo/properties/CharacterProperty.java @@ -24,6 +24,8 @@ import org.apache.fop.fo.PropertyList; /** * Superclass for properties that wrap a character value + * TODO convert character value to int in order to denote unicode scalar value + * instead of a single UTF-16 code element */ public final class CharacterProperty extends Property { @@ -39,6 +41,7 @@ public final class CharacterProperty extends Property { super(propId); } + /** {@inheritDoc} */ public Property make(PropertyList propertyList, String value, FObj fo) { char c = value.charAt(0); @@ -48,7 +51,8 @@ public final class CharacterProperty extends Property { } /** cache containing all canonical CharacterProperty instances */ - private static final PropertyCache cache = new PropertyCache(CharacterProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(CharacterProperty.class); private final char character; @@ -59,8 +63,13 @@ public final class CharacterProperty extends Property { this.character = character; } + /** + * Get character property instance for character. + * @param character the character + * @return the character property instance + */ public static CharacterProperty getInstance(char character) { - return (CharacterProperty) cache.fetch( + return (CharacterProperty) CACHE.fetch( new CharacterProperty(character)); } diff --git a/src/java/org/apache/fop/fo/properties/ColorProperty.java b/src/java/org/apache/fop/fo/properties/ColorProperty.java index 4bbf94b74..0550ce684 100644 --- a/src/java/org/apache/fop/fo/properties/ColorProperty.java +++ b/src/java/org/apache/fop/fo/properties/ColorProperty.java @@ -33,7 +33,8 @@ import org.apache.fop.util.ColorUtil; public final class ColorProperty extends Property { /** cache holding canonical ColorProperty instances */ - private static final PropertyCache cache = new PropertyCache(ColorProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(ColorProperty.class); /** * The color represented by this property. @@ -98,11 +99,12 @@ public final class ColorProperty extends Property { * @throws PropertyException if the value can't be parsed * @see ColorUtil#parseColorString(FOUserAgent, String) */ - public static ColorProperty getInstance(FOUserAgent foUserAgent, String value) throws PropertyException { + public static ColorProperty getInstance(FOUserAgent foUserAgent, String value) + throws PropertyException { ColorProperty instance = new ColorProperty( ColorUtil.parseColorString( foUserAgent, value)); - return (ColorProperty)cache.fetch(instance); + return (ColorProperty)CACHE.fetch(instance); } /** diff --git a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java b/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java index e32e9dbd9..f803439b9 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java +++ b/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java @@ -33,31 +33,32 @@ public class CommonAbsolutePosition { /** * The "absolute-position" property. */ - public int absolutePosition; + public int absolutePosition; // CSOK: VisibilityModifier /** * The "top" property. */ - public Length top; + public Length top; // CSOK: VisibilityModifier /** * The "right" property. */ - public Length right; + public Length right; // CSOK: VisibilityModifier /** * The "bottom" property. */ - public Length bottom; + public Length bottom; // CSOK: VisibilityModifier /** * The "left" property. */ - public Length left; + public Length left; // CSOK: VisibilityModifier /** * Create a CommonAbsolutePosition object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception is raised */ public CommonAbsolutePosition(PropertyList pList) throws PropertyException { absolutePosition = pList.get(Constants.PR_ABSOLUTE_POSITION).getEnum(); @@ -67,6 +68,7 @@ public class CommonAbsolutePosition { right = pList.get(Constants.PR_RIGHT).getLength(); } + /** {@inheritDoc} */ public String toString() { StringBuffer sb = new StringBuffer("CommonAbsolutePosition{"); sb.append(" absPos="); diff --git a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java b/src/java/org/apache/fop/fo/properties/CommonAccessibility.java index 74edf046b..dc17228d2 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAccessibility.java +++ b/src/java/org/apache/fop/fo/properties/CommonAccessibility.java @@ -32,16 +32,17 @@ public class CommonAccessibility { /** * The "source-doc" property. */ - public String sourceDoc = null; + public String sourceDoc = null; // CSOK: VisibilityModifier /** * The "role" property. */ - public String role = null; + public String role = null; // CSOK: VisibilityModifier /** * Create a <code>CommonAccessibility</code> object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception is raised */ public CommonAccessibility(PropertyList pList) throws PropertyException { sourceDoc = pList.get(Constants.PR_SOURCE_DOCUMENT).getString(); diff --git a/src/java/org/apache/fop/fo/properties/CommonAural.java b/src/java/org/apache/fop/fo/properties/CommonAural.java index a47f183f1..c805ab4fe 100644 --- a/src/java/org/apache/fop/fo/properties/CommonAural.java +++ b/src/java/org/apache/fop/fo/properties/CommonAural.java @@ -30,92 +30,92 @@ public class CommonAural { /** * The "azimuth" property. */ - public int azimuth; + public int azimuth; // CSOK: VisibilityModifier /** * The "cueAfter" property. */ - public String cueAfter; + public String cueAfter; // CSOK: VisibilityModifier /** * The "cueBefore" property. */ - public String cueBefore; + public String cueBefore; // CSOK: VisibilityModifier /** * The "elevation" property. */ - public int elevation; + public int elevation; // CSOK: VisibilityModifier /** * The "pauseAfter" property. */ - public int pauseAfter; + public int pauseAfter; // CSOK: VisibilityModifier /** * The "pauseBefore" property. */ - public int pauseBefore; + public int pauseBefore; // CSOK: VisibilityModifier /** * The "pitch" property. */ - public int pitch; + public int pitch; // CSOK: VisibilityModifier /** * The "pitch-range" property. */ - public int pitchRange; + public int pitchRange; // CSOK: VisibilityModifier /** * The "playDuring" property. */ - public int playDuring; + public int playDuring; // CSOK: VisibilityModifier /** * The "richness" property. */ - public int richness; + public int richness; // CSOK: VisibilityModifier /** * The "speak" property. */ - public int speak; + public int speak; // CSOK: VisibilityModifier /** * The "speak-header" property. */ - public int speakHeader; + public int speakHeader; // CSOK: VisibilityModifier /** * The "speak-numeral" property. */ - public int speakNumeral; + public int speakNumeral; // CSOK: VisibilityModifier /** * The "speak-punctuation" property. */ - public int speakPunctuation; + public int speakPunctuation; // CSOK: VisibilityModifier /** * The "speech-rate" property. */ - public int speechRate; + public int speechRate; // CSOK: VisibilityModifier /** * The "stress" property. */ - public int stress; + public int stress; // CSOK: VisibilityModifier /** * The "voice-family" property. */ - public int voiceFamily; + public int voiceFamily; // CSOK: VisibilityModifier /** * The "volume" property. */ - public int volume; + public int volume; // CSOK: VisibilityModifier /** * Create a CommonAbsolutePosition object. diff --git a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java index 7e68bbcea..d39dc24f0 100644 --- a/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java +++ b/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java @@ -42,45 +42,46 @@ import org.apache.fop.fo.expr.PropertyException; * Stores all common border and padding properties. * See Sec. 7.7 of the XSL-FO Standard. */ -public class CommonBorderPaddingBackground { +public class CommonBorderPaddingBackground { // CSOK: FinalClassCheck /** * cache holding all canonical instances * (w/ absolute background-position-* and padding-*) */ - private static final PropertyCache cache = new PropertyCache(CommonBorderPaddingBackground.class); + private static final PropertyCache CACHE + = new PropertyCache(CommonBorderPaddingBackground.class); private int hash = -1; /** * The "background-attachment" property. */ - public final int backgroundAttachment; + public final int backgroundAttachment; // CSOK: VisibilityModifier /** * The "background-color" property. */ - public final Color backgroundColor; + public final Color backgroundColor; // CSOK: VisibilityModifier /** * The "background-image" property. */ - public final String backgroundImage; + public final String backgroundImage; // CSOK: VisibilityModifier /** * The "background-repeat" property. */ - public final int backgroundRepeat; + public final int backgroundRepeat; // CSOK: VisibilityModifier /** * The "background-position-horizontal" property. */ - public final Length backgroundPositionHorizontal; + public final Length backgroundPositionHorizontal; // CSOK: VisibilityModifier /** * The "background-position-vertical" property. */ - public final Length backgroundPositionVertical; + public final Length backgroundPositionVertical; // CSOK: VisibilityModifier private ImageInfo backgroundImageInfo; @@ -96,12 +97,13 @@ public class CommonBorderPaddingBackground { public static final int END = 3; /** - * + * Utility class to express border info. */ - public static class BorderInfo { + public static final class BorderInfo { /** cache holding all canonical instances */ - private static final PropertyCache cache = new PropertyCache(BorderInfo.class); + private static final PropertyCache CACHE + = new PropertyCache(BorderInfo.class); private int mStyle; // Enum for border style private Color mColor; // Border color @@ -127,7 +129,7 @@ public class CommonBorderPaddingBackground { * @return a cached BorderInfo instance */ public static BorderInfo getInstance(int style, CondLengthProperty width, Color color) { - return cache.fetch(new BorderInfo(style, width, color)); + return CACHE.fetch(new BorderInfo(style, width, color)); } /** @@ -212,7 +214,7 @@ public class CommonBorderPaddingBackground { * A border info with style "none". Used as a singleton, in the collapsing-border model, * for elements which don't specify any border on some of their sides. */ - private static final BorderInfo defaultBorderInfo + private static final BorderInfo DEFAULT_BORDER_INFO = BorderInfo.getInstance(Constants.EN_NONE, new ConditionalNullLength(), null); /** @@ -274,7 +276,7 @@ public class CommonBorderPaddingBackground { * @return a BorderInfo instance with style set to {@link Constants#EN_NONE} */ public static BorderInfo getDefaultBorderInfo() { - return defaultBorderInfo; + return DEFAULT_BORDER_INFO; } private BorderInfo[] borderInfo = new BorderInfo[4]; @@ -352,13 +354,19 @@ public class CommonBorderPaddingBackground { CommonBorderPaddingBackground cachedInstance = null; /* if padding-* and background-position-* resolve to absolute lengths * the whole instance can be cached */ - if ((newInstance.padding[BEFORE] == null || newInstance.padding[BEFORE].getLength().isAbsolute()) - && (newInstance.padding[AFTER] == null || newInstance.padding[AFTER].getLength().isAbsolute()) - && (newInstance.padding[START] == null || newInstance.padding[START].getLength().isAbsolute()) - && (newInstance.padding[END] == null || newInstance.padding[END].getLength().isAbsolute()) - && (newInstance.backgroundPositionHorizontal == null || newInstance.backgroundPositionHorizontal.isAbsolute()) - && (newInstance.backgroundPositionVertical == null || newInstance.backgroundPositionVertical.isAbsolute())) { - cachedInstance = cache.fetch(newInstance); + if ((newInstance.padding[BEFORE] == null + || newInstance.padding[BEFORE].getLength().isAbsolute()) + && (newInstance.padding[AFTER] == null + || newInstance.padding[AFTER].getLength().isAbsolute()) + && (newInstance.padding[START] == null + || newInstance.padding[START].getLength().isAbsolute()) + && (newInstance.padding[END] == null + || newInstance.padding[END].getLength().isAbsolute()) + && (newInstance.backgroundPositionHorizontal == null + || newInstance.backgroundPositionHorizontal.isAbsolute()) + && (newInstance.backgroundPositionVertical == null + || newInstance.backgroundPositionVertical.isAbsolute())) { + cachedInstance = CACHE.fetch(newInstance); } /* for non-cached, or not-yet-cached instances, preload the image */ @@ -515,6 +523,7 @@ public class CommonBorderPaddingBackground { } /** + * @param side the side to retrieve * @param discard indicates whether the .conditionality component should be * considered (end of a reference-area) * @return the width of the start-border, taking into account the specified conditionality @@ -755,8 +764,12 @@ public class CommonBorderPaddingBackground { hash = 37 * hash + backgroundAttachment; hash = 37 * hash + (backgroundColor == null ? 0 : backgroundColor.hashCode()); hash = 37 * hash + (backgroundImage == null ? 0 : backgroundImage.hashCode()); - hash = 37 * hash + (backgroundPositionHorizontal == null ? 0 : backgroundPositionHorizontal.hashCode()); - hash = 37 * hash + (backgroundPositionVertical == null ? 0 : backgroundPositionVertical.hashCode()); + hash = 37 * hash + + (backgroundPositionHorizontal == null + ? 0 : backgroundPositionHorizontal.hashCode()); + hash = 37 * hash + + (backgroundPositionVertical == null + ? 0 : backgroundPositionVertical.hashCode()); hash = 37 * hash + backgroundRepeat; hash = 37 * hash + (borderInfo[BEFORE] == null ? 0 : borderInfo[BEFORE].hashCode()); hash = 37 * hash + (borderInfo[AFTER] == null ? 0 : borderInfo[AFTER].hashCode()); diff --git a/src/java/org/apache/fop/fo/properties/CommonFont.java b/src/java/org/apache/fop/fo/properties/CommonFont.java index 55a2393fa..b12f84ad2 100644 --- a/src/java/org/apache/fop/fo/properties/CommonFont.java +++ b/src/java/org/apache/fop/fo/properties/CommonFont.java @@ -37,7 +37,8 @@ public final class CommonFont { /** cache holding canonical CommonFont instances (only those with * absolute font-size and font-size-adjust) */ - private static final PropertyCache cache = new PropertyCache(CommonFont.class); + private static final PropertyCache CACHE + = new PropertyCache(CommonFont.class); /** hashcode of this instance */ private int hash = 0; @@ -61,10 +62,10 @@ public final class CommonFont { private final EnumProperty fontWeight; /** The "font-size" property. */ - public final Length fontSize; + public final Length fontSize; // CSOK: VisibilityModifier /** The "font-size-adjust" property. */ - public final Numeric fontSizeAdjust; + public final Numeric fontSizeAdjust; // CSOK: VisibilityModifier /** @@ -79,7 +80,7 @@ public final class CommonFont { * @param fontSize the font-size (possibly non-cached) * @param fontSizeAdjust the font-size-adjust (possibly non-cached) */ - private CommonFont(FontFamilyProperty fontFamily, + private CommonFont(FontFamilyProperty fontFamily, // CSOK: ParameterNumber EnumProperty fontSelectionStrategy, EnumProperty fontStretch, EnumProperty fontStyle, @@ -110,7 +111,8 @@ public final class CommonFont { */ public static CommonFont getInstance(PropertyList pList) throws PropertyException { FontFamilyProperty fontFamily = (FontFamilyProperty) pList.get(Constants.PR_FONT_FAMILY); - EnumProperty fontSelectionStrategy = (EnumProperty) pList.get(Constants.PR_FONT_SELECTION_STRATEGY); + EnumProperty fontSelectionStrategy + = (EnumProperty) pList.get(Constants.PR_FONT_SELECTION_STRATEGY); EnumProperty fontStretch = (EnumProperty) pList.get(Constants.PR_FONT_STRETCH); EnumProperty fontStyle = (EnumProperty) pList.get(Constants.PR_FONT_STYLE); EnumProperty fontVariant = (EnumProperty) pList.get(Constants.PR_FONT_VARIANT); @@ -127,7 +129,7 @@ public final class CommonFont { fontSize, fontSizeAdjust); - return cache.fetch(commonFont); + return CACHE.fetch(commonFont); } /** @return an array with the font-family names */ @@ -183,23 +185,22 @@ public final class CommonFont { /** * Create and return an array of <code>FontTriplets</code> based on * the properties stored in the instance variables. - * - * @param fontInfo - * @return a Font object. + * @param fontInfo a font info object + * @return a font triplet */ public FontTriplet[] getFontState(FontInfo fontInfo) { - int font_weight; + int fw; switch (fontWeight.getEnum()) { - case Constants.EN_100: font_weight = 100; break; - case Constants.EN_200: font_weight = 200; break; - case Constants.EN_300: font_weight = 300; break; - case Constants.EN_400: font_weight = 400; break; - case Constants.EN_500: font_weight = 500; break; - case Constants.EN_600: font_weight = 600; break; - case Constants.EN_700: font_weight = 700; break; - case Constants.EN_800: font_weight = 800; break; - case Constants.EN_900: font_weight = 900; break; - default: font_weight = 400; + case Constants.EN_100: fw = 100; break; + case Constants.EN_200: fw = 200; break; + case Constants.EN_300: fw = 300; break; + case Constants.EN_400: fw = 400; break; + case Constants.EN_500: fw = 500; break; + case Constants.EN_600: fw = 600; break; + case Constants.EN_700: fw = 700; break; + case Constants.EN_800: fw = 800; break; + case Constants.EN_900: fw = 900; break; + default: fw = 400; } String style; @@ -221,7 +222,7 @@ public final class CommonFont { //int fontVariant = propertyList.get("font-variant").getEnum(); FontTriplet[] triplets = fontInfo.fontLookup( getFontFamily(), - style, font_weight); + style, fw); return triplets; } @@ -259,7 +260,8 @@ public final class CommonFont { hash = 37 * hash + (fontSize == null ? 0 : fontSize.hashCode()); hash = 37 * hash + (fontSizeAdjust == null ? 0 : fontSizeAdjust.hashCode()); hash = 37 * hash + (fontFamily == null ? 0 : fontFamily.hashCode()); - hash = 37 * hash + (fontSelectionStrategy == null ? 0 : fontSelectionStrategy.hashCode()); + hash = 37 * hash + (fontSelectionStrategy == null + ? 0 : fontSelectionStrategy.hashCode()); hash = 37 * hash + (fontStretch == null ? 0 : fontStretch.hashCode()); hash = 37 * hash + (fontStyle == null ? 0 : fontStyle.hashCode()); hash = 37 * hash + (fontVariant == null ? 0 : fontVariant.hashCode()); diff --git a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java index 0e32f250a..7b9b5bc82 100644 --- a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java +++ b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java @@ -36,32 +36,32 @@ import org.apache.fop.fonts.Typeface; public final class CommonHyphenation { /** Logger */ - protected static Log log = LogFactory.getLog(CommonHyphenation.class); + private static final Log LOG = LogFactory.getLog(CommonHyphenation.class); - private static final PropertyCache cache = new PropertyCache(CommonHyphenation.class); + private static final PropertyCache CACHE = new PropertyCache(CommonHyphenation.class); private int hash = 0; /** The "language" property */ - public final StringProperty language; + public final StringProperty language; // CSOK: VisibilityModifier /** The "country" property */ - public final StringProperty country; + public final StringProperty country; // CSOK: VisibilityModifier /** The "script" property */ - public final StringProperty script; + public final StringProperty script; // CSOK: VisibilityModifier /** The "hyphenate" property */ - public final EnumProperty hyphenate; + public final EnumProperty hyphenate; // CSOK: VisibilityModifier /** The "hyphenation-character" property */ - public final CharacterProperty hyphenationCharacter; + public final CharacterProperty hyphenationCharacter; // CSOK: VisibilityModifier /** The "hyphenation-push-character-count" property */ - public final NumberProperty hyphenationPushCharacterCount; + public final NumberProperty hyphenationPushCharacterCount; // CSOK: VisibilityModifier /** The "hyphenation-remain-character-count" property*/ - public final NumberProperty hyphenationRemainCharacterCount; + public final NumberProperty hyphenationRemainCharacterCount; // CSOK: VisibilityModifier /** * Construct a CommonHyphenation object holding the given properties @@ -87,24 +87,26 @@ public final class CommonHyphenation { * Gets the canonical <code>CommonHyphenation</code> instance corresponding * to the values of the related properties present on the given * <code>PropertyList</code> - * * @param propertyList the <code>PropertyList</code> + * @return a common hyphenation instance + * @throws PropertyException if a a property exception occurs */ - public static CommonHyphenation getInstance(PropertyList propertyList) throws PropertyException { - StringProperty language = - (StringProperty) propertyList.get(Constants.PR_LANGUAGE); - StringProperty country = - (StringProperty) propertyList.get(Constants.PR_COUNTRY); - StringProperty script = - (StringProperty) propertyList.get(Constants.PR_SCRIPT); - EnumProperty hyphenate = - (EnumProperty) propertyList.get(Constants.PR_HYPHENATE); - CharacterProperty hyphenationCharacter = - (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER); - NumberProperty hyphenationPushCharacterCount = - (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT); - NumberProperty hyphenationRemainCharacterCount = - (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT); + public static CommonHyphenation getInstance(PropertyList propertyList) + throws PropertyException { + StringProperty language + = (StringProperty) propertyList.get(Constants.PR_LANGUAGE); + StringProperty country + = (StringProperty) propertyList.get(Constants.PR_COUNTRY); + StringProperty script + = (StringProperty) propertyList.get(Constants.PR_SCRIPT); + EnumProperty hyphenate + = (EnumProperty) propertyList.get(Constants.PR_HYPHENATE); + CharacterProperty hyphenationCharacter + = (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER); + NumberProperty hyphenationPushCharacterCount + = (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT); + NumberProperty hyphenationRemainCharacterCount + = (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT); CommonHyphenation instance = new CommonHyphenation( language, @@ -115,7 +117,7 @@ public final class CommonHyphenation { hyphenationPushCharacterCount, hyphenationRemainCharacterCount); - return cache.fetch(instance); + return CACHE.fetch(instance); } @@ -164,7 +166,7 @@ public final class CommonHyphenation { } } if (warn) { - log.warn("Substituted specified hyphenation character (0x" + LOG.warn("Substituted specified hyphenation character (0x" + Integer.toHexString(hyphChar) + ") with 0x" + Integer.toHexString(effHyphChar) + " because the font doesn't have the specified hyphenation character: " @@ -209,12 +211,15 @@ public final class CommonHyphenation { hash = 37 * hash + (script == null ? 0 : script.hashCode()); hash = 37 * hash + (country == null ? 0 : country.hashCode()); hash = 37 * hash + (hyphenate == null ? 0 : hyphenate.hashCode()); - hash = 37 * hash + - (hyphenationCharacter == null ? 0 : hyphenationCharacter.hashCode()); - hash = 37 * hash + - (hyphenationPushCharacterCount == null ? 0 : hyphenationPushCharacterCount.hashCode()); - hash = 37 * hash + - (hyphenationRemainCharacterCount == null ? 0 : hyphenationRemainCharacterCount.hashCode()); + hash = 37 * hash + + (hyphenationCharacter == null + ? 0 : hyphenationCharacter.hashCode()); + hash = 37 * hash + + (hyphenationPushCharacterCount == null + ? 0 : hyphenationPushCharacterCount.hashCode()); + hash = 37 * hash + + (hyphenationRemainCharacterCount == null + ? 0 : hyphenationRemainCharacterCount.hashCode()); this.hash = hash; } return this.hash; diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java b/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java index 8d63b3d22..a45c09672 100644 --- a/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java +++ b/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java @@ -33,46 +33,47 @@ public class CommonMarginBlock { /** * The "margin-top" property. */ - public Length marginTop; + public Length marginTop; // CSOK: VisibilityModifier /** * The "margin-bottom" property. */ - public Length marginBottom; + public Length marginBottom; // CSOK: VisibilityModifier /** * The "margin-left" property. */ - public Length marginLeft; + public Length marginLeft; // CSOK: VisibilityModifier /** * The "margin-right" property. */ - public Length marginRight; + public Length marginRight; // CSOK: VisibilityModifier /** * The "space-before" property. */ - public SpaceProperty spaceBefore; + public SpaceProperty spaceBefore; // CSOK: VisibilityModifier /** * The "space-after" property. */ - public SpaceProperty spaceAfter; + public SpaceProperty spaceAfter; // CSOK: VisibilityModifier /** * The "start-indent" property. */ - public Length startIndent; + public Length startIndent; // CSOK: VisibilityModifier /** * The "end-indent" property. */ - public Length endIndent; + public Length endIndent; // CSOK: VisibilityModifier /** * Create a CommonMarginBlock object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception occurs */ public CommonMarginBlock(PropertyList pList) throws PropertyException { marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength(); diff --git a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java b/src/java/org/apache/fop/fo/properties/CommonMarginInline.java index c578e58b8..3b1d886ea 100644 --- a/src/java/org/apache/fop/fo/properties/CommonMarginInline.java +++ b/src/java/org/apache/fop/fo/properties/CommonMarginInline.java @@ -34,36 +34,37 @@ public class CommonMarginInline { /** * The "margin-top" property. */ - public Length marginTop; + public Length marginTop; // CSOK: VisibilityModifier /** * The "margin-bottom" property. */ - public Length marginBottom; + public Length marginBottom; // CSOK: VisibilityModifier /** * The "margin-left" property. */ - public Length marginLeft; + public Length marginLeft; // CSOK: VisibilityModifier /** * The "margin-right" property. */ - public Length marginRight; + public Length marginRight; // CSOK: VisibilityModifier /** * The "space-start" property. */ - public SpaceProperty spaceStart; + public SpaceProperty spaceStart; // CSOK: VisibilityModifier /** * The "space-end" property. */ - public SpaceProperty spaceEnd; + public SpaceProperty spaceEnd; // CSOK: VisibilityModifier /** * Create a CommonMarginInline object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception occurs */ public CommonMarginInline(PropertyList pList) throws PropertyException { marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength(); diff --git a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java b/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java index f28a3edb3..32d21133b 100644 --- a/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java +++ b/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java @@ -33,31 +33,32 @@ public class CommonRelativePosition { /** * The "relative-position" property. */ - public int relativePosition; + public int relativePosition; // CSOK: VisibilityModifier /** * The "top" property. */ - public Length top; + public Length top; // CSOK: VisibilityModifier /** * The "right" property. */ - public Length right; + public Length right; // CSOK: VisibilityModifier /** * The "bottom" property. */ - public Length bottom; + public Length bottom; // CSOK: VisibilityModifier /** * The "left" property. */ - public Length left; + public Length left; // CSOK: VisibilityModifier /** * Create a CommonRelativePosition object. * @param pList The PropertyList with propery values. + * @throws PropertyException if a property exception occurs */ public CommonRelativePosition(PropertyList pList) throws PropertyException { relativePosition = pList.get(Constants.PR_RELATIVE_POSITION).getEnum(); diff --git a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java index 45f6b2e9f..cbd34c9b3 100644 --- a/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java @@ -32,8 +32,8 @@ public class CompoundPropertyMaker extends PropertyMaker { /** * The list of subproperty makers supported by this compound maker. */ - private PropertyMaker[] subproperties = - new PropertyMaker[Constants.COMPOUND_COUNT]; + private PropertyMaker[] subproperties + = new PropertyMaker[Constants.COMPOUND_COUNT]; /** * The first subproperty maker which has a setByShorthand of true. @@ -66,7 +66,7 @@ public class CompoundPropertyMaker extends PropertyMaker { /** * Add a subproperty to this maker. - * @param subproperty + * @param subproperty the sub property */ public void addSubpropMaker(PropertyMaker subproperty) { // Place the base propId in the propId of the subproperty. @@ -101,12 +101,11 @@ public class CompoundPropertyMaker extends PropertyMaker { * Calculate the real value of a subproperty by unmasking and shifting * the value into the range [0 - (COMPOUND_COUNT-1)]. * The value is used as index into the subproperties array. - * @param propId the property id of the sub property. + * @param subpropertyId the property id of the sub property. * @return the array index. */ private int getSubpropIndex(int subpropertyId) { - return ((subpropertyId & Constants.COMPOUND_MASK) >> - Constants.COMPOUND_SHIFT)-1; + return ((subpropertyId & Constants.COMPOUND_MASK) >> Constants.COMPOUND_SHIFT) - 1; } /** @@ -137,11 +136,11 @@ public class CompoundPropertyMaker extends PropertyMaker { * @param propertyList The PropertyList object being built for this FO. * @param tryInherit true if inherited properties should be examined. * @param tryDefault true if the default value should be returned. + * @return the property + * @throws PropertyException if a property exception occurs */ - public Property get(int subpropertyId, PropertyList propertyList, - boolean tryInherit, boolean tryDefault) - throws PropertyException - { + public Property get(int subpropertyId, PropertyList propertyList, boolean tryInherit, + boolean tryDefault) throws PropertyException { Property p = super.get(subpropertyId, propertyList, tryInherit, tryDefault); if (subpropertyId != 0 && p != null) { p = getSubprop(p, subpropertyId); @@ -254,14 +253,15 @@ public class CompoundPropertyMaker extends PropertyMaker { * @throws PropertyException ... */ protected Property makeCompound(PropertyList propertyList, FObj parentFO) - throws PropertyException { + throws PropertyException { Property p = makeNewProperty(); CompoundDatatype data = (CompoundDatatype) p.getObject(); for (int i = 0; i < Constants.COMPOUND_COUNT; i++) { PropertyMaker subpropertyMaker = subproperties[i]; if (subpropertyMaker != null) { Property subproperty = subpropertyMaker.make(propertyList); - data.setComponent(subpropertyMaker.getPropId() & Constants.COMPOUND_MASK, subproperty, true); + data.setComponent(subpropertyMaker.getPropId() + & Constants.COMPOUND_MASK, subproperty, true); } } return p; diff --git a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java index aa913d969..1ab7ec3ad 100644 --- a/src/java/org/apache/fop/fo/properties/CondLengthProperty.java +++ b/src/java/org/apache/fop/fo/properties/CondLengthProperty.java @@ -33,7 +33,8 @@ import org.apache.fop.fo.expr.PropertyException; public class CondLengthProperty extends Property implements CompoundDatatype { /** cache holding canonical instances (for absolute conditional lengths) */ - private static final PropertyCache cache = new PropertyCache(CondLengthProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(CondLengthProperty.class); /** components */ private Property length; @@ -158,7 +159,7 @@ public class CondLengthProperty extends Property implements CompoundDatatype { */ public CondLengthProperty getCondLength() { if (this.length.getLength().isAbsolute()) { - CondLengthProperty clp = (CondLengthProperty) cache.fetch(this); + CondLengthProperty clp = (CondLengthProperty) CACHE.fetch(this); if (clp == this) { isCached = true; } diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java index 60237c53a..6183b9e56 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java @@ -19,31 +19,46 @@ package org.apache.fop.fo.properties; -import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; /** + * Maker class for handling corresponding properties. */ public class CorrespondingPropertyMaker { + /** base property maker */ protected PropertyMaker baseMaker; - protected int lr_tb; - protected int rl_tb; - protected int tb_rl; + /** corresponding property for lr-tb writing mode */ + protected int lrtb; + /** corresponding property for rl-tb writing mode */ + protected int rltb; + /** corresponding property for tb-rl writing mode */ + protected int tbrl; + /** user parent property list */ protected boolean useParent; private boolean relative; + /** + * Construct a corresponding property maker. + * @param baseMaker the base property maker + */ public CorrespondingPropertyMaker(PropertyMaker baseMaker) { this.baseMaker = baseMaker; baseMaker.setCorresponding(this); } - public void setCorresponding(int lr_tb, int rl_tb, int tb_rl) { - this.lr_tb = lr_tb; - this.rl_tb = rl_tb; - this.tb_rl = tb_rl; + /** + * Set corresponding property identifiers. + * @param lrtb the property that corresponds with lr-tb writing mode + * @param rltb the property that corresponds with rl-tb writing mode + * @param tbrl the property that corresponds with tb-lr writing mode + */ + public void setCorresponding(int lrtb, int rltb, int tbrl) { + this.lrtb = lrtb; + this.rltb = rltb; + this.tbrl = tbrl; } /** @@ -55,6 +70,10 @@ public class CorrespondingPropertyMaker { this.useParent = useParent; } + /** + * Set relative flag. + * @param relative true if relative direction + */ public void setRelative(boolean relative) { this.relative = relative; } @@ -83,7 +102,7 @@ public class CorrespondingPropertyMaker { PropertyList pList = getWMPropertyList(propertyList); if (pList != null) { - int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int correspondingId = pList.getWritingMode(lrtb, rltb, tbrl); if (pList.getExplicit(correspondingId) != null) { return true; @@ -100,14 +119,14 @@ public class CorrespondingPropertyMaker { * @param propertyList The PropertyList for the FO. * @return Property A computed Property value or null if no rules * are specified (in foproperties.xml) to compute the value. - * @throws FOPException for invalid or inconsistent FO input + * @throws PropertyException if a property exception occurs */ public Property compute(PropertyList propertyList) throws PropertyException { PropertyList pList = getWMPropertyList(propertyList); if (pList == null) { return null; } - int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int correspondingId = pList.getWritingMode(lrtb, rltb, tbrl); Property p = propertyList.getExplicitOrShorthand(correspondingId); if (p != null) { @@ -120,6 +139,8 @@ public class CorrespondingPropertyMaker { /** * Return the property list to use for fetching writing mode depending property * ids. + * @param pList a property list + * @return the property list to use */ protected PropertyList getWMPropertyList(PropertyList pList) { if (useParent) { diff --git a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java index 29715fe66..0bef5e916 100644 --- a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java @@ -30,27 +30,44 @@ import org.apache.fop.fo.expr.PropertyException; * Window - Preferences - Java - Code Generation - Code and Comments */ public class DimensionPropertyMaker extends CorrespondingPropertyMaker { - int[][] extraCorresponding = null; + private int[][] extraCorresponding = null; + + /** + * Construct a dimension property maker. + * @param baseMaker the base property maker + */ public DimensionPropertyMaker(PropertyMaker baseMaker) { super(baseMaker); } + /** + * Set extra correspondences. + * @param extraCorresponding the extra correspondences + */ public void setExtraCorresponding(int[][] extraCorresponding) { this.extraCorresponding = extraCorresponding; } + /** + * Determine if corresponding property is forced. + * @param propertyList the property list to use + * @return true if it is forced + */ public boolean isCorrespondingForced(PropertyList propertyList) { - if (super.isCorrespondingForced(propertyList)) + if (super.isCorrespondingForced(propertyList)) { return true; + } for (int i = 0; i < extraCorresponding.length; i++) { int wmcorr = extraCorresponding[i][0]; //propertyList.getWritingMode()]; - if (propertyList.getExplicit(wmcorr) != null) + if (propertyList.getExplicit(wmcorr) != null) { return true; + } } return false; } + /** {@inheritDoc} */ public Property compute(PropertyList propertyList) throws PropertyException { // Based on [width|height] Property p = super.compute(propertyList); diff --git a/src/java/org/apache/fop/fo/properties/EnumLength.java b/src/java/org/apache/fop/fo/properties/EnumLength.java index 76fd0e5b7..d2480beb2 100644 --- a/src/java/org/apache/fop/fo/properties/EnumLength.java +++ b/src/java/org/apache/fop/fo/properties/EnumLength.java @@ -27,6 +27,10 @@ import org.apache.fop.datatypes.PercentBaseContext; public class EnumLength extends LengthProperty { private Property enumProperty; + /** + * Construct an enumerated length from an enum property. + * @param enumProperty the enumeration property + */ public EnumLength(Property enumProperty) { this.enumProperty = enumProperty; } @@ -38,6 +42,7 @@ public class EnumLength extends LengthProperty { return enumProperty.getEnum(); } + /** @return true if absolute */ public boolean isAbsolute() { return false; } diff --git a/src/java/org/apache/fop/fo/properties/EnumNumber.java b/src/java/org/apache/fop/fo/properties/EnumNumber.java index fdc359a06..153a716df 100644 --- a/src/java/org/apache/fop/fo/properties/EnumNumber.java +++ b/src/java/org/apache/fop/fo/properties/EnumNumber.java @@ -29,7 +29,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class EnumNumber extends Property implements Numeric { /** cache holding all canonical EnumNumber instances */ - private static final PropertyCache cache = new PropertyCache(EnumNumber.class); + private static final PropertyCache CACHE + = new PropertyCache(EnumNumber.class); private final EnumProperty enumProperty; @@ -49,7 +50,7 @@ public final class EnumNumber extends Property implements Numeric { * @return the canonical instance */ public static EnumNumber getInstance(Property enumProperty) { - return (EnumNumber)cache.fetch( + return (EnumNumber)CACHE.fetch( new EnumNumber((EnumProperty) enumProperty)); } diff --git a/src/java/org/apache/fop/fo/properties/EnumProperty.java b/src/java/org/apache/fop/fo/properties/EnumProperty.java index 07cfaadcc..ae704f1c9 100644 --- a/src/java/org/apache/fop/fo/properties/EnumProperty.java +++ b/src/java/org/apache/fop/fo/properties/EnumProperty.java @@ -29,7 +29,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class EnumProperty extends Property { /** cache holding all canonical EnumProperty instances */ - private static final PropertyCache cache = new PropertyCache(EnumProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(EnumProperty.class); /** * Inner class for creating EnumProperty instances @@ -54,6 +55,14 @@ public final class EnumProperty extends Property { return super.checkEnumValues(value); } + /** + * Convert a property. + * @param p the property to convert + * @param propertyList the property list to use in conversion + * @param fo the FO to use in conversion + * @return the converted property + * @throws PropertyException if a property conversion exception occurs + */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) throws PropertyException { @@ -77,8 +86,14 @@ public final class EnumProperty extends Property { this.text = text; } + /** + * Construct an enumeration property. + * @param explicitValue the value + * @param text the text + * @return an enumeration property + */ public static EnumProperty getInstance(int explicitValue, String text) { - return (EnumProperty) cache.fetch( + return (EnumProperty) CACHE.fetch( new EnumProperty(explicitValue, text)); } diff --git a/src/java/org/apache/fop/fo/properties/FixedLength.java b/src/java/org/apache/fop/fo/properties/FixedLength.java index 84d159edf..c35c6f6c9 100644 --- a/src/java/org/apache/fop/fo/properties/FixedLength.java +++ b/src/java/org/apache/fop/fo/properties/FixedLength.java @@ -45,7 +45,8 @@ public final class FixedLength extends LengthProperty { public static final String MPT = "mpt"; /** cache holding all canonical FixedLength instances */ - private static final PropertyCache cache = new PropertyCache(FixedLength.class); + private static final PropertyCache CACHE + = new PropertyCache(FixedLength.class); /** canonical zero-length instance */ public static final FixedLength ZERO_FIXED_LENGTH = new FixedLength(0, FixedLength.MPT, 1.0f); @@ -81,7 +82,7 @@ public final class FixedLength extends LengthProperty { if (numUnits == 0.0) { return ZERO_FIXED_LENGTH; } else { - return (FixedLength)cache.fetch( + return (FixedLength)CACHE.fetch( new FixedLength(numUnits, units, sourceResolution)); } diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java index 34a6b58d8..f6fa806c9 100644 --- a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java +++ b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java @@ -31,7 +31,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class FontFamilyProperty extends ListProperty { /** cache holding all canonical FontFamilyProperty instances */ - private static final PropertyCache cache = new PropertyCache(FontFamilyProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(FontFamilyProperty.class); private int hash = 0; @@ -50,7 +51,8 @@ public final class FontFamilyProperty extends ListProperty { /** * {@inheritDoc} */ - public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { + public Property make(PropertyList propertyList, String value, FObj fo) + throws PropertyException { if ("inherit".equals(value)) { return super.make(propertyList, value, fo); } else { @@ -93,7 +95,7 @@ public final class FontFamilyProperty extends ListProperty { prop.addProperty(StringProperty.getInstance(tmpVal)); } } - return cache.fetch(prop); + return CACHE.fetch(prop); } } diff --git a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java index 5096d6160..72884a177 100644 --- a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java @@ -50,7 +50,8 @@ public class FontSizePropertyMaker * here already: if the property evaluates to a {@link PercentLength}, * it is immediately replaced by the resolved {@link FixedLength}. */ - public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException { + public Property make(PropertyList propertyList, String value, FObj fo) + throws PropertyException { Property p = super.make(propertyList, value, fo); if (p instanceof PercentLength) { Property pp = propertyList.getFromParent(this.propId); diff --git a/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java b/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java index 278fec862..6397813e6 100644 --- a/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java @@ -13,7 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + */ + /* $Id$ */ package org.apache.fop.fo.properties; @@ -25,6 +26,9 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.PropertyInfo; import org.apache.fop.fo.expr.PropertyParser; +/** + * Font weight property maker. + */ public class FontWeightPropertyMaker extends EnumProperty.Maker { /** @@ -45,10 +49,8 @@ public class FontWeightPropertyMaker extends EnumProperty.Maker { } else { String pValue = checkValueKeywords(value); Property newProp = checkEnumValues(pValue); - int enumValue = -1; - if (newProp != null - && ((enumValue = newProp.getEnum()) == Constants.EN_BOLDER - || enumValue == Constants.EN_LIGHTER)) { + int enumValue = ( newProp != null ) ? newProp.getEnum() : -1; + if (enumValue == Constants.EN_BOLDER || enumValue == Constants.EN_LIGHTER) { /* check for relative enum values, compute in relation to parent */ Property parentProp = pList.getInherited(Constants.PR_FONT_WEIGHT); if (enumValue == Constants.EN_BOLDER) { diff --git a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java index d976fc6ea..19c4675ed 100644 --- a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java @@ -68,6 +68,9 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { /** * Calculate the corresponding value for start-indent and end-indent. + * @param propertyList the property list to use in the computation + * @return the computed indent property + * @throws PropertyException if a property exception occurs * @see CorrespondingPropertyMaker#compute(PropertyList) */ public Property compute(PropertyList propertyList) throws PropertyException { @@ -81,6 +84,9 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { /** * Calculate the corresponding value for start-indent and end-indent. + * @param propertyList the property list to use in the computation + * @return the computed indent property + * @throws PropertyException if a property exception occurs * @see CorrespondingPropertyMaker#compute(PropertyList) */ public Property computeConforming(PropertyList propertyList) throws PropertyException { @@ -93,7 +99,7 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { Numeric padding = getCorresponding(paddingCorresponding, propertyList).getNumeric(); Numeric border = getCorresponding(borderWidthCorresponding, propertyList).getNumeric(); - int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int marginProp = pList.getWritingMode(lrtb, rltb, tbrl); // Calculate the absolute margin. if (propertyList.getExplicitOrShorthand(marginProp) == null) { Property indent = propertyList.getExplicit(baseMaker.propId); @@ -136,6 +142,9 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { * This method calculates indent following an alternative rule set that * tries to mimic many commercial solutions that chose to violate the * XSL specification. + * @param propertyList the property list to use in the computation + * @return the computed indent property + * @throws PropertyException if a property exception occurs * @see CorrespondingPropertyMaker#compute(PropertyList) */ public Property computeAlternativeRuleset(PropertyList propertyList) throws PropertyException { @@ -149,7 +158,7 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker { Numeric padding = getCorresponding(paddingCorresponding, propertyList).getNumeric(); Numeric border = getCorresponding(borderWidthCorresponding, propertyList).getNumeric(); - int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl); + int marginProp = pList.getWritingMode(lrtb, rltb, tbrl); //Determine whether the nearest anscestor indent was specified through //start-indent|end-indent or through a margin property. diff --git a/src/java/org/apache/fop/fo/properties/KeepProperty.java b/src/java/org/apache/fop/fo/properties/KeepProperty.java index d2e2c70a7..9d04ce780 100644 --- a/src/java/org/apache/fop/fo/properties/KeepProperty.java +++ b/src/java/org/apache/fop/fo/properties/KeepProperty.java @@ -30,7 +30,8 @@ import org.apache.fop.fo.expr.PropertyException; public final class KeepProperty extends Property implements CompoundDatatype { /** class holding all canonical KeepProperty instances*/ - private static final PropertyCache cache = new PropertyCache(KeepProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(KeepProperty.class); private boolean isCachedValue = false; private Property withinLine; @@ -61,8 +62,7 @@ public final class KeepProperty extends Property implements CompoundDatatype { * {@inheritDoc} */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) - throws PropertyException - { + throws PropertyException { if (p instanceof KeepProperty) { return p; } @@ -154,10 +154,10 @@ public final class KeepProperty extends Property implements CompoundDatatype { * @return String representation */ public String toString() { - return "Keep[" + - "withinLine:" + getWithinLine().getObject() + - ", withinColumn:" + getWithinColumn().getObject() + - ", withinPage:" + getWithinPage().getObject() + "]"; + return "Keep[" + + "withinLine:" + getWithinLine().getObject() + + ", withinColumn:" + getWithinColumn().getObject() + + ", withinPage:" + getWithinPage().getObject() + "]"; } /** @@ -165,7 +165,7 @@ public final class KeepProperty extends Property implements CompoundDatatype { * this property */ public KeepProperty getKeep() { - KeepProperty keep = (KeepProperty) cache.fetch(this); + KeepProperty keep = (KeepProperty) CACHE.fetch(this); /* make sure setComponent() can never alter cached values */ keep.isCachedValue = true; return keep; diff --git a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java b/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java index 4b408e83b..1d79bb7af 100644 --- a/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java @@ -64,6 +64,7 @@ public class LineHeightPropertyMaker extends SpaceProperty.Maker { /** * Recalculate the line-height value based on the nearest specified * value. + * {@inheritDoc} */ protected Property compute(PropertyList propertyList) throws PropertyException { // recalculate based on last specified value diff --git a/src/java/org/apache/fop/fo/properties/NumberProperty.java b/src/java/org/apache/fop/fo/properties/NumberProperty.java index 4d7c3b97b..97844d723 100644 --- a/src/java/org/apache/fop/fo/properties/NumberProperty.java +++ b/src/java/org/apache/fop/fo/properties/NumberProperty.java @@ -68,6 +68,9 @@ public final class NumberProperty extends Property implements Numeric { } + /** + * A positive integer property maker. + */ public static class PositiveIntegerMaker extends PropertyMaker { /** @@ -103,7 +106,8 @@ public final class NumberProperty extends Property implements Numeric { } /** cache holding all canonical NumberProperty instances */ - private static final PropertyCache cache = new PropertyCache(NumberProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(NumberProperty.class); private final Number number; @@ -140,7 +144,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(Double num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num.doubleValue())); } @@ -151,7 +155,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(Integer num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num.intValue())); } @@ -162,7 +166,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(double num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num)); } @@ -173,7 +177,7 @@ public final class NumberProperty extends Property implements Numeric { * @return the canonical NumberProperty */ public static NumberProperty getInstance(int num) { - return (NumberProperty)cache.fetch( + return (NumberProperty)CACHE.fetch( new NumberProperty(num)); } diff --git a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java index 53a9c1286..c0c6a2ed7 100644 --- a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java +++ b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java @@ -43,7 +43,13 @@ public class PageDimensionMaker extends LengthProperty.Maker { * Check the value of the page-width / page-height property. * Return the default or user-defined fallback in case the value * was specified as "auto" - * + * @param subpropId The subproperty id of the property being retrieved. + * Is 0 when retrieving a base property. + * @param propertyList The PropertyList object being built for this FO. + * @param tryInherit true if inherited properties should be examined. + * @param tryDefault true if the default value should be returned. + * @return the property + * @throws PropertyException if a property exception occurs * @see PropertyMaker#get(int, PropertyList, boolean, boolean) */ public Property get(int subpropId, PropertyList propertyList, diff --git a/src/java/org/apache/fop/fo/properties/PercentLength.java b/src/java/org/apache/fop/fo/properties/PercentLength.java index f89007f34..66f1f175c 100644 --- a/src/java/org/apache/fop/fo/properties/PercentLength.java +++ b/src/java/org/apache/fop/fo/properties/PercentLength.java @@ -118,8 +118,7 @@ public class PercentLength extends LengthProperty { * @return the String equivalent of this */ public String toString() { - StringBuffer sb = - new StringBuffer(PercentLength.class.getName()) + StringBuffer sb = new StringBuffer(PercentLength.class.getName()) .append("[factor=").append(factor) .append(",lbase=").append(lbase).append("]"); return sb.toString(); diff --git a/src/java/org/apache/fop/fo/properties/Property.java b/src/java/org/apache/fop/fo/properties/Property.java index 29e8faac5..a04f96a3c 100644 --- a/src/java/org/apache/fop/fo/properties/Property.java +++ b/src/java/org/apache/fop/fo/properties/Property.java @@ -36,7 +36,7 @@ import org.apache.fop.fo.Constants; public class Property { /** Logger for all property classes */ - protected static Log log = LogFactory.getLog(PropertyMaker.class); + protected static final Log log = LogFactory.getLog(PropertyMaker.class); /** * The original specified value for properties which inherit @@ -197,6 +197,6 @@ public class Property { if (obj != this) { return obj.toString(); } - return null; + return ""; } } diff --git a/src/java/org/apache/fop/fo/properties/PropertyCache.java b/src/java/org/apache/fop/fo/properties/PropertyCache.java index dc9abb023..920125796 100644 --- a/src/java/org/apache/fop/fo/properties/PropertyCache.java +++ b/src/java/org/apache/fop/fo/properties/PropertyCache.java @@ -98,8 +98,13 @@ public final class PropertyCache { } /* Wrapper objects to synchronize on */ - private static class CacheSegment { + private static final class CacheSegment { + CacheSegment() { + } private int count = 0; + int getCount() { + return count; + } } private void cleanSegment(int segmentIndex) { @@ -209,10 +214,11 @@ public final class PropertyCache { /* try non-synched first */ for (CacheEntry e = entry; e != null; e = e.nextEntry) { - if (e.hash == hash - && (q = e.get()) != null - && eq(q, o)) { - return q; + if ( e.hash == hash ) { + q = e.get(); + if ( ( q != null ) && eq ( q, o ) ) { + return q; + } } } @@ -223,10 +229,11 @@ public final class PropertyCache { synchronized (segment) { entry = table[index]; for (CacheEntry e = entry; e != null; e = e.nextEntry) { - if (e.hash == hash - && (q = e.get()) != null - && eq(q, o)) { - return q; + if ( e.hash == hash ) { + q = e.get(); + if ( ( q != null ) && eq ( q, o ) ) { + return q; + } } } } @@ -261,7 +268,8 @@ public final class PropertyCache { newLength--; for (int i = table.length; --i >= 0;) { for (CacheEntry c = table[i]; c != null; c = c.nextEntry) { - if ((o = c.get()) != null) { + o = c.get(); + if (o != null) { hash = c.hash; idx = hash & newLength; newTable[idx] = new CacheEntry(o, newTable[idx]); @@ -384,7 +392,7 @@ public final class PropertyCache { } /** - * Checks if the given {@link Marker.MarkerAttribute} is present + * Checks if the given {@link org.apache.fop.fo.flow.Marker.MarkerAttribute} is present * in the cache - if so, returns a reference to the cached instance. * Otherwise the given object is added to the cache and returned. * diff --git a/src/java/org/apache/fop/fo/properties/ShorthandParser.java b/src/java/org/apache/fop/fo/properties/ShorthandParser.java index f0ec0e6e9..f03c377fd 100644 --- a/src/java/org/apache/fop/fo/properties/ShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/ShorthandParser.java @@ -30,9 +30,11 @@ public interface ShorthandParser { /** * @param propId the property ID in the Constants interface + * @param property from which value is obtained * @param maker Maker object for the Property * @param propertyList list of properties * @return Property object corresponding to propName + * @throws PropertyException in case a property exception occurs */ Property getValueForProperty(int propId, Property property, diff --git a/src/java/org/apache/fop/fo/properties/SpaceProperty.java b/src/java/org/apache/fop/fo/properties/SpaceProperty.java index 49f76f874..641ec3baf 100644 --- a/src/java/org/apache/fop/fo/properties/SpaceProperty.java +++ b/src/java/org/apache/fop/fo/properties/SpaceProperty.java @@ -136,13 +136,14 @@ public class SpaceProperty extends LengthRangeProperty { return this.conditionality.getEnum() == Constants.EN_DISCARD; } + /** {@inheritDoc} */ public String toString() { - return "Space[" + - "min:" + getMinimum(null).getObject() + - ", max:" + getMaximum(null).getObject() + - ", opt:" + getOptimum(null).getObject() + - ", precedence:" + precedence.getObject() + - ", conditionality:" + conditionality.getObject() + "]"; + return "Space[" + + "min:" + getMinimum(null).getObject() + + ", max:" + getMaximum(null).getObject() + + ", opt:" + getOptimum(null).getObject() + + ", precedence:" + precedence.getObject() + + ", conditionality:" + conditionality.getObject() + "]"; } /** diff --git a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java index 19fa7baa7..3c51dd44a 100644 --- a/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java @@ -41,6 +41,11 @@ public class SpacingPropertyMaker extends SpaceProperty.Maker { /** * Support for the 'normal' value. + * @param p the property to convert + * @param propertyList the property list to use in conversion + * @param fo the FO to use in conversion + * @return the converted property + * @throws PropertyException if a property conversion exception occurs */ public Property convertProperty(Property p, PropertyList propertyList, diff --git a/src/java/org/apache/fop/fo/properties/StringProperty.java b/src/java/org/apache/fop/fo/properties/StringProperty.java index ec7e1f841..9bbe33070 100644 --- a/src/java/org/apache/fop/fo/properties/StringProperty.java +++ b/src/java/org/apache/fop/fo/properties/StringProperty.java @@ -21,11 +21,6 @@ package org.apache.fop.fo.properties; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.FOValidationEventProducer; -import org.apache.fop.fo.ValidationException; -import org.apache.fop.fo.expr.PropertyException; - -import java.util.Set; /** * Exists primarily as a container for its Maker inner class, which is @@ -83,7 +78,8 @@ public final class StringProperty extends Property { } /** cache containing all canonical StringProperty instances */ - private static final PropertyCache cache = new PropertyCache(StringProperty.class); + private static final PropertyCache CACHE + = new PropertyCache(StringProperty.class); /** canonical instance for empty strings */ public static final StringProperty EMPTY_STRING_PROPERTY = new StringProperty(""); @@ -108,7 +104,7 @@ public final class StringProperty extends Property { if ("".equals(str) || str == null) { return EMPTY_STRING_PROPERTY; } else { - return (StringProperty)cache.fetch( + return (StringProperty)CACHE.fetch( new StringProperty(str)); } } diff --git a/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java b/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java index 4a2fc92f4..b01ee22a0 100644 --- a/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java +++ b/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java @@ -24,7 +24,11 @@ import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; -public class TableBorderPrecedence extends NumberProperty.Maker{ +/** + * A table border preference property maker. + */ +public class TableBorderPrecedence extends NumberProperty.Maker { + private static Property num0 = NumberProperty.getInstance(0); private static Property num1 = NumberProperty.getInstance(1); private static Property num2 = NumberProperty.getInstance(2); @@ -33,6 +37,10 @@ public class TableBorderPrecedence extends NumberProperty.Maker{ private static Property num5 = NumberProperty.getInstance(5); private static Property num6 = NumberProperty.getInstance(6); + /** + * Construct a table border preference property maker. + * @param propId the border's property id + */ public TableBorderPrecedence(int propId) { super(propId); } @@ -59,7 +67,8 @@ public class TableBorderPrecedence extends NumberProperty.Maker{ return num1; case Constants.FO_TABLE_FOOTER: return num0; + default: + return null; } - return null; } } diff --git a/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java b/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java index 3cbe56f00..bcd41fb20 100644 --- a/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java +++ b/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java @@ -14,6 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/* $Id$ */ + package org.apache.fop.fo.properties; import java.util.Iterator; @@ -72,11 +75,11 @@ public class TextDecorationProperty extends ListProperty { if (prop instanceof EnumProperty) { //skip } else if (prop instanceof NCnameProperty) { - Property prop_enum = checkEnumValues(((NCnameProperty)prop).getString()); - if (prop_enum == null) { + Property propEnum = checkEnumValues(((NCnameProperty)prop).getString()); + if (propEnum == null) { throw new PropertyException("Illegal enum value: " + prop.getString()); } - l.set(i, prop_enum); + l.set(i, propEnum); } else { throw new PropertyException("Invalid content for text-decoration " + "property: " + prop); @@ -113,7 +116,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_UNDERLINE: case Constants.EN_NO_UNDERLINE: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (under) { throw new PropertyException("Invalid combination of values"); @@ -123,7 +127,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_OVERLINE: case Constants.EN_NO_OVERLINE: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (over) { throw new PropertyException("Invalid combination of values"); @@ -133,7 +138,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_LINE_THROUGH: case Constants.EN_NO_LINE_THROUGH: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (through) { throw new PropertyException("Invalid combination of values"); @@ -143,7 +149,8 @@ public class TextDecorationProperty extends ListProperty { case Constants.EN_BLINK: case Constants.EN_NO_BLINK: if (none) { - throw new PropertyException("'none' specified, no additional values allowed"); + throw new PropertyException + ("'none' specified, no additional values allowed"); } if (blink) { throw new PropertyException("Invalid combination of values"); diff --git a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java b/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java index c04b1a892..59a6cafef 100644 --- a/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java +++ b/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java @@ -22,22 +22,33 @@ package org.apache.fop.fo.properties; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; +/** + * A special property for representing an as yet unimplemented property. + */ public class ToBeImplementedProperty extends Property { + /** + * A to be implemented property maker instance. + */ public static class Maker extends PropertyMaker { + /** + * Instantiate a to be implemented property maker instance. + * @param propId a property id + */ public Maker(int propId) { super(propId); } + /** {@inheritDoc} */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) { if (p instanceof ToBeImplementedProperty) { return p; } - ToBeImplementedProperty val = - new ToBeImplementedProperty(getPropId()); + ToBeImplementedProperty val + = new ToBeImplementedProperty(getPropId()); return val; } } diff --git a/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java b/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java index c0950a794..8c0cec744 100644 --- a/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java @@ -18,6 +18,7 @@ /* $Id$ */ package org.apache.fop.fo.properties; + import org.apache.fop.fo.Constants; import org.apache.fop.fo.PropertyList; @@ -47,6 +48,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_TOP: switch (propId) { @@ -58,6 +61,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_TEXT_TOP: switch (propId) { @@ -69,6 +74,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_MIDDLE: switch (propId) { @@ -80,6 +87,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_BOTTOM: switch (propId) { @@ -91,6 +100,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_TEXT_BOTTOM: switch (propId) { @@ -102,6 +113,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_SUB: switch (propId) { @@ -113,6 +126,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_SUB, "SUB")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } case EN_SUPER: switch (propId) { @@ -124,6 +139,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_SUPER, "SUPER")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } default: switch (propId) { @@ -135,6 +152,8 @@ public class VerticalAlignShorthandParser implements ShorthandParser, Constants return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); case PR_DOMINANT_BASELINE: return EnumProperty.getInstance(EN_AUTO, "AUTO"); + default: + break; } } return null; diff --git a/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java b/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java index efadd8957..d8b8dac27 100644 --- a/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java +++ b/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java @@ -13,7 +13,8 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + */ + /* $Id$ */ package org.apache.fop.fo.properties; @@ -22,6 +23,9 @@ import org.apache.fop.fo.Constants; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; +/** + * A parser for the xml:lang property. + */ public class XMLLangShorthandParser extends GenericShorthandParser { private static final char HYPHEN_MINUS = '-'; |