mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 08:45:11 +00:00
Better GUI handling for Ability Making System
This commit is contained in:
1 parent
38d305ab99
commit
2c6ec0ce34
31 files changed
+792
-464
No files matched your search
@@ -24,12 +24,10 @@ public class FieldDef {
|
||||
private final String label;
|
||||
private final FieldType type;
|
||||
private String tab = null;
|
||||
private ColumnHint column = ColumnHint.FULL;
|
||||
private Supplier<Object> getter;
|
||||
private Consumer<Object> setter;
|
||||
private BooleanSupplier visibleWhen = () -> true;
|
||||
private BooleanSupplier enabledWhen = () -> true;
|
||||
private String tooltip = null;
|
||||
private String hoverText = null;
|
||||
|
||||
// Numeric range
|
||||
@@ -51,6 +49,10 @@ public class FieldDef {
|
||||
private Supplier<Integer> buttonTextColorSupplier;
|
||||
private Runnable clearAction;
|
||||
|
||||
// Row pairing (ROW type only)
|
||||
private FieldDef leftChild;
|
||||
private FieldDef rightChild;
|
||||
|
||||
private FieldDef(String label, FieldType type) {
|
||||
this.label = label;
|
||||
this.type = type;
|
||||
@@ -134,6 +136,17 @@ public class FieldDef {
|
||||
return def;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a two-column row pairing two fields side by side.
|
||||
* If one child is hidden (via visibleWhen), the other renders full-width.
|
||||
*/
|
||||
public static FieldDef row(FieldDef left, FieldDef right) {
|
||||
FieldDef def = new FieldDef("", FieldType.ROW);
|
||||
def.leftChild = left;
|
||||
def.rightChild = right;
|
||||
return def;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// CONVENIENCE FACTORIES (SUB_GUI wrappers)
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
@@ -206,11 +219,6 @@ public class FieldDef {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef column(ColumnHint column) {
|
||||
this.column = column;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef visibleWhen(BooleanSupplier condition) {
|
||||
this.visibleWhen = condition;
|
||||
return this;
|
||||
@@ -221,11 +229,6 @@ public class FieldDef {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef tooltip(String tooltip) {
|
||||
this.tooltip = tooltip;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef hover(String hoverText) {
|
||||
this.hoverText = hoverText;
|
||||
return this;
|
||||
@@ -253,10 +256,8 @@ public class FieldDef {
|
||||
public String getLabel() { return label; }
|
||||
public FieldType getType() { return type; }
|
||||
public String getTab() { return tab; }
|
||||
public ColumnHint getColumn() { return column; }
|
||||
public boolean isVisible() { return visibleWhen.getAsBoolean(); }
|
||||
public boolean isEnabled() { return enabledWhen.getAsBoolean(); }
|
||||
public String getTooltip() { return tooltip; }
|
||||
public String getHoverText() { return hoverText; }
|
||||
public float getMin() { return min; }
|
||||
public float getMax() { return max; }
|
||||
@@ -293,4 +294,7 @@ public class FieldDef {
|
||||
return buttonTextColorSupplier != null ? buttonTextColorSupplier.get() : null;
|
||||
}
|
||||
|
||||
public FieldDef getLeftChild() { return leftChild; }
|
||||
public FieldDef getRightChild() { return rightChild; }
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user