Source Code Cross Referenced for CSSLexicalUnit.java in  » IDE-Netbeans » visualweb.api.designer » org » apache » batik » css » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » org.apache.batik.css.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:         ============================================================================
004:                           The Apache Software License, Version 1.1
005:         ============================================================================
006:
007:         Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
008:
009:         Redistribution and use in source and binary forms, with or without modifica-
010:         tion, are permitted provided that the following conditions are met:
011:
012:         1. Redistributions of  source code must  retain the above copyright  notice,
013:            this list of conditions and the following disclaimer.
014:
015:         2. Redistributions in binary form must reproduce the above copyright notice,
016:            this list of conditions and the following disclaimer in the documentation
017:            and/or other materials provided with the distribution.
018:
019:         3. The end-user documentation included with the redistribution, if any, must
020:            include  the following  acknowledgment:  "This product includes  software
021:            developed  by the  Apache Software Foundation  (http://www.apache.org/)."
022:            Alternately, this  acknowledgment may  appear in the software itself,  if
023:            and wherever such third-party acknowledgments normally appear.
024:
025:         4. The names "Batik" and  "Apache Software Foundation" must  not  be
026:            used to  endorse or promote  products derived from  this software without
027:            prior written permission. For written permission, please contact
028:            apache@apache.org.
029:
030:         5. Products  derived from this software may not  be called "Apache", nor may
031:            "Apache" appear  in their name,  without prior written permission  of the
032:            Apache Software Foundation.
033:
034:         THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
035:         INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
036:         FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
037:         APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
038:         INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
039:         DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
040:         OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
041:         ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
042:         (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
043:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
044:
045:         This software  consists of voluntary contributions made  by many individuals
046:         on  behalf of the Apache Software  Foundation. For more  information on the
047:         Apache Software Foundation, please see <http://www.apache.org/>.
048:
049:         */
050:
051:        package org.apache.batik.css.parser;
052:
053:        import org.w3c.css.sac.LexicalUnit;
054:
055:        /**
056:         * This class implements the {@link LexicalUnit} interface.
057:         *
058:         * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
059:         * @version $Id$
060:         */
061:        public abstract class CSSLexicalUnit implements  LexicalUnit {
062:
063:            public static final String UNIT_TEXT_CENTIMETER = "cm";
064:            public static final String UNIT_TEXT_DEGREE = "deg";
065:            public static final String UNIT_TEXT_EM = "em";
066:            public static final String UNIT_TEXT_EX = "ex";
067:            public static final String UNIT_TEXT_GRADIAN = "grad";
068:            public static final String UNIT_TEXT_HERTZ = "Hz";
069:            public static final String UNIT_TEXT_INCH = "in";
070:            public static final String UNIT_TEXT_KILOHERTZ = "kHz";
071:            public static final String UNIT_TEXT_MILLIMETER = "mm";
072:            public static final String UNIT_TEXT_MILLISECOND = "ms";
073:            public static final String UNIT_TEXT_PERCENTAGE = "%";
074:            public static final String UNIT_TEXT_PICA = "pc";
075:            public static final String UNIT_TEXT_PIXEL = "px";
076:            public static final String UNIT_TEXT_POINT = "pt";
077:            public static final String UNIT_TEXT_RADIAN = "rad";
078:            public static final String UNIT_TEXT_REAL = "";
079:            public static final String UNIT_TEXT_SECOND = "s";
080:
081:            /**
082:             * The lexical unit type.
083:             */
084:            protected short lexicalUnitType;
085:
086:            /**
087:             * The next lexical unit.
088:             */
089:            protected LexicalUnit nextLexicalUnit;
090:
091:            /**
092:             * The previous lexical unit.
093:             */
094:            protected LexicalUnit previousLexicalUnit;
095:
096:            /**
097:             * Creates a new LexicalUnit.
098:             */
099:            protected CSSLexicalUnit(short t, LexicalUnit prev) {
100:                lexicalUnitType = t;
101:                previousLexicalUnit = prev;
102:                if (prev != null) {
103:                    ((CSSLexicalUnit) prev).nextLexicalUnit = this ;
104:                }
105:            }
106:
107:            /**
108:             * <b>SAC</b>: Implements {@link LexicalUnit#getLexicalUnitType()}.
109:             */
110:            public short getLexicalUnitType() {
111:                return lexicalUnitType;
112:            }
113:
114:            /**
115:             * <b>SAC</b>: Implements {@link LexicalUnit#getNextLexicalUnit()}.
116:             */
117:            public LexicalUnit getNextLexicalUnit() {
118:                return nextLexicalUnit;
119:            }
120:
121:            /**
122:             * Sets the next lexical unit.
123:             */
124:            public void setNextLexicalUnit(LexicalUnit lu) {
125:                nextLexicalUnit = lu;
126:            }
127:
128:            /**
129:             * <b>SAC</b>: Implements {@link LexicalUnit#getPreviousLexicalUnit()}.
130:             */
131:            public LexicalUnit getPreviousLexicalUnit() {
132:                return previousLexicalUnit;
133:            }
134:
135:            /**
136:             * Sets the previous lexical unit.
137:             */
138:            public void setPreviousLexicalUnit(LexicalUnit lu) {
139:                previousLexicalUnit = lu;
140:            }
141:
142:            /**
143:             * <b>SAC</b>: Implements {@link LexicalUnit#getIntegerValue()}.
144:             */
145:            public int getIntegerValue() {
146:                throw new IllegalStateException();
147:            }
148:
149:            /**
150:             * <b>SAC</b>: Implements {@link LexicalUnit#getFloatValue()}.
151:             */
152:            public float getFloatValue() {
153:                throw new IllegalStateException();
154:            }
155:
156:            /**
157:             * <b>SAC</b>: Implements {@link LexicalUnit#getDimensionUnitText()}.
158:             */
159:            public String getDimensionUnitText() {
160:                switch (lexicalUnitType) {
161:                case LexicalUnit.SAC_CENTIMETER:
162:                    return UNIT_TEXT_CENTIMETER;
163:                case LexicalUnit.SAC_DEGREE:
164:                    return UNIT_TEXT_DEGREE;
165:                case LexicalUnit.SAC_EM:
166:                    return UNIT_TEXT_EM;
167:                case LexicalUnit.SAC_EX:
168:                    return UNIT_TEXT_EX;
169:                case LexicalUnit.SAC_GRADIAN:
170:                    return UNIT_TEXT_GRADIAN;
171:                case LexicalUnit.SAC_HERTZ:
172:                    return UNIT_TEXT_HERTZ;
173:                case LexicalUnit.SAC_INCH:
174:                    return UNIT_TEXT_INCH;
175:                case LexicalUnit.SAC_KILOHERTZ:
176:                    return UNIT_TEXT_KILOHERTZ;
177:                case LexicalUnit.SAC_MILLIMETER:
178:                    return UNIT_TEXT_MILLIMETER;
179:                case LexicalUnit.SAC_MILLISECOND:
180:                    return UNIT_TEXT_MILLISECOND;
181:                case LexicalUnit.SAC_PERCENTAGE:
182:                    return UNIT_TEXT_PERCENTAGE;
183:                case LexicalUnit.SAC_PICA:
184:                    return UNIT_TEXT_PICA;
185:                case LexicalUnit.SAC_PIXEL:
186:                    return UNIT_TEXT_PIXEL;
187:                case LexicalUnit.SAC_POINT:
188:                    return UNIT_TEXT_POINT;
189:                case LexicalUnit.SAC_RADIAN:
190:                    return UNIT_TEXT_RADIAN;
191:                case LexicalUnit.SAC_REAL:
192:                    return UNIT_TEXT_REAL;
193:                case LexicalUnit.SAC_SECOND:
194:                    return UNIT_TEXT_SECOND;
195:                default:
196:                    throw new IllegalStateException("No Unit Text for type: "
197:                            + lexicalUnitType);
198:                }
199:            }
200:
201:            /**
202:             * <b>SAC</b>: Implements {@link LexicalUnit#getFunctionName()}.
203:             */
204:            public String getFunctionName() {
205:                throw new IllegalStateException();
206:            }
207:
208:            /**
209:             * <b>SAC</b>: Implements {@link LexicalUnit#getParameters()}.
210:             */
211:            public LexicalUnit getParameters() {
212:                throw new IllegalStateException();
213:            }
214:
215:            /**
216:             * <b>SAC</b>: Implements {@link LexicalUnit#getStringValue()}.
217:             */
218:            public String getStringValue() {
219:                throw new IllegalStateException();
220:            }
221:
222:            /**
223:             * <b>SAC</b>: Implements {@link LexicalUnit#getSubValues()}.
224:             */
225:            public LexicalUnit getSubValues() {
226:                throw new IllegalStateException();
227:            }
228:
229:            /**
230:             * Creates a new integer lexical unit.
231:             */
232:            public static CSSLexicalUnit createSimple(short t, LexicalUnit prev) {
233:                return new SimpleLexicalUnit(t, prev);
234:            }
235:
236:            /**
237:             * This class represents a simple unit.
238:             */
239:            protected static class SimpleLexicalUnit extends CSSLexicalUnit {
240:
241:                /**
242:                 * Creates a new LexicalUnit.
243:                 */
244:                public SimpleLexicalUnit(short t, LexicalUnit prev) {
245:                    super (t, prev);
246:                }
247:            }
248:
249:            /**
250:             * Creates a new integer lexical unit.
251:             */
252:            public static CSSLexicalUnit createInteger(int val, LexicalUnit prev) {
253:                return new IntegerLexicalUnit(val, prev);
254:            }
255:
256:            /**
257:             * This class represents an integer unit.
258:             */
259:            protected static class IntegerLexicalUnit extends CSSLexicalUnit {
260:
261:                /**
262:                 * The integer value.
263:                 */
264:                protected int value;
265:
266:                /**
267:                 * Creates a new LexicalUnit.
268:                 */
269:                public IntegerLexicalUnit(int val, LexicalUnit prev) {
270:                    super (LexicalUnit.SAC_INTEGER, prev);
271:                    value = val;
272:                }
273:
274:                /**
275:                 * <b>SAC</b>: Implements {@link LexicalUnit#getIntegerValue()}.
276:                 */
277:                public int getIntegerValue() {
278:                    return value;
279:                }
280:            }
281:
282:            /**
283:             * Creates a new float lexical unit.
284:             */
285:            public static CSSLexicalUnit createFloat(short t, float val,
286:                    LexicalUnit prev) {
287:                return new FloatLexicalUnit(t, val, prev);
288:            }
289:
290:            /**
291:             * This class represents a float unit.
292:             */
293:            protected static class FloatLexicalUnit extends CSSLexicalUnit {
294:
295:                /**
296:                 * The float value.
297:                 */
298:                protected float value;
299:
300:                /**
301:                 * Creates a new LexicalUnit.
302:                 */
303:                public FloatLexicalUnit(short t, float val, LexicalUnit prev) {
304:                    super (t, prev);
305:                    value = val;
306:                }
307:
308:                /**
309:                 * <b>SAC</b>: Implements {@link LexicalUnit#getFloatValue()}.
310:                 */
311:                public float getFloatValue() {
312:                    return value;
313:                }
314:            }
315:
316:            /**
317:             * Creates a new float lexical unit.
318:             */
319:            public static CSSLexicalUnit createDimension(float val, String dim,
320:                    LexicalUnit prev) {
321:                return new DimensionLexicalUnit(val, dim, prev);
322:            }
323:
324:            /**
325:             * This class represents a dimension unit.
326:             */
327:            protected static class DimensionLexicalUnit extends CSSLexicalUnit {
328:
329:                /**
330:                 * The float value.
331:                 */
332:                protected float value;
333:
334:                /**
335:                 * The dimension.
336:                 */
337:                protected String dimension;
338:
339:                /**
340:                 * Creates a new LexicalUnit.
341:                 */
342:                public DimensionLexicalUnit(float val, String dim,
343:                        LexicalUnit prev) {
344:                    super (SAC_DIMENSION, prev);
345:                    value = val;
346:                    dimension = dim;
347:                }
348:
349:                /**
350:                 * <b>SAC</b>: Implements {@link LexicalUnit#getFloatValue()}.
351:                 */
352:                public float getFloatValue() {
353:                    return value;
354:                }
355:
356:                /**
357:                 * <b>SAC</b>: Implements {@link LexicalUnit#getDimensionUnitText()}.
358:                 */
359:                public String getDimensionUnitText() {
360:                    return dimension;
361:                }
362:            }
363:
364:            /**
365:             * Creates a new function lexical unit.
366:             */
367:            public static CSSLexicalUnit createFunction(String f,
368:                    LexicalUnit params, LexicalUnit prev) {
369:                return new FunctionLexicalUnit(f, params, prev);
370:            }
371:
372:            /**
373:             * This class represents a function unit.
374:             */
375:            protected static class FunctionLexicalUnit extends CSSLexicalUnit {
376:
377:                /**
378:                 * The function name.
379:                 */
380:                protected String name;
381:
382:                /**
383:                 * The function parameters.
384:                 */
385:                protected LexicalUnit parameters;
386:
387:                /**
388:                 * Creates a new LexicalUnit.
389:                 */
390:                public FunctionLexicalUnit(String f, LexicalUnit params,
391:                        LexicalUnit prev) {
392:                    super (SAC_FUNCTION, prev);
393:                    name = f;
394:                    parameters = params;
395:                }
396:
397:                /**
398:                 * <b>SAC</b>: Implements {@link LexicalUnit#getFunctionName()}.
399:                 */
400:                public String getFunctionName() {
401:                    return name;
402:                }
403:
404:                /**
405:                 * <b>SAC</b>: Implements {@link LexicalUnit#getParameters()}.
406:                 */
407:                public LexicalUnit getParameters() {
408:                    return parameters;
409:                }
410:
411:            }
412:
413:            /**
414:             * Creates a new function lexical unit.
415:             */
416:            public static CSSLexicalUnit createPredefinedFunction(short t,
417:                    LexicalUnit params, LexicalUnit prev) {
418:                return new PredefinedFunctionLexicalUnit(t, params, prev);
419:            }
420:
421:            /**
422:             * This class represents a function unit.
423:             */
424:            protected static class PredefinedFunctionLexicalUnit extends
425:                    CSSLexicalUnit {
426:
427:                /**
428:                 * The function parameters.
429:                 */
430:                protected LexicalUnit parameters;
431:
432:                /**
433:                 * Creates a new LexicalUnit.
434:                 */
435:                public PredefinedFunctionLexicalUnit(short t,
436:                        LexicalUnit params, LexicalUnit prev) {
437:                    super (t, prev);
438:                    parameters = params;
439:                }
440:
441:                /**
442:                 * <b>SAC</b>: Implements {@link LexicalUnit#getParameters()}.
443:                 */
444:                public LexicalUnit getParameters() {
445:                    return parameters;
446:                }
447:            }
448:
449:            /**
450:             * Creates a new string lexical unit.
451:             */
452:            public static CSSLexicalUnit createString(short t, String val,
453:                    LexicalUnit prev) {
454:                return new StringLexicalUnit(t, val, prev);
455:            }
456:
457:            /**
458:             * This class represents a string unit.
459:             */
460:            protected static class StringLexicalUnit extends CSSLexicalUnit {
461:
462:                /**
463:                 * The string value.
464:                 */
465:                protected String value;
466:
467:                /**
468:                 * Creates a new LexicalUnit.
469:                 */
470:                public StringLexicalUnit(short t, String val, LexicalUnit prev) {
471:                    super (t, prev);
472:                    value = val;
473:                }
474:
475:                /**
476:                 * <b>SAC</b>: Implements {@link LexicalUnit#getStringValue()}.
477:                 */
478:                public String getStringValue() {
479:                    return value;
480:                }
481:            }
482:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.