aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-06-30 20:14:03 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-06-30 20:14:03 +0300
commita991dd97d05f275bbd55049b18532fe748ba8514 (patch)
treed249b379792983b77fbd771bfc5db0a869d5c6c8 /src/main/java
parentd05fefa628604ab87181e7502b3674f8627b56f6 (diff)
downloadLibGui-a991dd97d05f275bbd55049b18532fe748ba8514.tar.gz
LibGui-a991dd97d05f275bbd55049b18532fe748ba8514.tar.bz2
LibGui-a991dd97d05f275bbd55049b18532fe748ba8514.zip
Deprecate WWidget.createPeers and recommend using validate() instead
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java5
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java5
4 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
index af09893..09b87fd 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
@@ -185,8 +185,9 @@ public class WBar extends WWidget {
}
@Override
- public void createPeers(GuiDescription c) {
- if (properties==null) properties = c.getPropertyDelegate();
+ public void validate(GuiDescription host) {
+ super.validate(host);
+ if (properties==null) properties = host.getPropertyDelegate();
}
/**
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
index 75c77cd..2aee0e7 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
@@ -191,8 +191,8 @@ public class WItemSlot extends WWidget {
}
@Override
- public void createPeers(GuiDescription c) {
- super.createPeers(c);
+ public void validate(GuiDescription host) {
+ super.validate(host);
peers.clear();
int index = startIndex;
@@ -204,7 +204,7 @@ public class WItemSlot extends WWidget {
slot.setTakingAllowed(takingAllowed);
slot.setFilter(filter);
peers.add(slot);
- c.addSlotPeer(slot);
+ host.addSlotPeer(slot);
index++;
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
index d657a01..259e93d 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
@@ -27,6 +27,7 @@ public abstract class WPanel extends WWidget {
@Environment(EnvType.CLIENT)
private BackgroundPainter backgroundPainter = null;
+ @SuppressWarnings("deprecation")
@Override
public void createPeers(GuiDescription c) {
super.createPeers(c);
@@ -176,6 +177,7 @@ public abstract class WPanel extends WWidget {
@Override
public void validate(GuiDescription c) {
+ super.validate(c);
layout();
for (WWidget child : children) {
child.validate(c);
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
index 7c1245a..8df8e14 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
@@ -310,9 +310,10 @@ public class WWidget {
/**
* Creates "heavyweight" component peers
* @param c the top-level Container that will hold the peers
+ * @deprecated All widget peers should be added in {@link #validate(GuiDescription)}.
*/
+ @Deprecated
public void createPeers(GuiDescription c) {
- host=c;
}
/**
@@ -363,7 +364,7 @@ public class WWidget {
* The host container must clear any heavyweight peers from its records before this method is called.
*/
public void validate(GuiDescription host) {
- //valid = true;
+ this.host = host;
}
/**