use of mcjty.lib.gui.layout.PositionalLayout in project XNet by McJty.
the class GuiRouter method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackgrounds(sideBackground, mainBackground).setBackgroundLayout(true, SIDEWIDTH);
toplevel.setBounds(new Rectangle(guiLeft - SIDEWIDTH, guiTop, xSize + SIDEWIDTH, ySize));
toplevel.addChild(initLocalChannelListPanel());
toplevel.addChild(initRemoteChannelListPanel());
toplevel.addChild(new Label<>(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("Local Channels").setColor(0xff2244aa).setLayoutHint(new PositionalLayout.PositionalHint(6, 8, 166, 13)));
toplevel.addChild(new Label<>(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("Remote Channels").setColor(0xff2244aa).setLayoutHint(new PositionalLayout.PositionalHint(172, 8, 164, 13)));
window = new Window(this, toplevel);
refresh();
listDirty = 0;
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiProgrammer method createValuePanel.
private Panel createValuePanel(ParameterDescription parameter, IIcon icon, IconHolder iconHolder, String tempDefault, boolean constantOnly) {
Label<?> label = (Label<?>) new Label(mc, this).setText(StringUtils.capitalize(parameter.getName()) + ":").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredHeight(13).setLayoutHint(new PositionalLayout.PositionalHint(0, 0, 53, 13));
List<String> description = new ArrayList<>(parameter.getDescription());
if (parameter.isOptional()) {
description.set(description.size() - 1, description.get(description.size() - 1) + TextFormatting.GOLD + " [Optional]");
}
if (tempDefault != null && !tempDefault.isEmpty()) {
description.add(TextFormatting.BLUE + tempDefault);
}
String[] tooltips = description.toArray(new String[description.size()]);
TextField field = new TextField(mc, this).setText(tempDefault).setTooltips(tooltips).setDesiredHeight(13).setEditable(false).setLayoutHint(new PositionalLayout.PositionalHint(0, 12, 68, 13));
Button button = new Button(mc, this).setText("...").setDesiredHeight(13).setTooltips(tooltips).addButtonEvent(w -> openValueEditor(icon, iconHolder, parameter, field, constantOnly)).setLayoutHint(new PositionalLayout.PositionalHint(58, 0, 11, 13));
return new Panel(mc, this).setLayout(new PositionalLayout()).addChild(label).addChild(field).addChild(button).setDesiredWidth(68);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiProcessor method openValueEditor.
private void openValueEditor(int varIdx) {
if (fromServer_vars == null || varIdx > fromServer_vars.size()) {
return;
}
if (fromServer_vars.get(varIdx) == null) {
GuiTools.showMessage(mc, this, getWindowManager(), 50, 50, "Variable is not defined!");
return;
}
Parameter parameter = fromServer_vars.get(varIdx);
if (parameter == null) {
GuiTools.showMessage(mc, this, getWindowManager(), 50, 50, "Variable is not defined!");
return;
}
ParameterType type = parameter.getParameterType();
ParameterEditor editor = ParameterEditors.getEditor(type);
Panel editPanel;
if (editor != null) {
editPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setFilledRectThickness(1);
editor.build(mc, this, editPanel, o -> {
NBTTagCompound tag = new NBTTagCompound();
ParameterTypeTools.writeToNBT(tag, type, o);
RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketVariableToServer(tileEntity.getPos(), varIdx, tag));
});
editor.writeValue(parameter.getParameterValue());
editor.constantOnly();
} else {
return;
}
Panel panel = new Panel(mc, this).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
panel.setBounds(new Rectangle(50, 50, 200, 60 + editor.getHeight()));
Window modalWindow = getWindowManager().createModalWindow(panel);
panel.addChild(new Label(mc, this).setText("Var " + varIdx + ":"));
panel.addChild(editPanel);
panel.addChild(new Button(mc, this).addButtonEvent(w -> {
getWindowManager().closeWindow(modalWindow);
}).setText("Close"));
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiCraftingCard method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
toplevel.addChild(new Label(mc, this).setText("Regular 3x3 crafting recipe").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 4, 160, 14)));
toplevel.addChild(new Label(mc, this).setText("or more complicated recipes").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 17, 160, 14)));
toplevel.addChild(new Button(mc, this).setText("Update").setTooltips("Update the item in the output", "slot to the recipe in the", "3x3 grid").addButtonEvent(parent -> RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketSendServerCommand(RFToolsControl.MODID, CommandHandler.CMD_TESTRECIPE, Arguments.EMPTY))).setLayoutHint(new PositionalLayout.PositionalHint(110, 57, 60, 14)));
ToggleButton toggle = new ToggleButton(mc, this).setCheckMarker(true).setText("NBT").setTooltips("Enable this if you want", "opcodes like 'get_ingredients'", "to strictly match on NBT").setLayoutHint(new PositionalLayout.PositionalHint(110, 74, 60, 14));
ItemStack heldItem = mc.player.getHeldItem(EnumHand.MAIN_HAND);
if (!heldItem.isEmpty()) {
toggle.setPressed(CraftingCardItem.isStrictNBT(heldItem));
}
toggle.addButtonEvent(parent -> {
RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketUpdateNBTItemCard(new Argument("strictnbt", toggle.isPressed())));
});
toplevel.addChild(toggle);
for (int y = 0; y < GRID_HEIGHT; y++) {
for (int x = 0; x < GRID_WIDTH; x++) {
int idx = y * GRID_WIDTH + x;
createDummySlot(toplevel, idx, new PositionalLayout.PositionalHint(x * 18 + 10, y * 18 + 37, 18, 18), createSelectionEvent(idx));
}
}
createDummySlot(toplevel, INPUT_SLOTS, new PositionalLayout.PositionalHint(10 + 8 * 18, 37, 18, 18), createSelectionEvent(INPUT_SLOTS));
updateSlots();
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsControl by McJty.
the class GuiMultiTank method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
for (int i = 0; i < TANKS; i++) {
liquids[i] = new BlockRender(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(10, 9 + i * 18, 16, 16));
toplevel.addChild(liquids[i]);
labels[i] = new Label(mc, this);
labels[i].setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setVerticalAlignment(VerticalAlignment.ALIGN_CENTER).setLayoutHint(new PositionalLayout.PositionalHint(32, 9 + i * 18, WIDTH - 32 - 6, 16));
toplevel.addChild(labels[i]);
}
window = new Window(this, toplevel);
}
Aggregations