Skip to content

Commit ec3a8fb

Browse files
author
HackusatePvP
committed
Added LayoutContainer.
1 parent ca0fd31 commit ec3a8fb

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package me.piitex.renjava.gui.containers;
2+
3+
import javafx.scene.Node;
4+
import javafx.scene.layout.BorderPane;
5+
import me.piitex.renjava.gui.Container;
6+
import me.piitex.renjava.gui.DisplayOrder;
7+
8+
import java.util.AbstractMap;
9+
import java.util.LinkedList;
10+
import java.util.Map;
11+
12+
public class LayoutContainer extends Container {
13+
private Node right, middle, left, top, bottom;
14+
15+
public LayoutContainer(double width, double height) {
16+
super(0, 0, width, height);
17+
}
18+
19+
public LayoutContainer(double x, double y, double width, double height) {
20+
super(x, y, width, height);
21+
}
22+
23+
public LayoutContainer(double x, double y, double width, double height, DisplayOrder order) {
24+
super(x, y, width, height, order);
25+
}
26+
27+
public Node getRight() {
28+
return right;
29+
}
30+
31+
public void setRight(Node right) {
32+
this.right = right;
33+
}
34+
35+
public Node getMiddle() {
36+
return middle;
37+
}
38+
39+
public void setMiddle(Node middle) {
40+
this.middle = middle;
41+
}
42+
43+
public Node getLeft() {
44+
return left;
45+
}
46+
47+
public void setLeft(Node left) {
48+
this.left = left;
49+
}
50+
51+
public Node getTop() {
52+
return top;
53+
}
54+
55+
public void setTop(Node top) {
56+
this.top = top;
57+
}
58+
59+
public Node getBottom() {
60+
return bottom;
61+
}
62+
63+
public void setBottom(Node bottom) {
64+
this.bottom = bottom;
65+
}
66+
67+
@Override
68+
public Map.Entry<Node, LinkedList<Node>> build() {
69+
BorderPane borderPane = new BorderPane();
70+
if (left != null)
71+
borderPane.setLeft(left);
72+
if (middle != null)
73+
borderPane.setCenter(middle);
74+
if (right != null)
75+
borderPane.setRight(right);
76+
if (top != null)
77+
borderPane.setTop(top);
78+
if (bottom != null)
79+
borderPane.setTop(top);
80+
81+
borderPane.setTranslateX(getX());
82+
borderPane.setTranslateY(getY());
83+
borderPane.setPrefSize(getWidth(), getHeight());
84+
85+
LinkedList<Node> lowOrder = new LinkedList<>();
86+
LinkedList<Node> normalOrder = new LinkedList<>();
87+
LinkedList<Node> highOrder = new LinkedList<>();
88+
buildBase(lowOrder, normalOrder, highOrder);
89+
90+
return new AbstractMap.SimpleEntry<>(borderPane, lowOrder);
91+
}
92+
}

0 commit comments

Comments
 (0)