use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiStorageScanner method makeStoragePanel.
private Panel makeStoragePanel(Panel energyPanel) {
storageList = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
getInventoryOnServer();
}
@Override
public void doubleClick(Widget parent, int index) {
hilightSelectedContainer(index);
}
}).setPropagateEventsToChildren(true);
Slider storageListSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(storageList);
return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(1)).setLayoutHint(new PositionalLayout.PositionalHint(3, 4, getStoragePanelWidth(), 86 + 54)).setDesiredHeight(86 + 54).addChild(energyPanel).addChild(storageList).addChild(storageListSlider);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiStorageScanner method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setVertical().setDesiredWidth(10).setDesiredHeight(50).setMaxValue(maxEnergyStored).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
openViewButton = new ToggleButton(mc, this).setCheckMarker(false).setText("V").setTooltips("Toggle wide storage list");
openViewButton.setPressed(tileEntity.isOpenWideView());
openViewButton.addButtonEvent(widget -> toggleView());
upButton = new Button(mc, this).setText("U").setTooltips("Move inventory up").addButtonEvent(widget -> moveUp());
topButton = new Button(mc, this).setText("T").setTooltips("Move inventory to the top").addButtonEvent(widget -> moveTop());
downButton = new Button(mc, this).setText("D").setTooltips("Move inventory down").addButtonEvent(widget -> moveDown());
bottomButton = new Button(mc, this).setText("B").setTooltips("Move inventory to the bottom").addButtonEvent(widget -> moveBottom());
removeButton = new Button(mc, this).setText("R").setTooltips("Remove inventory from list").addButtonEvent(widget -> removeFromList());
Panel energyPanel = new Panel(mc, this).setLayout(new VerticalLayout().setVerticalMargin(0).setSpacing(1)).setDesiredWidth(10);
energyPanel.addChild(openViewButton).addChild(energyBar).addChild(topButton).addChild(upButton).addChild(downButton).addChild(bottomButton).addChild(new Label(mc, this).setText(" ")).addChild(removeButton);
exportToStarred = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(12, 223, 13, 13)).addChoiceEvent((parent, newChoice) -> changeExportMode());
exportToStarred.addChoice("No", "Export to current container", guielements, 131, 19);
exportToStarred.addChoice("Yes", "Export to first routable container", guielements, 115, 19);
storagePanel = makeStoragePanel(energyPanel);
itemPanel = makeItemPanel();
Button scanButton = new Button(mc, this).setText("Scan").setDesiredWidth(50).setDesiredHeight(14).addButtonEvent(parent -> RFToolsMessages.INSTANCE.sendToServer(new PacketGetInfoFromServer(RFTools.MODID, new InventoriesInfoPacketServer(tileEntity.getDimension(), tileEntity.getStorageScannerPos(), true))));
if (RFTools.instance.xnet) {
if (StorageScannerConfiguration.xnetRequired) {
scanButton.setTooltips("Do a scan of all", "storage units connected", "with an active XNet channel");
} else {
scanButton.setTooltips("Do a scan of all", "storage units in radius", "Use 'xnet' radius to", "restrict to XNet only");
}
} else {
scanButton.setTooltips("Do a scan of all", "storage units in radius");
}
radiusLabel = new ScrollableLabel(mc, this).addValueEvent((parent, newValue) -> changeRadius(newValue)).setRealMinimum(RFTools.instance.xnet ? 0 : 1).setRealMaximum(20);
radiusLabel.setRealValue(tileEntity.getRadius());
visibleRadiusLabel = new Label(mc, this);
visibleRadiusLabel.setDesiredWidth(40);
searchField = new TextField(mc, this).addTextEvent((parent, newText) -> {
storageList.clearHilightedRows();
fromServer_foundInventories.clear();
startSearch(newText);
});
Panel searchPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(8, 142, 256 - 11, 18)).setLayout(new HorizontalLayout()).setDesiredHeight(18).addChild(new Label(mc, this).setText("Search:")).addChild(searchField);
Slider radiusSlider = new Slider(mc, this).setHorizontal().setTooltips("Radius of scan").setMinimumKnobSize(12).setDesiredHeight(14).setScrollable(radiusLabel);
Panel scanPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(8, 162, 74, 54)).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground).setLayout(new VerticalLayout().setVerticalMargin(6).setSpacing(1)).addChild(scanButton);
if (!(RFTools.instance.xnet && StorageScannerConfiguration.xnetRequired)) {
scanPanel.addChild(radiusSlider);
}
scanPanel.addChild(visibleRadiusLabel);
if (tileEntity.isDummy()) {
scanButton.setEnabled(false);
radiusLabel.setVisible(false);
radiusSlider.setVisible(false);
}
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(storagePanel).addChild(itemPanel).addChild(searchPanel).addChild(scanPanel).addChild(exportToStarred);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
fromServer_foundInventories.clear();
fromServer_inventory.clear();
if (tileEntity.isDummy()) {
fromServer_inventories.clear();
} else {
tileEntity.requestRfFromServer(RFTools.MODID);
}
BlockPos pos = tileEntity.getCraftingGridContainerPos();
craftingGrid.initGui(modBase, network, mc, this, pos, tileEntity.getCraftingGridProvider(), guiLeft, guiTop, xSize, ySize);
sendServerCommand(RFTools.MODID, CommandHandler.CMD_REQUEST_GRID_SYNC, Arguments.builder().value(pos).build());
if (StorageScannerConfiguration.hilightStarredOnGuiOpen) {
storageList.setSelected(0);
}
init = true;
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class StringEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
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_STRING);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class VectorEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
constantPanel.addChild(new Label(mc, gui).setText("No constant editor"));
createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_VECTOR);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project XNet by McJty.
the class GuiRouter method makeChannelLine.
private Panel makeChannelLine(ControllerChannelClientInfo channel, boolean local) {
String name = channel.getChannelName();
String publishedName = channel.getPublishedName();
BlockPos controllerPos = channel.getPos();
IChannelType type = channel.getChannelType();
int index = channel.getIndex();
Panel panel = new Panel(mc, this).setLayout(new PositionalLayout()).setDesiredHeight(30);
Panel panel1 = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(0).setSpacing(0)).setLayoutHint(new PositionalLayout.PositionalHint(0, 0, 160, 13));
panel1.addChild(new Label<>(mc, this).setText("Ch").setColor(0xff2244aa));
panel1.addChild(new Label<>(mc, this).setText(name));
panel1.addChild(new Label<>(mc, this).setText(">").setColor(0xff2244aa));
if (local) {
TextField pubName = new TextField(mc, this).setText(publishedName).setDesiredWidth(50).setDesiredHeight(13).addTextEvent((parent, newText) -> updatePublish(controllerPos, index, newText));
panel1.addChild(pubName);
} else {
panel1.addChild(new Label<>(mc, this).setText(publishedName).setColor(0xff33ff00));
}
Panel panel2 = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(0).setSpacing(0)).setLayoutHint(new PositionalLayout.PositionalHint(0, 13, 160, 13));
panel2.addChild(new Label<>(mc, this).setText("Pos").setColor(0xff2244aa));
panel2.addChild(new Label<>(mc, this).setText(BlockPosTools.toString(controllerPos)));
Panel panel3 = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(0).setSpacing(0)).setLayoutHint(new PositionalLayout.PositionalHint(0, 26, 160, 13));
panel3.addChild(new Label<>(mc, this).setText("Index").setColor(0xff2244aa));
panel3.addChild(new Label<>(mc, this).setText(index + " (" + type.getName() + ")"));
panel.addChild(panel1).addChild(panel2).addChild(panel3);
return panel;
}
Aggregations