use of net.malisis.core.client.gui.component.container.BasicContainer in project Almura by AlmuraDev.
the class SimpleIngameMenu method construct.
@Override
public void construct() {
this.renderer.setDefaultTexture(GuiConfig.SpriteSheet.ALMURA);
this.guiscreenBackground = true;
final BasicContainer<?> contentContainer = new BasicContainer<>(this);
contentContainer.setBackgroundAlpha(0);
contentContainer.setSize(220, 202);
contentContainer.setAnchor(Anchor.MIDDLE | Anchor.CENTER);
// Almura Header
final UIImage almuraHeader = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
almuraHeader.setSize(60, 99);
almuraHeader.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
final UIButton backButton = new UIButtonBuilder(this).text(I18n.format("menu.returnToGame")).size(192, 20).position(0, BasicScreen.getPaddedY(almuraHeader, 10)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).container(contentContainer).build("button.back");
final BasicContainer<?> shortcutContainer = new BasicContainer<>(this);
shortcutContainer.setBackgroundAlpha(0);
shortcutContainer.setSize(192, 24);
shortcutContainer.setPosition(backButton.getX(), BasicScreen.getPaddedY(backButton, PADDING));
shortcutContainer.setAnchor(Anchor.TOP | Anchor.CENTER);
final boolean lanAvaiable = Minecraft.getMinecraft().isSingleplayer() && !Minecraft.getMinecraft().getIntegratedServer().getPublic();
final UIButton shopButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("almura.menu_button.shop")).build("button.shop");
final UIButton mapButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_MAP).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(shopButton, PADDING), shopButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("item.map.name")).build("button.instance");
final UIButton statisticsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_PIE_CHART).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(mapButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("gui.stats")).build("button.statistics");
final UIButton advancementsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_TROPHY).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(statisticsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("gui.advancements")).build("button.advancements");
final UIButton forumsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.ENJIN).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(advancementsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("almura.menu_button.forums")).build("button.forums");
final UIButton lanButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_SITEMAP).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(forumsButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("menu.shareToLan")).enabled(lanAvaiable).build("button.lan");
final UIButton optionsButton = new UIButtonBuilder(this).container(shortcutContainer).icon(GuiConfig.Icon.FA_COG).size(UIConstants.Button.WIDTH_ICON, UIConstants.Button.HEIGHT_ICON).position(BasicScreen.getPaddedX(lanButton, PADDING), mapButton.getY()).anchor(Anchor.MIDDLE | Anchor.LEFT).listener(this).tooltip(I18n.format("menu.options")).build("button.options");
final UIButton quitButton = new UIButtonBuilder(this).container(contentContainer).text(I18n.format("almura.menu_button.quit")).fontOptions(FontOptions.builder().from(FontColors.RED_FO).shadow(true).build()).hoverFontOptions(FontOptions.builder().color(Color.ofRgb(255, 89, 89).getRgb()).shadow(true).build()).size(UIConstants.Button.WIDTH_SHORT, UIConstants.Button.HEIGHT).position(0, BasicScreen.getPaddedY(shortcutContainer, 25)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.quit");
contentContainer.add(almuraHeader, shortcutContainer);
this.addToScreen(contentContainer);
}
use of net.malisis.core.client.gui.component.container.BasicContainer in project Almura by AlmuraDev.
the class ManageTitlesGUI method construct.
@Override
public void construct() {
this.guiscreenBackground = false;
Keyboard.enableRepeatEvents(true);
// Master Pane
this.form = new BasicForm(this, this.screenWidth, this.screenHeight, "Title Manager");
this.form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
this.form.setMovable(true);
this.form.setClosable(true);
this.form.setBorder(FontColors.WHITE, 1, 185);
this.form.setBackgroundAlpha(215);
this.form.setBottomPadding(3);
this.form.setRightPadding(3);
this.form.setTopPadding(20);
this.form.setLeftPadding(3);
// Title List Area
this.listArea = new BasicForm(this, 220, 260, "");
this.listArea.setPosition(0, 0, Anchor.LEFT | Anchor.TOP);
this.listArea.setMovable(false);
this.listArea.setClosable(false);
this.listArea.setBorder(FontColors.WHITE, 1, 185);
this.listArea.setBackgroundAlpha(215);
this.listArea.setBottomPadding(3);
this.listArea.setRightPadding(3);
this.listArea.setTopPadding(3);
this.listArea.setLeftPadding(3);
// Create left container
final BasicContainer<?> titleContainer = new BasicContainer(this, 200, UIComponent.INHERITED);
titleContainer.setBackgroundAlpha(0);
titleContainer.setPosition(0, 0, Anchor.CENTER | Anchor.TOP);
titleContainer.setPadding(4, 4);
titleContainer.setTopPadding(20);
this.titleList = new BasicList<>(this, UIComponent.INHERITED, UIComponent.INHERITED);
this.titleList.setItemComponentFactory(TitleItemComponent::new);
this.titleList.setItemComponentSpacing(1);
this.titleList.setCanDeselect(false);
this.titleList.setName("list.left");
this.titleList.setItems(titleManager.getAvailableTitles());
if (!titleManager.getAvailableTitles().isEmpty()) {
if (titleManager.getSelectedTitleFor(this.mc.player.getUniqueID()) != null) {
titleManager.setTitleContentForDisplay(titleManager.getSelectedTitleFor(this.mc.player.getUniqueID()));
this.titleList.setSelectedItem(titleManager.getAvailableTitle(titleManager.getSelectedTitleFor(this.mc.player.getUniqueID()).getId()));
} else {
this.titleList.setSelectedItem(titleManager.getAvailableTitles().get(0));
titleManager.setTitleContentForDisplay(titleManager.getAvailableTitles().get(0));
}
}
this.titleList.register(this);
titleContainer.add(this.titleList);
this.listArea.add(titleContainer);
// Edit Container
this.editArea = new BasicForm(this, 220, 260, "");
this.editArea.setPosition(0, 0, Anchor.RIGHT | Anchor.TOP);
this.editArea.setMovable(false);
this.editArea.setClosable(false);
this.editArea.setBorder(FontColors.WHITE, 1, 185);
this.editArea.setBackgroundAlpha(215);
this.editArea.setBottomPadding(3);
this.editArea.setRightPadding(3);
this.editArea.setTopPadding(3);
this.editArea.setLeftPadding(3);
this.editArea.setVisible(false);
this.modeNameLabel = new UILabel(this, "Modify Title").setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).underline(false).scale(1.2F).build()).setVisible(false).setPosition(0, 5, Anchor.CENTER | Anchor.TOP);
final UILabel idLabel = new UILabel(this, "ID:").setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.0F).build()).setPosition(5, 17, Anchor.LEFT | Anchor.TOP);
this.idField = new UITextField(this, "", false).setSize(200, 0).setPosition(10, 30, Anchor.LEFT | Anchor.TOP).setEditable(false).setEnabled(false).setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
final UILabel permissionNodeLabel = new UILabel(this, "Permission:").setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.0F).build()).setPosition(5, 57, Anchor.LEFT | Anchor.TOP);
this.permissionField = new UITextField(this, "", false).setSize(200, 0).setPosition(10, 70, Anchor.LEFT | Anchor.TOP).setEditable(false).setEnabled(false).setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
final UILabel titleContextLabel = new UILabel(this, "Content:").setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.0F).build()).setPosition(5, 97, Anchor.LEFT | Anchor.TOP);
this.contentField = new UITextField(this, "", false).setSize(200, 0).setPosition(10, 110, Anchor.LEFT | Anchor.TOP).setEditable(true).setEnabled(false).setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
// Color Selection dropdown
this.colorSelector = new UISelect<>(this, 110, Arrays.asList("§1Dark Blue§f - &1", "§9Blue§f - &9", "§3Dark Aqua§f - &3", "§bAqua§f - &b", "§4Dark Red§f - &4", "§cRed§f - &c", "§eYellow§f - &e", "§6Gold§f - &6", "§2Dark Green§f - &2", "§aGreen§f - &a", "§5Dark Purple§f - &5", "§dLight Purple§f - &d", "§fWhite§f - &f", "§7Gray§f - &7", "§8Dark Gray§f - &8", "§0Black§f - &0,", "§lBold§f - &l", "§mStrikethrough§f - &m", "§nUnderline§f - &n", "§oItalic§f - &o"));
this.colorSelector.setPosition(10, 126, Anchor.LEFT | Anchor.TOP);
this.colorSelector.setOptionsWidth(UISelect.SELECT_WIDTH);
this.colorSelector.setFontOptions(FontOptions.builder().shadow(false).build());
this.colorSelector.select("§1Dark Blue§f - &1");
this.colorSelector.setEnabled(false);
this.colorSelector.maxDisplayedOptions(7);
// Add Color character button
this.buttonColor = new UIButtonBuilder(this).width(40).anchor(Anchor.TOP | Anchor.LEFT).position(130, 125).text("Add").listener(this).build("button.color");
this.formattedCheckbox = new UICheckBox(this);
this.formattedCheckbox.setText(TextFormatting.WHITE + "Formatted");
this.formattedCheckbox.setPosition(9, 145, Anchor.LEFT | Anchor.TOP);
this.formattedCheckbox.setChecked(false);
this.formattedCheckbox.setName("checkbox.formatted");
this.formattedCheckbox.register(this);
this.hiddenCheckbox = new UICheckBox(this);
this.hiddenCheckbox.setText(TextFormatting.WHITE + "Title Hidden from Players");
this.hiddenCheckbox.setPosition(10, -7, Anchor.LEFT | Anchor.BOTTOM);
this.hiddenCheckbox.setChecked(false);
this.hiddenCheckbox.setName("checkbox.hidden");
this.hiddenCheckbox.register(this);
// Save Changes button
final UIButton saveChangesButton = new UIButtonBuilder(this).width(30).text(I18n.format("almura.button.save")).position(0, -5).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).build("button.save");
editArea.add(this.modeNameLabel, idLabel, permissionNodeLabel, this.permissionField, this.idField, titleContextLabel, this.contentField, this.colorSelector, this.buttonColor, this.formattedCheckbox, this.hiddenCheckbox, saveChangesButton);
// Edit Container
this.playerArea = new BasicForm(this, 220, 260, "");
this.playerArea.setPosition(0, 0, Anchor.RIGHT | Anchor.TOP);
this.playerArea.setMovable(false);
this.playerArea.setClosable(false);
this.playerArea.setBorder(FontColors.WHITE, 1, 185);
this.playerArea.setBackgroundAlpha(215);
this.playerArea.setBottomPadding(3);
this.playerArea.setRightPadding(3);
this.playerArea.setTopPadding(3);
this.playerArea.setLeftPadding(3);
this.playerArea.setVisible(true);
final UILabel playerLabel = new UILabel(this, "Player Title").setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).underline(false).scale(1.2F).build()).setVisible(false).setPosition(0, 05, Anchor.CENTER | Anchor.TOP);
this.buttonApply = new UIButtonBuilder(this).text("Apply").anchor(Anchor.BOTTOM | Anchor.RIGHT).tooltip("Apply Title and Exit").listener(this).enabled(this.canChangeTitle).visible(true).build("button.apply");
this.buttonRemove = new UIButtonBuilder(this).text("Remove").anchor(Anchor.BOTTOM | Anchor.LEFT).tooltip("Remove Title and Exit").enabled(this.canChangeTitle).listener(this).visible(true).build("button.remove");
this.playerArea.add(playerLabel, this.buttonApply, this.buttonRemove);
this.titleSelectionLabel = new UILabel(this, "Available Titles:").setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(true).scale(1.1F).build()).setPosition(5, 10, Anchor.LEFT | Anchor.TOP);
// Add button
this.buttonAdd = new UIButtonBuilder(this).width(15).x(5).text(TextFormatting.GREEN + "+").anchor(Anchor.BOTTOM | Anchor.LEFT).tooltip("Add New Title").listener(this).visible(false).build("button.add");
// Remove button
this.buttonDelete = new UIButtonBuilder(this).width(15).x(24).text(TextFormatting.RED + "-").anchor(Anchor.BOTTOM | Anchor.LEFT).tooltip("Remove Title").listener(this).visible(false).build("button.delete");
this.editModeCheckbox = new UICheckBox(this);
this.editModeCheckbox.setText(TextFormatting.WHITE + "Edit Mode");
this.editModeCheckbox.setPosition(0, -3, Anchor.CENTER | Anchor.BOTTOM);
this.editModeCheckbox.setChecked(false);
this.editModeCheckbox.setName("checkbox.editmode");
this.editModeCheckbox.setVisible(isAdmin);
this.editModeCheckbox.register(this);
// Close button
final UIButton buttonClose = new UIButtonBuilder(this).width(40).anchor(Anchor.BOTTOM | Anchor.RIGHT).text(I18n.format("almura.button.close")).listener(this).build("button.close");
this.form.add(this.listArea, this.editArea, this.playerArea, this.titleSelectionLabel, this.buttonAdd, this.buttonDelete, this.editModeCheckbox, buttonClose);
this.addToScreen(this.form);
}
use of net.malisis.core.client.gui.component.container.BasicContainer in project Almura by AlmuraDev.
the class StoreScreen method construct.
@Override
public void construct() {
guiscreenBackground = false;
final BasicForm form = new BasicForm(this, 257, 300, this.store.getName());
form.setBackgroundAlpha(255);
final BasicContainer<?> storeContainer = new BasicContainer<>(this, 251, UIComponent.INHERITED);
storeContainer.setBorder(FontColors.WHITE, 1, 185);
storeContainer.setPadding(3);
storeContainer.setColor(0);
// Buy tab
final int leftOffset = storeContainer.getLeftPadding() - storeContainer.getLeftBorderSize();
this.buyTabContainer = new BasicContainer<>(this, this.tabWidth, this.tabHeight);
this.buyTabContainer.setBorders(FontColors.WHITE, 185, 1, 1, 1, 0);
this.buyTabContainer.setPosition(2, 2);
this.buyTabContainer.setColor(defaultTabColor);
this.buyTabContainer.attachData(SideType.BUY);
// Buy tab label
this.buyTabLabel = new UILabel(this, I18n.format("almura.feature.common.button.buy"));
this.buyTabLabel.setPosition(0, 1, Anchor.MIDDLE | Anchor.CENTER);
// Always use the same data as their parent
this.buyTabLabel.attachData(this.buyTabContainer.getData());
this.buyTabContainer.add(this.buyTabLabel);
// Sell tab
this.sellTabContainer = new BasicContainer<>(this, this.tabWidth, this.tabHeight);
this.sellTabContainer.setBorders(FontColors.WHITE, 185, 1, 1, 1, 0);
this.sellTabContainer.setColor(defaultTabColor);
this.sellTabContainer.setPosition(-2, 2, Anchor.TOP | Anchor.RIGHT);
this.sellTabContainer.attachData(SideType.SELL);
// Sell tab label
this.sellTabLabel = new UILabel(this, I18n.format("almura.feature.common.button.sell"));
this.sellTabLabel.setPosition(0, 1, Anchor.MIDDLE | Anchor.CENTER);
// Always use the same data as their parent
this.sellTabLabel.attachData(this.sellTabContainer.getData());
this.sellTabContainer.add(this.sellTabLabel);
// Doesn't exist.
this.thisDoesNotExistLine = new BasicLine(this, this.tabWidth - 2);
this.thisDoesNotExistLine.setBackgroundAlpha(255);
this.thisDoesNotExistLine.setColor(selectedTabColor);
// Bottom tab line
final BasicLine tabContainerLineBottom = new BasicLine(this, storeContainer.getWidth() - (storeContainer.getLeftBorderSize() + storeContainer.getRightBorderSize()), 1);
tabContainerLineBottom.setPosition(-leftOffset, BasicScreen.getPaddedY(this.buyTabContainer, 0));
// Search Y
final int searchY = BasicScreen.getPaddedY(tabContainerLineBottom, 2);
// Item Display Name Search Label
final UILabel itemSearchLabel = new UILabel(this, I18n.format("almura.feature.exchange.text.item_name") + ":");
itemSearchLabel.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).build());
itemSearchLabel.setPosition(1, searchY + 3, Anchor.LEFT | Anchor.TOP);
// Item Display Name Search Text Box
this.itemDisplayNameSearchBox = new BasicTextBox(this, "");
this.itemDisplayNameSearchBox.setAcceptsReturn(false);
this.itemDisplayNameSearchBox.setAcceptsTab(false);
this.itemDisplayNameSearchBox.setTabIndex(0);
this.itemDisplayNameSearchBox.setOnEnter((tb) -> this.search());
this.itemDisplayNameSearchBox.setSize(60, 0);
this.itemDisplayNameSearchBox.setPosition(BasicScreen.getPaddedX(itemSearchLabel, innerPadding), searchY + 1, Anchor.LEFT | Anchor.TOP);
this.itemDisplayNameSearchBox.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
// Sort combobox
this.comboBoxSortType = new UISelect<>(this, 78);
this.comboBoxSortType.setPosition(BasicScreen.getPaddedX(this.itemDisplayNameSearchBox, innerPadding), searchY + 1);
this.comboBoxSortType.setOptions(Arrays.asList(FeatureSortTypes.ITEM_DISPLAY_NAME_ASC, FeatureSortTypes.ITEM_DISPLAY_NAME_DESC, FeatureSortTypes.PRICE_ASC, FeatureSortTypes.PRICE_DESC));
this.comboBoxSortType.setOptionsWidth(UISelect.LONGEST_OPTION);
// Because that's reasonable.
this.comboBoxSortType.setLabelFunction(type -> type == null ? "" : type.getName());
this.comboBoxSortType.select(FeatureSortTypes.ITEM_DISPLAY_NAME_ASC);
// Search button
final UIButton buttonSearch = new UIButtonBuilder(this).width(50).anchor(Anchor.RIGHT | Anchor.TOP).position(0, searchY).text(I18n.format("almura.feature.common.button.search")).onClick(this::search).build("button.search");
// List
this.itemList = new BasicList<>(this, UIComponent.INHERITED, BasicScreen.getPaddedHeight(form) - this.buyTabContainer.getHeight() - tabContainerLineBottom.getHeight() - buttonSearch.getHeight() - 30);
this.itemList.setPosition(0, BasicScreen.getPaddedY(buttonSearch, 2));
this.itemList.setSelectConsumer(i -> this.updateStoreControls());
this.itemList.setItemComponentSpacing(1);
this.itemList.setBorder(FontColors.WHITE, 1, 185);
this.itemList.setPadding(2);
this.itemList.setItemComponentFactory(StoreItemComponent::new);
this.buttonTransactOne = new UIButtonBuilder(this).width(60).anchor(Anchor.BOTTOM | Anchor.LEFT).enabled(false).onClick(() -> this.transact(1)).build("button.transact.single");
this.buttonTransactStack = new UIButtonBuilder(this).width(60).x(BasicScreen.getPaddedX(this.buttonTransactOne, 2)).anchor(Anchor.BOTTOM | Anchor.LEFT).enabled(false).onClick(() -> {
if (this.itemList.getSelectedItem() == null) {
return;
}
final int value = this.itemList.getSelectedItem().asRealStack().getMaxStackSize();
this.transact(value);
}).build("button.transact.stack");
this.buttonTransactAll = new UIButtonBuilder(this).width(60).anchor(Anchor.BOTTOM | Anchor.RIGHT).enabled(false).onClick(() -> {
final StoreItem selectedItem = this.itemList.getSelectedItem();
if (selectedItem == null) {
return;
}
// Determine the value to transact
final int value;
if (this.currentSide == SideType.BUY) {
// If we are buying then base the value on the quantity remaining for the item to purchase
value = this.itemList.getSelectedItem().getQuantity();
} else {
// If we're selling then base it on how many we have in our main inventory
value = Minecraft.getMinecraft().player.inventory.mainInventory.stream().filter(i -> ItemStack.areItemsEqual(i, selectedItem.asRealStack())).mapToInt(ItemStack::getCount).sum();
}
this.transact(value);
}).build("button.transact.all");
this.buttonTransactQuantity = new UIButtonBuilder(this).width(60).x(BasicScreen.getPaddedX(this.buttonTransactAll, 2, Anchor.RIGHT)).anchor(Anchor.BOTTOM | Anchor.RIGHT).enabled(false).onClick(() -> {
final StoreItem selectedItem = this.itemList.getSelectedItem();
if (selectedItem == null) {
return;
}
new StoreTransactQuantityScreen(this, this.store, selectedItem, this.currentSide).display();
}).build("button.transact.quantity");
storeContainer.add(this.buyTabContainer, this.sellTabContainer, tabContainerLineBottom, this.thisDoesNotExistLine, itemSearchLabel, this.itemDisplayNameSearchBox, this.comboBoxSortType, buttonSearch, this.itemList, this.buttonTransactOne, this.buttonTransactStack, this.buttonTransactQuantity, this.buttonTransactAll);
form.add(storeContainer);
// Logic for admin pane
if (this.isAdmin) {
// Adjust form width
form.setWidth(form.getWidth() + 224);
// Create admin pane
final BasicContainer<?> adminContainer = new BasicContainer(this, 220, UIComponent.INHERITED);
adminContainer.setPosition(BasicScreen.getPaddedX(storeContainer, 4), 0);
adminContainer.setBorder(FontColors.WHITE, 1, 185);
adminContainer.setPadding(3);
adminContainer.setColor(0);
// Buy tab label
this.typeLabel = new UILabel(this, TextFormatting.WHITE + "Type: ");
this.typeLabel.setPosition(0, 2, Anchor.TOP | Anchor.LEFT);
// Item location selection
this.locationSelect = new UISelect<>(this, UIComponent.INHERITED);
this.locationSelect.setOptions(itemFinderRelationshipMap.keySet());
this.locationSelect.setLabelFunction(o -> I18n.format(o.translationKey));
this.locationSelect.setPosition(30, 0);
this.locationSelect.setSize(184, 12);
this.locationSelect.maxDisplayedOptions(24);
this.locationSelect.register(this);
// Search text box
this.adminSearchTextBox = new BasicTextBox(this, "");
this.adminSearchTextBox.setSize(UIComponent.INHERITED, this.locationSelect.getHeight());
this.adminSearchTextBox.setPosition(0, BasicScreen.getPaddedY(this.locationSelect, 2));
this.adminSearchTextBox.register(this);
// Item list
this.adminItemList = new BasicList<>(this, UIComponent.INHERITED, BasicScreen.getPaddedHeight(form) - this.locationSelect.getHeight() - this.adminSearchTextBox.getHeight() - 28);
this.adminItemList.setItemComponentFactory(AdminItemComponent::new);
this.adminItemList.setItemComponentSpacing(1);
this.adminItemList.setPosition(0, BasicScreen.getPaddedY(this.adminSearchTextBox, 2));
this.adminItemList.setPadding(2);
this.adminItemList.setBorder(FontColors.WHITE, 1, 185);
this.adminItemList.setSelectConsumer(i -> this.updateAdminControls());
this.buttonAdminList = new UIButtonBuilder(this).width(50).anchor(Anchor.BOTTOM | Anchor.LEFT).enabled(false).onClick(this::listOrModify).text(I18n.format("almura.feature.common.button.list")).build("button.list");
this.buttonAdminUnlist = new UIButtonBuilder(this).width(50).anchor(Anchor.BOTTOM | Anchor.LEFT).position(BasicScreen.getPaddedX(this.buttonAdminList, 2), 0).enabled(false).onClick(this::unlist).text(I18n.format("almura.feature.common.button.unlist")).build("button.unlist");
this.adminListTotalLabel = new UILabel(this, TextFormatting.WHITE + I18n.format("almura.feature.common.text.total") + ": ");
this.adminListTotalLabel.setPosition(0, -2, Anchor.BOTTOM | Anchor.RIGHT);
adminContainer.add(this.typeLabel, this.locationSelect, this.adminSearchTextBox, this.adminItemList, this.buttonAdminList, this.buttonAdminUnlist, this.adminListTotalLabel);
form.add(adminContainer);
// Select the first item
this.locationSelect.selectFirst();
}
addToScreen(form);
}
Aggregations