/** * Arranges the blocks without any constraints. This puts all blocks * into a single row. * * @param container the container. * @param g2 the graphics device. * * @return The size after the arrangement. */ protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { List blocks = container.getBlocks(); Block b = (Block) blocks.get(0); Size2D s = b.arrange(g2, RectangleConstraint.NONE); b.setBounds(new Rectangle2D.Double(0.0, 0.0, s.width, s.height)); return new Size2D(s.width, s.height); }
/** * Arranges the container with no constraint on the width or height. * * @param container the container ({@code null} not permitted). * @param g2 the graphics device. * * @return The size. */ protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { double maxW = 0.0; double maxH = 0.0; List blocks = container.getBlocks(); Iterator iterator = blocks.iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); if (b != null) { Size2D s = b.arrange(g2, RectangleConstraint.NONE); maxW = Math.max(maxW, s.width); maxH = Math.max(maxH, s.height); } } double width = this.columns * maxW; double height = this.rows * maxH; RectangleConstraint c = new RectangleConstraint(width, height); return arrangeFF(container, g2, c); }
while (iterator.hasNext()) { Block block = (Block) iterator.next(); Rectangle2D bounds = block.getBounds(); Rectangle2D drawArea = new Rectangle2D.Double(bounds.getX() + area.getX(), bounds.getY() + area.getY(), bounds.getWidth(), bounds.getHeight()); Object r = block.draw(g2, drawArea, params); if (sec != null) { if (r instanceof EntityBlockResult) {
/** * Arranges the container with a fixed overall width and height. * * @param container the container ({@code null} not permitted). * @param g2 the graphics device. * @param constraint the constraint ({@code null} not permitted). * * @return The size following the arrangement. */ protected Size2D arrangeFF(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { double width = constraint.getWidth() / this.columns; double height = constraint.getHeight() / this.rows; List blocks = container.getBlocks(); for (int c = 0; c < this.columns; c++) { for (int r = 0; r < this.rows; r++) { int index = r * this.columns + c; if (index >= blocks.size()) { break; } Block b = (Block) blocks.get(index); if (b != null) { b.setBounds(new Rectangle2D.Double(c * width, r * height, width, height)); } } } return new Size2D(this.columns * width, this.rows * height); }
/** * Arranges the container with no constraint on the width or height. * * @param container the container (<code>null</code> not permitted). * @param g2 the graphics device. * * @return The size. */ protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { double maxW = 0.0; double maxH = 0.0; List blocks = container.getBlocks(); Iterator iterator = blocks.iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); if (b != null) { Size2D s = b.arrange(g2, RectangleConstraint.NONE); maxW = Math.max(maxW, s.width); maxH = Math.max(maxH, s.height); } } double width = this.columns * maxW; double height = this.rows * maxH; RectangleConstraint c = new RectangleConstraint(width, height); return arrangeFF(container, g2, c); }
while (iterator.hasNext()) { Block block = (Block) iterator.next(); Rectangle2D bounds = block.getBounds(); Rectangle2D drawArea = new Rectangle2D.Double(bounds.getX() + area.getX(), bounds.getY() + area.getY(), bounds.getWidth(), bounds.getHeight()); Object r = block.draw(g2, drawArea, params); if (sec != null) { if (r instanceof EntityBlockResult) {
/** * Arranges the container with a fixed overall width and height. * * @param container the container (<code>null</code> not permitted). * @param g2 the graphics device. * @param constraint the constraint (<code>null</code> not permitted). * * @return The size following the arrangement. */ protected Size2D arrangeFF(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { double width = constraint.getWidth() / this.columns; double height = constraint.getHeight() / this.rows; List blocks = container.getBlocks(); for (int c = 0; c < this.columns; c++) { for (int r = 0; r < this.rows; r++) { int index = r * this.columns + c; if (index >= blocks.size()) { break; } Block b = (Block) blocks.get(index); if (b != null) { b.setBounds(new Rectangle2D.Double(c * width, r * height, width, height)); } } } return new Size2D(this.columns * width, this.rows * height); }
/** * Arranges the blocks without any constraints. This puts all blocks * into a single row. * * @param container the container. * @param g2 the graphics device. * * @return The size after the arrangement. */ protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { List blocks = container.getBlocks(); Block b = (Block) blocks.get(0); Size2D s = b.arrange(g2, RectangleConstraint.NONE); b.setBounds(new Rectangle2D.Double(0.0, 0.0, s.width, s.height)); return new Size2D(s.width, s.height); }
LengthConstraintType.NONE); if (this.topBlock != null) { Size2D size = this.topBlock.arrange(g2, c1); w[0] = size.width; h[0] = size.height; Size2D size = this.bottomBlock.arrange(g2, c1); w[1] = size.width; h[1] = size.height; 0.0, null, LengthConstraintType.NONE); if (this.leftBlock != null) { Size2D size = this.leftBlock.arrange(g2, c2); w[2] = size.width; h[2] = size.height; LengthConstraintType.RANGE, 0.0, null, LengthConstraintType.NONE); Size2D size = this.rightBlock.arrange(g2, c3); w[3] = size.width; h[3] = size.height; - w[3], null, LengthConstraintType.FIXED, 0.0, null, LengthConstraintType.NONE); Size2D size = this.centerBlock.arrange(g2, c4); w[4] = size.width; h[4] = size.height;
double[] h = new double[5]; if (this.topBlock != null) { Size2D size = this.topBlock.arrange(g2, RectangleConstraint.NONE); w[0] = size.width; h[0] = size.height; Size2D size = this.bottomBlock.arrange(g2, RectangleConstraint.NONE); w[1] = size.width; Size2D size = this.leftBlock.arrange(g2, RectangleConstraint.NONE); w[2] = size.width; h[2] = size.height; Size2D size = this.rightBlock.arrange(g2, RectangleConstraint.NONE); w[3] = size.width; h[3] = size.height; Size2D size = this.centerBlock.arrange(g2, RectangleConstraint.NONE); w[4] = size.width; double height = h[0] + h[1] + centerHeight; if (this.topBlock != null) { this.topBlock.setBounds(new Rectangle2D.Double(0.0, 0.0, width, h[0])); this.bottomBlock.setBounds(new Rectangle2D.Double(0.0, height - h[1], width, h[1]));
LengthConstraintType.NONE); if (this.topBlock != null) { Size2D size = this.topBlock.arrange(g2, c1); w[0] = size.width; h[0] = size.height; Size2D size = this.bottomBlock.arrange(g2, c1); w[1] = size.width; h[1] = size.height; 0.0, null, LengthConstraintType.NONE); if (this.leftBlock != null) { Size2D size = this.leftBlock.arrange(g2, c2); w[2] = size.width; h[2] = size.height; LengthConstraintType.RANGE, 0.0, null, LengthConstraintType.NONE); Size2D size = this.rightBlock.arrange(g2, c3); w[3] = size.width; h[3] = size.height; - w[3], null, LengthConstraintType.FIXED, 0.0, null, LengthConstraintType.NONE); Size2D size = this.centerBlock.arrange(g2, c4); w[4] = size.width; h[4] = size.height;
double[] h = new double[5]; if (this.topBlock != null) { Size2D size = this.topBlock.arrange(g2, RectangleConstraint.NONE); w[0] = size.width; h[0] = size.height; Size2D size = this.bottomBlock.arrange(g2, RectangleConstraint.NONE); w[1] = size.width; Size2D size = this.leftBlock.arrange(g2, RectangleConstraint.NONE); w[2] = size.width; h[2] = size.height; Size2D size = this.rightBlock.arrange(g2, RectangleConstraint.NONE); w[3] = size.width; h[3] = size.height; Size2D size = this.centerBlock.arrange(g2, RectangleConstraint.NONE); w[4] = size.width; double height = h[0] + h[1] + centerHeight; if (this.topBlock != null) { this.topBlock.setBounds(new Rectangle2D.Double(0.0, 0.0, width, h[0])); this.bottomBlock.setBounds(new Rectangle2D.Double(0.0, height - h[1], width, h[1]));
Size2D s = b.arrange(g2, bc); maxH = Math.max(maxH, s.getHeight());
/** * Arranges the blocks in the container with a fixed width and no height * constraint. * * @param container the container. * @param g2 the graphics device. * @param constraint the constraint. * * @return The size. */ protected Size2D arrangeFN(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { List blocks = container.getBlocks(); Block b = (Block) blocks.get(0); Size2D s = b.arrange(g2, RectangleConstraint.NONE); double width = constraint.getWidth(); Rectangle2D bounds = new Rectangle2D.Double((width - s.width) / 2.0, 0.0, s.width, s.height); b.setBounds(bounds); return new Size2D((width - s.width) / 2.0, s.height); }
Size2D s = b.arrange(g2, bc); maxW = Math.max(maxW, s.getWidth());
/** * Arranges the blocks in the container with a fixed width and no height * constraint. * * @param container the container. * @param g2 the graphics device. * @param constraint the constraint. * * @return The size. */ protected Size2D arrangeFN(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { List blocks = container.getBlocks(); Block b = (Block) blocks.get(0); Size2D s = b.arrange(g2, RectangleConstraint.NONE); double width = constraint.getWidth(); Rectangle2D bounds = new Rectangle2D.Double((width - s.width) / 2.0, 0.0, s.width, s.height); b.setBounds(bounds); return new Size2D((width - s.width) / 2.0, s.height); }
Size2D s = b.arrange(g2, bc); maxH = Math.max(maxH, s.getHeight());
for (int i = 0; i < blocks.size(); i++) { Block block = (Block) blocks.get(i); sizes[i] = block.arrange(g2, RectangleConstraint.NONE); width = width + sizes[i].getWidth(); maxHeight = Math.max(sizes[i].height, maxHeight); block.setBounds( new Rectangle2D.Double( x, 0.0, sizes[i].width, sizes[i].height
Size2D s = b.arrange(g2, bc); maxW = Math.max(maxW, s.getWidth());
for (int i = 0; i < blocks.size(); i++) { Block block = (Block) blocks.get(i); Size2D size = block.arrange(g2, RectangleConstraint.NONE); if (x + size.width <= width) { itemsInRow.add(block); block.setBounds( new Rectangle2D.Double(x, y, size.width, size.height) ); if (itemsInRow.isEmpty()) { block.setBounds( new Rectangle2D.Double( x, y, Math.min(size.width, width - x), size.height y = y + maxHeight + this.verticalGap; maxHeight = size.height; block.setBounds( new Rectangle2D.Double( x, y, Math.min(size.width, width), size.height