Maker Maker addPropertyName("", PR_); [PR_] =.maker(PR_); package org.apache.fop.fo.properties; import java.util.HashMap; import java.util.Set; import org.apache.fop.fo.Constants; import org.apache.fop.fo.Property; //import org.apache.fop.svg.*; public class PropertyMapping implements Constants { private static Property.Maker[] s_htGeneric = new Property.Maker[PROPERTY_COUNT+1]; /* s_htElementLists not currently used; apparently for specifying element-specific * property makers (instead of the default maker for a particular property); see * former org.apache.fop.fo.PropertyListBuilder */ private static HashMap s_htElementLists = new HashMap(); private static HashMap s_htSubPropNames = new HashMap(); private static HashMap s_htPropNames = new HashMap(); private static HashMap s_htPropIds = new HashMap(); private static HashMap s_ht; public static Property.Maker[] getGenericMappings() { return s_htGeneric; } public static Set getElementMappings() { return s_htElementLists.keySet(); } public static Property.Maker[] getElementMapping(int elemName) { return (Property.Maker[])s_htElementLists.get(new Integer(elemName)); } public static int getPropertyId(String name) { // check to see if base.compound or just base property int sepchar = name.indexOf('.'); if (sepchar > -1) { Integer baseId = (Integer) s_htPropNames.get(name.substring(0, sepchar)); if (baseId == null) { return -1; } else { int cmpdId = getSubPropertyId(name.substring(sepchar + 1)); if (cmpdId == -1) { return -1; } else { return baseId.intValue() + cmpdId; } } } else { Integer baseId = (Integer) s_htPropNames.get(name); if (baseId == null) return -1; return baseId.intValue(); } } public static int getSubPropertyId(String name) { Integer i = (Integer) s_htSubPropNames.get(name); if (i == null) return -1; return i.intValue(); } // returns a property, compound, or property.compound name 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)); } else { return (String) s_htPropIds.get(new Integer( id & Constants.PROPERTY_MASK)) + "." + s_htPropIds.get( new Integer(id & Constants.COMPOUND_MASK)); } } static { addSubPropertyName("length", CP_LENGTH); addSubPropertyName("conditionality", CP_CONDITIONALITY); addSubPropertyName("block-progression-direction", CP_BLOCK_PROGRESSION_DIRECTION); addSubPropertyName("inline-progression-direction", CP_INLINE_PROGRESSION_DIRECTION); addSubPropertyName("within-line", CP_WITHIN_LINE); addSubPropertyName("within-column", CP_WITHIN_COLUMN); addSubPropertyName("within-page", CP_WITHIN_PAGE); addSubPropertyName("minimum", CP_MINIMUM); addSubPropertyName("maximum", CP_MAXIMUM); addSubPropertyName("optimum", CP_OPTIMUM); addSubPropertyName("precedence", CP_PRECEDENCE); } public static void addPropertyName(String name, int id) { s_htPropNames.put(name, new Integer(id)); s_htPropIds.put(new Integer(id), name); } public static void addSubPropertyName(String name, int id) { s_htSubPropNames.put(name, new Integer(id)); s_htPropIds.put(new Integer(id), name); } } static { // Generate the generic mapping } static { s_ht = new HashMap(); s_htElementLists.put("", s_ht); s_ht } /* PROPCLASS = */ /* PROPCLASS = */