List of usage examples for com.vaadin.ui FormLayout FormLayout
public FormLayout()
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 w ww.j a v a 2 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 ww.j a v a2s . c o 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. ja v a 2s . 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 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);/*from www . ja va 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 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 www .jav a 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 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);/*from www. j a v a2 s .c o m*/ name = new TextField("Last Name"); details.addComponent(name); 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//from ww w . j av a 2 s. co m 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);//from ww w . j a va 2s. 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); }
From source file:com.ocs.dynamo.ui.composite.form.ModelBasedEditForm.java
License:Apache License
/** * Constructs the main layout of the screen * //w w w . jav a 2s . c om * @param entityModel * @return */ protected VerticalLayout buildMainLayout(EntityModel<T> entityModel) { VerticalLayout layout = new VerticalLayout(); titleLabels.put(isViewMode(), constructTitleLabel()); // horizontal layout that contains title label and buttons titleBars.put(isViewMode(), new DefaultHorizontalLayout(false, true, true)); titleBars.get(isViewMode()).addComponent(titleLabels.get(isViewMode())); HorizontalLayout buttonBar = constructButtonBar(); buttonBar.setSizeUndefined(); titleBars.get(isViewMode()).addComponent(buttonBar); layout.addComponent(titleBars.get(isViewMode())); Layout form = null; if (entityModel.usesDefaultGroupOnly()) { form = new FormLayout(); } else { form = new DefaultVerticalLayout(false, true); } // in case of vertical layout (the default), don't use the entire screen if (ScreenMode.VERTICAL.equals(getFormOptions().getScreenMode())) { form.setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN); } int count = 0; if (!entityModel.usesDefaultGroupOnly()) { // display the attributes in groups TabSheet tabSheet = null; boolean tabs = AttributeGroupMode.TABSHEET.equals(getFormOptions().getAttributeGroupMode()); if (tabs) { tabSheet = new TabSheet(); form.addComponent(tabSheet); } if (getParentGroupHeaders() != null && getParentGroupHeaders().length > 0) { // extra layer of grouping for (String parentGroupHeader : getParentGroupHeaders()) { Layout innerForm = constructAttributeGroupLayout(form, tabs, tabSheet, parentGroupHeader, false); // add a tab sheet on the inner level if needed TabSheet innerTabSheet = null; boolean innerTabs = !tabs; if (innerTabs) { innerTabSheet = new TabSheet(); innerForm.addComponent(innerTabSheet); } // add all appropriate inner groups int tempCount = processParentHeaderGroup(parentGroupHeader, innerForm, innerTabs, innerTabSheet, count); count += tempCount; } } else { // just one layer of attribute groups for (String attributeGroup : entityModel.getAttributeGroups()) { if (entityModel.isAttributeGroupVisible(attributeGroup, viewMode)) { Layout innerForm = constructAttributeGroupLayout(form, tabs, tabSheet, getAttributeGroupCaption(attributeGroup), true); for (AttributeModel attributeModel : entityModel .getAttributeModelsForGroup(attributeGroup)) { addField(innerForm, entityModel, attributeModel, count); count++; } } } } } else { // iterate over the attributes and add them to the form (without any // grouping) for (AttributeModel attributeModel : entityModel.getAttributeModels()) { addField(form, entityModel, attributeModel, count); count++; } } layout.addComponent(form); if (firstField != null) { firstField.focus(); } buttonBar = constructButtonBar(); buttonBar.setSizeUndefined(); layout.addComponent(buttonBar); checkSaveButtonState(); return layout; }
From source file:com.ocs.dynamo.ui.composite.form.ModelBasedEditForm.java
License:Apache License
/** * Construct the layout (form and panel) for an attribute group * /*from w w w . ja v a2s . c o m*/ * @param parent * the parent component * @param tabs * whether to include the component in a tab sheet * @param tabSheet * the parent tab sheet (only used if the "tabs" parameter is true) * @param caption * caption of the panel or tab sheet * @param lowest * indicates whether this is the lowest level * @return */ private Layout constructAttributeGroupLayout(Layout parent, boolean tabs, TabSheet tabSheet, String caption, boolean lowest) { Layout innerLayout = null; if (lowest) { innerLayout = new FormLayout(); ((FormLayout) innerLayout).setMargin(true); if (!tabs) { ((FormLayout) innerLayout).setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN); } } else { innerLayout = new DefaultVerticalLayout(true, true); } if (tabs) { tabSheet.addTab(innerLayout, caption); } else { Panel panel = new Panel(); panel.setStyleName("attributePanel"); panel.setCaption(caption); panel.setContent(innerLayout); parent.addComponent(panel); } return innerLayout; }