1 | if (blockCount > 0) {↵ | | 1 | if (blockCount > 0) {↵
|
2 | Size2D[] sizes = new Size2D[blocks.size()];↵ | | 2 | Size2D[] sizes = new Size2D[blocks.size()];↵
|
3 | for (int i = 0; i < blocks.size(); i++) {↵ | | 3 | for (int i = 0; i < blocks.size(); i++) {↵
|
4 | Block block = (Block) blocks.get(i);↵ | | 4 | Block block = (Block) blocks.get(i);↵
|
5 | sizes[i] = block.arrange(g2, RectangleConstraint.NONE);↵ | | 5 | sizes[i] = block.arrange(g2, RectangleConstraint.NONE);↵
|
6 | height = height + sizes[i].getHeight();↵ | | 6 | width = width + sizes[i].getWidth();↵
|
7 | maxWidth = Math.max(sizes[i].width, maxWidth);↵ | | 7 | maxHeight = Math.max(sizes[i].height, maxHeight);↵
|
8 | block.setBounds(↵ | | 8 | block.setBounds(↵
|
9 | new Rectangle2D.Double(↵ | | 9 | new Rectangle2D.Double(↵
|
10 | 0.0, y, sizes[i].width, sizes[i].height↵ | | 10 | x, 0.0, sizes[i].width, sizes[i].height↵
|
11 | )↵ | | 11 | )↵
|
12 | );↵ | | 12 | );↵
|
13 | y = y + sizes[i].height + this.verticalGap;↵ | | 13 | x = x + sizes[i].width + this.horizontalGap;↵
|
14 | }↵ | | 14 | }↵
|
15 | if (blockCount > 1) {↵ | | 15 | if (blockCount > 1) {↵
|
16 | height = height + this.verticalGap * (blockCount - 1); ↵ | | 16 | width = width + this.horizontalGap * (blockCount - 1); ↵
|
17 | }↵ | | 17 | }↵
|
18 | if (this.horizontalAlignment != HorizontalAlignment.LEFT) {↵ | | 18 | if (this.verticalAlignment != VerticalAlignment.TOP) {↵
|
19 | for (int i = 0; i < blocks.size(); i++) {↵ | | 19 | for (int i = 0; i < blocks.size(); i++) {↵
|
20 | //Block b = (Block) blocks.get(i);↵ | | 20 | //Block b = (Block) blocks.get(i);↵
|
21 | if (this.horizontalAlignment ↵ | | 21 | if (this.verticalAlignment ↵
|
22 | == HorizontalAlignment.CENTER) {↵ | | 22 | == VerticalAlignment.CENTER) {↵
|
23 | //TODO: shift block right by half↵ | | 23 | //TODO: shift block down by half↵
|
24 | }↵ | | 24 | }↵
|
25 | else if (this.horizontalAlignment ↵ | | 25 | else if (this.verticalAlignment ↵
|
26 | == HorizontalAlignment.RIGHT) {↵ | | 26 | == VerticalAlignment.BOTTOM) {↵
|
27 | //TODO: shift block over to right↵ | | 27 | //TODO: shift block down to bottom↵
|
28 | }↵ | | 28 | }↵
|
29 | } ↵ | | 29 | } ↵
|
30 | }↵ | | 30 | }↵
|
31 | } | | 31 | }
|