List of usage examples for com.vaadin.ui FormLayout addComponent
@Override public void addComponent(Component c)
From source file:com.mcparland.john.vaadin_mvn_arch.samples.authentication.LoginScreen.java
License:Apache License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();// ww w . j a v a 2 s.c o m loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription("Write anything"); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); buttons.addComponent(login = new Button("Login")); login.setDisableOnClick(true); login.addClickListener(new Button.ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { try { login(); } finally { login.setEnabled(true); } } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Try anything")); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); return loginForm; }
From source file:com.morevaadin.eventbus.ui.AggregateView.java
License:Apache License
public AggregateView() { EventBus bus = new EventBus(); FormLayout layout = new FormLayout(); FirstComponent first = new FirstComponent(bus); SecondComponent second = new SecondComponent(); bus.register(second);/*from w ww . j a va 2s . c o m*/ layout.addComponent(first); layout.addComponent(second); setCompositionRoot(layout); }
From source file:com.morevaadin.vaadin.externallayout.View.java
License:Apache License
public View() { FormLayout layout = new FormLayout(); layout.addComponent(new TextField("First name")); layout.addComponent(new TextField("Last name")); layout.addComponent(new DateField("Birth date")); layout.addComponent(new Button("Submit")); setCompositionRoot(layout);//from ww w . j av a2 s . c om }
From source file:com.morevaadin.vaadin7.converter.ConverterView.java
License:Apache License
public ConverterView() { FormLayout layout = new FormLayout(); layout.setMargin(true);/*from w w w .j a va 2s .co m*/ setCompositionRoot(layout); FieldGroup group = new FieldGroup(); Account account = new Account(); Money money = Money.of(CurrencyUnit.USD, new BigDecimal(1000)); account.setBalance(money); group.setItemDataSource(new BeanItem<Account>(account)); TextField field = (TextField) group.buildAndBind("Balance", "balance"); field.setImmediate(true); field.setConverter(Money.class); layout.addComponent(field); }
From source file:com.morevaadin.vaadin7.html.basic.BasicHtmlIntegrationView.java
License:Apache License
public BasicHtmlIntegrationView() { FormLayout layout = new FormLayout(); addComponent(layout);/*from ww w. j a va 2 s . c o m*/ Link blog = new Link("A Java Geek", new ExternalResource("http://blog.frankel.ch/")); Link morevaadin = new Link("More Vaadin", new ExternalResource("http://morevaadin.com/")); new BasicTooltipExtension().extend(blog); new BasicTooltipExtension().extend(morevaadin); layout.addComponent(blog); layout.addComponent(morevaadin); }
From source file:com.morevaadin.vaadin7.html.config.ConfigurableHtmlIntegrationView.java
License:Apache License
public ConfigurableHtmlIntegrationView() { FormLayout layout = new FormLayout(); addComponent(layout);/* w w w . j a v a2s . co m*/ Link blog = new Link("A Java Geek", new ExternalResource("http://blog.frankel.ch/")); Link morevaadin = new Link("More Vaadin", new ExternalResource("http://morevaadin.com/")); new ConfigurableTooltipExtension().extend(blog); new ConfigurableTooltipExtension().extend(morevaadin); layout.addComponent(blog); layout.addComponent(morevaadin); }
From source file:com.morevaadin.vaadin7.html.js.JavascriptIntegrationView.java
License:Apache License
public JavascriptIntegrationView() { FormLayout layout = new FormLayout(); addComponent(layout);/*from w w w. j a v a 2s . com*/ Link blog = new Link("A Java Geek", new ExternalResource("http://blog.frankel.ch/")); Link morevaadin = new Link("More Vaadin", new ExternalResource("http://morevaadin.com/")); new JavascriptTooltipExtension().extend(blog); new JavascriptTooltipExtension().extend(morevaadin); layout.addComponent(blog); layout.addComponent(morevaadin); }
From source file:com.naoset.framework.frontend.component.profile.CustomerPanelView.java
private Component builtData() { FormLayout details = new FormLayout(); details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); code = new TextField("First Name"); details.addComponent(code); name = new TextField("Last Name"); details.addComponent(name);/*w ww . j a v a 2 s .c o m*/ sexField = new OptionGroup("Sex"); sexField.addItem(Boolean.FALSE); sexField.setItemCaption(Boolean.FALSE, "Female"); sexField.addItem(Boolean.TRUE); sexField.setItemCaption(Boolean.TRUE, "Male"); sexField.addStyleName("horizontal"); details.addComponent(sexField); // Label section = new Label("Contact Info"); // section.addStyleName(ValoTheme.LABEL_H4); // section.addStyleName(ValoTheme.LABEL_COLORED); // details.addComponent(section); emailField = new TextField("Email"); emailField.setWidth("100%"); emailField.setRequired(true); emailField.setNullRepresentation(""); details.addComponent(emailField); locationField = new TextField("Direccin"); locationField.setWidth("100%"); locationField.setNullRepresentation(""); locationField.setComponentError(new UserError("This address doesn't exist")); details.addComponent(locationField); phoneField = new TextField("Telefono"); phoneField.setWidth("100%"); phoneField.setNullRepresentation(""); details.addComponent(phoneField); details.addComponent(buildSpecies()); return details; }
From source file:com.neatresults.mgnltweaks.app.status.ConfigStatusViewImpl.java
License:Open Source License
@Override public void build() { Component totalExtends = buildAndBind(ConfigStatusView.EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.extendscount")); Component absoluteExtends = buildAndBind(ConfigStatusView.ABS_EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.absoluteextendscount")); Component relativeExtends = buildAndBind(ConfigStatusView.REL_EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.relativeextendscount")); Component overrideExtends = buildAndBind(ConfigStatusView.OVR_EXTENDS_COUNT, translator.translate("neatconfiguration.app.status.overrideextendscount")); Component unresolvedExtends = buildAndBind(ConfigStatusView.EXTENDS_FAIL_COUNT, translator.translate("neatconfiguration.app.status.extendsfailcount")); Component unresolvedExtendsList = buildAndBindList(ConfigStatusView.EXTENDS_FAIL_LIST, translator.translate("neatconfiguration.app.status.extendsfaillist")); unresolvedExtendsList.addStyleName("neat-extends-list"); // top title// ww w . j a v a2 s . c om FormLayout layout = new FormLayout(); Label sectionTitle = new Label(translator.translate("neatconfiguration.app.status.top.title")); sectionTitle.addStyleName("section-title"); layout.addComponent(sectionTitle); root.addSection(layout); // extends layout = new FormLayout(); layout.addComponent( createFieldsetTitle(translator.translate("neatconfiguration.app.status.extends.title"))); layout.addComponent(totalExtends); layout.addComponent(absoluteExtends); layout.addComponent(relativeExtends); layout.addComponent(overrideExtends); layout.addComponent(unresolvedExtends); layout.addComponent(unresolvedExtendsList); root.addSection(layout); // refresh layout = new FormLayout(); Button refreshButton = new Button(translator.translate("neatconfiguration.app.status.refresh.caption")); refreshButton.addStyleName("v-button-smallapp"); refreshButton.addStyleName("commit"); refreshButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { getListener().refreshData(); refresh(); } }); layout.addComponent(refreshButton); root.addSection(layout); }
From source file:com.ocs.dynamo.functional.ui.MultiDomainEditLayout.java
License:Apache License
public void build() { mainLayout = new DefaultVerticalLayout(true, true); // form that contains the combo box FormLayout form = new FormLayout(); form.setMargin(true);/*ww w . ja v a 2 s . co m*/ form.setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN); mainLayout.addComponent(form); // combo box for selecting domain domainCombo = new ComboBox(message("ocs.select.domain")); for (Class<? extends Domain> clazz : getDomainClasses()) { domainCombo.addItem(clazz); domainCombo.setItemCaption(clazz, getEntityModelFactory().getModel(clazz).getDisplayName()); } domainCombo.setNullSelectionAllowed(false); domainCombo.setSizeFull(); // respond to a change by displaying the correct domain domainCombo.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 8441066091930807231L; @Override @SuppressWarnings("unchecked") public void valueChange(ValueChangeEvent event) { selectDomain((Class<? extends Domain>) event.getProperty().getValue()); } }); form.addComponent(domainCombo); selectedDomainLayout = new DefaultVerticalLayout(); mainLayout.addComponent(selectedDomainLayout); // select the first domain (if there is any) if (!getDomainClasses().isEmpty()) { domainCombo.setValue(getDomainClasses().get(0)); } setCompositionRoot(mainLayout); }