KickJava   Java API By Example, From Geeks To Geeks.

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


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  * TextBlockData.java
22  *
23  * Created on October 29, 2004, 11:11 AM
24  */

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

35 public class TextBlockData {
36     /**
37      * Holds value of property verticalAlignUnit.
38      */

39     private String JavaDoc verticalAlignUnit ="px"; //NOI18N
40

41     /**
42      * Holds value of property verticalAlignValue.
43      */

44     private String JavaDoc verticalAlignValue ="";
45
46     /**
47      * Holds value of property indentationUnit.
48      */

49     private String JavaDoc indentationUnit ="px"; //NOI18N
50

51     /**
52      * Holds value of property wordSpacingUnit.
53      */

54     private String JavaDoc wordSpacingUnit ="px"; //NOI18N
55

56     /**
57      * Holds value of property indentationValue.
58      */

59     private String JavaDoc indentationValue ="";
60
61     /**
62      * Holds value of property wordSpacingValue.
63      */

64     private String JavaDoc wordSpacingValue ="";
65
66     /**
67      * Holds value of property letterSpacingUnit.
68      */

69     private String JavaDoc letterSpacingUnit="px"; //NOI18N
70

71     /**
72      * Holds value of property letterSpacingValue.
73      */

74     private String JavaDoc letterSpacingValue="";
75
76     /**
77      * Holds value of property lineHeightUnit.
78      */

79     private String JavaDoc lineHeightUnit="px"; //NOI18N
80

81     /**
82      * Holds value of property lineHeightValue.
83      */

84     private String JavaDoc lineHeightValue;
85
86     public void setVerticalAlign(String JavaDoc verticalAlignStr){
87         verticalAlignUnit = getUnit(verticalAlignStr);
88         verticalAlignValue = verticalAlignStr.replaceAll(verticalAlignUnit,"").trim();
89     }
90
91     public void setIndentation(String JavaDoc indentationStr){
92         indentationUnit = getUnit(indentationStr);
93         indentationValue = indentationStr.replaceAll(indentationUnit,"").trim();
94     }
95
96     public void setWordSpacing(String JavaDoc wordSpacingStr){
97         wordSpacingUnit = getUnit(wordSpacingStr);
98         wordSpacingValue = wordSpacingStr.replaceAll(wordSpacingUnit,"").trim();
99     }
100
101     public void setLetterSpacing(String JavaDoc letterSpacingStr){
102         letterSpacingUnit = getUnit(letterSpacingStr);
103         letterSpacingValue = letterSpacingStr.replaceAll(letterSpacingUnit,"").trim();
104     }
105
106     public void setLineHeight(String JavaDoc lineHeightStr){
107         lineHeightUnit = getUnit(lineHeightStr);
108         lineHeightValue = lineHeightStr.replaceAll(lineHeightUnit,"").trim();
109     }
110
111     private String JavaDoc getUnit(String JavaDoc textBlockStr){
112         DefaultComboBoxModel JavaDoc unitList = new TextBlockModel().getTextBlockUnitList();
113         for(int i=0; i< unitList.getSize(); i++){
114             String JavaDoc unit = (String JavaDoc)unitList.getElementAt(i);
115             if(textBlockStr.trim().endsWith(unit)){
116                 return unit;
117             }
118         }
119         return "";
120     }
121
122     /**
123      * Getter for property verticalAlignUnit.
124      * @return Value of property verticalAlignUnit.
125      */

126     public String JavaDoc getVerticalAlignUnit() {
127
128         return this.verticalAlignUnit;
129     }
130
131     /**
132      * Setter for property verticalAlignUnit.
133      * @param verticalAlignUnit New value of property verticalAlignUnit.
134      */

135     public void setVerticalAlignUnit(String JavaDoc verticalAlignUnit) {
136
137         this.verticalAlignUnit = verticalAlignUnit;
138     }
139
140     /**
141      * Getter for property verticalAlignValue.
142      * @return Value of property verticalAlignValue.
143      */

144     public String JavaDoc getVerticalAlignValue() {
145
146         return this.verticalAlignValue;
147     }
148
149     /**
150      * Setter for property verticalAlignValue.
151      * @param verticalAlignValue New value of property verticalAlignValue.
152      */

153     public void setVerticalAlignValue(String JavaDoc verticalAlignValue) {
154
155         this.verticalAlignValue = verticalAlignValue;
156     }
157     
158     /**
159      * Getter for property indentationUnit.
160      * @return Value of property indentationUnit.
161      */

162     public String JavaDoc getIndentationUnit() {
163         
164         return this.indentationUnit;
165     }
166     
167     /**
168      * Setter for property indentationUnit.
169      * @param indentationUnit New value of property indentationUnit.
170      */

171     public void setIndentationUnit(java.lang.String JavaDoc indentationUnit) {
172         
173         this.indentationUnit = indentationUnit;
174     }
175     
176     /**
177      * Getter for property wordSpacingUnit.
178      * @return Value of property wordSpacingUnit.
179      */

180     public String JavaDoc getWordSpacingUnit() {
181         
182         return this.wordSpacingUnit;
183     }
184     
185     /**
186      * Setter for property wordSpacingUnit.
187      * @param wordSpacingUnit New value of property wordSpacingUnit.
188      */

189     public void setWordSpacingUnit(String JavaDoc wordSpacingUnit) {
190         
191         this.wordSpacingUnit = wordSpacingUnit;
192     }
193     
194     /**
195      * Getter for property indentationValue.
196      * @return Value of property indentationValue.
197      */

198     public String JavaDoc getIndentationValue() {
199         
200         return this.indentationValue;
201     }
202     
203     /**
204      * Setter for property indentationValue.
205      * @param indentationValue New value of property indentationValue.
206      */

207     public void setIndentationValue(String JavaDoc indentationValue) {
208         
209         this.indentationValue = indentationValue;
210     }
211     
212     /**
213      * Getter for property wordSpacingValue.
214      * @return Value of property wordSpacingValue.
215      */

216     public String JavaDoc getWordSpacingValue() {
217         
218         return this.wordSpacingValue;
219     }
220     
221     /**
222      * Setter for property wordSpacingValue.
223      * @param wordSpacingValue New value of property wordSpacingValue.
224      */

225     public void setWordSpacingValue(String JavaDoc wordSpacingValue) {
226         
227         this.wordSpacingValue = wordSpacingValue;
228     }
229     
230     /**
231      * Getter for property letterSpacingUnit.
232      * @return Value of property letterSpacingUnit.
233      */

234     public String JavaDoc getLetterSpacingUnit() {
235         
236         return this.letterSpacingUnit;
237     }
238     
239     /**
240      * Setter for property letterSpacingUnit.
241      * @param letterSpacingUnit New value of property letterSpacingUnit.
242      */

243     public void setLetterSpacingUnit(String JavaDoc letterSpacingUnit) {
244         
245         this.letterSpacingUnit = letterSpacingUnit;
246     }
247     
248     /**
249      * Getter for property letterSpacingValue.
250      * @return Value of property letterSpacingValue.
251      */

252     public String JavaDoc getLetterSpacingValue() {
253         
254         return this.letterSpacingValue;
255     }
256     
257     /**
258      * Setter for property letterSpacingValue.
259      * @param letterSpacingValue New value of property letterSpacingValue.
260      */

261     public void setLetterSpacingValue(String JavaDoc letterSpacingValue) {
262         
263         this.letterSpacingValue = letterSpacingValue;
264     }
265     
266     /**
267      * Getter for property lineHeightUnit.
268      * @return Value of property lineHeightUnit.
269      */

270     public String JavaDoc getLineHeightUnit() {
271         
272         return this.lineHeightUnit;
273     }
274     
275     /**
276      * Setter for property lineHeightUnit.
277      * @param lineHeightUnit New value of property lineHeightUnit.
278      */

279     public void setLineHeightUnit(String JavaDoc lineHeightUnit) {
280         
281         this.lineHeightUnit = lineHeightUnit;
282     }
283     
284     /**
285      * Getter for property lineHeightValue.
286      * @return Value of property lineHeightValue.
287      */

288     public String JavaDoc getLineHeightValue() {
289         
290         return this.lineHeightValue;
291     }
292     
293     /**
294      * Setter for property lineHeightValue.
295      * @param lineHeightValue New value of property lineHeightValue.
296      */

297     public void setLineHeightValue(String JavaDoc lineHeightValue) {
298         
299         this.lineHeightValue = lineHeightValue;
300     }
301     
302     
303 }
304
Popular Tags