Search in sources :

Example 6 with ChoiceLabel

use of mcjty.lib.gui.widgets.ChoiceLabel in project RFToolsControl by McJty.

the class NumberEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new VerticalLayout());
    typeLabel = new ChoiceLabel(mc, gui).addChoices("Integer", "Long", "Float", "Double").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Type:", typeLabel, "Type of the number"));
    field = new TextField(mc, gui).addTextEvent((parent, newText) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow());
    constantPanel.addChild(field);
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_NUMBER);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) TypeConverters(mcjty.rftoolscontrol.logic.TypeConverters) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Example 7 with ChoiceLabel

use of mcjty.lib.gui.widgets.ChoiceLabel in project RFToolsControl by McJty.

the class BooleanEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
    label = new ChoiceLabel(mc, gui).addChoices("*", "true", "false").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(label);
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_BOOLEAN);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 8 with ChoiceLabel

use of mcjty.lib.gui.widgets.ChoiceLabel in project RFToolsControl by McJty.

the class ExceptionEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
    label = new ChoiceLabel(mc, gui).setDesiredWidth(160);
    label.addChoices("*");
    for (ExceptionType exception : ExceptionType.values()) {
        label.addChoices(exception.getCode());
    }
    label.addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue()));
    constantPanel.addChild(label);
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_EXCEPTION);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) ExceptionType(mcjty.rftoolscontrol.logic.running.ExceptionType) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 9 with ChoiceLabel

use of mcjty.lib.gui.widgets.ChoiceLabel in project RFToolsControl by McJty.

the class InventoryEditor method build.

@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
    Panel constantPanel = new Panel(mc, gui).setLayout(new VerticalLayout());
    nameLabel = new TextField(mc, gui).addTextEvent((o, text) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow()).setDesiredWidth(50).setDesiredHeight(14);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Node name:", nameLabel, "Optional name of a node in the network"));
    sideLabel = new ChoiceLabel(mc, gui).addChoices("*", "Down", "Up", "North", "South", "West", "East").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Side:", sideLabel, "Side relative to processor or node", "for the desired inventory"));
    intSideLabel = new ChoiceLabel(mc, gui).addChoices("*", "Down", "Up", "North", "South", "West", "East").addChoiceEvent((parent, newChoice) -> callback.valueChanged(readValue())).setDesiredWidth(60);
    constantPanel.addChild(createLabeledPanel(mc, gui, "Access:", intSideLabel, "Optional side from which we want to", "access the given inventory"));
    createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_INVENTORY);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) EnumFacing(net.minecraft.util.EnumFacing) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) StringUtils(org.apache.commons.lang3.StringUtils) Inventory(mcjty.rftoolscontrol.api.parameters.Inventory) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Example 10 with ChoiceLabel

use of mcjty.lib.gui.widgets.ChoiceLabel in project RFTools by McJty.

the class GuiInvChecker method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    amountField = new TextField(mc, this).setTooltips("Set the amount of items in slot").setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14)).addTextEvent((parent, newText) -> setAmount());
    int amount = tileEntity.getAmount();
    amountField.setText(String.valueOf(amount));
    slotField = new TextField(mc, this).setTooltips("Set the slot index").setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14)).addTextEvent((parent, newText) -> setSlot());
    int current = tileEntity.getSlot();
    slotField.setText(String.valueOf(current));
    metaLabel = new ChoiceLabel(mc, this).addChoices(META_IGNORE, META_MATCH).addChoiceEvent((parent, newChoice) -> setMetaUsage()).setChoiceTooltip(META_IGNORE, "Ignore meta/damage on item").setChoiceTooltip(META_MATCH, "Meta/damage on item must match");
    metaLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
    metaLabel.setChoice(tileEntity.isUseMeta() ? META_MATCH : META_IGNORE);
    oreDictLabel = new ChoiceLabel(mc, this).addChoices(OREDICT_IGNORE, OREDICT_USE).addChoiceEvent((parent, newChoice) -> setOredictUsage()).setChoiceTooltip(OREDICT_IGNORE, "Ingore ore dictionary").setChoiceTooltip(OREDICT_USE, "Use ore dictionary matching");
    oreDictLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 51, 80, 14));
    oreDictLabel.setChoice(tileEntity.isOreDict() ? OREDICT_USE : OREDICT_IGNORE);
    toplevel.addChild(new Label(mc, this).setText("Slot:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(slotField).addChild(new Label(mc, this).setText("Amount:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(amountField).addChild(new Label(mc, this).setText("Meta:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(metaLabel).addChild(new Label(mc, this).setText("Oredict:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 51, 50, 14))).addChild(oreDictLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) Window(mcjty.lib.gui.Window) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) TextField(mcjty.lib.gui.widgets.TextField)

Aggregations

ChoiceLabel (mcjty.lib.gui.widgets.ChoiceLabel)11 Panel (mcjty.lib.gui.widgets.Panel)10 Window (mcjty.lib.gui.Window)8 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)5 TextField (mcjty.lib.gui.widgets.TextField)5 Argument (mcjty.lib.network.Argument)5 Label (mcjty.lib.gui.widgets.Label)4 java.awt (java.awt)3 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)3 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)3 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)3 RFTools (mcjty.rftools.RFTools)3 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)3 ParameterType (mcjty.rftoolscontrol.api.parameters.ParameterType)3 ParameterValue (mcjty.rftoolscontrol.api.parameters.ParameterValue)3 Minecraft (net.minecraft.client.Minecraft)3 Gui (net.minecraft.client.gui.Gui)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)2 EnumFacing (net.minecraft.util.EnumFacing)2