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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /*
  2. * $Id$
  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.properties;
  52. import java.util.Vector;
  53. import org.apache.fop.datatypes.Length;
  54. import org.apache.fop.datatypes.Numeric;
  55. /**
  56. * Base class for all property objects
  57. * @author unascribed
  58. */
  59. public class Property {
  60. /**
  61. * The original specified value for properties which inherit
  62. * specified values.
  63. */
  64. private String specVal;
  65. /**
  66. * Set the original value specified for the property attribute.
  67. * @param specVal The specified value.
  68. */
  69. public void setSpecifiedValue(String specVal) {
  70. this.specVal = specVal;
  71. }
  72. /**
  73. * Return the original value specified for the property attribute.
  74. * @return The specified value as a String.
  75. */
  76. public String getSpecifiedValue() {
  77. return specVal;
  78. }
  79. /*
  80. * This section contains accessor functions for all possible Property datatypes
  81. */
  82. /**
  83. * This method expects to be overridden by subclasses
  84. * @return Length property value
  85. */
  86. public Length getLength() {
  87. return null;
  88. }
  89. /**
  90. * This method expects to be overridden by subclasses
  91. * @return ColorType property value
  92. */
  93. public ColorTypeProperty getColorType() {
  94. return null;
  95. }
  96. /**
  97. * This method expects to be overridden by subclasses
  98. * @return CondLength property value
  99. */
  100. public CondLengthProperty getCondLength() {
  101. return null;
  102. }
  103. /**
  104. * This method expects to be overridden by subclasses
  105. * @return LenghtRange property value
  106. */
  107. public LengthRangeProperty getLengthRange() {
  108. return null;
  109. }
  110. /**
  111. * This method expects to be overridden by subclasses
  112. * @return LengthPair property value
  113. */
  114. public LengthPairProperty getLengthPair() {
  115. return null;
  116. }
  117. /**
  118. * This method expects to be overridden by subclasses
  119. * @return Space property value
  120. */
  121. public SpaceProperty getSpace() {
  122. return null;
  123. }
  124. /**
  125. * This method expects to be overridden by subclasses
  126. * @return Keep property value
  127. */
  128. public KeepProperty getKeep() {
  129. return null;
  130. }
  131. /**
  132. * This method expects to be overridden by subclasses
  133. * @return integer equivalent of enumerated property value
  134. */
  135. public int getEnum() {
  136. return 0;
  137. }
  138. /**
  139. * This method expects to be overridden by subclasses
  140. * @return char property value
  141. */
  142. public char getCharacter() {
  143. return 0;
  144. }
  145. /**
  146. * This method expects to be overridden by subclasses
  147. * @return collection of other property (sub-property) objects
  148. */
  149. public Vector getList() {
  150. return null;
  151. }
  152. /**
  153. * This method expects to be overridden by subclasses
  154. * @return Number property value
  155. */
  156. public Number getNumber() {
  157. return null;
  158. }
  159. /**
  160. * This method expects to be overridden by subclasses
  161. * @return Numeric property value
  162. */
  163. public Numeric getNumeric() {
  164. return null;
  165. }
  166. /**
  167. * This method expects to be overridden by subclasses
  168. * @return NCname property value
  169. */
  170. public String getNCname() {
  171. return null;
  172. }
  173. /**
  174. * This method expects to be overridden by subclasses
  175. * @return Object property value
  176. */
  177. public Object getObject() {
  178. return null;
  179. }
  180. /**
  181. * This method expects to be overridden by subclasses.
  182. * @return String property value
  183. */
  184. public String getString() {
  185. return null;
  186. }
  187. /**
  188. * Return a string representation of the property value. Only used
  189. * for debugging.
  190. */
  191. public String toString() {
  192. Object obj = getObject();
  193. if (obj != this) {
  194. return obj.toString();
  195. }
  196. return null;
  197. }
  198. }