本文整理匯總了Java中com.vaadin.ui.FormLayout類的典型用法代碼示例。如果您正苦於以下問題:Java FormLayout類的具體用法?Java FormLayout怎麽用?Java FormLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FormLayout類屬於com.vaadin.ui包,在下文中一共展示了FormLayout類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: form1
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
public void form1() {
// tag::form1[]
final PathProperty<Long> ID = PathProperty.create("id", Long.class);
final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);
final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);
PropertyInputForm form = Components.input.form(new FormLayout()).properties(PROPERTIES).required(ID).build(); // <1>
form = Components.input.form(new FormLayout()).properties(PROPERTIES).required(ID)
.composer((layout, source) -> { // <2>
source.getValueComponents().forEach(c -> layout.addComponent(c.getComponent()));
}).build();
form.setValue(PropertyBox.builder(PROPERTIES).set(ID, 1L).set(DESCRIPTION, "Test").build()); // <3>
PropertyBox value = form.getValue(); // <4>
// end::form1[]
}
示例2: view2
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
public void view2() {
// tag::view2[]
final PathProperty<Long> ID = PathProperty.create("id", Long.class);
final PathProperty<String> DESCRIPTION = PathProperty.create("description", String.class);
final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION);
PropertyViewGroup viewGroup = Components.view.propertyGroup().properties(PROPERTIES).build(); // <1>
PropertyViewForm viewForm = Components.view.formVertical().properties(PROPERTIES).build(); // <2>
viewForm = Components.view.form(new FormLayout()).properties(PROPERTIES) //
.composer((layout, source) -> { // <3>
source.getValueComponents().forEach(c -> layout.addComponent(c.getComponent()));
}).build();
viewForm.setValue(PropertyBox.builder(PROPERTIES).set(ID, 1L).set(DESCRIPTION, "Test").build()); // <4>
PropertyBox value = viewForm.getValue(); // <5>
// end::view2[]
}
示例3: getTestComponent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
public Component getTestComponent() {
AutoBinder<Flight> binder = new AutoBinder<>(Flight.class);
binder.bindInstanceFields(this);
FormLayout f = new FormLayout();
f.addComponents(airline, flightNumber, flightSuffix, date, legType, sbt, ebt, abt, gate, canceled);
Label statusLabel = new Label();
binder.setStatusLabel(statusLabel);
f.addComponents(statusLabel);
binder.setBean(new Flight());
return f;
}
示例4: getTestComponent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
public Component getTestComponent() {
ReflectionBinder<Flight> binder = new ReflectionBinder<>(Flight.class);
binder.bind(airline, "flightId.airline");
binder.bind(flightNumber, "flightId.flightNumber");
binder.bind(flightSuffix, "flightId.flightSuffix");
binder.bind(date, "flightId.date");
binder.bind(legType, "flightId.legType");
binder.bind(sbt, "sbt");
binder.bind(ebt, "ebt");
binder.bind(abt, "abt");
binder.bind(gate, "gate");
binder.bind(canceled, "canceled");
FormLayout f = new FormLayout();
f.addComponents(airline, flightNumber, flightSuffix, date, legType, sbt, ebt, abt, gate, canceled);
Label statusLabel = new Label();
binder.setStatusLabel(statusLabel);
f.addComponents(statusLabel);
binder.setBean(new Flight());
return f;
}
示例5: init
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@PostConstruct
void init() {
FormLayout formLayout = new FormLayout();
formLayout.addComponent(usernameField);
formLayout.addComponent(passwordField);
formLayout.addComponent(loginButton);
formLayout.setWidth(null);
addComponent(formLayout);
loginButton.setClickShortcut( ShortcutAction.KeyCode.ENTER ) ;
loginButton.addClickListener((Button.ClickListener) clickEvent -> {
if (usernameField.isEmpty()) {
Notification.show("Username is required");
usernameField.focus();
} else if (passwordField.isEmpty()) {
Notification.show("Password is required");
passwordField.focus();
} else {
handler.login(this, usernameField.getValue(), passwordField.getValue());
}
});
usernameField.focus();
// setComponentAlignment(formLayout, Alignment.MIDDLE_CENTER);
}
示例6: createContent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
protected Component createContent() {
FormLayout layout = new FormLayout();
name = new FTextField("Nom");
shortDescription = new FTextField("Description courte").withFullWidth();
description = new FTextArea("Description").withFullWidth();
keyAbility = new ComboBox<Ability>("Attribut clé", Services.getAbilityService().findAll());
layout.addComponent(name);
layout.addComponent(shortDescription);
layout.addComponent(description);
layout.addComponent(keyAbility);
layout.addComponent(getToolbar());
return layout;
}
示例7: createContent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
protected Component createContent() {
FormLayout layout = new FormLayout();
name = new FTextField("Nom");
abbreviation = new FTextField("Abbréviation");
playable = new FormCheckBox("Jouable par un personnage");
shortDescription = new FTextField("Description courte").withFullWidth();
description = new FTextArea("Description").withFullWidth();
layout.addComponent(name);
layout.addComponent(abbreviation);
layout.addComponent(playable);
layout.addComponent(shortDescription);
layout.addComponent(description);
layout.addComponent(getToolbar());
return layout;
}
示例8: createContent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
protected Component createContent() {
FormLayout layout = new FormLayout();
name = new FTextField("Nom");
region = new ComboBox<Region>("Région", regionService.findAll());
shortDescription = new FTextField("Description courte");
description = new FTextArea("Description").withFullWidth();
layout.addComponent(name);
layout.addComponent(region);
layout.addComponent(shortDescription);
layout.addComponent(description);
layout.addComponent(getToolbar());
return layout;
}
示例9: createContent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
protected Component createContent() {
FormLayout layout = new FormLayout();
name = new FTextField("Nom").withWidth(50, Unit.PERCENTAGE);
description = new FTextArea("Description").withFullWidth().withRows(10);
usage = new EnumComboBox<FeatUsage>(FeatUsage.class, "Usage");
prerequisiteType = new EnumComboBox<PrerequisiteType>(PrerequisiteType.class, "Type de prérequis");
prerequisiteArmorProficiency = new EnumComboBox<>(ArmorType.ProficiencyType.class, "Maitrise d'armure prérequise");
prerequisiteAbility = new ComboBox<Ability>("Caractéristique prérequise", abilityService.findAll());
prerequisiteAbilityScore = new DSIntegerField("Score de caractéristique");
prerequisiteType.addSelectionListener(event -> adjustTypeVisibility(event.getValue()));
layout.addComponent(name);
layout.addComponent(description);
layout.addComponent(usage);
layout.addComponents(prerequisiteType, prerequisiteArmorProficiency, prerequisiteAbility, prerequisiteAbilityScore);
layout.addComponent(getToolbar());
return layout;
}
示例10: getSpellWindow
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
private void getSpellWindow(Spell spell) {
Messages messages = Messages.getInstance();
Window window = new Window(spell.getName());
window.setModal(true);
window.setWidth("60%");
CollectionToStringConverter converter = new CollectionToStringConverter();
FormLayout layout = new FormLayout();
DSLabel componentType = new DSLabel(messages.getMessage("spellStep.component.label"),
converter.convertToPresentation(spell.getComponentTypes(), new ValueContext()));
DSLabel text = new DSLabel(messages.getMessage("spellStep.description.label"), spell.getDescription());
layout.addComponents(componentType, text);
//TODO : other useful info
window.setContent(layout);
UI.getCurrent().addWindow(window);
}
示例11: createContent
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@Override
protected Component createContent() {
layout = new FormLayout();
name = new FTextField("Titre").withWidth("50%");
description = new FTextArea("Description").withFullWidth();
challengeRating = new ComboBox<>("Degré de difficulté");
challengeRating.setItems(Services.getLevelService().findAll());
status = new EnumComboBox<>(AdventureStatus.class, "Statut");
layout.addComponents(name, description, challengeRating, status);
layout.addComponent(getToolbar());
messageButton = new Button("Messages", event -> {
EventBus.post(new NavigationEvent(AdventureView.URI + "/" + getEntity().getId()));
});
layout.addComponent(messageButton);
return layout;
}
示例12: MultiColumnFormLayout
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
public MultiColumnFormLayout(int columns, String caption) {
if (columns < 1) {
throw new IllegalArgumentException("column number must be greater than 1");
}
hLayout = new HorizontalLayout();
hLayout.setWidth(100, Unit.PERCENTAGE);
for (int i = 0; i < columns; i++) {
FormLayout form = new FormLayout();
hLayout.addComponent(form, i);
}
if (caption != null) {
hLayout.setMargin(new MarginInfo(false, true));
Panel panel = new Panel(caption, hLayout);
setCompositionRoot(panel);
} else {
setCompositionRoot(hLayout);
}
}
示例13: postInit
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
@PostConstruct
private void postInit() {
addStyleName("bookery-content");
formLayout = new FormLayout();
formLayout.addStyleName("light");
formLayout.addComponents(generateFields());
formLayout.addComponents(generateStatusFields());
Button checkSolr = new Button("check", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
checkSolr();
}
});
checkSolr.addStyleName(ValoTheme.BUTTON_SMALL);
checkSolr.addStyleName(ValoTheme.BUTTON_FRIENDLY);
formLayout.addComponent(checkSolr);
Label titleLabel = new Label("General Settings");
titleLabel.addStyleName(ValoTheme.LABEL_H2);
addComponents(titleLabel, formLayout);
}
示例14: createSolrIndexManagementSection
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
protected Component createSolrIndexManagementSection() {
FormLayout layout = new FormLayout();
Label manageSolrSectionTitle = new Label(i18n.translate("solr.app.manageSolrIndex.label.intro"));
manageSolrSectionTitle.addStyleName(STYLE_SECTION_TITLE);
layout.addComponent(manageSolrSectionTitle);
layout.addComponent(new Label(i18n.translate("solr.app.manageSolrIndex.label.description")));
Button clearSolrIndexButton =
new Button(i18n.translate("solr.app.management.button.clearSolrIndex.caption"),
event -> listener.clearSolrIndex()
);
clearSolrIndexButton.addStyleName(STYLE_V_BUTTON_SMALLAPP);
clearSolrIndexButton.addStyleName(STYLE_COMMIT);
VerticalLayout buttons = new VerticalLayout();
buttons.addStyleName(STYLE_BUTTONS);
buttons.setSpacing(true);
buttons.addComponent(clearSolrIndexButton);
layout.addComponent(buttons);
return layout;
}
示例15: buildEntryForm
import com.vaadin.ui.FormLayout; //導入依賴的package包/類
protected FormLayout buildEntryForm() {
FormLayout form = new FormLayout();
form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
form.setMargin(true);
nameField = new TextField("Name");
nameField.setValue(releasePackage.getName() != null ? releasePackage.getName() : "");
nameField.setReadOnly(releasePackage.isReleased());
form.addComponent(nameField);
versionLabelField = new TextField("Version");
versionLabelField.setValue(releasePackage.getVersionLabel() != null ? releasePackage.getVersionLabel() : "");
versionLabelField.setReadOnly(releasePackage.isReleased());
form.addComponent(versionLabelField);
releaseDateField = new DateField("Release Date");
releaseDateField.setValue(releasePackage.getReleaseDate() != null ? releasePackage.getReleaseDate() : null);
releaseDateField.setReadOnly(releasePackage.isReleased());
form.addComponent(releaseDateField);
return form;
}