protected Property setSubprop(Property baseProp, int subpropId,
Property subProp) {
</xsl:text>
- String subpropName = FOPropertyMapping.getPropertyName(subpropId);
<xsl:value-of select="datatype"/>
<xsl:text> val = baseProp.get</xsl:text>
<xsl:value-of select="datatype"/>
<xsl:text>();
// Do some type checking???
// Check if one of our subproperties???
- val.setComponent(subpropName, subProp, false);
+ val.setComponent(subpropId, subProp, false);
return baseProp;
}
public Property getSubpropValue(Property baseProp, String subpropName) {
+ int subpropId = org.apache.fop.fo.properties.FOPropertyMapping.getSubPropertyId(subpropName);
</xsl:text>
<xsl:value-of select="datatype"/>
<xsl:text> val = baseProp.get</xsl:text>
<xsl:value-of select="datatype"/>
<xsl:text>();
- return val.getComponent(subpropName);
+ return val.getComponent(subpropId);
}
</xsl:text>
<xsl:choose>
<xsl:text>").make(pList, getDefaultFor</xsl:text>
<xsl:value-of select='$spname'/>
<xsl:text>(), fo);
- p.setComponent("</xsl:text>
- <xsl:value-of select='.'/>
- <xsl:text>", subProp, true);</xsl:text>
+ p.setComponent(Constants.CP_</xsl:text>
+ <xsl:call-template name="makeEnumConstant">
+ <xsl:with-param name="propstr" select="."/>
+ </xsl:call-template>
+ <xsl:text>, subProp, true);</xsl:text>
</xsl:for-each>
<xsl:text>
return new </xsl:text>
<xsl:text>();</xsl:text>
<xsl:for-each select="compound/subproperty[@set-by-shorthand='true']">
<xsl:text>
- pval.setComponent("</xsl:text>
- <xsl:value-of select='name'/>
- <xsl:text>", p, false);</xsl:text>
+ pval.setComponent(Constants.CP_</xsl:text>
+ <xsl:call-template name="makeEnumConstant">
+ <xsl:with-param name="propstr" select="name"/>
+ </xsl:call-template>
+ <xsl:text>, p, false);</xsl:text>
</xsl:for-each>
<xsl:text>
return prop;
/**
* Sets a component of the compound datatype.
- * @param sCmpnName name of the component
+ * @param Constants ID of the component
* @param cmpnValue value of the component
* @param bIsDefault Indicates if it's the default value
*/
- void setComponent(String sCmpnName, Property cmpnValue, boolean bIsDefault);
+ void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault);
/**
* Returns a component of the compound datatype.
- * @param sCmpnName name of the component
+ * @param Constants ID of the component
* @return the value of the component
*/
- Property getComponent(String sCmpnName);
+ Property getComponent(int cmpId);
}
private Property conditionality;
/**
- * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(String, Property, boolean)
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
*/
- public void setComponent(String sCmpnName, Property cmpnValue,
+ public void setComponent(int cmpId, Property cmpnValue,
boolean bIsDefault) {
- if (sCmpnName.equals("length")) {
+ if (cmpId == Constants.CP_LENGTH) {
length = cmpnValue;
- } else if (sCmpnName.equals("conditionality")) {
+ } else if (cmpId == Constants.CP_CONDITIONALITY) {
conditionality = cmpnValue;
}
}
/**
- * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(String)
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
*/
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("length")) {
+ public Property getComponent(int cmpId) {
+ if (cmpId == Constants.CP_LENGTH) {
return length;
- } else if (sCmpnName.equals("conditionality")) {
+ } else if (cmpId == Constants.CP_CONDITIONALITY) {
return conditionality;
} else {
return null;
package org.apache.fop.datatypes;
import org.apache.fop.fo.Property;
+import org.apache.fop.fo.Constants;
/**
* XSL FO Keep Property datatype (keep-together, etc)
/**
- * From CompoundDatatype
- * @param sCmpnName name of compound property to set
- * @param cmpnValue property containing value to be set
- * @param bIsDefault not used (??)
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
*/
- public void setComponent(String sCmpnName, Property cmpnValue,
+ public void setComponent(int cmpId, Property cmpnValue,
boolean bIsDefault) {
- if (sCmpnName.equals("within-line")) {
+ if (cmpId == Constants.CP_WITHIN_LINE) {
setWithinLine(cmpnValue, bIsDefault);
- } else if (sCmpnName.equals("within-column")) {
+ } else if (cmpId == Constants.CP_WITHIN_COLUMN) {
setWithinColumn(cmpnValue, bIsDefault);
- } else if (sCmpnName.equals("within-page")) {
+ } else if (cmpId == Constants.CP_WITHIN_PAGE) {
setWithinPage(cmpnValue, bIsDefault);
}
}
/**
- * From CompoundDatatype
- * @param sCmpnName compound property name
- * @return property corresponding to compound property string
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
*/
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("within-line")) {
+ public Property getComponent(int cmpId) {
+ if (cmpId == Constants.CP_WITHIN_LINE) {
return getWithinLine();
- } else if (sCmpnName.equals("within-column")) {
+ } else if (cmpId == Constants.CP_WITHIN_COLUMN) {
return getWithinColumn();
- } else if (sCmpnName.equals("within-page")) {
+ } else if (cmpId == Constants.CP_WITHIN_PAGE) {
return getWithinPage();
} else {
return null;
package org.apache.fop.datatypes;
import org.apache.fop.fo.Property;
+import org.apache.fop.fo.Constants;
/**
* Models a pair of lengths, one specifiying the dimensions for the
private Property bpd;
/**
- * From CompoundDatatype
- * @param sCmpnName component name ("block-progression-direction" or
- * "inline-progression-direction") which is being set
- * @param cmpnValue Property containing the value to be set
- * @param bIsDefault true if this is the default property (??)
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
*/
- public void setComponent(String sCmpnName, Property cmpnValue,
+ public void setComponent(int cmpId, Property cmpnValue,
boolean bIsDefault) {
- if (sCmpnName.equals("block-progression-direction")) {
+ if (cmpId == Constants.CP_BLOCK_PROGRESSION_DIRECTION) {
bpd = cmpnValue;
- } else if (sCmpnName.equals("inline-progression-direction")) {
+ } else if (cmpId == Constants.CP_INLINE_PROGRESSION_DIRECTION) {
ipd = cmpnValue;
}
}
/**
- * From CompoundDatatype
- * @param sCmpnName component name ("block-progression-direction" or
- * "inline-progression-direction") for which the length is sought
- * @return Property containing the length sought
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
*/
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("block-progression-direction")) {
+ public Property getComponent(int cmpId) {
+ if (cmpId == Constants.CP_BLOCK_PROGRESSION_DIRECTION) {
return getBPD();
- } else if (sCmpnName.equals("inline-progression-direction")) {
+ } else if (cmpId == Constants.CP_INLINE_PROGRESSION_DIRECTION) {
return getIPD();
} else {
return null; // SHOULDN'T HAPPEN
package org.apache.fop.datatypes;
import org.apache.fop.fo.Property;
+import org.apache.fop.fo.Constants;
/**
* A "progression-dimension" quantity.
private boolean bChecked = false;
/**
- * From CompoundDatatype
- * @param sCmpnName component name ("minimum", "maximum", or "optimum")
- * which is being set
- * @param cmpnValue Property object to be set
- * @param bIsDefault true of this is the default value (??)
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
*/
- public void setComponent(String sCmpnName, Property cmpnValue,
+ public void setComponent(int cmpId, Property cmpnValue,
boolean bIsDefault) {
- if (sCmpnName.equals("minimum")) {
+ if (cmpId == Constants.CP_MINIMUM) {
setMinimum(cmpnValue, bIsDefault);
- } else if (sCmpnName.equals("optimum")) {
+ } else if (cmpId == Constants.CP_OPTIMUM) {
setOptimum(cmpnValue, bIsDefault);
- } else if (sCmpnName.equals("maximum")) {
+ } else if (cmpId == Constants.CP_MAXIMUM) {
setMaximum(cmpnValue, bIsDefault);
}
}
/**
- * From CompoundDatatype
- * @param sCmpnName component name ("minimum", "maximum", or "optimum")
- * for which the length is sought
- * @return the requested Property, or null if the component name is invalid
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
*/
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("minimum")) {
+ public Property getComponent(int cmpId) {
+ if (cmpId == Constants.CP_MINIMUM) {
return getMinimum();
- } else if (sCmpnName.equals("optimum")) {
+ } else if (cmpId == Constants.CP_OPTIMUM) {
return getOptimum();
- } else if (sCmpnName.equals("maximum")) {
+ } else if (cmpId == Constants.CP_MAXIMUM) {
return getMaximum();
} else {
return null; // SHOULDN'T HAPPEN
package org.apache.fop.datatypes;
import org.apache.fop.fo.Property;
+import org.apache.fop.fo.Constants;
/**
* a space quantity in XSL (space-before, space-after)
private Property conditionality;
/**
- * From CompoundDatatype
- * @param sCmpnName name of component
- * @param cmpnValue Property object for the component
- * @param bIsDefault true if this is the default (??)
+ * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean)
*/
- public void setComponent(String sCmpnName, Property cmpnValue,
+ public void setComponent(int cmpId, Property cmpnValue,
boolean bIsDefault) {
- if (sCmpnName.equals("precedence")) {
+ if (cmpId == Constants.CP_PRECEDENCE) {
setPrecedence(cmpnValue, bIsDefault);
- } else if (sCmpnName.equals("conditionality")) {
+ } else if (cmpId == Constants.CP_CONDITIONALITY) {
setConditionality(cmpnValue, bIsDefault);
} else {
- super.setComponent(sCmpnName, cmpnValue, bIsDefault);
+ super.setComponent(cmpId, cmpnValue, bIsDefault);
}
}
/**
- * From CompoundDatatype
- * @param sCmpnName name of component
- * @return Property matching the component name
+ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int)
*/
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("precedence")) {
+ public Property getComponent(int cmpId) {
+ if (cmpId == Constants.CP_PRECEDENCE) {
return getPrecedence();
- } else if (sCmpnName.equals("conditionality")) {
+ } else if (cmpId == Constants.CP_CONDITIONALITY) {
return getConditionality();
} else {
- return super.getComponent(sCmpnName);
+ return super.getComponent(cmpId);
}
}