use of com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder in project Almura by AlmuraDev.
the class SimpleOptionsMenu method construct.
@SuppressWarnings({ "unchecked" })
@Override
public void construct() {
final ClientCategory config = StaticAccess.config.get().client;
this.saveAndLoad();
final UILabel titleLabel = new UILabel(this, I18n.format("almura.menu_button.options"));
titleLabel.setFontOptions(FontColors.WHITE_FO);
titleLabel.setPosition(0, 20, Anchor.TOP | Anchor.CENTER);
this.addToScreen(titleLabel);
final UIBackgroundContainer optionsContainer = new UIBackgroundContainer(this, 335, 200);
optionsContainer.setBackgroundAlpha(0);
optionsContainer.setPosition(0, getPaddedY(titleLabel, CONTROL_PADDING), Anchor.TOP | Anchor.CENTER);
/*
* LEFT COLUMN
*/
this.buttonHudType = new UIButtonBuilder(this).text("HUD: " + config.hud.substring(0, 1).toUpperCase() + config.hud.substring(1)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("button.hudType");
this.updatePosition(this.buttonHudType, Anchor.LEFT);
// TODO: Add builder for checkbox component
final boolean displayWorldCompassWidget = config.displayWorldCompassWidget;
final UICheckBox checkboxWorldCompassWidget = new UICheckBox(this);
checkboxWorldCompassWidget.setText(TextFormatting.WHITE + "Display World Compass Widget");
checkboxWorldCompassWidget.setChecked(displayWorldCompassWidget);
checkboxWorldCompassWidget.setName("checkbox.world_compass_widget");
checkboxWorldCompassWidget.register(this);
this.updatePosition(checkboxWorldCompassWidget, Anchor.LEFT);
final boolean displayLocationWidget = config.displayLocationWidget;
final UICheckBox checkboxLocationWidget = new UICheckBox(this);
checkboxLocationWidget.setText(TextFormatting.WHITE + "Display Location Widget");
checkboxLocationWidget.setChecked(displayLocationWidget);
checkboxLocationWidget.setName("checkbox.location_widget");
checkboxLocationWidget.register(this);
this.updatePosition(checkboxLocationWidget, Anchor.LEFT);
final boolean displayNumericHUDValues = config.displayNumericHUDValues;
final UICheckBox checkboxNumericHUDValues = new UICheckBox(this);
checkboxNumericHUDValues.setText(TextFormatting.WHITE + "Display Numeric HUD Values");
checkboxNumericHUDValues.setChecked(displayNumericHUDValues);
checkboxNumericHUDValues.setName("checkbox.numeric_hud_values");
checkboxNumericHUDValues.register(this);
this.updatePosition(checkboxNumericHUDValues, Anchor.LEFT);
final boolean displayNames = config.displayNames;
final UICheckBox checkboxDisplayNames = new UICheckBox(this);
checkboxDisplayNames.setText(TextFormatting.WHITE + "Display Entity Names");
checkboxDisplayNames.setChecked(displayNames);
checkboxDisplayNames.setName("checkbox.display_names");
checkboxDisplayNames.register(this);
this.updatePosition(checkboxDisplayNames, Anchor.LEFT);
final boolean displayHealthbars = config.displayHealthbars;
final UICheckBox checkboxDisplayHealthbars = new UICheckBox(this);
checkboxDisplayHealthbars.setText(TextFormatting.WHITE + "Display Entity Healthbars");
checkboxDisplayHealthbars.setChecked(displayHealthbars);
checkboxDisplayHealthbars.setName("checkbox.display_healthbars");
checkboxDisplayHealthbars.register(this);
this.updatePosition(checkboxDisplayHealthbars, Anchor.LEFT);
final boolean disableOffhandTorchPlacement = config.disableOffhandTorchPlacement;
final UICheckBox checkboxDisableOffhandTorchPlacement = new UICheckBox(this);
checkboxDisableOffhandTorchPlacement.setText(TextFormatting.WHITE + "Disable Offhand Torch Placement");
checkboxDisableOffhandTorchPlacement.setChecked(disableOffhandTorchPlacement);
checkboxDisableOffhandTorchPlacement.setName("checkbox.disable_offhand_torch_placement");
checkboxDisableOffhandTorchPlacement.register(this);
this.updatePosition(checkboxDisableOffhandTorchPlacement, Anchor.LEFT);
// Reset for new column
this.lastComponent = null;
/*
* RIGHT COLUMN
*/
final boolean isOrigin = config.hud.equalsIgnoreCase(HUDType.ORIGIN);
this.sliderOriginHudOpacity = new UISliderBuilder(this, Converter.<Float, Integer>from(f -> (int) (f * 255), i -> (float) i / 255)).text("HUD Opacity: %d").value(config.originHudOpacity).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).enabled(isOrigin).build("slider.originHudOpacity");
this.sliderOriginHudOpacity.setAlpha(isOrigin ? 255 : 128);
this.updatePosition(this.sliderOriginHudOpacity, Anchor.RIGHT);
final UISlider<OptionsConverter.Options> sliderChestDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Chest Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == config.chestRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.chestRenderDistance");
this.updatePosition(sliderChestDistance, Anchor.RIGHT);
final UISlider<OptionsConverter.Options> sliderSignTextDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Sign Text Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == config.signTextRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.signTextRenderDistance");
this.updatePosition(sliderSignTextDistance, Anchor.RIGHT);
final UISlider<OptionsConverter.Options> sliderItemFrameDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Item Frame Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == config.itemFrameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.itemFrameRenderDistance");
this.updatePosition(sliderItemFrameDistance, Anchor.RIGHT);
final UISlider<OptionsConverter.Options> sliderPlayerNameRenderDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Player Name Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == config.playerNameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.playerNameRenderDistance");
this.updatePosition(sliderPlayerNameRenderDistance, Anchor.RIGHT);
final UISlider<OptionsConverter.Options> sliderEnemyNameRenderDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Enemy Name Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == config.enemyNameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.enemyNameRenderDistance");
this.updatePosition(sliderEnemyNameRenderDistance, Anchor.RIGHT);
final UISlider<OptionsConverter.Options> sliderAnimalNameRenderDistance = new UISliderBuilder(this, OPTIONS_CONVERTER).text("Animal Name Distance: %s").value(Arrays.stream(OptionsConverter.Options.values()).filter(o -> o.value == config.animalNameRenderDistance).findFirst().orElse(OptionsConverter.Options.DEFAULT)).size(CONTROL_WIDTH, CONTROL_HEIGHT).listener(this).build("slider.animalNameRenderDistance");
this.updatePosition(sliderAnimalNameRenderDistance, Anchor.RIGHT);
final UIButton buttonDone = new UIButtonBuilder(this).text(I18n.format("gui.done")).size(200, CONTROL_HEIGHT).position(0, this.lastComponent == null ? 10 : getPaddedY(this.lastComponent, 10)).anchor(Anchor.TOP | Anchor.CENTER).listener(this).build("button.done");
optionsContainer.add(this.buttonHudType, this.sliderOriginHudOpacity, checkboxWorldCompassWidget, checkboxLocationWidget, checkboxNumericHUDValues, checkboxDisplayNames, checkboxDisplayHealthbars, checkboxDisableOffhandTorchPlacement, sliderChestDistance, sliderSignTextDistance, sliderItemFrameDistance, sliderPlayerNameRenderDistance, sliderEnemyNameRenderDistance, sliderAnimalNameRenderDistance, buttonDone);
addToScreen(optionsContainer);
}
use of com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder in project Almura by AlmuraDev.
the class SimpleAboutMenu method construct.
@SuppressWarnings({ "unchecked" })
@Override
public void construct() {
super.construct();
this.list = new UISimpleList(this, 125, UIComponent.INHERITED);
this.list.setPosition(4, 0);
this.list.setElementSpacing(4);
this.list.setUnselect(false);
final List<AboutListElementData> elementDataList = Lists.newArrayList();
// Static entry
elementDataList.add(new AboutListElementData(this.list, new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_MAN), null), 5, 0, 23, 32, 8, AboutConfig.TITLE, AboutConfig.STORY));
// Dynamic entry
AboutConfig.ENTRIES.forEach(entry -> {
Text titles = Text.EMPTY;
for (String title : entry.titles) {
titles = titles.toBuilder().append(Text.of(" • ", I18n.format(title)), Text.NEW_LINE).build();
}
elementDataList.add(new AboutListElementData(this.list, new UIImage(this, new GuiRemoteTexture(GuiConfig.Location.GENERIC_AVATAR, new ResourceLocation(Almura.ID, "textures/gui/skins/avatars/" + entry.uniqueId + ".png"), String.format(GuiConfig.Url.SKINS, entry.uniqueId, 32), 32, 32), null), 2, 0, 32, 32, 4, Text.of(entry.color, I18n.format(entry.name)), Text.of(TextColors.WHITE, I18n.format(entry.description), Text.NEW_LINE, Text.NEW_LINE, TextStyles.BOLD, I18n.format("almura.menu.about.titles"), TextStyles.RESET, TextColors.RESET, Text.NEW_LINE, titles)));
});
final UIButton doneButton = new UIButtonBuilder(this).text(Text.of(I18n.format("gui.done"))).size(98, 20).position(0, -15, 1).anchor(Anchor.BOTTOM | Anchor.CENTER).listener(this).build("button.done");
this.textField = new UITextField(this, "", true);
this.textField.setPosition(SimpleScreen.getPaddedX(this.list, 4), 0);
this.textField.setEditable(false);
this.textField.setFontOptions(FontOptions.builder().from(FontColors.WHITE_FO).shadow(false).build());
this.list.setComponentFactory(AboutListElement::new);
this.list.setElements(elementDataList);
this.list.register(this);
this.list.select(elementDataList.get(0));
this.getContainer().add(this.list, this.textField);
// SpongeForge
final UILabel spongeForgeVersionLabel = new UILabel(this, TextFormatting.WHITE + "SpongeForge: " + ((Optional<String>) Sponge.getPlatform().asMap().get("ImplementationVersion")).orElse("dev"));
spongeForgeVersionLabel.setPosition(4, -24, Anchor.LEFT | Anchor.BOTTOM);
// Forge
final PluginContainer forgeContainer = Sponge.getPluginManager().getPlugin("Forge").orElseThrow(NullPointerException::new);
final UILabel forgeVersionLabel = new UILabel(this, TextFormatting.WHITE + "Forge: " + forgeContainer.getVersion().orElse("dev"));
forgeVersionLabel.setPosition(4, -14, Anchor.LEFT | Anchor.BOTTOM);
addToScreen(forgeVersionLabel);
// Almura
final PluginContainer almuraContainer = Sponge.getPluginManager().getPlugin("almura").orElseThrow(NullPointerException::new);
final UILabel almuraVersionLabel = new UILabel(this, TextFormatting.WHITE + "Almura: " + almuraContainer.getVersion().orElse("dev"));
almuraVersionLabel.setPosition(4, -4, Anchor.LEFT | Anchor.BOTTOM);
addToScreen(almuraVersionLabel);
addToScreen(doneButton);
addToScreen(spongeForgeVersionLabel);
}
use of com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder in project Almura by AlmuraDev.
the class ServerMenu method construct.
@Override
public void construct() {
// Create the form
final UIBackgroundContainer form = new UIBackgroundContainer(this, "", 225, 225);
// form.setTitle(TextFormatting.WHITE + "Multiplayer");
form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
// Create the logo
logoImage = new UIImage(this, new GuiTexture(GuiConfig.Location.ALMURA_LOGO), null);
logoImage.setSize(60, 99);
logoImage.setPosition(0, 0, Anchor.TOP | Anchor.CENTER);
liveServerOnline = new UILabel(this, TextFormatting.YELLOW + "Updating...");
liveServerOnline.setPosition(0, getPaddedY(logoImage, padding) + 7, Anchor.TOP | Anchor.CENTER);
liveServerTitle = new UILabel(this, TextFormatting.WHITE + "Public Server : ");
liveServerTitle.setPosition(-liveServerTitle.getWidth() / 2 + padding, liveServerOnline.getY(), Anchor.TOP | Anchor.CENTER);
// Create the live Almura button
almuraLiveButton = new UIButton(this, "Join ");
almuraLiveButton.setSize(40, 16);
almuraLiveButton.setName("button.server.almura.live");
almuraLiveButton.setPosition(liveServerTitle.getWidth() / 2 + padding, getPaddedY(logoImage, padding) + 3, Anchor.TOP | Anchor.CENTER);
almuraLiveButton.setVisible(false);
almuraLiveButton.register(this);
livePlayersOnline = new UILabel(this, TextFormatting.DARK_BLUE + "(0/50)");
livePlayersOnline.setPosition(0, liveServerOnline.getY(), Anchor.TOP | Anchor.CENTER);
livePlayersOnline.setVisible(false);
devServerOnline = new UILabel(this, TextFormatting.YELLOW + "Updating...");
devServerOnline.setPosition(0, getPaddedY(almuraLiveButton, padding) + 8, Anchor.TOP | Anchor.CENTER);
devServerTitle = new UILabel(this, TextFormatting.WHITE + "Dev Server : ");
devServerTitle.setPosition(26, devServerTitle.getY(), Anchor.TOP | Anchor.CENTER);
// Create the beta Almura button
almuraDevButton = new UIButton(this, "Join ");
almuraDevButton.setSize(40, 16);
almuraDevButton.setName("button.server.almura.dev");
almuraDevButton.setPosition(devServerOnline.getX() + devServerOnline.getWidth() + 5, getPaddedY(almuraLiveButton, padding) + 3, Anchor.TOP | Anchor.LEFT);
almuraDevButton.setVisible(false);
almuraDevButton.register(this);
devPlayersOnline = new UILabel(this, TextFormatting.DARK_BLUE + "(0/50)");
devPlayersOnline.setPosition(0, getPaddedY(almuraLiveButton, padding) + 8, Anchor.TOP | Anchor.CENTER);
devPlayersOnline.setVisible(false);
centerAlign();
// Create the join another server button
UIButton anotherButton = new UIButton(this, "Other Multiplayer");
anotherButton.setPosition(0, getPaddedY(almuraDevButton, padding) + 13, Anchor.TOP | Anchor.CENTER);
anotherButton.setSize(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT);
anotherButton.setName("button.server.another");
anotherButton.register(this);
// Create the back button
UIButton backButton = new UIButton(this, "Back");
backButton.setPosition(0, getPaddedY(anotherButton, padding) + 3, Anchor.TOP | Anchor.CENTER);
backButton.setSize(GuiConfig.Button.WIDTH_LONG, GuiConfig.Button.HEIGHT);
backButton.setName("button.back");
backButton.register(this);
final UIButton forumsButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.ENJIN).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(-padding, -padding).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu.forums"))).build("button.forums");
final UIButton issuesButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_GITHUB).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(forumsButton, padding, Anchor.RIGHT), forumsButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format(I18n.format("almura.menu.issues")))).build("button.issues");
final UIButton shopButton = new UIButtonBuilder(this).container(this.buttonContainer).icon(GuiConfig.Icon.FA_SHOPPING_BAG).size(GuiConfig.Button.WIDTH_ICON, GuiConfig.Button.HEIGHT_ICON).position(SimpleScreen.getPaddedX(issuesButton, padding, Anchor.RIGHT), issuesButton.getY()).anchor(Anchor.BOTTOM | Anchor.RIGHT).listener(this).tooltip(Text.of(I18n.format("almura.menu.shop"))).build("button.shop");
final UILabel trademarkLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.trademark"));
trademarkLabel.setPosition(padding, -padding, Anchor.BOTTOM | Anchor.LEFT);
final UILabel copyrightLabel = new UILabel(this, TextFormatting.YELLOW + I18n.format("almura.menu.main.copyright"));
copyrightLabel.setPosition(trademarkLabel.getX(), SimpleScreen.getPaddedY(trademarkLabel, padding, Anchor.BOTTOM), trademarkLabel.getAnchor());
form.add(logoImage, liveServerTitle, liveServerOnline, almuraLiveButton, devServerTitle, devServerOnline, almuraDevButton, devPlayersOnline, livePlayersOnline, anotherButton, backButton);
form.setColor(Integer.MIN_VALUE);
form.setBackgroundAlpha(0);
addToScreen(form, forumsButton, issuesButton, shopButton, trademarkLabel, copyrightLabel);
}
use of com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder in project Almura by AlmuraDev.
the class IngameFarmersAlmanac method construct.
// TODO: Translation support
@SuppressWarnings("deprecation")
@Override
public void construct() {
guiscreenBackground = false;
final UIFormContainer form = new UIFormContainer(this, formWidth, formHeight, formTitle);
form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
form.setMovable(true);
form.setClosable(false);
form.setBorder(FontColors.WHITE, 1, formAlpha);
form.setBackgroundAlpha(formAlpha);
final WorldClient world = this.client.world;
final RayTraceResult omo = this.client.objectMouseOver;
final BlockPos blockPos = omo.getBlockPos();
final IBlockState blockState = getState(world, blockPos);
final Block block = blockState.getBlock();
// Block image
final ItemStack pickStack = blockState.getBlock().getPickBlock(blockState, omo, this.client.world, omo.getBlockPos(), this.client.player);
final UIImage blockImage = new UIImage(this, pickStack);
blockImage.setPosition(leftPad / 2, 0, Anchor.LEFT | Anchor.TOP);
form.add(blockImage);
// Localized name
final UILabel labelLocalizedName = new UILabel(this, block.getLocalizedName());
labelLocalizedName.setFontOptions(FontColors.WHITE_FO);
labelLocalizedName.setPosition(SimpleScreen.getPaddedX(blockImage, 4), 0);
form.add(labelLocalizedName);
// Registry name
final String registryName = block.getRegistryName() == null ? "unknown" : block.getRegistryName().toString();
final UILabel labelRegistryName = new UILabel(this, registryName);
labelRegistryName.setFontOptions(FontColors.GRAY_FO);
labelRegistryName.setPosition(labelLocalizedName.getX(), SimpleScreen.getPaddedY(labelLocalizedName, 2));
form.add(labelRegistryName);
// Line separator
final UISeparator separator = new UISeparator(this);
separator.setSize(form.getWidth() - 15, 1);
separator.setPosition(0, SimpleScreen.getPaddedY(labelRegistryName, 3), Anchor.TOP | Anchor.CENTER);
form.add(separator);
// Property container
this.propertyContainer = new UIBackgroundContainer(this);
new UISlimScrollbar(this, this.propertyContainer, UIScrollBar.Type.VERTICAL).setAutoHide(true);
this.propertyContainer.setBackgroundAlpha(50);
this.propertyContainer.setPosition(0, SimpleScreen.getPaddedY(separator, 5));
form.add(this.propertyContainer);
// Get all displayed properties
loadProperties(world, blockState, blockPos);
// Adjust the size of the container to reach at most the specified max height
propertyContainer.setSize(UIComponent.INHERITED, Math.min(propertyContainerMaxHeight, propertyContainer.getContentHeight()));
final UIButton closeButton = new UIButtonBuilder(this).text("Close").anchor(Anchor.BOTTOM | Anchor.RIGHT).position(-4, -4).onClick(this::close).build("button.close");
form.add(closeButton);
// Adjust the size of the form to better fit content
form.setSize(form.getContentWidth() + leftPad, form.getContentHeight() + closeButton.getHeight() + 10);
// Readjust size for width because MalisisCore doesn't account for the scrollbar with UIComponent.INHERITED
propertyContainer.setSize(propertyContainer.getWidth() - 1, propertyContainer.getHeight());
addToScreen(form);
Mouse.setGrabbed(false);
}
use of com.almuradev.almura.shared.client.ui.component.button.UIButtonBuilder in project Almura by AlmuraDev.
the class SimplePageCreate method construct.
@Override
public void construct() {
this.guiscreenBackground = true;
final UIForm form = new UIForm(this, 150, 125, I18n.format("almura.guide.create.form.title"));
form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
form.setMovable(true);
form.setClosable(true);
form.setZIndex(50);
// File name
final UILabel labelId = new UILabel(this, I18n.format("almura.guide.label.id"));
labelId.setAnchor(Anchor.TOP | Anchor.LEFT);
this.textFieldId = new UITextField(this, "");
this.textFieldId.setAnchor(Anchor.TOP | Anchor.LEFT);
this.textFieldId.setPosition(0, SimpleScreen.getPaddedY(labelId, 1));
this.textFieldId.setSize(UIComponent.INHERITED, 0);
this.textFieldId.setFocused(true);
this.textFieldId.setFilter(String::toLowerCase);
// Index
final UILabel labelIndex = new UILabel(this, I18n.format("almura.guide.label.index"));
labelIndex.setAnchor(Anchor.TOP | Anchor.LEFT);
labelIndex.setPosition(0, this.textFieldId.isVisible() ? SimpleScreen.getPaddedY(this.textFieldId, padding) : padding);
this.textFieldIndex = new UITextField(this, Integer.toString(0));
this.textFieldIndex.setAnchor(Anchor.TOP | Anchor.LEFT);
this.textFieldIndex.setPosition(0, SimpleScreen.getPaddedY(labelIndex, 1));
this.textFieldIndex.setSize(UIComponent.INHERITED, 0);
this.textFieldIndex.setFilter(s -> s.replaceAll("[^\\d]", ""));
// Title
final UILabel labelName = new UILabel(this, I18n.format("almura.guide.label.name"));
labelName.setAnchor(Anchor.TOP | Anchor.LEFT);
labelName.setPosition(0, this.textFieldIndex.isVisible() ? SimpleScreen.getPaddedY(this.textFieldIndex, padding) : padding);
this.textFieldName = new UITextField(this, "");
this.textFieldName.setAnchor(Anchor.TOP | Anchor.LEFT);
this.textFieldName.setPosition(0, SimpleScreen.getPaddedY(labelName, 1));
this.textFieldName.setSize(UIComponent.INHERITED, 0);
this.textFieldName.setFilter(s -> s.substring(0, Math.min(s.length(), 50)));
// Save/Cancel
final UIButton buttonSave = new UIButtonBuilder(this).text(Text.of("almura.guide.button.save")).anchor(Anchor.BOTTOM | Anchor.RIGHT).width(40).listener(this).build("button.save");
final UIButton buttonCancel = new UIButtonBuilder(this).text(Text.of("almura.guide.button.cancel")).anchor(Anchor.BOTTOM | Anchor.RIGHT).position(SimpleScreen.getPaddedX(buttonSave, 2, Anchor.RIGHT), 0).width(40).listener(this).build("button.cancel");
form.add(labelId, this.textFieldId, labelIndex, this.textFieldIndex, labelName, this.textFieldName, buttonCancel, buttonSave);
addToScreen(form);
this.textFieldId.setFocused(true);
}
Aggregations