You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2011/01/18 09:54:26 UTC
svn commit: r1060241 [8/21] - in /xmlgraphics/fop/branches/Temp_Color: ./
examples/plan/src/org/apache/fop/plan/ lib/ lib/build/
src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/data/
src/codegen/unicode/java/org/apache/fop/hyphenation/ src/c...
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonHyphenation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonHyphenation.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonHyphenation.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonHyphenation.java Tue Jan 18 08:54:08 2011
@@ -36,32 +36,32 @@ import org.apache.fop.fonts.Typeface;
public final class CommonHyphenation {
/** Logger */
- protected static Log log = LogFactory.getLog(CommonHyphenation.class);
+ private static final Log LOG = LogFactory.getLog(CommonHyphenation.class);
- private static final PropertyCache cache = new PropertyCache(CommonHyphenation.class);
+ private static final PropertyCache CACHE = new PropertyCache(CommonHyphenation.class);
private int hash = 0;
/** The "language" property */
- public final StringProperty language;
+ public final StringProperty language; // CSOK: VisibilityModifier
/** The "country" property */
- public final StringProperty country;
+ public final StringProperty country; // CSOK: VisibilityModifier
/** The "script" property */
- public final StringProperty script;
+ public final StringProperty script; // CSOK: VisibilityModifier
/** The "hyphenate" property */
- public final EnumProperty hyphenate;
+ public final EnumProperty hyphenate; // CSOK: VisibilityModifier
/** The "hyphenation-character" property */
- public final CharacterProperty hyphenationCharacter;
+ public final CharacterProperty hyphenationCharacter; // CSOK: VisibilityModifier
/** The "hyphenation-push-character-count" property */
- public final NumberProperty hyphenationPushCharacterCount;
+ public final NumberProperty hyphenationPushCharacterCount; // CSOK: VisibilityModifier
/** The "hyphenation-remain-character-count" property*/
- public final NumberProperty hyphenationRemainCharacterCount;
+ public final NumberProperty hyphenationRemainCharacterCount; // CSOK: VisibilityModifier
/**
* Construct a CommonHyphenation object holding the given properties
@@ -87,24 +87,26 @@ public final class CommonHyphenation {
* Gets the canonical <code>CommonHyphenation</code> instance corresponding
* to the values of the related properties present on the given
* <code>PropertyList</code>
- *
* @param propertyList the <code>PropertyList</code>
+ * @return a common hyphenation instance
+ * @throws PropertyException if a a property exception occurs
*/
- public static CommonHyphenation getInstance(PropertyList propertyList) throws PropertyException {
- StringProperty language =
- (StringProperty) propertyList.get(Constants.PR_LANGUAGE);
- StringProperty country =
- (StringProperty) propertyList.get(Constants.PR_COUNTRY);
- StringProperty script =
- (StringProperty) propertyList.get(Constants.PR_SCRIPT);
- EnumProperty hyphenate =
- (EnumProperty) propertyList.get(Constants.PR_HYPHENATE);
- CharacterProperty hyphenationCharacter =
- (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER);
- NumberProperty hyphenationPushCharacterCount =
- (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT);
- NumberProperty hyphenationRemainCharacterCount =
- (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT);
+ public static CommonHyphenation getInstance(PropertyList propertyList)
+ throws PropertyException {
+ StringProperty language
+ = (StringProperty) propertyList.get(Constants.PR_LANGUAGE);
+ StringProperty country
+ = (StringProperty) propertyList.get(Constants.PR_COUNTRY);
+ StringProperty script
+ = (StringProperty) propertyList.get(Constants.PR_SCRIPT);
+ EnumProperty hyphenate
+ = (EnumProperty) propertyList.get(Constants.PR_HYPHENATE);
+ CharacterProperty hyphenationCharacter
+ = (CharacterProperty) propertyList.get(Constants.PR_HYPHENATION_CHARACTER);
+ NumberProperty hyphenationPushCharacterCount
+ = (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_PUSH_CHARACTER_COUNT);
+ NumberProperty hyphenationRemainCharacterCount
+ = (NumberProperty) propertyList.get(Constants.PR_HYPHENATION_REMAIN_CHARACTER_COUNT);
CommonHyphenation instance = new CommonHyphenation(
language,
@@ -115,7 +117,7 @@ public final class CommonHyphenation {
hyphenationPushCharacterCount,
hyphenationRemainCharacterCount);
- return cache.fetch(instance);
+ return CACHE.fetch(instance);
}
@@ -164,7 +166,7 @@ public final class CommonHyphenation {
}
}
if (warn) {
- log.warn("Substituted specified hyphenation character (0x"
+ LOG.warn("Substituted specified hyphenation character (0x"
+ Integer.toHexString(hyphChar)
+ ") with 0x" + Integer.toHexString(effHyphChar)
+ " because the font doesn't have the specified hyphenation character: "
@@ -209,12 +211,15 @@ public final class CommonHyphenation {
hash = 37 * hash + (script == null ? 0 : script.hashCode());
hash = 37 * hash + (country == null ? 0 : country.hashCode());
hash = 37 * hash + (hyphenate == null ? 0 : hyphenate.hashCode());
- hash = 37 * hash +
- (hyphenationCharacter == null ? 0 : hyphenationCharacter.hashCode());
- hash = 37 * hash +
- (hyphenationPushCharacterCount == null ? 0 : hyphenationPushCharacterCount.hashCode());
- hash = 37 * hash +
- (hyphenationRemainCharacterCount == null ? 0 : hyphenationRemainCharacterCount.hashCode());
+ hash = 37 * hash
+ + (hyphenationCharacter == null
+ ? 0 : hyphenationCharacter.hashCode());
+ hash = 37 * hash
+ + (hyphenationPushCharacterCount == null
+ ? 0 : hyphenationPushCharacterCount.hashCode());
+ hash = 37 * hash
+ + (hyphenationRemainCharacterCount == null
+ ? 0 : hyphenationRemainCharacterCount.hashCode());
this.hash = hash;
}
return this.hash;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java Tue Jan 18 08:54:08 2011
@@ -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();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginInline.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginInline.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginInline.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonMarginInline.java Tue Jan 18 08:54:08 2011
@@ -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();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java Tue Jan 18 08:54:08 2011
@@ -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();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -32,8 +32,8 @@ public class CompoundPropertyMaker exten
/**
* 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 exten
/**
* Add a subproperty to this maker.
- * @param subproperty
+ * @param subproperty the sub property
*/
public void addSubpropMaker(PropertyMaker subproperty) {
// Place the base propId in the propId of the subproperty.
@@ -101,12 +101,11 @@ public class CompoundPropertyMaker exten
* Calculate the real value of a subproperty by unmasking and shifting
* the value into the range [0 - (COMPOUND_COUNT-1)].
* The value is used as index into the subproperties array.
- * @param propId the property id of the sub property.
+ * @param subpropertyId the property id of the sub property.
* @return the array index.
*/
private int getSubpropIndex(int subpropertyId) {
- return ((subpropertyId & Constants.COMPOUND_MASK) >>
- Constants.COMPOUND_SHIFT)-1;
+ return ((subpropertyId & Constants.COMPOUND_MASK) >> Constants.COMPOUND_SHIFT) - 1;
}
/**
@@ -137,11 +136,11 @@ public class CompoundPropertyMaker exten
* @param propertyList The PropertyList object being built for this FO.
* @param tryInherit true if inherited properties should be examined.
* @param tryDefault true if the default value should be returned.
+ * @return the property
+ * @throws PropertyException if a property exception occurs
*/
- public Property get(int subpropertyId, PropertyList propertyList,
- boolean tryInherit, boolean tryDefault)
- throws PropertyException
- {
+ public Property get(int subpropertyId, PropertyList propertyList, boolean tryInherit,
+ boolean tryDefault) throws PropertyException {
Property p = super.get(subpropertyId, propertyList, tryInherit, tryDefault);
if (subpropertyId != 0 && p != null) {
p = getSubprop(p, subpropertyId);
@@ -254,14 +253,15 @@ public class CompoundPropertyMaker exten
* @throws PropertyException ...
*/
protected Property makeCompound(PropertyList propertyList, FObj parentFO)
- throws PropertyException {
+ throws PropertyException {
Property p = makeNewProperty();
CompoundDatatype data = (CompoundDatatype) p.getObject();
for (int i = 0; i < Constants.COMPOUND_COUNT; i++) {
PropertyMaker subpropertyMaker = subproperties[i];
if (subpropertyMaker != null) {
Property subproperty = subpropertyMaker.make(propertyList);
- data.setComponent(subpropertyMaker.getPropId() & Constants.COMPOUND_MASK, subproperty, true);
+ data.setComponent(subpropertyMaker.getPropId()
+ & Constants.COMPOUND_MASK, subproperty, true);
}
}
return p;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CondLengthProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CondLengthProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CondLengthProperty.java Tue Jan 18 08:54:08 2011
@@ -33,7 +33,8 @@ import org.apache.fop.fo.expr.PropertyEx
public class CondLengthProperty extends Property implements CompoundDatatype {
/** cache holding canonical instances (for absolute conditional lengths) */
- private static final PropertyCache cache = new PropertyCache(CondLengthProperty.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(CondLengthProperty.class);
/** components */
private Property length;
@@ -158,7 +159,7 @@ public class CondLengthProperty extends
*/
public CondLengthProperty getCondLength() {
if (this.length.getLength().isAbsolute()) {
- CondLengthProperty clp = (CondLengthProperty) cache.fetch(this);
+ CondLengthProperty clp = (CondLengthProperty) CACHE.fetch(this);
if (clp == this) {
isCached = true;
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -19,31 +19,46 @@
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
/**
+ * Maker class for handling corresponding properties.
*/
public class CorrespondingPropertyMaker {
+ /** base property maker */
protected PropertyMaker baseMaker;
- protected int lr_tb;
- protected int rl_tb;
- protected int tb_rl;
+ /** corresponding property for lr-tb writing mode */
+ protected int lrtb;
+ /** corresponding property for rl-tb writing mode */
+ protected int rltb;
+ /** corresponding property for tb-rl writing mode */
+ protected int tbrl;
+ /** user parent property list */
protected boolean useParent;
private boolean relative;
+ /**
+ * Construct a corresponding property maker.
+ * @param baseMaker the base property maker
+ */
public CorrespondingPropertyMaker(PropertyMaker baseMaker) {
this.baseMaker = baseMaker;
baseMaker.setCorresponding(this);
}
- public void setCorresponding(int lr_tb, int rl_tb, int tb_rl) {
- this.lr_tb = lr_tb;
- this.rl_tb = rl_tb;
- this.tb_rl = tb_rl;
+ /**
+ * Set corresponding property identifiers.
+ * @param lrtb the property that corresponds with lr-tb writing mode
+ * @param rltb the property that corresponds with rl-tb writing mode
+ * @param tbrl the property that corresponds with tb-lr writing mode
+ */
+ public void setCorresponding(int lrtb, int rltb, int tbrl) {
+ this.lrtb = lrtb;
+ this.rltb = rltb;
+ this.tbrl = tbrl;
}
/**
@@ -55,6 +70,10 @@ public class CorrespondingPropertyMaker
this.useParent = useParent;
}
+ /**
+ * Set relative flag.
+ * @param relative true if relative direction
+ */
public void setRelative(boolean relative) {
this.relative = relative;
}
@@ -83,7 +102,7 @@ public class CorrespondingPropertyMaker
PropertyList pList = getWMPropertyList(propertyList);
if (pList != null) {
- int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
+ int correspondingId = pList.getWritingMode(lrtb, rltb, tbrl);
if (pList.getExplicit(correspondingId) != null) {
return true;
@@ -100,14 +119,14 @@ public class CorrespondingPropertyMaker
* @param propertyList The PropertyList for the FO.
* @return Property A computed Property value or null if no rules
* are specified (in foproperties.xml) to compute the value.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException if a property exception occurs
*/
public Property compute(PropertyList propertyList) throws PropertyException {
PropertyList pList = getWMPropertyList(propertyList);
if (pList == null) {
return null;
}
- int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
+ int correspondingId = pList.getWritingMode(lrtb, rltb, tbrl);
Property p = propertyList.getExplicitOrShorthand(correspondingId);
if (p != null) {
@@ -120,6 +139,8 @@ public class CorrespondingPropertyMaker
/**
* Return the property list to use for fetching writing mode depending property
* ids.
+ * @param pList a property list
+ * @return the property list to use
*/
protected PropertyList getWMPropertyList(PropertyList pList) {
if (useParent) {
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -30,27 +30,44 @@ import org.apache.fop.fo.expr.PropertyEx
* 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);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumLength.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumLength.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumLength.java Tue Jan 18 08:54:08 2011
@@ -27,6 +27,10 @@ import org.apache.fop.datatypes.PercentB
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 LengthPr
return enumProperty.getEnum();
}
+ /** @return true if absolute */
public boolean isAbsolute() {
return false;
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumNumber.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumNumber.java Tue Jan 18 08:54:08 2011
@@ -29,7 +29,8 @@ import org.apache.fop.fo.expr.PropertyEx
public final class EnumNumber extends Property implements Numeric {
/** cache holding all canonical EnumNumber instances */
- private static final PropertyCache cache = new PropertyCache(EnumNumber.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(EnumNumber.class);
private final EnumProperty enumProperty;
@@ -49,7 +50,7 @@ public final class EnumNumber extends Pr
* @return the canonical instance
*/
public static EnumNumber getInstance(Property enumProperty) {
- return (EnumNumber)cache.fetch(
+ return (EnumNumber)CACHE.fetch(
new EnumNumber((EnumProperty) enumProperty));
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/EnumProperty.java Tue Jan 18 08:54:08 2011
@@ -29,7 +29,8 @@ import org.apache.fop.fo.expr.PropertyEx
public final class EnumProperty extends Property {
/** cache holding all canonical EnumProperty instances */
- private static final PropertyCache cache = new PropertyCache(EnumProperty.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(EnumProperty.class);
/**
* Inner class for creating EnumProperty instances
@@ -54,6 +55,14 @@ public final class EnumProperty extends
return super.checkEnumValues(value);
}
+ /**
+ * Convert a property.
+ * @param p the property to convert
+ * @param propertyList the property list to use in conversion
+ * @param fo the FO to use in conversion
+ * @return the converted property
+ * @throws PropertyException if a property conversion exception occurs
+ */
public Property convertProperty(Property p,
PropertyList propertyList,
FObj fo) throws PropertyException {
@@ -77,8 +86,14 @@ public final class EnumProperty extends
this.text = text;
}
+ /**
+ * Construct an enumeration property.
+ * @param explicitValue the value
+ * @param text the text
+ * @return an enumeration property
+ */
public static EnumProperty getInstance(int explicitValue, String text) {
- return (EnumProperty) cache.fetch(
+ return (EnumProperty) CACHE.fetch(
new EnumProperty(explicitValue, text));
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FixedLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FixedLength.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FixedLength.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FixedLength.java Tue Jan 18 08:54:08 2011
@@ -45,7 +45,8 @@ public final class FixedLength extends L
public static final String MPT = "mpt";
/** cache holding all canonical FixedLength instances */
- private static final PropertyCache cache = new PropertyCache(FixedLength.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(FixedLength.class);
/** canonical zero-length instance */
public static final FixedLength ZERO_FIXED_LENGTH = new FixedLength(0, FixedLength.MPT, 1.0f);
@@ -81,7 +82,7 @@ public final class FixedLength extends L
if (numUnits == 0.0) {
return ZERO_FIXED_LENGTH;
} else {
- return (FixedLength)cache.fetch(
+ return (FixedLength)CACHE.fetch(
new FixedLength(numUnits, units, sourceResolution));
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontFamilyProperty.java Tue Jan 18 08:54:08 2011
@@ -31,7 +31,8 @@ import org.apache.fop.fo.expr.PropertyEx
public final class FontFamilyProperty extends ListProperty {
/** cache holding all canonical FontFamilyProperty instances */
- private static final PropertyCache cache = new PropertyCache(FontFamilyProperty.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(FontFamilyProperty.class);
private int hash = 0;
@@ -50,7 +51,8 @@ public final class FontFamilyProperty ex
/**
* {@inheritDoc}
*/
- public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException {
+ public Property make(PropertyList propertyList, String value, FObj fo)
+ throws PropertyException {
if ("inherit".equals(value)) {
return super.make(propertyList, value, fo);
} else {
@@ -93,7 +95,7 @@ public final class FontFamilyProperty ex
prop.addProperty(StringProperty.getInstance(tmpVal));
}
}
- return cache.fetch(prop);
+ return CACHE.fetch(prop);
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -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);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/FontWeightPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -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.PropertyEx
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 ext
} 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) {
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -68,6 +68,9 @@ public class IndentPropertyMaker extends
/**
* 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
/**
* 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
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
* 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
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.
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/KeepProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/KeepProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/KeepProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/KeepProperty.java Tue Jan 18 08:54:08 2011
@@ -30,7 +30,8 @@ import org.apache.fop.fo.expr.PropertyEx
public final class KeepProperty extends Property implements CompoundDatatype {
/** class holding all canonical KeepProperty instances*/
- private static final PropertyCache cache = new PropertyCache(KeepProperty.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(KeepProperty.class);
private boolean isCachedValue = false;
private Property withinLine;
@@ -61,8 +62,7 @@ public final class KeepProperty extends
* {@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
* @return String representation
*/
public String toString() {
- return "Keep[" +
- "withinLine:" + getWithinLine().getObject() +
- ", withinColumn:" + getWithinColumn().getObject() +
- ", withinPage:" + getWithinPage().getObject() + "]";
+ return "Keep["
+ + "withinLine:" + getWithinLine().getObject()
+ + ", withinColumn:" + getWithinColumn().getObject()
+ + ", withinPage:" + getWithinPage().getObject() + "]";
}
/**
@@ -165,7 +165,7 @@ public final class KeepProperty extends
* this property
*/
public KeepProperty getKeep() {
- KeepProperty keep = (KeepProperty) cache.fetch(this);
+ KeepProperty keep = (KeepProperty) CACHE.fetch(this);
/* make sure setComponent() can never alter cached values */
keep.isCachedValue = true;
return keep;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -64,6 +64,7 @@ public class LineHeightPropertyMaker ext
/**
* 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
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/NumberProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/NumberProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/NumberProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/NumberProperty.java Tue Jan 18 08:54:08 2011
@@ -68,6 +68,9 @@ public final class NumberProperty extend
}
+ /**
+ * A positive integer property maker.
+ */
public static class PositiveIntegerMaker extends PropertyMaker {
/**
@@ -103,7 +106,8 @@ public final class NumberProperty extend
}
/** cache holding all canonical NumberProperty instances */
- private static final PropertyCache cache = new PropertyCache(NumberProperty.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(NumberProperty.class);
private final Number number;
@@ -140,7 +144,7 @@ public final class NumberProperty extend
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(Double num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num.doubleValue()));
}
@@ -151,7 +155,7 @@ public final class NumberProperty extend
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(Integer num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num.intValue()));
}
@@ -162,7 +166,7 @@ public final class NumberProperty extend
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(double num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num));
}
@@ -173,7 +177,7 @@ public final class NumberProperty extend
* @return the canonical NumberProperty
*/
public static NumberProperty getInstance(int num) {
- return (NumberProperty)cache.fetch(
+ return (NumberProperty)CACHE.fetch(
new NumberProperty(num));
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java Tue Jan 18 08:54:08 2011
@@ -43,7 +43,13 @@ public class PageDimensionMaker extends
* Check the value of the page-width / page-height property.
* Return the default or user-defined fallback in case the value
* was specified as "auto"
- *
+ * @param subpropId The subproperty id of the property being retrieved.
+ * Is 0 when retrieving a base property.
+ * @param propertyList The PropertyList object being built for this FO.
+ * @param tryInherit true if inherited properties should be examined.
+ * @param tryDefault true if the default value should be returned.
+ * @return the property
+ * @throws PropertyException if a property exception occurs
* @see PropertyMaker#get(int, PropertyList, boolean, boolean)
*/
public Property get(int subpropId, PropertyList propertyList,
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PercentLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PercentLength.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PercentLength.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PercentLength.java Tue Jan 18 08:54:08 2011
@@ -118,8 +118,7 @@ public class PercentLength extends Lengt
* @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();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/Property.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/Property.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/Property.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/Property.java Tue Jan 18 08:54:08 2011
@@ -36,7 +36,7 @@ import org.apache.fop.fo.Constants;
public class Property {
/** Logger for all property classes */
- protected static Log log = LogFactory.getLog(PropertyMaker.class);
+ protected static final Log log = LogFactory.getLog(PropertyMaker.class);
/**
* The original specified value for properties which inherit
@@ -197,6 +197,6 @@ public class Property {
if (obj != this) {
return obj.toString();
}
- return null;
+ return "";
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PropertyCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PropertyCache.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PropertyCache.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/PropertyCache.java Tue Jan 18 08:54:08 2011
@@ -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.
*
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ShorthandParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ShorthandParser.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ShorthandParser.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ShorthandParser.java Tue Jan 18 08:54:08 2011
@@ -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,
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpaceProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpaceProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpaceProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpaceProperty.java Tue Jan 18 08:54:08 2011
@@ -136,13 +136,14 @@ public class SpaceProperty extends Lengt
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() + "]";
}
/**
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/SpacingPropertyMaker.java Tue Jan 18 08:54:08 2011
@@ -41,6 +41,11 @@ public class SpacingPropertyMaker extend
/**
* 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,
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/StringProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/StringProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/StringProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/StringProperty.java Tue Jan 18 08:54:08 2011
@@ -21,11 +21,6 @@ package org.apache.fop.fo.properties;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.FOValidationEventProducer;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.expr.PropertyException;
-
-import java.util.Set;
/**
* Exists primarily as a container for its Maker inner class, which is
@@ -83,7 +78,8 @@ public final class StringProperty extend
}
/** cache containing all canonical StringProperty instances */
- private static final PropertyCache cache = new PropertyCache(StringProperty.class);
+ private static final PropertyCache CACHE
+ = new PropertyCache(StringProperty.class);
/** canonical instance for empty strings */
public static final StringProperty EMPTY_STRING_PROPERTY = new StringProperty("");
@@ -108,7 +104,7 @@ public final class StringProperty extend
if ("".equals(str) || str == null) {
return EMPTY_STRING_PROPERTY;
} else {
- return (StringProperty)cache.fetch(
+ return (StringProperty)CACHE.fetch(
new StringProperty(str));
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TableBorderPrecedence.java Tue Jan 18 08:54:08 2011
@@ -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 exten
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 exten
return num1;
case Constants.FO_TABLE_FOOTER:
return num0;
+ default:
+ return null;
}
- return null;
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/TextDecorationProperty.java Tue Jan 18 08:54:08 2011
@@ -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 exte
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 exte
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 exte
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 exte
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 exte
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");
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/ToBeImplementedProperty.java Tue Jan 18 08:54:08 2011
@@ -22,22 +22,33 @@ package org.apache.fop.fo.properties;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+/**
+ * A special property for representing an as yet unimplemented property.
+ */
public class ToBeImplementedProperty extends Property {
+ /**
+ * A to be implemented property maker instance.
+ */
public static class Maker extends PropertyMaker {
+ /**
+ * Instantiate a to be implemented property maker instance.
+ * @param propId a property id
+ */
public Maker(int propId) {
super(propId);
}
+ /** {@inheritDoc} */
public Property convertProperty(Property p,
PropertyList propertyList, FObj fo) {
if (p instanceof ToBeImplementedProperty) {
return p;
}
- ToBeImplementedProperty val =
- new ToBeImplementedProperty(getPropId());
+ ToBeImplementedProperty val
+ = new ToBeImplementedProperty(getPropId());
return val;
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/VerticalAlignShorthandParser.java Tue Jan 18 08:54:08 2011
@@ -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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
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 VerticalAlignShorthandParse
return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE"));
case PR_DOMINANT_BASELINE:
return EnumProperty.getInstance(EN_AUTO, "AUTO");
+ default:
+ break;
}
}
return null;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fo/properties/XMLLangShorthandParser.java Tue Jan 18 08:54:08 2011
@@ -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 = '-';
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java Tue Jan 18 08:54:08 2011
@@ -20,24 +20,25 @@
package org.apache.fop.fonts;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Map;
-import org.apache.xmlgraphics.fonts.Glyphs;
-
import org.apache.fop.util.CharUtilities;
+import org.apache.xmlgraphics.fonts.Glyphs;
/**
* Abstract base class for code point mapping classes (1-byte character encodings).
*/
public class AbstractCodePointMapping implements SingleByteEncoding {
- private String name;
+ private final String name;
private char[] latin1Map;
private char[] characters;
private char[] codepoints;
private char[] unicodeMap; //code point to Unicode char
private String[] charNameMap; //all character names in the encoding
- private Map fallbackMap; //Here we accumulate all mappings we have found through substitution
+ //Here we accumulate all mappings we have found through substitution
+ private Map<Character, Character> fallbackMap;
/**
* Main constructor.
@@ -144,7 +145,7 @@ public class AbstractCodePointMapping im
//Fallback: using cache
synchronized (this) {
if (fallbackMap != null) {
- Character fallback = (Character)fallbackMap.get(new Character(c));
+ Character fallback = fallbackMap.get(new Character(c));
if (fallback != null) {
return fallback.charValue();
}
@@ -172,7 +173,7 @@ public class AbstractCodePointMapping im
private void putFallbackCharacter(char c, char mapTo) {
synchronized (this) {
if (this.fallbackMap == null) {
- this.fallbackMap = new java.util.HashMap();
+ this.fallbackMap = new HashMap<Character, Character>();
}
this.fallbackMap.put(new Character(c), new Character(mapTo));
}
@@ -239,6 +240,7 @@ public class AbstractCodePointMapping im
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return getName();
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDFontType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDFontType.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDFontType.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDFontType.java Tue Jan 18 08:54:08 2011
@@ -38,6 +38,9 @@ public class CIDFontType extends ValuedE
/**
+ * Construct a CID font type.
+ * @param name a type name
+ * @param value a type value
* @see org.apache.avalon.framework.Enum#Enum(String)
*/
protected CIDFontType(String name, int value) {
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDSubset.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDSubset.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDSubset.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CIDSubset.java Tue Jan 18 08:54:08 2011
@@ -21,7 +21,7 @@ package org.apache.fop.fonts;
import java.util.BitSet;
import java.util.Collections;
-import java.util.Iterator;
+import java.util.HashMap;
import java.util.Map;
import org.apache.fop.util.CharUtilities;
@@ -42,19 +42,22 @@ public class CIDSubset {
/**
* usedGlyphs contains orginal, new glyph index (glyph index -> char selector)
*/
- private Map/*<Integer, Integer>*/ usedGlyphs = new java.util.HashMap();
+ private Map<Integer, Integer> usedGlyphs = new HashMap<Integer, Integer>();
/**
* usedGlyphsIndex contains new glyph, original index (char selector -> glyph index)
*/
- private Map/*<Integer, Integer>*/ usedGlyphsIndex = new java.util.HashMap();
+ private Map<Integer, Integer> usedGlyphsIndex = new HashMap<Integer, Integer>();
private int usedGlyphsCount = 0;
/**
* usedCharsIndex contains new glyph, original char (char selector -> Unicode)
*/
- private Map/*<Integer, Character>*/ usedCharsIndex = new java.util.HashMap();
+ private Map<Integer, Character> usedCharsIndex = new HashMap<Integer, Character>();
+ /**
+ * Default constructor.
+ */
public CIDSubset() {
}
@@ -81,7 +84,7 @@ public class CIDSubset {
* @return the original index (or -1 if no glyph index is available for the subset index)
*/
public int getGlyphIndexForSubsetIndex(int subsetIndex) {
- Integer glyphIndex = (Integer)usedGlyphsIndex.get(new Integer(subsetIndex));
+ Integer glyphIndex = usedGlyphsIndex.get(new Integer(subsetIndex));
if (glyphIndex != null) {
return glyphIndex.intValue();
} else {
@@ -96,7 +99,7 @@ public class CIDSubset {
* @return the Unicode value or "NOT A CHARACTER" (0xFFFF)
*/
public char getUnicodeForSubsetIndex(int subsetIndex) {
- Character mapValue = (Character)usedCharsIndex.get(new Integer(subsetIndex));
+ Character mapValue = usedCharsIndex.get(new Integer(subsetIndex));
if (mapValue != null) {
return mapValue.charValue();
} else {
@@ -115,7 +118,7 @@ public class CIDSubset {
public int mapSubsetChar(int glyphIndex, char unicode) {
// Reencode to a new subset font or get the reencoded value
// IOW, accumulate the accessed characters and build a character map for them
- Integer subsetCharSelector = (Integer)usedGlyphs.get(new Integer(glyphIndex));
+ Integer subsetCharSelector = usedGlyphs.get(new Integer(glyphIndex));
if (subsetCharSelector == null) {
int selector = usedGlyphsCount;
usedGlyphs.put(new Integer(glyphIndex),
@@ -136,7 +139,7 @@ public class CIDSubset {
* character selector (i.e. the subset index in this case).
* @return Map Map<Integer, Integer> of the font subset
*/
- public Map/*<Integer, Integer>*/ getSubsetGlyphs() {
+ public Map<Integer, Integer> getSubsetGlyphs() {
return Collections.unmodifiableMap(this.usedGlyphs);
}
@@ -166,9 +169,7 @@ public class CIDSubset {
*/
public BitSet getGlyphIndexBitSet() {
BitSet bitset = new BitSet();
- Iterator iter = usedGlyphsIndex.keySet().iterator();
- while (iter.hasNext()) {
- Integer cid = (Integer)iter.next();
+ for (Integer cid : usedGlyphs.keySet()) {
bitset.set(cid.intValue());
}
return bitset;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFont.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFont.java Tue Jan 18 08:54:08 2011
@@ -21,6 +21,8 @@ package org.apache.fop.fonts;
import java.io.IOException;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -35,7 +37,7 @@ public abstract class CustomFont extends
private String fontName = null;
private String fullName = null;
- private Set familyNames = null; //Set<String>
+ private Set<String> familyNames = null;
private String fontSubName = null;
private String embedFileName = null;
private String embedResourceName = null;
@@ -55,7 +57,7 @@ public abstract class CustomFont extends
private int firstChar = 0;
private int lastChar = 255;
- private Map kerning;
+ private Map<Integer, Map<Integer, Integer>> kerning;
private boolean useKerning = true;
@@ -78,7 +80,7 @@ public abstract class CustomFont extends
* Returns the font family names.
* @return the font family names (a Set of Strings)
*/
- public Set getFamilyNames() {
+ public Set<String> getFamilyNames() {
return Collections.unmodifiableSet(this.familyNames);
}
@@ -275,11 +277,11 @@ public abstract class CustomFont extends
/**
* {@inheritDoc}
*/
- public final Map getKerningInfo() {
+ public final Map<Integer, Map<Integer, Integer>> getKerningInfo() {
if (hasKerningInfo()) {
return kerning;
} else {
- return java.util.Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
@@ -296,8 +298,8 @@ public abstract class CustomFont extends
}
/** {@inheritDoc} */
- public void setFamilyNames(Set names) {
- this.familyNames = new java.util.HashSet(names);
+ public void setFamilyNames(Set<String> names) {
+ this.familyNames = new HashSet<String>(names);
}
/**
@@ -434,9 +436,9 @@ public abstract class CustomFont extends
}
/** {@inheritDoc} */
- public void putKerningEntry(Integer key, Map value) {
+ public void putKerningEntry(Integer key, Map<Integer, Integer> value) {
if (kerning == null) {
- kerning = new java.util.HashMap();
+ kerning = new HashMap<Integer, Map<Integer, Integer>>();
}
this.kerning.put(key, value);
}
@@ -446,9 +448,9 @@ public abstract class CustomFont extends
* @param kerningMap the kerning map (Map<Integer, Map<Integer, Integer>, the integers are
* character codes)
*/
- public void replaceKerningMap(Map kerningMap) {
+ public void replaceKerningMap(Map<Integer, Map<Integer, Integer>> kerningMap) {
if (kerningMap == null) {
- this.kerning = Collections.EMPTY_MAP;
+ this.kerning = Collections.emptyMap();
} else {
this.kerning = kerningMap;
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFontCollection.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/CustomFontCollection.java Tue Jan 18 08:54:08 2011
@@ -27,7 +27,7 @@ import java.util.List;
public class CustomFontCollection implements FontCollection {
private FontResolver fontResolver;
- private List/*<EmbedFontInfo>*/ embedFontInfoList;
+ private final List<EmbedFontInfo> embedFontInfoList;
/**
* Main constructor.
@@ -35,7 +35,7 @@ public class CustomFontCollection implem
* @param customFonts the list of custom fonts
*/
public CustomFontCollection(FontResolver fontResolver,
- List/*<EmbedFontInfo>*/ customFonts) {
+ List<EmbedFontInfo> customFonts) {
this.fontResolver = fontResolver;
if (this.fontResolver == null) {
//Ensure that we have minimal font resolution capabilities
@@ -54,7 +54,7 @@ public class CustomFontCollection implem
//FontReader reader = null;
for (int i = 0; i < embedFontInfoList.size(); i++) {
- EmbedFontInfo embedFontInfo = (EmbedFontInfo)embedFontInfoList.get(i);
+ EmbedFontInfo embedFontInfo = embedFontInfoList.get(i);
//String metricsFile = configFontInfo.getMetricsFile();
internalName = "F" + num;
@@ -69,7 +69,7 @@ public class CustomFontCollection implem
LazyFont font = new LazyFont(embedFontInfo, this.fontResolver);
fontInfo.addMetrics(internalName, font);
- List triplets = embedFontInfo.getFontTriplets();
+ List<FontTriplet> triplets = embedFontInfo.getFontTriplets();
for (int tripletIndex = 0; tripletIndex < triplets.size(); tripletIndex++) {
FontTriplet triplet = (FontTriplet) triplets.get(tripletIndex);
fontInfo.addFontProperties(internalName, triplet);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EmbedFontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EmbedFontInfo.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EmbedFontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EmbedFontInfo.java Tue Jan 18 08:54:08 2011
@@ -46,7 +46,7 @@ public class EmbedFontInfo implements Se
protected String subFontName = null;
/** the list of associated font triplets */
- private List/*<FontTriplet>*/ fontTriplets = null;
+ private List<FontTriplet> fontTriplets = null;
private transient boolean embedded = true;
@@ -59,7 +59,7 @@ public class EmbedFontInfo implements Se
* @param subFontName the sub-fontname used for TrueType Collections (null otherwise)
*/
public EmbedFontInfo(String metricsFile, boolean kerning,
- List/*<FontTriplet>*/ fontTriplets, String embedFile, String subFontName) {
+ List<FontTriplet> fontTriplets, String embedFile, String subFontName) {
this.metricsFile = metricsFile;
this.embedFile = embedFile;
this.kerning = kerning;
@@ -120,7 +120,7 @@ public class EmbedFontInfo implements Se
* Returns the list of font triplets associated with this font.
* @return List of font triplets
*/
- public List/*<FontTriplet>*/ getFontTriplets() {
+ public List<FontTriplet> getFontTriplets() {
return fontTriplets;
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EncodingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EncodingMode.java?rev=1060241&r1=1060240&r2=1060241&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EncodingMode.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/fonts/EncodingMode.java Tue Jan 18 08:54:08 2011
@@ -19,25 +19,19 @@
package org.apache.fop.fonts;
-import java.io.ObjectStreamException;
-import java.io.Serializable;
-
-
/**
* This class enumerates all supported encoding modes for fonts: auto, single-byte and CID.
*/
-public final class EncodingMode implements Serializable {
-
- private static final long serialVersionUID = 8311486102457779529L;
+public enum EncodingMode {
/** Automatic selection of encoding mode. */
- public static final EncodingMode AUTO = new EncodingMode("auto");
+ AUTO("auto"),
/** Single-byte encoding */
- public static final EncodingMode SINGLE_BYTE = new EncodingMode("single-byte");
+ SINGLE_BYTE("single-byte"),
/** CID encoding */
- public static final EncodingMode CID = new EncodingMode("cid");
+ CID("cid");
private String name;
@@ -58,25 +52,18 @@ public final class EncodingMode implemen
* @param name the name of the encoding mode to look up
* @return the encoding mode constant
*/
- public static EncodingMode valueOf(String name) {
- if (name.equalsIgnoreCase(EncodingMode.AUTO.getName())) {
- return EncodingMode.AUTO;
- } else if (name.equalsIgnoreCase(EncodingMode.SINGLE_BYTE.getName())) {
- return EncodingMode.SINGLE_BYTE;
- } else if (name.equalsIgnoreCase(EncodingMode.CID.getName())) {
- return EncodingMode.CID;
- } else {
- throw new IllegalArgumentException("Invalid encoding mode: " + name);
+ public static EncodingMode getEncodingMode(String name) {
+ for (EncodingMode em : EncodingMode.values()) {
+ if (name.equalsIgnoreCase(em.getName())) {
+ return em;
+ }
}
- }
-
- private Object readResolve() throws ObjectStreamException {
- return valueOf(getName());
+ throw new IllegalArgumentException("Invalid encoding mode: " + name);
}
/** {@inheritDoc} */
public String toString() {
- return "EncodingMode:" + getName();
+ return "EncodingMode: " + getName();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org