KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fo > properties > Property


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 /* $Id: Property.java 474225 2006-11-13 10:08:19Z jeremias $ */
19
20 package org.apache.fop.fo.properties;
21
22 import java.util.List JavaDoc;
23 import java.awt.Color JavaDoc;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import org.apache.fop.apps.FOUserAgent;
29 import org.apache.fop.datatypes.Length;
30 import org.apache.fop.datatypes.Numeric;
31 import org.apache.fop.fo.Constants;
32
33 /**
34  * Base class for all property objects
35  */

36 public class Property {
37     
38     /** Logger for all property classes */
39     protected static Log log = LogFactory.getLog(PropertyMaker.class);
40
41     /**
42      * The original specified value for properties which inherit
43      * specified values.
44      */

45     private String JavaDoc specVal;
46
47     /**
48      * Set the original value specified for the property attribute.
49      * @param value The specified value.
50      */

51     public void setSpecifiedValue(String JavaDoc value) {
52         this.specVal = value;
53     }
54
55     /**
56      * Return the original value specified for the property attribute.
57      * @return The specified value as a String.
58      */

59     public String JavaDoc getSpecifiedValue() {
60         return specVal;
61     }
62
63 /*
64  * This section contains accessor functions for all possible Property datatypes
65  */

66
67
68     /**
69      * This method expects to be overridden by subclasses
70      * @return Length property value
71      */

72     public Length getLength() {
73         return null;
74     }
75
76     /**
77      * This method expects to be overridden by subclasses
78      * @param foUserAgent FOP user agent
79      * @return ColorType property value
80      */

81     public Color JavaDoc getColor(FOUserAgent foUserAgent) {
82         return null;
83     }
84
85     /**
86      * This method expects to be overridden by subclasses
87      * @return CondLength property value
88      */

89     public CondLengthProperty getCondLength() {
90         return null;
91     }
92
93     /**
94      * This method expects to be overridden by subclasses
95      * @return LenghtRange property value
96      */

97     public LengthRangeProperty getLengthRange() {
98         return null;
99     }
100
101     /**
102      * This method expects to be overridden by subclasses
103      * @return LengthPair property value
104      */

105     public LengthPairProperty getLengthPair() {
106         return null;
107     }
108
109     /**
110      * This method expects to be overridden by subclasses
111      * @return Space property value
112      */

113     public SpaceProperty getSpace() {
114         return null;
115     }
116
117     /**
118      * This method expects to be overridden by subclasses
119      * @return Keep property value
120      */

121     public KeepProperty getKeep() {
122         return null;
123     }
124
125     /**
126      * This method expects to be overridden by subclasses
127      * @return integer equivalent of enumerated property value
128      */

129     public int getEnum() {
130         return 0;
131     }
132
133     /** @return true if the property is an enum and has value 'auto' */
134     public boolean isAuto() {
135         return (getEnum() == Constants.EN_AUTO);
136     }
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     /**
147      * This method expects to be overridden by subclasses
148      * @return collection of other property (sub-property) objects
149      */

150     public List JavaDoc getList() {
151         return null;
152     }
153
154     /**
155      * This method expects to be overridden by subclasses
156      * @return Number property value
157      */

158     public Number JavaDoc getNumber() {
159         return null;
160     }
161
162     /**
163      * This method expects to be overridden by subclasses
164      * @return Numeric property value
165      */

166     public Numeric getNumeric() {
167         return null;
168     }
169
170     /**
171      * This method expects to be overridden by subclasses
172      * @return NCname property value
173      */

174     public String JavaDoc getNCname() {
175         return null;
176     }
177
178     /**
179      * This method expects to be overridden by subclasses
180      * @return Object property value
181      */

182     public Object JavaDoc getObject() {
183         return null;
184     }
185
186     /**
187      * This method expects to be overridden by subclasses.
188      * @return String property value
189      */

190     public String JavaDoc getString() {
191         return null;
192     }
193
194     /** @see java.lang.Object#toString() */
195     public String JavaDoc toString() {
196         Object JavaDoc obj = getObject();
197         if (obj != this) {
198             return obj.toString();
199         }
200         return null;
201     }
202 }
203
Popular Tags