KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > style > CSSStyle


1 /*
2  * $Id: CSSStyle.java,v 1.1 2005/05/27 09:17:35 blueshift Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14
15 package org.wings.style;
16
17 /**
18  * @author bschmid
19  */

20 public class CSSStyle extends CSSAttributeSet implements Style {
21     private StyleSheet sheet;
22     private CSSSelector selector;
23
24     public CSSStyle(CSSSelector selector, CSSAttributeSet attributes) {
25         super(attributes);
26         this.selector = selector;
27     }
28
29     public CSSStyle(CSSSelector selector, CSSProperty property, String JavaDoc value) {
30         super(property, value);
31         this.selector = selector;
32     }
33
34     public void setSelector(CSSSelector selector) {
35         this.selector = selector;
36     }
37
38     public CSSSelector getCssSelector() { return selector; }
39
40     /**
41      * The style sheet owning this style.
42      * @param sheet The style sheet owning this style.
43      */

44     public void setSheet(StyleSheet sheet) {
45         this.sheet = sheet;
46     }
47
48     /**
49      * @return The style sheet owning this style.
50      */

51     public StyleSheet getSheet() { return sheet; }
52
53     /**
54      * @return Rendered Style: css selector { attribute/values }
55      */

56     public String JavaDoc toString() {
57         return selector.getSelectorString() + " { " + super.toString() + "}";
58     }
59
60     /* @see Style */
61     public Object JavaDoc getSelector() {
62         return getCssSelector();
63     }
64
65     /* @see Style */
66     public Object JavaDoc put(Object JavaDoc styleProperty, Object JavaDoc styleValue) {
67         return super.put((CSSProperty) styleProperty, (String JavaDoc) styleValue);
68     }
69
70 }
71
Popular Tags