Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PropertyList.java 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. /*
  2. * $Id: PropertyList.java,v 1.20 2003/03/05 21:48:01 jeremias Exp $
  3. * ============================================================================
  4. * The Apache Software License, Version 1.1
  5. * ============================================================================
  6. *
  7. * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without modifica-
  10. * tion, are permitted provided that the following conditions are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright notice,
  13. * this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. *
  19. * 3. The end-user documentation included with the redistribution, if any, must
  20. * include the following acknowledgment: "This product includes software
  21. * developed by the Apache Software Foundation (http://www.apache.org/)."
  22. * Alternately, this acknowledgment may appear in the software itself, if
  23. * and wherever such third-party acknowledgments normally appear.
  24. *
  25. * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  26. * endorse or promote products derived from this software without prior
  27. * written permission. For written permission, please contact
  28. * apache@apache.org.
  29. *
  30. * 5. Products derived from this software may not be called "Apache", nor may
  31. * "Apache" appear in their name, without prior written permission of the
  32. * Apache Software Foundation.
  33. *
  34. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  35. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  36. * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  37. * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  38. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  39. * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  40. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  41. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  42. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  43. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44. * ============================================================================
  45. *
  46. * This software consists of voluntary contributions made by many individuals
  47. * on behalf of the Apache Software Foundation and was originally created by
  48. * James Tauber <jtauber@jtauber.com>. For more information on the Apache
  49. * Software Foundation, please see <http://www.apache.org/>.
  50. */
  51. package org.apache.fop.fo;
  52. // Java
  53. import java.util.HashMap;
  54. import org.xml.sax.Attributes;
  55. // FOP
  56. import org.apache.fop.apps.FOPException;
  57. import org.apache.fop.fo.Property.Maker;
  58. import org.apache.fop.fo.properties.FOPropertyMapping;
  59. import org.apache.fop.fo.properties.WritingMode;
  60. /**
  61. * Class containing the collection of properties for a given FObj.
  62. */
  63. public class PropertyList extends HashMap {
  64. // writing-mode values
  65. private byte[] wmtable = null;
  66. private int writingMode;
  67. // absolute directions and dimensions
  68. /** constant for direction "left" */
  69. public static final int LEFT = 0;
  70. /** constant for direction "right" */
  71. public static final int RIGHT = 1;
  72. /** constant for direction "top" */
  73. public static final int TOP = 2;
  74. /** constant for direction "bottom" */
  75. public static final int BOTTOM = 3;
  76. /** constant for dimension "height" */
  77. public static final int HEIGHT = 4;
  78. /** constant for dimension "width" */
  79. public static final int WIDTH = 5;
  80. // directions relative to writing-mode
  81. /** constant for direction "start" */
  82. public static final int START = 0;
  83. /** constant for direction "end" */
  84. public static final int END = 1;
  85. /** constant for direction "before" */
  86. public static final int BEFORE = 2;
  87. /** constant for direction "after" */
  88. public static final int AFTER = 3;
  89. /** constant for dimension "block-progression-dimension" */
  90. public static final int BLOCKPROGDIM = 4;
  91. /** constant for dimension "inline-progression-dimension" */
  92. public static final int INLINEPROGDIM = 5;
  93. private static final String[] ABS_NAMES = new String[] {
  94. "left", "right", "top", "bottom", "height", "width"
  95. };
  96. private static final String[] REL_NAMES = new String[] {
  97. "start", "end", "before", "after", "block-progression-dimension",
  98. "inline-progression-dimension"
  99. };
  100. private static final HashMap WRITING_MODE_TABLES = new HashMap(4);
  101. {
  102. WRITING_MODE_TABLES.put(new Integer(WritingMode.LR_TB), /* lr-tb */
  103. new byte[] {
  104. START, END, BEFORE, AFTER, BLOCKPROGDIM, INLINEPROGDIM
  105. });
  106. WRITING_MODE_TABLES.put(new Integer(WritingMode.RL_TB), /* rl-tb */
  107. new byte[] {
  108. END, START, BEFORE, AFTER, BLOCKPROGDIM, INLINEPROGDIM
  109. });
  110. WRITING_MODE_TABLES.put(new Integer(WritingMode.TB_RL), /* tb-rl */
  111. new byte[] {
  112. AFTER, BEFORE, START, END, INLINEPROGDIM, BLOCKPROGDIM
  113. });
  114. }
  115. private PropertyList parentPropertyList = null;
  116. private String namespace = "";
  117. private String elementName = "";
  118. private FObj fobj = null;
  119. /**
  120. * Basic constructor.
  121. * @param parentPropertyList the PropertyList belonging to the new objects
  122. * parent
  123. * @param space name of namespace
  124. * @param elementName name of element
  125. */
  126. public PropertyList(FObj fObjToAttach, PropertyList parentPropertyList,
  127. String space, String elementName) {
  128. this.fobj = fObjToAttach;
  129. this.parentPropertyList = parentPropertyList;
  130. this.namespace = space;
  131. this.elementName = elementName;
  132. }
  133. /**
  134. * @return the FObj object to which this propertyList is attached
  135. */
  136. public FObj getFObj() {
  137. return this.fobj;
  138. }
  139. /**
  140. * @return the FObj object attached to the parentPropetyList
  141. */
  142. public FObj getParentFObj() {
  143. if (parentPropertyList != null) {
  144. return parentPropertyList.getFObj();
  145. } else {
  146. return null;
  147. }
  148. }
  149. /**
  150. * @return the namespace of this element
  151. */
  152. public String getNameSpace() {
  153. return namespace;
  154. }
  155. /**
  156. * @return element name for this
  157. */
  158. public String getElement() {
  159. return elementName;
  160. }
  161. /**
  162. * Return the value explicitly specified on this FO.
  163. * @param propertyName The name of the property whose value is desired.
  164. * It may be a compound name, such as space-before.optimum.
  165. * @return The value if the property is explicitly set or set by
  166. * a shorthand property, otherwise null.
  167. */
  168. public Property getExplicitOrShorthand(int propId) {
  169. /* Handle request for one part of a compound property */
  170. String propertyName = FOPropertyMapping.getPropertyName(propId);
  171. int sepchar = propertyName.indexOf('.');
  172. String baseName;
  173. if (sepchar > -1) {
  174. baseName = propertyName.substring(0, sepchar);
  175. } else {
  176. baseName = propertyName;
  177. }
  178. Property p = getExplicitBaseProp(baseName);
  179. if (p == null) {
  180. p = getShorthand(propId & Constants.PROPERTY_MASK);
  181. }
  182. if (p != null && sepchar > -1) {
  183. return getSubpropValue(p, propId);
  184. }
  185. return p;
  186. }
  187. /**
  188. * Return the value explicitly specified on this FO.
  189. * @param propertyName The name of the property whose value is desired.
  190. * It may be a compound name, such as space-before.optimum.
  191. * @return The value if the property is explicitly set, otherwise null.
  192. */
  193. public Property getExplicit(int propId) {
  194. String propertyName = FOPropertyMapping.getPropertyName(propId);
  195. /* Handle request for one part of a compound property */
  196. int sepchar = propertyName.indexOf('.');
  197. if (sepchar > -1) {
  198. String baseName = propertyName.substring(0, sepchar);
  199. Property p = getExplicitBaseProp(baseName);
  200. if (p != null) {
  201. return getSubpropValue(p, propId);
  202. } else {
  203. return null;
  204. }
  205. }
  206. return (Property) super.get(propertyName);
  207. }
  208. /**
  209. * Return the value explicitly specified on this FO.
  210. * @param propertyName The name of the base property whose value is desired.
  211. * @return The value if the property is explicitly set, otherwise null.
  212. */
  213. public Property getExplicitBaseProp(String propertyName) {
  214. return (Property) super.get(propertyName);
  215. }
  216. /**
  217. * Return the value of this property inherited by this FO.
  218. * Implements the inherited-property-value function.
  219. * The property must be inheritable!
  220. * @param propertyName The name of the property whose value is desired.
  221. * @return The inherited value, otherwise null.
  222. */
  223. public Property getInherited(String propertyName) {
  224. int propId = FOPropertyMapping.getPropertyId(propertyName);
  225. if (parentPropertyList != null
  226. && isInherited(propId)) {
  227. return parentPropertyList.get(propId);
  228. } else {
  229. // return the "initial" value
  230. try {
  231. return makeProperty(propId);
  232. } catch (org.apache.fop.apps.FOPException e) {
  233. //log.error("Exception in getInherited(): property="
  234. // + propertyName + " : " + e);
  235. }
  236. }
  237. return null; // Exception in makeProperty!
  238. }
  239. /**
  240. * Return the property on the current FlowObject. If it isn't set explicitly,
  241. * this will try to compute it based on other properties, or if it is
  242. * inheritable, to return the inherited value. If all else fails, it returns
  243. * the default value.
  244. * @param propId The Constants ID of the property whose value is desired.
  245. * @return the Property corresponding to that name
  246. */
  247. public Property get(int propId) {
  248. return get(propId, true, true);
  249. }
  250. /**
  251. * Return the property on the current FlowObject. Depending on the passed flags,
  252. * this will try to compute it based on other properties, or if it is
  253. * inheritable, to return the inherited value. If all else fails, it returns
  254. * the default value.
  255. */
  256. private Property get(int propId, boolean bTryInherit,
  257. boolean bTryDefault) {
  258. Property p = findProperty(propId & Constants.PROPERTY_MASK,
  259. bTryInherit);
  260. if (p == null && bTryDefault) { // default value for this FO!
  261. try {
  262. p = makeProperty(propId & Constants.PROPERTY_MASK);
  263. } catch (FOPException e) {
  264. // don't know what to do here
  265. }
  266. }
  267. // if value is inherit then get computed value from
  268. // parent
  269. if (p != null && "inherit".equals(p.getSpecifiedValue())) {
  270. if (this.parentPropertyList != null) {
  271. p = parentPropertyList.get(propId, true, false);
  272. }
  273. }
  274. if ((propId & Constants.COMPOUND_MASK) != 0 && p != null) {
  275. return getSubpropValue(p, propId);
  276. } else {
  277. return p;
  278. }
  279. }
  280. /*
  281. * If the property is a relative property with a corresponding absolute
  282. * value specified, the absolute value is used. This is also true of
  283. * the inheritance priority (I think...)
  284. * If the property is an "absolute" property and it isn't specified, then
  285. * we try to compute it from the corresponding relative property: this
  286. * happens in computeProperty.
  287. */
  288. private Property findProperty(int propId, boolean bTryInherit) {
  289. String propertyName = FOPropertyMapping.getPropertyName(propId);
  290. Property p = null;
  291. if (isCorrespondingForced(propId)) {
  292. p = computeProperty(propId);
  293. } else {
  294. p = getExplicitBaseProp(propertyName);
  295. if (p == null) {
  296. p = this.computeProperty(propId);
  297. }
  298. if (p == null) { // check for shorthand specification
  299. p = getShorthand(propId);
  300. }
  301. if (p == null && bTryInherit) {
  302. // else inherit (if has parent and is inheritable)
  303. if (this.parentPropertyList != null
  304. && isInherited(propId)) {
  305. p = parentPropertyList.findProperty(propId, true);
  306. }
  307. }
  308. }
  309. return p;
  310. }
  311. /**
  312. * Return the "nearest" specified value for the given property.
  313. * Implements the from-nearest-specified-value function.
  314. * @param propertyName The name of the property whose value is desired.
  315. * @return The computed value if the property is explicitly set on some
  316. * ancestor of the current FO, else the initial value.
  317. */
  318. public Property getNearestSpecified(int propId) {
  319. String propertyName = FOPropertyMapping.getPropertyName(propId);
  320. Property p = null;
  321. for (PropertyList plist = this; p == null && plist != null;
  322. plist = plist.parentPropertyList) {
  323. p = plist.getExplicit(propId);
  324. }
  325. if (p == null) {
  326. // If no explicit setting found, return initial (default) value.
  327. try {
  328. p = makeProperty(propId);
  329. } catch (FOPException e) {
  330. //log.error("Exception in getNearestSpecified(): property="
  331. // + propertyName + " : " + e);
  332. }
  333. }
  334. return p;
  335. }
  336. /**
  337. * Return the value of this property on the parent of this FO.
  338. * Implements the from-parent function.
  339. * @param propId The Constants ID of the property whose value is desired.
  340. * @return The computed value on the parent or the initial value if this
  341. * FO is the root or is in a different namespace from its parent.
  342. */
  343. public Property getFromParent(int propId) {
  344. if (parentPropertyList != null) {
  345. return parentPropertyList.get(propId);
  346. } else {
  347. try {
  348. return makeProperty(propId);
  349. } catch (org.apache.fop.apps.FOPException e) {
  350. //log.error("Exception in getFromParent(): property="
  351. // + propertyName + " : " + e);
  352. }
  353. }
  354. return null; // Exception in makeProperty!
  355. }
  356. /**
  357. * Uses the stored writingMode.
  358. * @param absdir an absolute direction (top, bottom, left, right)
  359. * @return the corresponding writing model relative direction name
  360. * for the flow object.
  361. */
  362. public int wmMap(int lrtb, int rltb, int tbrl) {
  363. switch (writingMode) {
  364. case WritingMode.LR_TB: return lrtb;
  365. case WritingMode.RL_TB: return lrtb;
  366. case WritingMode.TB_RL: return lrtb;
  367. }
  368. return -1;
  369. }
  370. /**
  371. * Uses the stored writingMode.
  372. * @param absdir an absolute direction (top, bottom, left, right)
  373. * @return the corresponding writing model relative direction name
  374. * for the flow object.
  375. */
  376. public String wmAbsToRel(int absdir) {
  377. if (wmtable != null) {
  378. return REL_NAMES[wmtable[absdir]];
  379. } else {
  380. return "";
  381. }
  382. }
  383. /**
  384. * Uses the stored writingMode.
  385. * @param reldir a writing mode relative direction (start, end, before, after)
  386. * @return the corresponding absolute direction name for the flow object.
  387. */
  388. public String wmRelToAbs(int reldir) {
  389. if (wmtable != null) {
  390. for (int i = 0; i < wmtable.length; i++) {
  391. if (wmtable[i] == reldir) {
  392. return ABS_NAMES[i];
  393. }
  394. }
  395. }
  396. return "";
  397. }
  398. /**
  399. * Set the writing mode traits for the FO with this property list.
  400. * @param writingMode the writing-mode property to be set for this object
  401. */
  402. public void setWritingMode(int writingMode) {
  403. this.writingMode = writingMode;
  404. this.wmtable = (byte[])WRITING_MODE_TABLES.get(new Integer(writingMode));
  405. }
  406. /**
  407. *
  408. * @param attributes Collection of attributes passed to us from the parser.
  409. * @throws FOPException If an error occurs while building the PropertyList
  410. */
  411. public void addAttributesToList(Attributes attributes)
  412. throws FOPException {
  413. /*
  414. * If font-size is set on this FO, must set it first, since
  415. * other attributes specified in terms of "ems" depend on it.
  416. */
  417. /** @todo When we do "shorthand" properties, must handle the
  418. * "font" property as well to see if font-size is set.
  419. */
  420. String attributeName = "font-size";
  421. String attributeValue = attributes.getValue(attributeName);
  422. convertAttributeToProperty(attributes, attributeName,
  423. attributeValue);
  424. for (int i = 0; i < attributes.getLength(); i++) {
  425. attributeName = attributes.getQName(i);
  426. attributeValue = attributes.getValue(i);
  427. convertAttributeToProperty(attributes, attributeName,
  428. attributeValue);
  429. }
  430. }
  431. /**
  432. *
  433. * @param attributes Collection of attributes
  434. * @param attributeName Attribute name to convert
  435. * @param attributeValue Attribute value to assign to property
  436. */
  437. private void convertAttributeToProperty(Attributes attributes,
  438. String attributeName,
  439. String attributeValue) {
  440. Property.Maker propertyMaker = null;
  441. FObj parentFO = fobj.findNearestAncestorFObj();
  442. /* Handle "compound" properties, ex. space-before.minimum */
  443. String basePropertyName = findBasePropertyName(attributeName);
  444. String subPropertyName = findSubPropertyName(attributeName);
  445. int propId = FOPropertyMapping.getPropertyId(basePropertyName);
  446. propertyMaker = findMaker(propId);
  447. if (propertyMaker == null) {
  448. handleInvalidProperty(attributeName);
  449. return;
  450. }
  451. if (attributeValue == null) {
  452. return;
  453. }
  454. try {
  455. Property prop = null;
  456. if (subPropertyName == null) { // base attribute only found
  457. /* Do nothing if the base property has already been created.
  458. * This is e.g. the case when a compound attribute was
  459. * specified before the base attribute; in these cases
  460. * the base attribute was already created in
  461. * findBaseProperty()
  462. */
  463. if (getExplicitBaseProp(basePropertyName) != null) {
  464. return;
  465. }
  466. prop = propertyMaker.make(this, attributeValue, parentFO);
  467. } else { // e.g. "leader-length.maximum"
  468. Property baseProperty = findBaseProperty(attributes,
  469. parentFO, basePropertyName, propertyMaker);
  470. prop = propertyMaker.make(baseProperty, subPropertyName,
  471. this, attributeValue, parentFO);
  472. }
  473. if (prop != null) {
  474. put(basePropertyName, prop);
  475. }
  476. } catch (FOPException e) {
  477. /**@todo log this exception */
  478. // log.error(e.getMessage());
  479. }
  480. }
  481. private Property findBaseProperty(Attributes attributes,
  482. FObj parentFO,
  483. String basePropName,
  484. Maker propertyMaker)
  485. throws FOPException {
  486. /* If the baseProperty has already been created, return it
  487. * e.g. <fo:leader xxxx="120pt" xxxx.maximum="200pt"... />
  488. */
  489. Property baseProperty = getExplicitBaseProp(basePropName);
  490. if (baseProperty != null) {
  491. return baseProperty;
  492. }
  493. /* Otherwise If it is specified later in this list of Attributes, create it now
  494. * e.g. <fo:leader xxxx.maximum="200pt" xxxx="200pt"... />
  495. */
  496. String basePropertyValue = attributes.getValue(basePropName);
  497. if (basePropertyValue != null) {
  498. int propertyId = FOPropertyMapping.getPropertyId(basePropName);
  499. if (propertyId != -1) {
  500. baseProperty = propertyMaker.make(this, basePropertyValue,
  501. parentFO);
  502. return baseProperty;
  503. }
  504. }
  505. return null; // could not find base property
  506. }
  507. private void handleInvalidProperty(String attributeName) {
  508. if (!attributeName.startsWith("xmlns")) {
  509. //log.error("property '"
  510. // + attributeName + "' ignored");
  511. }
  512. }
  513. /**
  514. * Finds the first or base part (up to any period) of an attribute name.
  515. * For example, if input is "space-before.minimum", should return
  516. * "space-before".
  517. * @param attributeName String to be atomized
  518. * @return the base portion of the attribute
  519. */
  520. private static String findBasePropertyName(String attributeName) {
  521. int sepCharIndex = attributeName.indexOf('.');
  522. String basePropName = attributeName;
  523. if (sepCharIndex > -1) {
  524. basePropName = attributeName.substring(0, sepCharIndex);
  525. }
  526. return basePropName;
  527. }
  528. /**
  529. * Finds the second or sub part (portion past any period) of an attribute
  530. * name. For example, if input is "space-before.minimum", should return
  531. * "minimum".
  532. * @param attributeName String to be atomized
  533. * @return the sub portion of the attribute
  534. */
  535. private static String findSubPropertyName(String attributeName) {
  536. int sepCharIndex = attributeName.indexOf('.');
  537. String subPropName = null;
  538. if (sepCharIndex > -1) {
  539. subPropName = attributeName.substring(sepCharIndex + 1);
  540. }
  541. return subPropName;
  542. }
  543. /**
  544. * @param propId ID of property
  545. * @param p a Property object
  546. * @return the sub-property
  547. */
  548. private Property getSubpropValue(Property p, int propId) {
  549. String subpropName = FOPropertyMapping.getPropertyName(propId &
  550. Constants.COMPOUND_MASK);
  551. Property.Maker maker = findMaker(propId & Constants.PROPERTY_MASK);
  552. if (maker != null) {
  553. return maker.getSubpropValue(p, subpropName);
  554. } else {
  555. return null;
  556. }
  557. }
  558. /**
  559. * @param propId ID of property
  560. * @return value from the appropriate Property.Maker
  561. */
  562. private boolean isCorrespondingForced(int propId) {
  563. Property.Maker propertyMaker = findMaker(propId);
  564. if (propertyMaker != null) {
  565. return propertyMaker.isCorrespondingForced(this);
  566. } else {
  567. //log.error("no Maker for " + propertyName);
  568. }
  569. return false;
  570. }
  571. /**
  572. * @param propId ID of property
  573. * @return new Property object
  574. */
  575. private Property getShorthand(int propId) {
  576. Property.Maker propertyMaker = findMaker(propId);
  577. if (propertyMaker != null) {
  578. return propertyMaker.getShorthand(this);
  579. } else {
  580. //log.error("no Maker for " + propertyName);
  581. return null;
  582. }
  583. }
  584. /**
  585. * @param propID ID of property
  586. * @return new Property object
  587. * @throws FOPException for errors in the input
  588. */
  589. private Property makeProperty(int propId) throws FOPException {
  590. Property p = null;
  591. Property.Maker propertyMaker = findMaker(propId);
  592. if (propertyMaker != null) {
  593. p = propertyMaker.make(this);
  594. } else {
  595. //log.error("property " + propertyName
  596. // + " ignored");
  597. }
  598. return p;
  599. }
  600. /**
  601. * @param propID ID of property
  602. * @return the requested Property object
  603. */
  604. private Property computeProperty(int propId) {
  605. Property p = null;
  606. Property.Maker propertyMaker = findMaker(propId);
  607. if (propertyMaker != null) {
  608. try {
  609. p = propertyMaker.compute(this);
  610. } catch (FOPException e) {
  611. //log.error("exception occurred while computing"
  612. // + " value of property '"
  613. // + propertyName + "': "
  614. // + e.getMessage());
  615. }
  616. } else {
  617. //log.error("property " + propertyName
  618. // + " ignored");
  619. }
  620. return p;
  621. }
  622. /**
  623. * @param propId ID of property
  624. * @return isInherited value from the requested Property.Maker
  625. */
  626. private boolean isInherited(int propId) {
  627. boolean b = true;
  628. Property.Maker propertyMaker = findMaker(propId);
  629. if (propertyMaker != null) {
  630. b = propertyMaker.isInherited();
  631. }
  632. return b;
  633. }
  634. /**
  635. * @param propId Id of property
  636. * @return the Property.Maker for this property
  637. */
  638. private Property.Maker findMaker(int propId) {
  639. if (propId < 1 || propId > Constants.PROPERTY_COUNT) {
  640. return null;
  641. } else {
  642. return FObj.propertyListTable[propId];
  643. }
  644. }
  645. }