KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > steadystate > css > dom > RectImpl


1 /*
2  * RectImpl.java
3  *
4  * Steady State CSS2 Parser
5  *
6  * Copyright (C) 1999, 2002 Steady State Software Ltd. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * To contact the authors of the library, write to Steady State Software Ltd.,
23  * 49 Littleworth, Wing, Buckinghamshire, LU7 0JX, England
24  *
25  * http://www.steadystate.com/css/
26  * mailto:css@steadystate.co.uk
27  *
28  * $Id: RectImpl.java,v 1.1.1.1 2003/12/28 21:22:55 davidsch Exp $
29  */

30  
31 package com.steadystate.css.dom;
32
33 import java.io.Serializable JavaDoc;
34 import org.w3c.dom.css.*;
35 import org.w3c.css.sac.*;
36
37 /**
38  *
39  * @author David Schweinsberg
40  * @version $Release$
41  */

42 public class RectImpl implements Rect, Serializable JavaDoc {
43     
44     private CSSPrimitiveValue _left;
45     private CSSPrimitiveValue _top;
46     private CSSPrimitiveValue _right;
47     private CSSPrimitiveValue _bottom;
48
49     /** Creates new RectImpl */
50     public RectImpl(LexicalUnit lu) {
51         LexicalUnit next = lu;
52         _left = new CSSValueImpl(next, true);
53         next = next.getNextLexicalUnit();
54         next = next.getNextLexicalUnit();
55         _top = new CSSValueImpl(next, true);
56         next = next.getNextLexicalUnit();
57         next = next.getNextLexicalUnit();
58         _right = new CSSValueImpl(next, true);
59         next = next.getNextLexicalUnit();
60         next = next.getNextLexicalUnit();
61         _bottom = new CSSValueImpl(next, true);
62     }
63   
64     public CSSPrimitiveValue getTop() {
65         return _top;
66     }
67
68     public CSSPrimitiveValue getRight() {
69         return _right;
70     }
71
72     public CSSPrimitiveValue getBottom() {
73         return _bottom;
74     }
75
76     public CSSPrimitiveValue getLeft() {
77         return _left;
78     }
79     
80     public String JavaDoc toString() {
81         return new StringBuffer JavaDoc()
82             .append("rect(")
83             .append(_left.toString())
84             .append(", ")
85             .append(_top.toString())
86             .append(", ")
87             .append(_right.toString())
88             .append(", ")
89             .append(_bottom.toString())
90             .append(")")
91             .toString();
92     }
93 }
Popular Tags