use of com.almuradev.almura.shared.client.ui.component.UIForm 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);
}
use of com.almuradev.almura.shared.client.ui.component.UIForm in project Almura by AlmuraDev.
the class SimpleConfirmRemove method construct.
@Override
public void construct() {
// Create the form
final UIForm form = new UIForm(this, 250, 60, I18n.format("almura.guide.view.form.title"));
form.setAnchor(Anchor.CENTER | Anchor.MIDDLE);
// Confirmation Window Text
final UILabel line1 = new UILabel(this, "Do you wish to delete the selected guide?");
line1.setPosition(0, 0, Anchor.CENTER | Anchor.TOP);
final UIButton yesButton = new UIButton(this, "Yes");
yesButton.setSize(30, 10);
yesButton.setPosition(-45, 0, Anchor.RIGHT | Anchor.BOTTOM);
yesButton.setName("button.yes");
yesButton.register(this);
// Cancel
final UIButton noButton = new UIButton(this, "No");
noButton.setSize(30, 10);
noButton.setPosition(-10, 0, Anchor.RIGHT | Anchor.BOTTOM);
noButton.setName("button.no");
noButton.register(this);
form.add(line1, yesButton, noButton);
addToScreen(form);
}
use of com.almuradev.almura.shared.client.ui.component.UIForm in project Almura by AlmuraDev.
the class SimplePageDetails method construct.
@Override
public void construct() {
this.guiscreenBackground = true;
this.validatePage();
assert manager.getPage() != null;
final UIForm form = new UIForm(this, 150, 225, I18n.format("almura.guide.details.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);
final UITextField textFieldId = new UITextField(this, manager.getPage().getId());
textFieldId.setAnchor(Anchor.TOP | Anchor.LEFT);
textFieldId.setPosition(0, SimpleScreen.getPaddedY(labelId, 1));
textFieldId.setSize(UIComponent.INHERITED, 0);
textFieldId.setFontOptions(this.readOnlyFontOptions);
textFieldId.setEditable(false);
// Index
final UILabel labelIndex = new UILabel(this, I18n.format("almura.guide.label.index"));
labelIndex.setAnchor(Anchor.TOP | Anchor.LEFT);
labelIndex.setPosition(0, SimpleScreen.getPaddedY(textFieldId, padding));
this.textFieldIndex = new UITextField(this, Integer.toString(manager.getPage().getIndex()));
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, SimpleScreen.getPaddedY(this.textFieldIndex, padding));
this.textFieldName = new UITextField(this, manager.getPage().getName());
this.textFieldName.setAnchor(Anchor.TOP | Anchor.LEFT);
this.textFieldName.setPosition(0, SimpleScreen.getPaddedY(labelName, 1));
this.textFieldName.setSize(UIComponent.INHERITED, 0);
// Creator
final UILabel labelCreator = new UILabel(this, I18n.format("almura.guide.label.creator"));
labelCreator.setAnchor(Anchor.TOP | Anchor.LEFT);
labelCreator.setPosition(0, SimpleScreen.getPaddedY(this.textFieldName, padding));
// TODO: Show username in format of: Username (UUID)
final UITextField textFieldCreator = new UITextField(this, manager.getPage().getCreator().toString());
textFieldCreator.setAnchor(Anchor.TOP | Anchor.LEFT);
textFieldCreator.setPosition(0, SimpleScreen.getPaddedY(labelCreator, 1));
textFieldCreator.setSize(UIComponent.INHERITED, 0);
textFieldCreator.setFontOptions(this.readOnlyFontOptions);
textFieldCreator.setEditable(false);
// Created
final UILabel labelCreated = new UILabel(this, I18n.format("almura.guide.label.created"));
labelCreated.setAnchor(Anchor.TOP | Anchor.LEFT);
labelCreated.setPosition(0, SimpleScreen.getPaddedY(textFieldCreator, padding));
final UITextField textFieldCreated = new UITextField(this, formatter.format(manager.getPage().getCreated()));
textFieldCreated.setAnchor(Anchor.TOP | Anchor.LEFT);
textFieldCreated.setPosition(0, SimpleScreen.getPaddedY(labelCreated, 1));
textFieldCreated.setSize(UIComponent.INHERITED, 0);
textFieldCreated.setFontOptions(this.readOnlyFontOptions);
textFieldCreated.setEditable(false);
// Last Modifier
final UILabel labelLastModifier = new UILabel(this, I18n.format("almura.guide.label.last_modifier"));
labelLastModifier.setAnchor(Anchor.TOP | Anchor.LEFT);
labelLastModifier.setPosition(0, SimpleScreen.getPaddedY(textFieldCreated, padding));
// TODO: Show username in format of: Username (UUID)
final UITextField textFieldLastModifier = new UITextField(this, manager.getPage().getLastModifier().toString());
textFieldLastModifier.setAnchor(Anchor.TOP | Anchor.LEFT);
textFieldLastModifier.setPosition(0, SimpleScreen.getPaddedY(labelLastModifier, 1));
textFieldLastModifier.setSize(UIComponent.INHERITED, 0);
textFieldLastModifier.setFontOptions(this.readOnlyFontOptions);
textFieldLastModifier.setEditable(false);
// Last Modified
final UILabel labelLastModified = new UILabel(this, I18n.format("almura.guide.label.last_modified"));
labelLastModified.setAnchor(Anchor.TOP | Anchor.LEFT);
labelLastModified.setPosition(0, SimpleScreen.getPaddedY(textFieldLastModifier, padding));
final UITextField textFieldLastModified = new UITextField(this, formatter.format(manager.getPage().getLastModified()));
textFieldLastModified.setAnchor(Anchor.TOP | Anchor.LEFT);
textFieldLastModified.setPosition(0, SimpleScreen.getPaddedY(labelLastModified, 1));
textFieldLastModified.setSize(UIComponent.INHERITED, 0);
textFieldLastModified.setFontOptions(this.readOnlyFontOptions);
textFieldLastModified.setEditable(false);
// Save/Cancel
final UIButton buttonSave = new UIButtonBuilder(this).text(Text.of("almura.guide.button.close")).anchor(Anchor.BOTTOM | Anchor.RIGHT).width(40).listener(this).build("button.close");
final UIButton buttonCancel = new UIButtonBuilder(this).text(Text.of("almura.guide.button.save")).anchor(Anchor.BOTTOM | Anchor.RIGHT).position(SimpleScreen.getPaddedX(buttonSave, 2, Anchor.RIGHT), 0).width(40).listener(this).build("button.save");
form.add(labelId, textFieldId, labelIndex, this.textFieldIndex, labelName, this.textFieldName, labelCreator, textFieldCreator, labelCreated, textFieldCreated, labelLastModifier, textFieldLastModifier, labelLastModified, textFieldLastModified, buttonSave, buttonCancel);
addToScreen(form);
}
Aggregations