use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiShield method initRedstoneMode.
private void initRedstoneMode() {
redstoneMode = new ImageChoiceLabel(mc, this).addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeRedstoneMode();
}
}).addChoice(RedstoneMode.REDSTONE_IGNORED.getDescription(), "Redstone mode:\nIgnored", iconGuiElements, 0, 0).addChoice(RedstoneMode.REDSTONE_OFFREQUIRED.getDescription(), "Redstone mode:\nOff to activate", iconGuiElements, 16, 0).addChoice(RedstoneMode.REDSTONE_ONREQUIRED.getDescription(), "Redstone mode:\nOn to activate", iconGuiElements, 32, 0);
redstoneMode.setLayoutHint(new PositionalLayout.PositionalHint(62, 200, 16, 16));
redstoneMode.setCurrentChoice(tileEntity.getRedstoneMode().ordinal());
}
use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiRelay method createSubPanel.
private Panel createSubPanel(int side, String redstoneState) {
String labelText = String.valueOf(RelayTileEntity.DUNSWE.charAt(side));
int rf;
boolean input;
if ("Off".equals(redstoneState)) {
rf = tileEntity.getRfOff(side);
input = tileEntity.isInputModeOff(side);
} else {
rf = tileEntity.getRfOn(side);
input = tileEntity.isInputModeOn(side);
}
ImageChoiceLabel inputOutput = new ImageChoiceLabel(mc, this).setDesiredWidth(14).setDesiredHeight(14).addChoice("Output", "Side set to output mode", iconGuiElements, 80, 16).addChoice("Input", "Side set to input mode", iconGuiElements, 96, 16).addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeSettings();
}
});
String key = labelText + redstoneState;
if (input) {
inputOutput.setCurrentChoice("Input");
} else {
inputOutput.setCurrentChoice("Output");
}
inputOutputs.put(key, inputOutput);
TextField energyField = new TextField(mc, this).setTooltips("Amount of RF to input/output", "when redstone is " + redstoneState).setDesiredWidth(42).setDesiredHeight(14).addTextEvent(new TextEvent() {
@Override
public void textChanged(Widget parent, String newText) {
adjustEnergy((TextField) parent, 0);
}
});
energyField.setText(String.valueOf(rf));
Button sub100 = createEnergyOffsetButton(energyField, "-", -500);
Button add100 = createEnergyOffsetButton(energyField, "+", 500);
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(1)).addChild(inputOutput).addChild(sub100).addChild(energyField).addChild(add100);
energyValues.put(key, energyField);
return panel;
}
use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.
the class GuiSequencer method initGuiGrid.
private void initGuiGrid(Panel toplevel) {
for (int row = 0; row < 8; row++) {
Panel rowPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(13);
toplevel.addChild(rowPanel);
for (int col = 0; col < 8; col++) {
final int bit = row * 8 + col;
ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).addChoiceEvent(new ChoiceEvent() {
@Override
public void choiceChanged(Widget parent, String newChoice) {
changeBit(bit, newChoice);
}
}).setDesiredHeight(12).addChoice("0", "Disabled", iconGuiElements, 160, 0).addChoice("1", "Enabled", iconGuiElements, 176, 0);
choiceLabel.setCurrentChoice(tileEntity.getCycleBit(bit) ? 1 : 0);
bits.add(choiceLabel);
rowPanel.addChild(choiceLabel);
}
}
}
use of mcjty.lib.gui.events.ChoiceEvent 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.ChoiceEvent 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