List of usage examples for com.vaadin.ui FormLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:ch.bfh.ti.soed.hs16.srs.black.view.loginView.LoginView.java
License:Open Source License
public LoginView() { usernameField = new TextField("Username"); usernameField.setIcon(FontAwesome.USER); usernameField.setWidth(12, Unit.EM); passwordField = new PasswordField("Password"); passwordField.setIcon(FontAwesome.KEY); passwordField.setWidth(12, Unit.EM); loginButton = new Button("Login"); loginButton.setWidth(5, Unit.EM);//w w w .j av a 2s . c om loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); signUpButton = new Button("Sign Up"); signUpButton.setWidth(6, Unit.EM); VerticalLayout layout = new VerticalLayout(); HorizontalLayout layoutButtons = new HorizontalLayout(loginButton, signUpButton); layoutButtons.setSpacing(true); Panel panel = new Panel("Login - Smart ReservationEntity System"); panel.setSizeUndefined(); layout.addComponent(panel); FormLayout content = new FormLayout(); content.addComponents(usernameField, passwordField, layoutButtons); content.setSizeFull(); content.setMargin(true); panel.setContent(content); setCompositionRoot(layout); layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); layout.setMargin(new MarginInfo(true, false, false, false)); }
From source file:ch.bfh.ti.soed.hs16.srs.black.view.reservationView.ReservationMakeView.java
License:Open Source License
public ReservationMakeView() { fromField = new DateField("Start Date"); fromField.setLocale(new Locale("de", "DE")); fromField.setResolution(Resolution.MINUTE); fromField.setDateFormat("dd.MM.yyyy HH:mm"); fromField.setIcon(FontAwesome.CALENDAR); fromField.setWidth(12, Unit.EM);/*from www. j av a 2s. c o m*/ toField = new DateField("End Date"); toField.setLocale(new Locale("de", "DE")); toField.setResolution(Resolution.MINUTE); toField.setDateFormat("dd.MM.yyyy HH:mm"); toField.setIcon(FontAwesome.CALENDAR); toField.setWidth(12, Unit.EM); roomSelect = new NativeSelect("Room Number"); roomSelect.setIcon(FontAwesome.BED); roomSelect.setNullSelectionAllowed(true); roomSelect.setImmediate(true); makeReservationButton = new Button("Make Reservation", FontAwesome.CHECK); makeReservationButton.setWidth(12, Unit.EM); logoutButton = new Button("Logout"); Panel panel = new Panel("Create New Reservation"); FormLayout content = new FormLayout(); content.addComponents(fromField, toField, roomSelect, makeReservationButton); content.setSizeUndefined(); content.setMargin(true); VerticalLayout formAndLogout = new VerticalLayout(content, logoutButton); formAndLogout.setMargin(true); panel.setContent(formAndLogout); makeViewLayout = new VerticalLayout(panel); makeViewLayout.setSizeUndefined(); makeViewLayout.setMargin(true); }
From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java
License:Open Source License
public SignUpView() { usernameField = new TextField("Username"); usernameField.setIcon(FontAwesome.USER); usernameField.setWidth(12, Unit.EM); passwordField = new PasswordField("Password"); passwordField.setIcon(FontAwesome.KEY); passwordField.setWidth(12, Unit.EM); passwordFieldRepeat = new PasswordField("Repeat Password"); passwordFieldRepeat.setIcon(FontAwesome.KEY); passwordFieldRepeat.setWidth(12, Unit.EM); addUserButton = new Button("Add New User"); addUserButton.setWidth(12, Unit.EM); goBackButton = new Button("Back"); VerticalLayout layout = new VerticalLayout(); Panel panel = new Panel("Sign Up - Smart ReservationEntity System"); panel.setSizeUndefined();/*from w w w . j a v a 2s .co m*/ layout.addComponent(panel); FormLayout content = new FormLayout(); content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton); content.setSizeUndefined(); content.setMargin(true); VerticalLayout formAndBack = new VerticalLayout(content, goBackButton); formAndBack.setMargin(true); panel.setContent(formAndBack); setCompositionRoot(layout); layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); layout.setMargin(new MarginInfo(true, false, false, false)); }
From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java
License:Open Source License
/** * Method which actually creates the whole UI. *//* w w w . jav a2 s. c o m*/ @Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); Panel panel = new Panel("Login"); panel.setSizeUndefined(); FormLayout content = new FormLayout(); userName = new TextField("Username"); content.addComponent(userName); PasswordField password = new PasswordField("Password"); content.addComponent(password); Button login = new Button("Login"); register = new Button("Register"); CheckBox askBox = new CheckBox("Are you a Roommanager?"); login.setStyleName(Reindeer.BUTTON_SMALL); login.setWidth("86px"); register.setStyleName(Reindeer.BUTTON_SMALL); register.setWidth("86px"); askBox.setStyleName(Reindeer.BUTTON_SMALL); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(login); hl.addComponent(register); hl.addComponent(askBox); content.addComponent(hl); content.setSizeUndefined(); content.setMargin(true); panel.setContent(content); login.addClickListener(e -> { System.out.println(userName.getValue()); System.out.println(password.getValue()); try { if (controller.login(userName.getValue(), password.getValue()) || userName.equals(userName.getValue()) && password.equals(password.getValue())) { setContent(new ReservationUI()); } } catch (Throwable e1) { e1.printStackTrace(); } }); register.addClickListener(e -> { try { Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER; controller.register(userName.getValue(), password.getValue(), x); } catch (Throwable e1) { e1.printStackTrace(); } }); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(panel); setContent(layout); }
From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java
License:Open Source License
private void initComponents() { removeAllComponents();/*from w ww. ja v a 2s . c o m*/ fieldGroup = new BeanFieldGroup<Vcf2fastaInputBean>(Vcf2fastaInputBean.class); vcf2fastaInputBean = new Vcf2fastaInputBean(config); fieldGroup.setItemDataSource(vcf2fastaInputBean); FormLayout layout = new FormLayout(); layout.setResponsive(true); layout.setMargin(true); layout.setWidth("100%"); //layout.addStyleName("light"); layout.setImmediate(true); addComponent(layout); Label section1; final ComboBox analysis_combo; final ComboBox accession_combo; Label section2; ComboBox contig_combo; TextField interval; Label section3; Component buttonLayout; Component progressLayout; section1 = new Label("Input"); section1.addStyleName("h3 colored"); layout.addComponent(section1); analysis_combo = getComboBox(ANALYSIS_CAPTION, ANALYSIS, getAnalysesList(), false); layout.addComponent(analysis_combo); accession_combo = getComboBox(ACCESSION_CAPTION, ACCESSION, getAccessionsList("Cassava 6.1 WGS Bredeson 61 accessions"), false); layout.addComponent(accession_combo); analysis_combo.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { accession_combo.setContainerDataSource(getAccessionsList((String) analysis_combo.getValue())); accession_combo.select(accession_combo.getContainerDataSource().getItemIds().iterator().next()); } }); section2 = new Label("Parameters"); section2.addStyleName("h3 colored"); layout.addComponent(section2); contig_combo = getComboBox(CONTIG_CAPTION, CONTIG, getContigsList(), true); layout.addComponent(contig_combo); interval = getTextField(INTERVAL_CAPTION, INTERVAL, vcf2fastaUI.getConfig().getString("defaultInterval"), 20); layout.addComponent(interval); section3 = new Label("Result"); section3.addStyleName("h3 colored"); layout.addComponent(section3); resultLayout = new VerticalLayout(); resultLayout.setSizeFull(); resultLayout.setMargin(true); resultLayout.setSpacing(true); resultLayout.addStyleName("light"); layout.addComponent(resultLayout); layout.addComponent(new Label("")); buttonLayout = getSubmitLayout(); layout.addComponent(buttonLayout); progressLayout = getProgressLayout(); layout.addComponent(progressLayout); initCommitHandler(); }
From source file:com.cavisson.gui.dashboard.components.controls.Forms.java
License:Apache License
public Forms() { setSpacing(true);/*from w ww. j av a 2 s. c om*/ setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Montly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.coatl.vaadin.abc.ixABCDialogos.java
ixDefinicionDeForma getForma(String forma, String tipo) { Stack<AbstractComponent> pila = new Stack(); Map<String, AbstractComponent> componentes = new HashMap(); AbstractComponent ultimo = null;/*from w w w .j ava 2 s. c o m*/ String[] cmds = forma.split(" "); for (String cmd : cmds) { cmd = cmd.trim(); if (!cmd.equals("")) { //System.out.println("CMD> [" + cmd + "]"); if (cmd.equals("bConfBorrar")) { agregar(pila, getbConfBorrar()); } else if (cmd.equals("bBorrar")) { agregar(pila, getbBorrar()); } else if (cmd.equals("bGuardar")) { agregar(pila, getbGuardar()); } else if (cmd.equals("bCrear")) { agregar(pila, getbCrear()); } else if (cmd.startsWith("H")) { HorizontalLayout hl = new HorizontalLayout(); if (cmd.contains("m")) { hl.setMargin(true); } agregar(pila, hl); } else if (cmd.startsWith("V")) { VerticalLayout vl = new VerticalLayout(); if (cmd.contains("m")) { vl.setMargin(true); } agregar(pila, vl); } else if (cmd.startsWith("F")) { FormLayout fl = new FormLayout(); if (cmd.contains("m")) { fl.setMargin(true); } agregar(pila, fl); } else if (cmd.equals(".")) { ultimo = pila.pop(); //System.out.println("Sacando de pila a " + ultimo); } else if (cmd.startsWith("'")) { String txt = cmd.substring(1); while (txt.contains("~")) { txt = txt.replace("~", " "); } Label l = new Label(txt); agregar(pila, l); } else { //System.out.println("Buscando columna [" + cmd + "]"); ixDefinicionDeColumna columna = columnas.get(cmd); String claseControl = columna.getClaseControl(); if (claseControl == null) { claseControl = "com.vaadin.ui.TextField"; } AbstractComponent con = null; try { con = (AbstractComponent) this.getClass().getClassLoader().loadClass(claseControl) .newInstance(); } catch (Exception ex) { System.out.println("ERROR INSTANCIANDO> [" + claseControl + "], " + ex); } con.setCaption(this.getTituloColumna(cmd)); if (con != null) { agregar(pila, con); componentes.put(cmd, con); } if (tipo != null) { if (tipo.toLowerCase().equals("c")) { if (columna.isSoloLecturaCrear() || columna.isSoloLectura()) { con.setReadOnly(true); } } if (tipo.toLowerCase().equals("e") || tipo.toLowerCase().equals("g")) { if (columna.isSoloLecturaGuardar() || columna.isSoloLectura()) { con.setReadOnly(true); } } if (tipo.toLowerCase().equals("b")) { con.setReadOnly(true); } } } } } while (pila.size() > 0) { ultimo = pila.pop(); } ixDefinicionDeForma res = new ixDefinicionDeForma(); res.setComponente(ultimo); res.setComponentes(componentes); return res; }
From source file:com.concur.ui.WebApp.java
License:Apache License
private Window createWindow() { FormLayout fl = new FormLayout(); // final SessionGuard sg = new SessionGuard(); // sg.setKeepalive(true); // fl.addComponent(sg); fl.setSizeFull();/*from w ww. j a v a 2s. c o m*/ fl.setMargin(true); fl.addComponent(new Label("<h2>ATS Tuple Store -- Demo App<h2/>", Label.CONTENT_XML)); actionField = new NativeSelect("Action:"); actionField.addItem("Authenticate"); actionField.addItem("GetTuple"); actionField.addItem("PutTuple"); actionField.addItem("GetConfigurations"); actionField.select("Authenticate"); fl.addComponent(actionField); tokenField = new TextField("Authentication Token:"); tokenField.setColumns(40); fl.addComponent(tokenField); tupleKeyField = new TextField("TupleKey:"); tupleKeyField.setColumns(40); fl.addComponent(tupleKeyField); tupleDataArea = new TextArea("TupleData:"); tupleDataArea.setColumns(40); tupleDataArea.setRows(5); fl.addComponent(tupleDataArea); Button b = new Button("Send Request"); b.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { submit(); } }); fl.addComponent(b); final Window w = new Window("ATS Tuple Store -- DEMO"); w.setContent(fl); return w; }
From source file:com.dungnv.streetfood.ui.CommonSearchPagedUI.java
private final void init() { setWidth("100%"); setStyleName("item-search-box"); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);//from w w w . j av a 2 s . co m this.addComponent(layout); FormLayout form = new FormLayout(); // form.setWidth("100%"); form.setMargin(false); layout.addComponent(form); layout.setComponentAlignment(form, Alignment.MIDDLE_CENTER); cbRecordPerPage = new ComboBox(); cbRecordPerPage.setWidth("65px"); cbRecordPerPage.setStyleName(ValoTheme.COMBOBOX_TINY); cbRecordPerPage.setCaption(BundleUtils.getLanguage("lbl.recordsPerPage")); cbRecordPerPage.setTextInputAllowed(false); cbRecordPerPage.addItem(10); cbRecordPerPage.addItem(20); cbRecordPerPage.addItem(30); cbRecordPerPage.addItem(50); cbRecordPerPage.addItem(100); cbRecordPerPage.addItem(200); cbRecordPerPage.select(10); form.addComponent(cbRecordPerPage); cbRecordPerPage.setNullSelectionAllowed(false); btnFastBackward = new Button(); btnFastBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFastBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFastBackward.setIcon(FontAwesome.FAST_BACKWARD); layout.addComponent(btnFastBackward); layout.setComponentAlignment(btnFastBackward, Alignment.MIDDLE_CENTER); btnBackward = new Button(); btnBackward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnBackward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnBackward.setIcon(FontAwesome.BACKWARD); layout.addComponent(btnBackward); layout.setComponentAlignment(btnBackward, Alignment.MIDDLE_CENTER); cbPaged = new ComboBox(); cbPaged.setTextInputAllowed(false); for (int i = 1; i <= pageCount; i++) { cbPaged.addItem(i); } cbPaged.setNullSelectionAllowed(false); cbPaged.select(1); cbPaged.addStyleName(ValoTheme.COMBOBOX_TINY); cbPaged.setWidth("60px"); layout.addComponent(cbPaged); layout.setComponentAlignment(cbPaged, Alignment.MIDDLE_CENTER); btnFoward = new Button(); btnFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFoward.setIcon(FontAwesome.FORWARD); layout.addComponent(btnFoward); layout.setComponentAlignment(btnFoward, Alignment.MIDDLE_CENTER); btnFastFoward = new Button(); btnFastFoward.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnFastFoward.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnFastFoward.setIcon(FontAwesome.FAST_FORWARD); layout.addComponent(btnFastFoward); layout.setComponentAlignment(btnFastFoward, Alignment.MIDDLE_CENTER); enableComponent(); }
From source file:com.etest.valo.Forms.java
License:Apache License
public Forms() { setSpacing(true);/* w w w. j a v a 2 s. co m*/ setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Monthly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }