KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > value > RectValue


1 /*
2
3    Copyright 2002 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    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 package org.apache.batik.css.engine.value;
19
20 import org.w3c.dom.DOMException JavaDoc;
21 import org.w3c.dom.css.CSSPrimitiveValue;
22
23 /**
24  * This class represents CSS rect values.
25  *
26  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
27  * @version $Id: RectValue.java,v 1.3 2004/08/18 07:12:53 vhardy Exp $
28  */

29 public class RectValue extends AbstractValue {
30     
31     /**
32      * The top value.
33      */

34     protected Value top;
35
36     /**
37      * The right value.
38      */

39     protected Value right;
40
41     /**
42      * The bottom value.
43      */

44     protected Value bottom;
45
46     /**
47      * The left value.
48      */

49     protected Value left;
50
51     /**
52      * Creates a new Rect value.
53      */

54     public RectValue(Value t, Value r, Value b, Value l) {
55     top = t;
56     right = r;
57     bottom = b;
58     left = l;
59     }
60
61     /**
62      * The type of the value.
63      */

64     public short getPrimitiveType() {
65         return CSSPrimitiveValue.CSS_RECT;
66     }
67
68     /**
69      * A string representation of the current value.
70      */

71     public String JavaDoc getCssText() {
72     return "rect(" + top.getCssText() + ", "
73         + right.getCssText() + ", "
74         + bottom.getCssText() + ", "
75         + left.getCssText() + ")";
76     }
77
78     /**
79      * Implements {@link Value#getTop()}.
80      */

81     public Value getTop() throws DOMException JavaDoc {
82         return top;
83     }
84
85     /**
86      * Implements {@link Value#getRight()}.
87      */

88     public Value getRight() throws DOMException JavaDoc {
89         return right;
90     }
91
92     /**
93      * Implements {@link Value#getBottom()}.
94      */

95     public Value getBottom() throws DOMException JavaDoc {
96         return bottom;
97     }
98
99     /**
100      * Implements {@link Value#getLeft()}.
101      */

102     public Value getLeft() throws DOMException JavaDoc {
103         return left;
104     }
105
106     /**
107      * Returns a printable representation of this value.
108      */

109     public String JavaDoc toString() {
110         return getCssText();
111     }
112 }
113
Popular Tags