KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > css > visual > model > CssRuleData


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * CssRuleData.java
22  *
23  * Created on February 2, 2005, 4:15 PM
24  */

25
26 package org.netbeans.modules.css.visual.model;
27
28 import javax.swing.text.JTextComponent JavaDoc;
29
30 /**
31  * Data Structure for the CSS rule
32  * @author Winston Prakash
33  * @version 1.0
34  */

35 public class CssRuleData {
36     CssStyleData cssStyleData = null;
37     String JavaDoc cssRule = null;
38
39     int cssRuleOffset;
40
41     private JTextComponent JavaDoc cssTextComponent;
42
43     /** Creates a new instance of CssRuleData */
44     public CssRuleData() {
45     }
46
47     /** Creates a new instance of CssRuleData */
48     public CssRuleData(String JavaDoc rule, CssStyleData styleData) {
49         cssRule = rule.trim();
50         cssStyleData = styleData;
51     }
52
53     public CssRuleData(JTextComponent JavaDoc comp, String JavaDoc rule, int offset){
54         cssTextComponent = comp;
55         cssRule = rule.trim();
56         cssRuleOffset = offset;
57     }
58
59     /**
60      * Set the rule name (ex .myClass )
61      */

62     public void setRule(String JavaDoc rule){
63         if(rule != null){
64             cssRule = rule.trim();
65         }
66     }
67
68     /**
69      * Get the rule name
70      */

71     public String JavaDoc getRule(){
72         return cssRule;
73     }
74
75     public void setTextComponent(JTextComponent JavaDoc comp){
76         cssTextComponent = comp;
77     }
78
79     public JTextComponent JavaDoc getTextComponent(){
80         return cssTextComponent;
81     }
82
83     /**
84      * Set the offset of the rule in the CSS docuent
85      */

86     public void setOffset(int offset){
87         cssRuleOffset = offset;
88     }
89
90     /**
91      * Get the offset of the rule in the CSS docuent
92      */

93     public int getOffset(){
94         return cssRuleOffset;
95     }
96
97     public void setCssStyleData(CssStyleData styleData){
98         cssStyleData = styleData;
99     }
100
101     public CssStyleData getCssStyleData(){
102         return cssStyleData;
103     }
104 }
105
Popular Tags