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