01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.perseus.parser;
28:
29: /**
30: * The <code>LengthParser</code> returns <code>Length</code> objects
31: * from its <code>parserLength</code> method.
32: * <br />
33: * The <code>Length</code> class captures the value of the length
34: * valut along with its unit. The resolution into a user space
35: * value depends on the context (e.g., in Perseus, the
36: * {@link com.sun.perseus.builder.BuildContext} class holds the context)
37: * defining things like the size of a pixel.
38: *
39: * @see LengthParser
40: * @see com.sun.perseus.builder.BuilderUtil
41: *
42: * @version $Id: Length.java,v 1.2 2006/04/21 06:40:28 st125089 Exp $
43: */
44: public class Length {
45: /*
46: * Possible Length unit types
47: */
48:
49: /**
50: * Plain length, no unit
51: */
52: public static final int SVG_LENGTHTYPE_NUMBER = 1;
53:
54: /**
55: * Percentage unit, usually used for percentage of
56: * viewport width or height.
57: */
58: public static final int SVG_LENGTHTYPE_PERCENTAGE = 2;
59:
60: /**
61: * Centimeter unit
62: */
63: public static final int SVG_LENGTHTYPE_CM = 6;
64:
65: /**
66: * Millimeter unit.
67: */
68: public static final int SVG_LENGTHTYPE_MM = 7;
69:
70: /**
71: * Inch unit (2.54cm)
72: */
73: public static final int SVG_LENGTHTYPE_IN = 8;
74:
75: /**
76: * Point unit. A point is 1/72th of an inch as
77: * defined in the CSS 2 specification.
78: */
79: public static final int SVG_LENGTHTYPE_PT = 9;
80:
81: /**
82: * Pica unit. A pica is 12 points as defined in
83: * the CSS 2 specification.
84: */
85: public static final int SVG_LENGTHTYPE_PC = 10;
86:
87: /**
88: * The unit value. One of the SVG_LENGTHTYPE_XXX values.
89: */
90: public int unit;
91:
92: /**
93: * The actual length value, prior to unit convertion
94: */
95: public float value;
96:
97: }
|