mirror of
https://github.com/GTNewHorizons/JustEnoughCalculation.git
synced 2026-11-28 07:35:41 +00:00
chore: clean up
This commit is contained in:
1 parent
6c80a421fe
commit
ea1eab8685
32 files changed
+418
-358
No files matched your search
@@ -25,18 +25,17 @@ public class WLabelScroll extends WContainer implements ISearchable {
|
||||
protected WScroll scroll;
|
||||
protected int xPos, yPos, column, row, current;
|
||||
protected String filter = "";
|
||||
protected Consumer<ILabel> lsnrUpdate;
|
||||
protected ListenerValue<? super WLabelScroll, ILabel> listener;
|
||||
|
||||
public WLabelScroll(int xPos, int yPos, int column, int row, WLabel.enumMode mode, boolean drawConnection) {
|
||||
public WLabelScroll(int xPos, int yPos, int column, int row, WLabel.Mode mode, boolean drawConnection) {
|
||||
this.xPos = xPos;
|
||||
this.yPos = yPos;
|
||||
this.column = column;
|
||||
this.row = row;
|
||||
labelGroup = new WLabelGroup(xPos, yPos, column, row, mode)
|
||||
.setLsnrUpdate(i -> {
|
||||
if (lsnrUpdate != null) lsnrUpdate.accept(labels.get(i + current * column));
|
||||
});
|
||||
scroll = new WScroll(xPos + column * 18 + 4, yPos, row * 18).setLsnrScroll(this::update);
|
||||
labelGroup = new WLabelGroup(xPos, yPos, column, row, mode).setListener((i, v) -> {
|
||||
if (listener != null) listener.invoke(this, i.get(v));
|
||||
});
|
||||
scroll = new WScroll(xPos + column * 18 + 4, yPos, row * 18).setListener(i -> update(i.getCurrent()));
|
||||
add(labelGroup);
|
||||
add(scroll);
|
||||
if (drawConnection) add(new WRectangle(xPos + column * 18, yPos, 4, row * 18, JecaGui.COLOR_GUI_GREY));
|
||||
@@ -82,16 +81,11 @@ public class WLabelScroll extends WContainer implements ISearchable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public WLabelScroll setLsnrUpdate(Consumer<ILabel> lsnr) {
|
||||
lsnrUpdate = lsnr;
|
||||
public WLabelScroll setListener(ListenerValue<? super WLabelScroll, ILabel> listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ILabel getLabelAt(int index) {
|
||||
return labelGroup.getLabelAt(index - current * column);
|
||||
}
|
||||
|
||||
|
||||
private int getStepAmount() {
|
||||
int line = (labels.size() + column - 1) / column;
|
||||
return Math.max(line - row + 1, 1);
|
||||
|
||||
Reference in new issue
Block a user