KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * RGBColorImpl.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: RGBColorImpl.java,v 1.1.1.1 2003/12/28 21:22:56 davidsch Exp $
29  */

30
31 package com.steadystate.css.dom;
32
33 import java.io.Serializable JavaDoc;
34 import org.w3c.css.sac.*;
35 import org.w3c.dom.css.*;
36
37 public class RGBColorImpl implements RGBColor, Serializable JavaDoc {
38
39     private CSSPrimitiveValue _red = null;
40     private CSSPrimitiveValue _green = null;
41     private CSSPrimitiveValue _blue = null;
42
43     protected RGBColorImpl(LexicalUnit lu) {
44         LexicalUnit next = lu;
45         _red = new CSSValueImpl(next, true);
46         next = next.getNextLexicalUnit();
47         next = next.getNextLexicalUnit();
48         _green = new CSSValueImpl(next, true);
49         next = next.getNextLexicalUnit();
50         next = next.getNextLexicalUnit();
51         _blue = new CSSValueImpl(next, true);
52     }
53
54     protected RGBColorImpl() {
55     }
56     
57     public CSSPrimitiveValue getRed() {
58         return _red;
59     }
60
61     public void setRed(CSSPrimitiveValue red) {
62         _red = red;
63     }
64
65     public CSSPrimitiveValue getGreen() {
66         return _green;
67     }
68
69     public void setGreen(CSSPrimitiveValue green) {
70         _green = green;
71     }
72
73     public CSSPrimitiveValue getBlue() {
74         return _blue;
75     }
76
77     public void setBlue(CSSPrimitiveValue blue) {
78         _blue = blue;
79     }
80
81     public String JavaDoc toString() {
82         return
83             "rgb(" +
84             _red.toString() + ", " +
85             _green.toString() + ", " +
86             _blue.toString() + ")";
87     }
88 }
89
Popular Tags