use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.
the class GuiStorageScanner method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored(ForgeDirection.DOWN);
energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setVertical().setDesiredWidth(10).setDesiredHeight(84).setMaxValue(maxEnergyStored).setShowText(false);
energyBar.setValue(tileEntity.getCurrentRF());
storageList = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
itemList.removeChildren();
tileEntity.clearShowingItems();
getInventoryOnServer();
}
@Override
public void doubleClick(Widget parent, int index) {
hilightSelectedContainer(index);
}
});
Slider storageListSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(storageList);
Panel topPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(1)).setDesiredHeight(90).addChild(energyBar).addChild(storageList).addChild(storageListSlider);
itemList = new WidgetList(mc, this);
Slider itemListSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(itemList);
Panel midPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(1)).addChild(itemList).addChild(itemListSlider);
scanButton = new Button(mc, this).setText("Scan").setDesiredWidth(50).setDesiredHeight(14).addButtonEvent(new ButtonEvent() {
@Override
public void buttonClicked(Widget parent) {
startStopScan();
}
}).setTooltips("Start/stop a scan of", "all storage units", "in radius");
progressBar = new EnergyBar(mc, this).setShowText(false).setEnergyOnColor(0xff0022ee).setEnergyOffColor(0xff111163).setSpacerColor(0xff000043).setHorizontal().setMaxValue(100).setDesiredWidth(30).setValue(0);
radiusLabel = new ScrollableLabel(mc, this).addValueEvent(new ValueEvent() {
@Override
public void valueChanged(Widget parent, int newValue) {
changeRadius(newValue);
}
}).setRealMinimum(1).setRealMaximum(20).setDesiredWidth(30);
radiusLabel.setRealValue(tileEntity.getRadius());
TextField textField = new TextField(mc, this).addTextEvent(new TextEvent() {
@Override
public void textChanged(Widget parent, String newText) {
storageList.clearHilightedRows();
fromServer_coordinates.clear();
startSearch(newText);
}
});
Panel searchPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(18).addChild(new Label(mc, this).setText("Search:")).addChild(textField);
Slider radiusSlider = new Slider(mc, this).setHorizontal().setTooltips("Radius of scan").setMinimumKnobSize(12).setScrollable(radiusLabel);
Panel scanPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(18).addChild(scanButton).addChild(progressBar).addChild(radiusSlider).addChild(radiusLabel);
Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout().setSpacing(1).setVerticalMargin(3)).addChild(topPanel).addChild(midPanel).addChild(searchPanel).addChild(scanPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
tileEntity.requestRfFromServer(RFToolsMessages.INSTANCE);
}
use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.
the class GuiDimensionMonitor method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
alarmLevel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent(new ValueEvent() {
@Override
public void valueChanged(Widget parent, int newValue) {
changeAlarmValue(newValue);
}
});
Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setHorizontal().setTooltips("Alarm level").setScrollable(alarmLevel);
Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmLevel).addChild(alarmSlider);
toplevel.addChild(bottomPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, MONITOR_WIDTH, MONITOR_HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.
the class GuiEnvironmentalController method initGui.
@Override
public void initGui() {
super.initGui();
toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
int r = tileEntity.getRadius();
if (r < 5) {
r = 5;
} else if (r > 100) {
r = 100;
}
int miny = tileEntity.getMiny();
int maxy = tileEntity.getMaxy();
Panel radiusPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(25, 6, ENV_WIDTH - 30, 16));
ScrollableLabel radius = new ScrollableLabel(mc, this).setRealMinimum(5).setRealMaximum(100).setRealValue(r).setDesiredWidth(24).addValueEvent(new ValueEvent() {
@Override
public void valueChanged(Widget parent, int newValue) {
sendServerCommand(RFToolsMessages.INSTANCE, EnvironmentalControllerTileEntity.CMD_SETRADIUS, new Argument("radius", newValue));
}
});
Slider slider = new Slider(mc, this).setHorizontal().setScrollable(radius).setMinimumKnobSize(12);
radiusPanel.addChild(new Label(mc, this).setText("Radius:")).addChild(slider).addChild(radius);
Panel minPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(25, 24, ENV_WIDTH - 30, 16));
minyTextField = new TextField(mc, this).setText(Integer.toString(miny)).addTextEvent(new TextEvent() {
@Override
public void textChanged(Widget parent, String newText) {
sendBounds(true);
}
});
maxyTextField = new TextField(mc, this).setText(Integer.toString(maxy)).addTextEvent(new TextEvent() {
@Override
public void textChanged(Widget parent, String newText) {
sendBounds(false);
}
});
minPanel.addChild(new Label(mc, this).setText("Height:")).addChild(minyTextField).addChild(maxyTextField);
playersList = new WidgetList(mc, this);
Slider playerSlider = new Slider(mc, this).setDesiredWidth(11).setVertical().setScrollable(playersList);
Panel playersPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 42, ENV_WIDTH - 30, 72)).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(playersList).addChild(playerSlider);
Panel controlPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25, 118, ENV_WIDTH - 30, 16)).setLayout(new HorizontalLayout().setHorizontalMargin(1).setVerticalMargin(0).setSpacing(1));
ChoiceLabel blacklist = new ChoiceLabel(mc, this).addChoices(MODE_BLACKLIST, MODE_WHITELIST).setDesiredWidth(30).setDesiredHeight(15).setChoiceTooltip(MODE_BLACKLIST, "Players in the list above will not get the effects").setChoiceTooltip(MODE_WHITELIST, "Players in the list above will get the effects").addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeBlacklistMode(newChoice);
}
});
if (tileEntity.isWhitelistMode()) {
blacklist.setChoice(MODE_WHITELIST);
} else {
blacklist.setChoice(MODE_BLACKLIST);
}
addButton = new Button(mc, this).setText("+").setDesiredHeight(15).setTooltips("Add a player to the list").addButtonEvent(new ButtonEvent() {
@Override
public void buttonClicked(Widget parent) {
addPlayer();
}
});
delButton = new Button(mc, this).setText("-").setDesiredHeight(15).setTooltips("Remove selected player from the list").addButtonEvent(new ButtonEvent() {
@Override
public void buttonClicked(Widget parent) {
delPlayer();
}
});
nameField = new TextField(mc, this);
initRedstoneMode();
controlPanel.addChild(blacklist).addChild(addButton).addChild(delButton).addChild(nameField).addChild(redstoneMode);
toplevel.addChild(radiusPanel).addChild(minPanel).addChild(playersPanel).addChild(controlPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
listDirty = 0;
requestPlayers();
}
use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.
the class GuiRFMonitor method initGui.
@Override
public void initGui() {
super.initGui();
list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
setSelectedBlock(index);
}
});
listDirty = 0;
Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(list);
Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(list).addChild(listSlider);
alarmModeChoiceLabel = new ChoiceLabel(mc, this).addChoices(RFMonitorMode.MODE_OFF.getDescription(), RFMonitorMode.MODE_LESS.getDescription(), RFMonitorMode.MODE_MORE.getDescription()).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Control when a redstone", "signal should be sent").addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeAlarmMode(RFMonitorMode.getModeFromDescription(newChoice));
}
});
alarmModeChoiceLabel.setChoice(tileEntity.getAlarmMode().getDescription());
alarmLabel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent(new ValueEvent() {
@Override
public void valueChanged(Widget parent, int newValue) {
changeAlarmValue(newValue);
}
});
Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setHorizontal().setMinimumKnobSize(15).setTooltips("Alarm level").setScrollable(alarmLabel);
Panel alarmPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmModeChoiceLabel).addChild(alarmSlider).addChild(alarmLabel).setDesiredHeight(20);
Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(listPanel).addChild(alarmPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
fromServer_clientAdjacentBlocks = new ArrayList<Coordinate>();
RFToolsMessages.INSTANCE.sendToServer(new PacketGetAdjacentBlocks(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
}
use of mcjty.lib.gui.events.ValueEvent in project RFTools by McJty.
the class GuiLiquidMonitor method initGui.
@Override
public void initGui() {
super.initGui();
list = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
setSelectedBlock(index);
}
});
listDirty = 0;
Slider listSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(list);
Panel listPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(list).addChild(listSlider);
alarmModeChoiceLabel = new ChoiceLabel(mc, this).addChoices(RFMonitorMode.MODE_OFF.getDescription(), RFMonitorMode.MODE_LESS.getDescription(), RFMonitorMode.MODE_MORE.getDescription()).setDesiredWidth(60).setDesiredHeight(15).setTooltips("Control when a redstone", "signal should be sent").addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeAlarmMode(RFMonitorMode.getModeFromDescription(newChoice));
}
});
alarmModeChoiceLabel.setChoice(tileEntity.getAlarmMode().getDescription());
alarmLabel = new ScrollableLabel(mc, this).setSuffix("%").setDesiredWidth(30).setRealMinimum(0).setRealMaximum(100).setRealValue(tileEntity.getAlarmLevel()).addValueEvent(new ValueEvent() {
@Override
public void valueChanged(Widget parent, int newValue) {
changeAlarmValue(newValue);
}
});
Slider alarmSlider = new Slider(mc, this).setDesiredHeight(15).setMinimumKnobSize(15).setHorizontal().setTooltips("Alarm level").setScrollable(alarmLabel);
Panel alarmPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(alarmModeChoiceLabel).addChild(alarmSlider).addChild(alarmLabel).setDesiredHeight(20);
Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(listPanel).addChild(alarmPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
fromServer_clientAdjacentBlocks = new ArrayList<Coordinate>();
RFToolsMessages.INSTANCE.sendToServer(new PacketGetAdjacentTankBlocks(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
}
Aggregations