diff options
Diffstat (limited to 'src/java/org/apache/fop/fo')
90 files changed, 918 insertions, 430 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java index bbe3ce3a3..a6be832f0 100644 --- a/src/java/org/apache/fop/fo/FONode.java +++ b/src/java/org/apache/fop/fo/FONode.java @@ -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..8293180cf 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 + * @asf.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/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 133d932bc..244013c4d 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[] propertyListTable // CSOK: ConstantName = FOPropertyMapping.getGenericMappings(); /** @@ -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 + * @asf.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/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..d1f91d509 100644 --- a/src/java/org/apache/fop/fo/expr/NumericOp.java +++ b/src/java/org/apache/fop/fo/expr/NumericOp.java @@ -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. @@ -39,7 +43,8 @@ public class NumericOp { * @throws PropertyException If the dimension of the operand is different * from the dimension of this Numeric. */ - public static Numeric addition(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric addition(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return addition2(op1, op2, null); } else { @@ -47,11 +52,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()); } /** @@ -63,7 +80,8 @@ public class NumericOp { * @throws PropertyException If the dimension of the operand is different * from the dimension of this Numeric. */ - public static Numeric subtraction(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric subtraction(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return subtraction2(op1, op2, null); } else { @@ -71,11 +89,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()); } /** @@ -87,7 +117,8 @@ public class NumericOp { * @throws PropertyException If the dimension of the operand is different * from the dimension of this Numeric. */ - public static Numeric multiply(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric multiply(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return multiply2(op1, op2, null); } else { @@ -95,7 +126,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 +160,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,8 +181,10 @@ 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 { + public static Numeric modulo(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return modulo2(op1, op2, null); } else { @@ -137,16 +192,29 @@ 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 { + public static Numeric abs(Numeric op) + throws PropertyException { if (op.isAbsolute()) { return abs2(op, null); } else { @@ -154,7 +222,16 @@ public class NumericOp { } } - public static Numeric abs2(Numeric op, PercentBaseContext context) throws PropertyException { + /** + * 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,8 +239,10 @@ 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 { + public static Numeric negate(Numeric op) + throws PropertyException { if (op.isAbsolute()) { return negate2(op, null); } else { @@ -171,8 +250,18 @@ public class NumericOp { } } - public static Numeric negate2(Numeric op, PercentBaseContext context) throws PropertyException { - return numeric(- op.getNumericValue(context), op.getDimension()); + + /** + * 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()); } /** @@ -182,7 +271,8 @@ public class NumericOp { * @return a Numeric which is the maximum of the two operands. * @throws PropertyException if the dimensions or value types of the operands are different. */ - public static Numeric max(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric max(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return max2(op1, op2, null); } else { @@ -190,7 +280,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"); } @@ -204,7 +304,8 @@ public class NumericOp { * @return a Numeric which is the minimum of the two operands. * @throws PropertyException if the dimensions or value types of the operands are different. */ - public static Numeric min(Numeric op1, Numeric op2) throws PropertyException { + public static Numeric min(Numeric op1, Numeric op2) + throws PropertyException { if (op1.isAbsolute() && op2.isAbsolute()) { return min2(op1, op2, null); } else { @@ -212,7 +313,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 +332,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 5baa0c4d8..3008dbebe 100644 --- a/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java +++ b/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java @@ -83,7 +83,7 @@ class PropertyTokenizer { boolean currentMaybeOperator = recognizeOperator; boolean bSawDecimal; recognizeOperator = true; - for (; ;) { + while ( true ) { if (exprIndex >= exprLength) { currentToken = TOK_EOF; return; @@ -273,8 +273,11 @@ class PropertyTokenizer { } private void scanRestOfName() { - while (++exprIndex < exprLength - && isNameChar(expr.charAt(exprIndex))) { } + while ( ++exprIndex < exprLength ) { + if ( !isNameChar ( expr.charAt ( exprIndex ) ) ) { + break; + } + } } /** @@ -320,8 +323,8 @@ class PropertyTokenizer { } - private static final String NAME_START_CHARS = - "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + private static final String NAME_START_CHARS + = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String NAME_CHARS = ".-0123456789"; private static final String DIGITS = "0123456789"; private static final String HEX_CHARS = DIGITS + "abcdefABCDEF"; @@ -331,7 +334,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; } @@ -340,7 +343,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; } @@ -349,15 +352,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; } /** @@ -365,7 +369,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; } @@ -374,7 +378,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..32d0d745c 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java @@ -37,7 +37,8 @@ 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 propertyAttributes // CSOK: ConstantName + = new java.util.HashSet(); static { //These are FOP's standard extension properties (fox:*) 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/svg/BatikExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java index 2cc451b64..449258525 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 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/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..9967a54d8 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 + * @asf.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 + * @asf.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..1b32e3f1e 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() + * @asf.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..3f714dbd8 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 + * @asf.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..e23a13f33 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -111,7 +111,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 + * @asf.todo implement "additional" constraint, possibly within fo:retrieve-marker */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { @@ -199,17 +199,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 +267,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 +317,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 +358,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..76bded0be 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() + * @asf.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..5ee5e78ad 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 + * @asf.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..6ba763933 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,11 @@ public abstract class TableFObj extends FObj implements StructurePointerProperty */ i = 1; } - TableEventProducer eventProducer = - TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster()); - eventProducer.forceNextColumnNumber(this, propertyList.getFObj().getName(), - val, i, propertyList.getFObj().getLocator()); + TableEventProducer eventProducer + = TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster()); + eventProducer.forceNextColumnNumber + (this, propertyList.getFObj().getName(), + val, i, propertyList.getFObj().getLocator()); } return NumberProperty.getInstance(i); } @@ -229,7 +231,9 @@ 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/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/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 26812166d..01ca5863e 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -151,7 +151,7 @@ public class PageSequence extends AbstractPageSequence { /** * {@inheritDoc} - * @todo see if addChildNode() should also be called for fo's other than + * @asf.todo see if addChildNode() should also be called for fo's other than * fo:flow. */ public void addChildNode(FONode child) throws FOPException { @@ -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/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index 165bb4734..cb265706d 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -106,8 +106,10 @@ 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; diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index fcbb54abd..2a634c24a 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -144,7 +144,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 +211,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; diff --git a/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java b/src/java/org/apache/fop/fo/properties/BackgroundPositionShorthand.java index 709fdf7f2..58f1ac210 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..467682878 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; @@ -55,8 +56,7 @@ public class BorderWidthPropertyMaker extends LengthProperty.Maker { public Property get(int subpropId, PropertyList propertyList, boolean bTryInherit, boolean bTryDefault) - throws PropertyException - { + throws PropertyException { Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault); diff --git a/src/java/org/apache/fop/fo/properties/CharacterProperty.java b/src/java/org/apache/fop/fo/properties/CharacterProperty.java index c078da0c7..71b70ebee 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 + * @asf.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 // CSOK: ConstantName + = new PropertyCache(CharacterProperty.class); private final char character; @@ -59,6 +63,11 @@ 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( 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 925d275af..95725f3e8 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 // CSOK: ConstantName + = new PropertyCache(ColorProperty.class); /** * The color represented by this property. @@ -97,7 +98,8 @@ 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)); 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..b3ae7d8cd 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 // CSOK: ConstantName + = 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 // CSOK: ConstantName + = new PropertyCache(BorderInfo.class); private int mStyle; // Enum for border style private Color mColor; // Border 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 defaultBorderInfo // CSOK: ConstantName = BorderInfo.getInstance(Constants.EN_NONE, new ConditionalNullLength(), null); /** @@ -352,12 +354,18 @@ 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())) { + 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); } @@ -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..f3f7d3f69 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 // CSOK: ConstantName + = 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); @@ -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..c65b5b616 100644 --- a/src/java/org/apache/fop/fo/properties/CommonHyphenation.java +++ b/src/java/org/apache/fop/fo/properties/CommonHyphenation.java @@ -36,32 +36,34 @@ import org.apache.fop.fonts.Typeface; public final class CommonHyphenation { /** Logger */ - protected static Log log = LogFactory.getLog(CommonHyphenation.class); + private static final Log log // CSOK: ConstantName + = LogFactory.getLog(CommonHyphenation.class); - private static final PropertyCache cache = new PropertyCache(CommonHyphenation.class); + private static final PropertyCache cache // CSOK: ConstantName + = 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 +89,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, @@ -209,12 +213,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 f7381dba7..3edb84009 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. @@ -105,8 +105,7 @@ public class CompoundPropertyMaker extends PropertyMaker { * @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,12 @@ 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 - { + throws PropertyException { Property p = super.get(subpropertyId, propertyList, tryInherit, tryDefault); if (subpropertyId != 0 && p != null) { p = getSubprop(p, subpropertyId); @@ -261,7 +261,8 @@ public class CompoundPropertyMaker extends PropertyMaker { 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..dc7d80c39 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 // CSOK: ConstantName + = new PropertyCache(CondLengthProperty.class); /** components */ private Property length; diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java index 60237c53a..18c6f09a6 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java @@ -27,23 +27,38 @@ import org.apache.fop.fo.expr.PropertyException; /** */ 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..df8583089 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..6a2879479 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 // CSOK: ConstantName + = new PropertyCache(EnumNumber.class); private final 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..db26cfdc6 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 // CSOK: ConstantName + = 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,6 +86,12 @@ 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( 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..cc4d04c69 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 // CSOK: ConstantName + = new PropertyCache(FixedLength.class); /** canonical zero-length instance */ public static final FixedLength ZERO_FIXED_LENGTH = new FixedLength(0, FixedLength.MPT, 1.0f); diff --git a/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java b/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java index 34a6b58d8..5b05aa959 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 // CSOK: ConstantName + = 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 { diff --git a/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java b/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java index 5096d6160..60ef955ba 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..7c5b6124f 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 // CSOK: ConstantName + = 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() + "]"; } /** 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..d54161b8d 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 // CSOK: ConstantName + = new PropertyCache(NumberProperty.class); private final Number number; diff --git a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java index 53a9c1286..919dd84d0 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 retriving 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/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..ab4544c0a 100644 --- a/src/java/org/apache/fop/fo/properties/StringProperty.java +++ b/src/java/org/apache/fop/fo/properties/StringProperty.java @@ -83,7 +83,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 // CSOK: ConstantName + = new PropertyCache(StringProperty.class); /** canonical instance for empty strings */ public static final StringProperty EMPTY_STRING_PROPERTY = new StringProperty(""); 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..387355623 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 implemented implemented 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 = '-'; |