1 19 20 25 26 package org.netbeans.modules.css.visual.model; 27 28 import javax.swing.DefaultComboBoxModel ; 29 30 36 public class PositionData { 37 40 private String topUnit="px"; 42 45 private String rightUnit="px"; 47 50 private String leftUnit="px"; 52 55 private String bottomUnit="px"; 57 60 private String widthUnit="px"; 62 65 private String heightUnit="px"; 67 70 private String bottomValue=""; 71 72 75 private String heightValue=""; 76 77 80 private String leftValue=""; 81 82 85 private String rightValue=""; 86 87 90 private String topValue=""; 91 92 95 private String widthValue=""; 96 97 public void setTop(String topStr){ 98 topUnit = getUnit(topStr); 99 topValue = topStr.replaceAll(topUnit,"").trim(); 100 } 101 102 public void setBottom(String bottomStr){ 103 bottomUnit = getUnit(bottomStr); 104 bottomValue = bottomStr.replaceAll(bottomUnit,"").trim(); 105 } 106 107 public void setLeft(String leftStr){ 108 leftUnit = getUnit(leftStr); 109 leftValue = leftStr.replaceAll(leftUnit,"").trim(); 110 } 111 112 public void setRight(String rightStr){ 113 rightUnit = getUnit(rightStr); 114 rightValue = rightStr.replaceAll(rightUnit,"").trim(); 115 } 116 117 public void setWidth(String widthStr){ 118 widthUnit = getUnit(widthStr); 119 widthValue = widthStr.replaceAll(widthUnit,"").trim(); 120 } 121 122 public void setHeight(String heightStr){ 123 heightUnit = getUnit(heightStr); 124 heightValue = heightStr.replaceAll(heightUnit,"").trim(); 125 } 126 127 private String getUnit(String positionStr){ 128 DefaultComboBoxModel unitList = new PositionModel().getPositionUnitList(); 129 for(int i=0; i< unitList.getSize(); i++){ 130 String unit = (String )unitList.getElementAt(i); 131 if(positionStr.trim().endsWith(unit)){ 132 return unit; 133 } 134 } 135 return ""; 136 } 137 138 142 public String getTopUnit() { 143 144 return this.topUnit; 145 } 146 147 151 public void setTopUnit(java.lang.String topUnit) { 152 153 this.topUnit = topUnit; 154 } 155 156 160 public String getRightUnit() { 161 162 return this.rightUnit; 163 } 164 165 169 public void setRightUnit(java.lang.String rightUnit) { 170 171 this.rightUnit = rightUnit; 172 } 173 174 178 public String getLeftUnit() { 179 180 return this.leftUnit; 181 } 182 183 187 public void setLeftUnit(java.lang.String leftUnit) { 188 189 this.leftUnit = leftUnit; 190 } 191 192 196 public String getBottomUnit() { 197 198 return this.bottomUnit; 199 } 200 201 205 public void setBottomUnit(java.lang.String bottom) { 206 } 207 208 209 213 public String getWidthUnit() { 214 215 return this.widthUnit; 216 } 217 218 222 public void setWidthUnit(java.lang.String widthUnit) { 223 224 this.widthUnit = widthUnit; 225 } 226 227 231 public String getHeightUnit() { 232 233 return this.heightUnit; 234 } 235 236 240 public void setHeightUnit(java.lang.String heightUnit) { 241 242 this.heightUnit = heightUnit; 243 } 244 245 249 public String getBottomValue() { 250 251 return this.bottomValue; 252 } 253 254 258 public void setBottomValue(String bottomValue) { 259 260 this.bottomValue = bottomValue; 261 } 262 263 267 public String getHeightValue() { 268 269 return this.heightValue; 270 } 271 272 276 public void setHeightValue(String heightValue) { 277 278 this.heightValue = heightValue; 279 } 280 281 285 public String getLeftValue() { 286 287 return this.leftValue; 288 } 289 290 294 public void setLeftValue(String leftValue) { 295 296 this.leftValue = leftValue; 297 } 298 299 303 public String getRightValue() { 304 305 return this.rightValue; 306 } 307 308 312 public void setRightValue(String rightValue) { 313 314 this.rightValue = rightValue; 315 } 316 317 321 public String getTopValue() { 322 323 return this.topValue; 324 } 325 326 330 public void setTopValue(String topValue) { 331 332 this.topValue = topValue; 333 } 334 335 339 public String getWidthValue() { 340 341 return this.widthValue; 342 } 343 344 348 public void setWidthValue(String widthValue) { 349 350 this.widthValue = widthValue; 351 } 352 } 353 | Popular Tags |