You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EnumProperty.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.fo;
  8. import org.apache.fop.apps.FOPException;
  9. public class EnumProperty extends Property {
  10. public static class Maker extends Property.Maker {
  11. protected Maker(String propName) {
  12. super(propName);
  13. }
  14. /**
  15. * Called by subclass if no match found.
  16. */
  17. public Property checkEnumValues(String value) {
  18. //log.error("Unknown enumerated value for property '"
  19. // + getPropName() + "': " + value);
  20. return null;
  21. }
  22. protected Property findConstant(String value) {
  23. return null;
  24. }
  25. public Property convertProperty(Property p,
  26. PropertyList propertyList,
  27. FObj fo) throws FOPException {
  28. if (p instanceof EnumProperty) {
  29. return p;
  30. } else {
  31. return null;
  32. }
  33. }
  34. }
  35. private int value;
  36. public EnumProperty(int explicitValue) {
  37. this.value = explicitValue;
  38. }
  39. public int getEnum() {
  40. return this.value;
  41. }
  42. public Object getObject() {
  43. // FIXME: return String value: property must reference maker
  44. // return maker.getEnumValue(this.value);
  45. return new Integer(this.value);
  46. }
  47. }