use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiEnvironmentalController method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(8, 141, 10, 76)).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
Panel areaPanel = initAreaPanel();
Panel playersPanel = initPlayerPanel();
Panel controlPanel = initControlPanel();
toplevel.addChild(areaPanel).addChild(playersPanel).addChild(controlPanel).addChild(energyBar);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
listDirty = 0;
requestPlayers();
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiPearlInjector method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiModularStorage method initGui.
@Override
public void initGui() {
super.initGui();
itemList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(5, 3, 235, ySize - 89)).setNoSelectionMode(true).setUserObject(new Integer(-1)).setLeftMargin(0).setRowheight(-1);
Slider slider = new Slider(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(241, 3, 11, ySize - 89)).setDesiredWidth(11).setVertical().setScrollable(itemList);
Panel modePanel = setupModePanel();
cycleButton = new Button(mc, this).setText("C").setTooltips("Cycle to the next storage module").setLayoutHint(new PositionalLayout.PositionalHint(5, ySize - 23, 16, 16)).addButtonEvent(parent -> cycleStorage());
Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).addChild(itemList).addChild(slider).addChild(modePanel).addChild(cycleButton);
toplevel.setBackgrounds(iconLocationTop, iconLocation);
toplevel.setBackgroundLayout(false, ySize - STORAGE_HEIGHT0 + 2);
if (tileEntity == null) {
// We must hide three slots.
ImageLabel hideLabel = new ImageLabel(mc, this);
hideLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, ySize - 26 - 3 * 18, 20, 55));
hideLabel.setImage(guiElements, 32, 32);
toplevel.addChild(hideLabel);
}
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
if (ModularStorageConfiguration.autofocusSearch) {
window.setTextFocus(filter);
}
CraftingGridProvider provider;
BlockPos pos = null;
if (tileEntity != null) {
provider = tileEntity;
pos = tileEntity.getPos();
} else if (inventorySlots instanceof ModularStorageItemContainer) {
ModularStorageItemContainer storageItemContainer = (ModularStorageItemContainer) inventorySlots;
provider = storageItemContainer.getCraftingGridProvider();
} else if (inventorySlots instanceof RemoteStorageItemContainer) {
RemoteStorageItemContainer storageItemContainer = (RemoteStorageItemContainer) inventorySlots;
provider = storageItemContainer.getCraftingGridProvider();
} else {
throw new RuntimeException("Should not happen!");
}
craftingGrid.initGui(modBase, network, mc, this, pos, provider, guiLeft, guiTop, xSize, ySize);
sendServerCommand(RFTools.MODID, CommandHandler.CMD_REQUEST_GRID_SYNC, Arguments.builder().value(pos).build());
}
use of mcjty.lib.gui.layout.PositionalLayout 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.PositionalLayout in project RFTools by McJty.
the class GuiLevelEmitter method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
amountField = new mcjty.lib.gui.widgets.TextField(mc, this).setTooltips("Set the amount of items in slot").setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14)).addTextEvent((parent, newText) -> setAmount());
int amount = tileEntity.getAmount();
amountField.setText(String.valueOf(amount));
starredLabel = new ChoiceLabel(mc, this).addChoices(NOTSTARRED, STARRED).addChoiceEvent((parent, newChoice) -> setMetaUsage()).setChoiceTooltip(NOTSTARRED, "All inventories are considered").setChoiceTooltip(STARRED, "Only routable inventories are considered");
starredLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14));
starredLabel.setChoice(tileEntity.isStarred() ? STARRED : NOTSTARRED);
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, 35, 80, 14));
oreDictLabel.setChoice(tileEntity.isOreDict() ? OREDICT_USE : OREDICT_IGNORE);
toplevel.addChild(new Label(mc, this).setText("Amount:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(amountField).addChild(new Label(mc, this).setText("Routable:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(starredLabel).addChild(new Label(mc, this).setText("Oredict:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(oreDictLabel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
Aggregations