1 28 package net.sf.jasperreports.engine.design; 29 30 import java.awt.Color ; 31 import java.io.IOException ; 32 import java.util.ArrayList ; 33 import java.util.List ; 34 35 import net.sf.jasperreports.engine.JRAbstractObjectFactory; 36 import net.sf.jasperreports.engine.JRBox; 37 import net.sf.jasperreports.engine.JRChild; 38 import net.sf.jasperreports.engine.JRConstants; 39 import net.sf.jasperreports.engine.JRDefaultStyleProvider; 40 import net.sf.jasperreports.engine.JRElement; 41 import net.sf.jasperreports.engine.JRElementGroup; 42 import net.sf.jasperreports.engine.JRExpressionCollector; 43 import net.sf.jasperreports.engine.JRFrame; 44 import net.sf.jasperreports.engine.base.JRBaseElementGroup; 45 import net.sf.jasperreports.engine.util.JRStyleResolver; 46 import net.sf.jasperreports.engine.xml.JRXmlWriter; 47 48 54 public class JRDesignFrame extends JRDesignElement implements JRFrame 55 { 56 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 57 58 private List children; 59 60 65 public JRDesignFrame(JRDefaultStyleProvider defaultStyleProvider) 66 { 67 super(defaultStyleProvider); 68 69 children = new ArrayList (); 70 } 71 72 73 76 public JRDesignFrame() 77 { 78 this(null); 79 } 80 81 82 public void collectExpressions(JRExpressionCollector collector) 83 { 84 collector.collect(this); 85 } 86 87 public JRChild getCopy(JRAbstractObjectFactory factory) 88 { 89 return factory.getFrame(this); 90 } 91 92 public void writeXml(JRXmlWriter writer) throws IOException 93 { 94 writer.writeFrame(this); 95 } 96 97 public JRElement[] getElements() 98 { 99 return JRBaseElementGroup.getElements(children); 100 } 101 102 103 108 public void addElement(JRElement element) 109 { 110 children.add(element); 111 } 112 113 114 120 public boolean removeElement(JRElement element) 121 { 122 return children.remove(element); 123 } 124 125 126 131 public void addElementGroup(JRElementGroup group) 132 { 133 children.add(group); 134 } 135 136 137 143 public boolean removeElementGroup(JRElementGroup group) 144 { 145 return children.remove(group); 146 } 147 148 149 public List getChildren() 150 { 151 return children; 152 } 153 154 public JRElement getElementByKey(String elementKey) 155 { 156 return JRBaseElementGroup.getElementByKey(getElements(), elementKey); 157 } 158 159 160 public byte getMode() 161 { 162 return JRStyleResolver.getMode(this, MODE_TRANSPARENT); 163 } 164 165 166 protected Byte border; 168 protected Byte topBorder = null; 169 protected Byte leftBorder = null; 170 protected Byte bottomBorder = null; 171 protected Byte rightBorder = null; 172 protected Color borderColor = null; 173 protected Color topBorderColor = null; 174 protected Color leftBorderColor = null; 175 protected Color bottomBorderColor = null; 176 protected Color rightBorderColor = null; 177 protected Integer padding; 178 protected Integer topPadding = null; 179 protected Integer leftPadding = null; 180 protected Integer bottomPadding = null; 181 protected Integer rightPadding = null; 182 183 184 public byte getBorder() 185 { 186 return JRStyleResolver.getBorder(this); 187 } 188 189 public Byte getOwnBorder() 190 { 191 return border; 192 } 193 194 public void setBorder(byte border) 195 { 196 this.border = new Byte (border); 197 } 198 199 public void setBorder(Byte border) 200 { 201 this.border = border; 202 } 203 204 public Color getBorderColor() 205 { 206 return JRStyleResolver.getBorderColor(this, getForecolor()); 207 } 208 209 public Color getOwnBorderColor() 210 { 211 return borderColor; 212 } 213 214 public void setBorderColor(Color borderColor) 215 { 216 this.borderColor = borderColor; 217 } 218 219 public int getPadding() 220 { 221 return JRStyleResolver.getPadding(this); 222 } 223 224 public Integer getOwnPadding() 225 { 226 return padding; 227 } 228 229 public void setPadding(int padding) 230 { 231 this.padding = new Integer (padding); 232 } 233 234 public void setPadding(Integer padding) 235 { 236 this.padding = padding; 237 } 238 239 public byte getTopBorder() 240 { 241 return JRStyleResolver.getTopBorder(this); 242 } 243 244 public Byte getOwnTopBorder() 245 { 246 return topBorder; 247 } 248 249 public void setTopBorder(byte topBorder) 250 { 251 this.topBorder = new Byte (topBorder); 252 } 253 254 public void setTopBorder(Byte topBorder) 255 { 256 this.topBorder = topBorder; 257 } 258 259 public Color getTopBorderColor() 260 { 261 return JRStyleResolver.getTopBorderColor(this, getForecolor()); 262 } 263 264 public Color getOwnTopBorderColor() 265 { 266 return topBorderColor; 267 } 268 269 public void setTopBorderColor(Color topBorderColor) 270 { 271 this.topBorderColor = topBorderColor; 272 } 273 274 public int getTopPadding() 275 { 276 return JRStyleResolver.getTopPadding(this); 277 } 278 279 public Integer getOwnTopPadding() 280 { 281 return topPadding; 282 } 283 284 public void setTopPadding(int topPadding) 285 { 286 this.topPadding = new Integer (topPadding); 287 } 288 289 public void setTopPadding(Integer topPadding) 290 { 291 this.topPadding = topPadding; 292 } 293 294 public byte getLeftBorder() 295 { 296 return JRStyleResolver.getLeftBorder(this); 297 } 298 299 public Byte getOwnLeftBorder() 300 { 301 return leftBorder; 302 } 303 304 public void setLeftBorder(byte leftBorder) 305 { 306 this.leftBorder = new Byte (leftBorder); 307 } 308 309 public void setLeftBorder(Byte leftBorder) 310 { 311 this.leftBorder = leftBorder; 312 } 313 314 public Color getLeftBorderColor() 315 { 316 return JRStyleResolver.getLeftBorderColor(this, getForecolor()); 317 } 318 319 public Color getOwnLeftBorderColor() 320 { 321 return leftBorderColor; 322 } 323 324 public void setLeftBorderColor(Color leftBorderColor) 325 { 326 this.leftBorderColor = leftBorderColor; 327 } 328 329 public int getLeftPadding() 330 { 331 return JRStyleResolver.getLeftPadding(this); 332 } 333 334 public Integer getOwnLeftPadding() 335 { 336 return leftPadding; 337 } 338 339 public void setLeftPadding(int leftPadding) 340 { 341 this.leftPadding = new Integer (leftPadding); 342 } 343 344 public void setLeftPadding(Integer leftPadding) 345 { 346 this.leftPadding = leftPadding; 347 } 348 349 public byte getBottomBorder() 350 { 351 return JRStyleResolver.getBottomBorder(this); 352 } 353 354 public Byte getOwnBottomBorder() 355 { 356 return bottomBorder; 357 } 358 359 public void setBottomBorder(byte bottomBorder) 360 { 361 this.bottomBorder = new Byte (bottomBorder); 362 } 363 364 public void setBottomBorder(Byte bottomBorder) 365 { 366 this.bottomBorder = bottomBorder; 367 } 368 369 public Color getBottomBorderColor() 370 { 371 return JRStyleResolver.getBottomBorderColor(this, getForecolor()); 372 } 373 374 public Color getOwnBottomBorderColor() 375 { 376 return bottomBorderColor; 377 } 378 379 public void setBottomBorderColor(Color bottomBorderColor) 380 { 381 this.bottomBorderColor = bottomBorderColor; 382 } 383 384 public int getBottomPadding() 385 { 386 return JRStyleResolver.getBottomPadding(this); 387 } 388 389 public Integer getOwnBottomPadding() 390 { 391 return bottomPadding; 392 } 393 394 public void setBottomPadding(int bottomPadding) 395 { 396 this.bottomPadding = new Integer (bottomPadding); 397 } 398 399 public void setBottomPadding(Integer bottomPadding) 400 { 401 this.bottomPadding = bottomPadding; 402 } 403 404 public byte getRightBorder() 405 { 406 return JRStyleResolver.getRightBorder(this); 407 } 408 409 public Byte getOwnRightBorder() 410 { 411 return rightBorder; 412 } 413 414 public void setRightBorder(byte rightBorder) 415 { 416 this.rightBorder = new Byte (rightBorder); 417 } 418 419 public void setRightBorder(Byte rightBorder) 420 { 421 this.rightBorder = rightBorder; 422 } 423 424 public Color getRightBorderColor() 425 { 426 return JRStyleResolver.getRightBorderColor(this, getForecolor()); 427 } 428 429 public Color getOwnRightBorderColor() 430 { 431 return rightBorderColor; 432 } 433 434 public void setRightBorderColor(Color rightBorderColor) 435 { 436 this.rightBorderColor = rightBorderColor; 437 } 438 439 public int getRightPadding() 440 { 441 return JRStyleResolver.getRightPadding(this); 442 } 443 444 public Integer getOwnRightPadding() 445 { 446 return rightPadding; 447 } 448 449 public void setRightPadding(int rightPadding) 450 { 451 this.rightPadding = new Integer (rightPadding); 452 } 453 454 public void setRightPadding(Integer rightPadding) 455 { 456 this.rightPadding = rightPadding; 457 } 458 459 460 465 public void setBox(JRBox box) 466 { 467 if (box != null) 468 { 469 border = box.getOwnBorder(); 470 topBorder = box.getOwnTopBorder(); 471 leftBorder = box.getOwnLeftBorder(); 472 bottomBorder = box.getOwnBottomBorder(); 473 rightBorder = box.getOwnRightBorder(); 474 borderColor = box.getOwnBorderColor(); 475 topBorderColor = box.getOwnTopBorderColor(); 476 leftBorderColor = box.getOwnLeftBorderColor(); 477 bottomBorderColor = box.getOwnBottomBorderColor(); 478 rightBorderColor = box.getOwnRightBorderColor(); 479 padding = box.getOwnPadding(); 480 topPadding = box.getOwnTopPadding(); 481 leftPadding = box.getOwnLeftPadding(); 482 bottomPadding = box.getOwnBottomPadding(); 483 rightPadding = box.getOwnRightPadding(); 484 } 485 } 486 } 487 | Popular Tags |