Update of /cvsroot/jfreechart/jfreechart/source/org/jfree/chart/block
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24677/source/org/jfree/chart/block
Modified Files:
ColumnArrangement.java
Log Message:
28-10-2005 David Gilbert <david.gilbert@...>
* source/org/jfree/chart/block/ColumnArrangement.java
(arrangeFN): set bounds of blocks, total height calculation updated
to reflect the number of vertical gaps,
(arrangeNF): updated for new arrange() method return type.
Index: ColumnArrangement.java
===================================================================
RCS file: /cvsroot/jfreechart/jfreechart/source/org/jfree/chart/block/ColumnArrangement.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ColumnArrangement.java 19 Jul 2005 14:27:02 -0000 1.14
--- ColumnArrangement.java 28 Oct 2005 12:52:47 -0000 1.15
***************
*** 216,220 ****
Block b = (Block) blocks.get(i);
ArrangeResult r = b.arrange(g2, constraint, params);
! totalHeight += b.getBounds().getHeight();
if (messages != null) {
if (r.getMessages() != null) {
--- 216,222 ----
Block b = (Block) blocks.get(i);
ArrangeResult r = b.arrange(g2, constraint, params);
! b.setBounds(new Rectangle2D.Double(0.0, totalHeight, r.getWidth(),
! r.getHeight()));
! totalHeight += r.getHeight() + this.verticalGap;
if (messages != null) {
if (r.getMessages() != null) {
***************
*** 223,226 ****
--- 225,231 ----
}
}
+ if (blockCount > 0) {
+ totalHeight = totalHeight - this.verticalGap;
+ }
ArrangeResult result = params.getRecyclableResult();
***************
*** 265,287 ****
for (int i = 0; i < blocks.size(); i++) {
Block block = (Block) blocks.get(i);
! Size2D size = block.arrange(g2, params);
! if (y + size.height <= height) {
itemsInColumn.add(block);
block.setBounds(
! new Rectangle2D.Double(x, y, size.width, size.height)
);
! y = y + size.height + this.verticalGap;
! maxWidth = Math.max(maxWidth, size.width);
}
else {
if (itemsInColumn.isEmpty()) {
// place in this column (truncated) anyway
! block.setBounds(
! new Rectangle2D.Double(
! x, y, size.width, Math.min(size.height, height - y)
! )
! );
y = 0.0;
! x = x + size.width + this.horizontalGap;
}
else {
--- 270,290 ----
for (int i = 0; i < blocks.size(); i++) {
Block block = (Block) blocks.get(i);
! ArrangeResult r = block.arrange(g2, RectangleConstraint.NONE,
! params);
! if (y + r.getHeight() <= height) {
itemsInColumn.add(block);
block.setBounds(
! new Rectangle2D.Double(x, y, r.getWidth(), r.getHeight())
);
! y = y + r.getHeight() + this.verticalGap;
! maxWidth = Math.max(maxWidth, r.getWidth());
}
else {
if (itemsInColumn.isEmpty()) {
// place in this column (truncated) anyway
! block.setBounds(new Rectangle2D.Double(x, y, r.getWidth(),
! Math.min(r.getHeight(), height - y)));
y = 0.0;
! x = x + r.getWidth() + this.horizontalGap;
}
else {
***************
*** 290,305 ****
x = x + maxWidth + this.horizontalGap;
y = 0.0;
! maxWidth = size.width;
! block.setBounds(
! new Rectangle2D.Double(
! x, y, size.width, Math.min(size.height, height)
! )
! );
! y = size.height + this.verticalGap;
itemsInColumn.add(block);
}
}
}
! return new ArrangeResult(new Size2D(x + maxWidth, constraint.getHeight()), null);
}
--- 293,305 ----
x = x + maxWidth + this.horizontalGap;
y = 0.0;
! maxWidth = r.getWidth();
! block.setBounds(new Rectangle2D.Double(x, y, r.getWidth(),
! Math.min(r.getHeight(), height)));
! y = r.getHeight() + this.verticalGap;
itemsInColumn.add(block);
}
}
}
! return new ArrangeResult(x + maxWidth, constraint.getHeight(), null);
}
|