List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
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 .j a v a2s . 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:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel windows() { Panel p = new Panel("Dialogs"); VerticalLayout content = new VerticalLayout() { final Window win = new Window("Window Caption"); String prevHeight = "300px"; boolean footerVisible = true; boolean autoHeight = false; boolean tabsVisible = false; boolean toolbarVisible = false; boolean footerToolbar = false; boolean toolbarLayout = false; String toolbarStyle = null; VerticalLayout windowContent() { VerticalLayout root = new VerticalLayout(); if (toolbarVisible) { MenuBar menuBar = MenuBars.getToolBar(); menuBar.setSizeUndefined(); menuBar.setStyleName(toolbarStyle); Component toolbar = menuBar; if (toolbarLayout) { menuBar.setWidth(null); HorizontalLayout toolbarLayout = new HorizontalLayout(); toolbarLayout.setWidth("100%"); toolbarLayout.setSpacing(true); Label label = new Label("Tools"); label.setSizeUndefined(); toolbarLayout.addComponents(label, menuBar); toolbarLayout.setExpandRatio(menuBar, 1); toolbarLayout.setComponentAlignment(menuBar, Alignment.TOP_RIGHT); toolbar = toolbarLayout; }//from w w w . jav a 2s.c om toolbar.addStyleName("v-window-top-toolbar"); root.addComponent(toolbar); } Component content = null; if (tabsVisible) { TabSheet tabs = new TabSheet(); tabs.setSizeFull(); VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML)); l.setMargin(true); tabs.addTab(l, "Selected"); tabs.addTab(new Label(" ", ContentMode.HTML), "Another"); tabs.addTab(new Label(" ", ContentMode.HTML), "One more"); tabs.addStyleName("padded-tabbar"); tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) { try { Thread.sleep(600); } catch (InterruptedException e) { e.printStackTrace(); } } }); content = tabs; } else if (!autoHeight) { Panel p = new Panel(); p.setSizeFull(); p.addStyleName("borderless"); if (!toolbarVisible || !toolbarLayout) { p.addStyleName("scroll-divider"); } VerticalLayout l = new VerticalLayout(); l.addComponent(new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML)); l.setMargin(true); p.setContent(l); content = p; } else { content = new Label( "<h2>Subtitle</h2><p>Normal type for plain text. Etiam at risus et justo dignissim congue. Phasellus laoreet lorem vel dolor tempus vehicula.</p><p>Quisque ut dolor gravida, placerat libero vel, euismod. Etiam habebis sem dicantur magna mollis euismod. Nihil hic munitissimus habendi senatus locus, nihil horum? Curabitur est gravida et libero vitae dictum. Ullamco laboris nisi ut aliquid ex ea commodi consequat. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</p>", ContentMode.HTML); root.setMargin(true); } root.addComponent(content); if (footerVisible) { HorizontalLayout footer = new HorizontalLayout(); footer.setWidth("100%"); footer.setSpacing(true); footer.addStyleName("v-window-bottom-toolbar"); Label footerText = new Label("Footer text"); footerText.setSizeUndefined(); Button ok = new Button("OK"); ok.addStyleName("primary"); Button cancel = new Button("Cancel"); footer.addComponents(footerText, ok, cancel); footer.setExpandRatio(footerText, 1); if (footerToolbar) { MenuBar menuBar = MenuBars.getToolBar(); menuBar.setStyleName(toolbarStyle); menuBar.setWidth(null); footer.removeAllComponents(); footer.addComponent(menuBar); } root.addComponent(footer); } if (!autoHeight) { root.setSizeFull(); root.setExpandRatio(content, 1); } return root; } { setSpacing(true); setMargin(true); win.setWidth("380px"); win.setHeight(prevHeight); win.setClosable(false); win.setResizable(false); win.setContent(windowContent()); win.setCloseShortcut(KeyCode.ESCAPE, null); Command optionsCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Footer")) { footerVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Auto Height")) { autoHeight = selectedItem.isChecked(); if (!autoHeight) { win.setHeight(prevHeight); } else { prevHeight = win.getHeight() + win.getHeightUnits().toString(); win.setHeight(null); } } if (selectedItem.getText().equals("Tabs")) { tabsVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Top")) { toolbarVisible = selectedItem.isChecked(); } if (selectedItem.getText().equals("Footer")) { footerToolbar = selectedItem.isChecked(); } if (selectedItem.getText().equals("Top layout")) { toolbarLayout = selectedItem.isChecked(); } if (selectedItem.getText().equals("Borderless")) { toolbarStyle = selectedItem.isChecked() ? "borderless" : null; } win.setContent(windowContent()); } }; MenuBar options = new MenuBar(); options.setCaption("Content"); options.addItem("Auto Height", optionsCommand).setCheckable(true); options.addItem("Tabs", optionsCommand).setCheckable(true); MenuItem option = options.addItem("Footer", optionsCommand); option.setCheckable(true); option.setChecked(true); options.addStyleName("small"); addComponent(options); options = new MenuBar(); options.setCaption("Toolbars"); options.addItem("Footer", optionsCommand).setCheckable(true); options.addItem("Top", optionsCommand).setCheckable(true); options.addItem("Top layout", optionsCommand).setCheckable(true); options.addItem("Borderless", optionsCommand).setCheckable(true); options.addStyleName("small"); addComponent(options); Command optionsCommand2 = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Caption")) { win.setCaption(selectedItem.isChecked() ? "Window Caption" : null); } else if (selectedItem.getText().equals("Closable")) { win.setClosable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Resizable")) { win.setResizable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Modal")) { win.setModal(selectedItem.isChecked()); } } }; options = new MenuBar(); options.setCaption("Options"); MenuItem caption = options.addItem("Caption", optionsCommand2); caption.setCheckable(true); caption.setChecked(true); options.addItem("Closable", optionsCommand2).setCheckable(true); options.addItem("Resizable", optionsCommand2).setCheckable(true); options.addItem("Modal", optionsCommand2).setCheckable(true); options.addStyleName("small"); addComponent(options); final Button show = new Button("Open Window", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getUI().addWindow(win); win.center(); win.focus(); event.getButton().setEnabled(false); } }); show.addStyleName("primary"); addComponent(show); final CheckBox hidden = new CheckBox("Hidden"); hidden.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { win.setVisible(!hidden.getValue()); } }); addComponent(hidden); win.addCloseListener(new CloseListener() { @Override public void windowClose(final CloseEvent e) { show.setEnabled(true); } }); } }; p.setContent(content); return p; }
From source file:com.cavisson.gui.dashboard.components.controls.Tabsheets.java
License:Apache License
public Tabsheets() { setMargin(true);/*from w w w. jav a 2 s .c om*/ Label h1 = new Label("Tabs"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.addStyleName("wrapping"); addComponent(wrap); final CheckBox closable = new CheckBox("Closable"); closable.setImmediate(true); wrap.addComponent(closable); final CheckBox overflow = new CheckBox("Overflow"); overflow.setImmediate(true); wrap.addComponent(overflow); final CheckBox caption = new CheckBox("Captions", true); caption.setImmediate(true); wrap.addComponent(caption); final CheckBox icon = new CheckBox("Icons"); icon.setImmediate(true); wrap.addComponent(icon); final CheckBox disable = new CheckBox("Disable tabs"); disable.setImmediate(true); wrap.addComponent(disable); Label h3 = new Label("Additional Styles"); h3.addStyleName("h3"); addComponent(h3); wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.addStyleName("wrapping"); wrap.setMargin(new MarginInfo(false, false, true, false)); addComponent(wrap); final CheckBox framed = new CheckBox("Framed", true); framed.setImmediate(true); wrap.addComponent(framed); final CheckBox centered = new CheckBox("Centered tabs"); centered.setImmediate(true); wrap.addComponent(centered); final CheckBox rightAlign = new CheckBox("Right-aligned tabs"); rightAlign.setImmediate(true); wrap.addComponent(rightAlign); final CheckBox equal = new CheckBox("Equal-width tabs"); equal.setImmediate(true); wrap.addComponent(equal); final CheckBox padded = new CheckBox("Padded tabbar"); padded.setImmediate(true); wrap.addComponent(padded); final CheckBox compact = new CheckBox("Compact"); compact.setImmediate(true); wrap.addComponent(compact); final CheckBox iconsOnTop = new CheckBox("Icons on top"); iconsOnTop.setImmediate(true); wrap.addComponent(iconsOnTop); final CheckBox selectedOnly = new CheckBox("Selected tab closable"); selectedOnly.setImmediate(true); wrap.addComponent(selectedOnly); ValueChangeListener update = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String style = framed.getValue() ? "framed " : ""; style += centered.getValue() ? " centered-tabs" : ""; style += rightAlign.getValue() ? " right-aligned-tabs" : ""; style += equal.getValue() ? " equal-width-tabs" : ""; style += padded.getValue() ? " padded-tabbar" : ""; style += compact.getValue() ? " compact-tabbar" : ""; style += iconsOnTop.getValue() ? " icons-on-top" : ""; style += selectedOnly.getValue() ? " only-selected-closable" : ""; if (tabs != null) { removeComponent(tabs); } tabs = getTabSheet(caption.getValue(), style.trim(), closable.getValue(), overflow.getValue(), icon.getValue(), disable.getValue()); addComponent(tabs); } }; closable.addValueChangeListener(update); overflow.addValueChangeListener(update); caption.addValueChangeListener(update); icon.addValueChangeListener(update); disable.addValueChangeListener(update); framed.addValueChangeListener(update); centered.addValueChangeListener(update); rightAlign.addValueChangeListener(update); equal.addValueChangeListener(update); padded.addValueChangeListener(update); compact.addValueChangeListener(update); iconsOnTop.addValueChangeListener(update); selectedOnly.addValueChangeListener(update); // Generate initial view icon.setValue(true); }
From source file:com.cerebro.provevaadin.smtp.ConfigurazioneSMTP.java
public ConfigurazioneSMTP() { this.setMargin(true); TextField smtpHost = new TextField("SMTP Host Server"); smtpHost.setRequired(true);//from w w w . j a v a2 s. c om TextField smtpPort = new TextField("SMTP Port"); smtpPort.setRequired(true); TextField smtpUser = new TextField("SMTP Username"); smtpUser.setRequired(true); TextField smtpPwd = new TextField("SMTP Password"); smtpPwd.setRequired(true); TextField pwdConf = new TextField("Conferma la Password"); pwdConf.setRequired(true); CheckBox security = new CheckBox("Sicurezza del server"); Properties props = new Properties(); InputStream config = VaadinServlet.getCurrent().getServletContext() .getResourceAsStream("/WEB-INF/config.properties"); if (config != null) { System.out.println("Carico file di configurazione"); try { props.load(config); } catch (IOException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } } smtpHost.setValue(props.getProperty("smtp_host")); smtpUser.setValue(props.getProperty("smtp_user")); security.setValue(Boolean.parseBoolean(props.getProperty("smtp_sec"))); Button salva = new Button("Salva i parametri"); salva.addClickListener((Button.ClickEvent event) -> { System.out.println("Salvo i parametri SMTP"); if (smtpHost.isValid() && smtpPort.isValid() && smtpUser.isValid() && smtpPwd.isValid() && smtpPwd.getValue().equals(pwdConf.getValue())) { props.setProperty("smtp_host", smtpHost.getValue()); props.setProperty("smtp_port", smtpPort.getValue()); props.setProperty("smtp_user", smtpUser.getValue()); props.setProperty("smtp_pwd", smtpPwd.getValue()); props.setProperty("smtp_sec", security.getValue().toString()); String webInfPath = VaadinServlet.getCurrent().getServletConfig().getServletContext() .getRealPath("WEB-INF"); File f = new File(webInfPath + "/config.properties"); try { OutputStream o = new FileOutputStream(f); try { props.store(o, "Prova"); } catch (IOException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } } catch (FileNotFoundException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } Notification.show("Parametri salvati"); } else { Notification.show("Ricontrolla i parametri"); } }); TextField emailTest = new TextField("Destinatario Mail di Prova"); emailTest.setImmediate(true); emailTest.addValidator(new EmailValidator("Mail non valida")); Button test = new Button("Invia una mail di prova"); test.addClickListener((Button.ClickEvent event) -> { System.out.println("Invio della mail di prova"); if (emailTest.isValid()) { try { System.out.println("Invio mail di prova a " + emailTest.getValue()); HtmlEmail email = new HtmlEmail(); email.setHostName(props.getProperty("smtp_host")); email.setSmtpPort(Integer.parseInt(props.getProperty("smtp_port"))); email.setSSLOnConnect(Boolean.parseBoolean(props.getProperty("smtp_sec"))); email.setAuthentication(props.getProperty("smtp_user"), props.getProperty("smtp_pwd")); email.setFrom("prova@prova.it"); email.setSubject("Mail di prova"); email.addTo(emailTest.getValue()); email.setHtmlMsg("This is the message"); email.send(); } catch (EmailException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } } else { Notification.show("Controlla l'indirizzo mail del destinatario"); } }); this.addComponents(smtpHost, smtpPort, smtpUser, smtpPwd, pwdConf, security, salva, emailTest, test); }
From source file:com.cerebro.provevaadin.smtp.ConfigurazioneSMTPSpring.java
public ConfigurazioneSMTPSpring() { TextField smtpHost = new TextField("SMTP Host Server"); smtpHost.setRequired(true);/*from w w w .j ava2 s . c om*/ TextField smtpPort = new TextField("SMTP Port"); smtpPort.setRequired(true); TextField smtpUser = new TextField("SMTP Username"); smtpUser.setRequired(true); PasswordField smtpPwd = new PasswordField("SMTP Password"); smtpPwd.setRequired(true); PasswordField pwdConf = new PasswordField("Conferma la Password"); pwdConf.setRequired(true); CheckBox security = new CheckBox("Sicurezza del server"); Properties props = new Properties(); InputStream config = VaadinServlet.getCurrent().getServletContext() .getResourceAsStream("/WEB-INF/config.properties"); if (config != null) { System.out.println("Carico file di configurazione"); try { props.load(config); } catch (IOException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } } smtpHost.setValue(props.getProperty("mail.smtp.host")); smtpUser.setValue(props.getProperty("smtp_user")); security.setValue(Boolean.parseBoolean(props.getProperty("smtp_sec"))); Button salva = new Button("Salva i parametri"); salva.addClickListener((Button.ClickEvent event) -> { System.out.println("Salvo i parametri SMTP"); if (smtpHost.isValid() && smtpPort.isValid() && smtpUser.isValid() && smtpPwd.isValid() && smtpPwd.getValue().equals(pwdConf.getValue())) { System.out.println(smtpHost.getValue() + smtpPort.getValue() + smtpUser.getValue() + smtpPwd.getValue() + security.getValue().toString()); props.setProperty("mail.smtp.host", smtpHost.getValue()); props.setProperty("mail.smtp.port", smtpPort.getValue()); props.setProperty("smtp_user", smtpUser.getValue()); props.setProperty("smtp_pwd", smtpPwd.getValue()); props.setProperty("mail.smtp.ssl.enable", security.getValue().toString()); String webInfPath = VaadinServlet.getCurrent().getServletConfig().getServletContext() .getRealPath("WEB-INF"); File f = new File(webInfPath + "/config.properties"); try { OutputStream o = new FileOutputStream(f); try { props.store(o, "Prova"); } catch (IOException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } } catch (FileNotFoundException ex) { Logger.getLogger(ConfigurazioneSMTP.class.getName()).log(Level.SEVERE, null, ex); } Notification.show("Parametri salvati"); } else { Notification.show("Ricontrolla i parametri"); } }); TextField emailTest = new TextField("Destinatario Mail di Prova"); emailTest.setImmediate(true); emailTest.addValidator(new EmailValidator("Mail non valida")); Button test = new Button("Invia una mail di prova"); test.addClickListener((Button.ClickEvent event) -> { System.out.println("Invio della mail di prova"); if (emailTest.isValid() && !emailTest.isEmpty()) { System.out.println("Invio mail di prova a " + emailTest.getValue()); JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setJavaMailProperties(props); mailSender.setUsername(props.getProperty("smtp_user")); mailSender.setPassword(props.getProperty("smtp_pwd")); MimeMessage message = mailSender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message); try { helper.setFrom("dottmatteocasagrande@gmail.com"); helper.setSubject("Subject"); helper.setText("It works!"); helper.addTo(emailTest.getValue()); mailSender.send(message); } catch (MessagingException ex) { Logger.getLogger(ConfigurazioneSMTPSpring.class.getName()).log(Level.SEVERE, null, ex); } } else { Notification.show("Controlla l'indirizzo mail del destinatario"); } }); this.addComponents(smtpHost, smtpPort, smtpUser, smtpPwd, pwdConf, security, salva, emailTest, test); }
From source file:com.cms.utils.TableUtils.java
public void generateColumn(final CustomPageTableFilter<IndexedContainer> tbl) { tbl.addGeneratedColumn(Constants.CHECKBOX_COLUMN, new CustomTable.ColumnGenerator() { @Override/*from www .j a v a2s . c o m*/ public Object generateCell(final CustomTable source, final Object itemId, Object columnId) { setHeader(tbl); final CheckBox checkBox = new CheckBox(""); checkBox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { // Don't react to the event if we're being changed from the table-value-change event Boolean selected = (Boolean) valueChangeEvent.getProperty().getValue(); if (selected) { source.select(itemId); } else { source.unselect(itemId); } } }); // set value checkBox.setValue(isItemIdSelected(source, itemId)); // Let's keep track of the checkboxes checkBox.addAttachListener(new ClientConnector.AttachListener() { @Override public void attach(ClientConnector.AttachEvent event) { itemIdToCheckbox.put(itemId, checkBox); } }); return checkBox; } }); tbl.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { // return Object newSelectionValue = event.getItemId(); CheckBox cb = itemIdToCheckbox.get(newSelectionValue); if (!event.isCtrlKey()) { Collection<Object> collection = (Collection<Object>) tbl.getValue(); if (collection.size() > 1) { cb.setValue(true); } else { cb.setValue(!cb.getValue()); } for (Object item : itemIdToCheckbox.keySet()) { if (item != newSelectionValue) { itemIdToCheckbox.get(item).setValue(false); } } } else { cb.setValue(!cb.getValue()); } } }); tbl.addListener(new CustomTable.HeaderClickListener() { @Override public void headerClick(CustomTable.HeaderClickEvent event) { if (Constants.CHECKBOX_COLUMN.equals(event.getPropertyId())) { String currentPage = String.valueOf(tbl.getCurrentPage()); if (mapPageSelected.get(currentPage) == null) { mapPageSelected.put(currentPage, false); } if (!mapPageSelected.get(currentPage)) { List<Object> lstObject = (List<Object>) tbl.getContainerDataSource().getItemIds(); for (Object itemId : lstObject) { setCheckBoxes(itemId, true); tbl.select(itemId); } // Change the header value tbl.setColumnHeader(Constants.CHECKBOX_COLUMN, "<span class=\"v-checkbox v-widget\">\n" + "<input checked=\"\" type=\"checkbox\" >\n" + "<label></label>\n" + "</span>"); } else { for (Object itemId : tbl.getItemIds()) { setCheckBoxes(itemId, false); tbl.unselect(itemId); } tbl.setColumnHeader(Constants.CHECKBOX_COLUMN, "<span class=\"v-checkbox v-widget\">\n" + "<input type=\"checkbox\" >\n" + "<label></label>\n" + "</span>"); } mapPageSelected.put(currentPage, !mapPageSelected.get(currentPage)); } } }); /* Just some cosmetics : no caption for the checkbox, and make it the first column */ tbl.setColumnHeader(Constants.CHECKBOX_COLUMN, "<span class=\"v-checkbox v-widget\">\n" + "<input type=\"checkbox\" >\n" + "<label></label>\n" + "</span>"); tbl.setColumnAlignment(Constants.CHECKBOX_COLUMN, CustomTable.Align.CENTER); }
From source file:com.demo.tutorial.agenda.ui.SearchView.java
public SearchView(final MyUI app) { this.app = app; setCaption("Buscar Contactos"); setSizeFull();// w w w . j av a 2s .c o m addStyleName("view"); /* Usar un FormLayout como layout principal para este Panel*/ FormLayout formLayout = new FormLayout(); /* Creando componente UI */ txtTextField = new TextField("Buscar"); cmbFieldtoSearch = new NativeSelect("Campo por buscar"); chkSaveSearch = new CheckBox("Guardar Bsqueda"); txtSearchName = new TextField("Buscar nombre"); Button btnBuscar = new Button("Buscar"); btnBuscar.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { performSearch(); } }); /* Inicializar combo */ for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) { cmbFieldtoSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]); cmbFieldtoSearch.setItemCaption(PersonContainer.NATURAL_COL_ORDER[i], PersonContainer.COL_HEADERS_ENGLISH[i]); } cmbFieldtoSearch.setValue("apPaterno"); cmbFieldtoSearch.setNullSelectionAllowed(false); /* Inicializando save checkbox */ chkSaveSearch.setValue(true); chkSaveSearch.setImmediate(true); chkSaveSearch.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } }); /* chkSaveSearch.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); txtSearchName.setVisible(value); } });*/ /* Aadiendo los componentes creados al formulario */ formLayout.addComponent(txtTextField); formLayout.addComponent(cmbFieldtoSearch); formLayout.addComponent(chkSaveSearch); formLayout.addComponent(txtSearchName); formLayout.addComponent(btnBuscar); setContent(formLayout); }
From source file:com.demo.tutorial.agenda.ui.SharingOptions.java
public SharingOptions() { setModal(true);// w w w. j a v a 2 s . c o m setWidth("50%"); center(); setCaption("Sharing Options"); VerticalLayout subContent = new VerticalLayout(); subContent.addComponent(new Label(SHARING_HTML_SNNIPET)); subContent.addComponent(new CheckBox("Gmail")); subContent.addComponent(new CheckBox(".Mac")); Button close = new Button("Ok"); close.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); subContent.addComponent(close); setContent(subContent); }
From source file:com.digitallabs.demos.Vaadin6BootstrapThemeDemo.java
License:Apache License
private void forms(ComponentContainer container) { VerticalLayout form = new VerticalLayout(); form.addStyleName(Bootstrap.Forms.FORM.styleName()); form.setSpacing(true);//w w w . j a v a 2 s . com form.setCaption("Legend"); TextField email = new TextField("Email address"); email.setInputPrompt("Enter email"); form.addComponent(email); PasswordField password = new PasswordField("Password"); password.setInputPrompt("Password"); form.addComponent(password); Upload upload = new Upload("File input", null); form.addComponent(upload); Label help = new Label("Example block-level help text here."); help.addStyleName("help-block"); form.addComponent(help); CheckBox check = new CheckBox("Check me out"); form.addComponent(check); Button submit = new Button("Submit"); submit.addStyleName(Bootstrap.Buttons.DEFAULT.styleName()); form.addComponent(submit); container.addComponent(form); }
From source file:com.dungnv.streetfood.view.CategorySearchDetail.java
private void init() { layout = new VerticalLayout(); layout.setSpacing(true);// ww w .java2 s . com layout.setMargin(true); form = new FormLayout(); form.addStyleName("light"); // form.addStyleName("outlined"); form.setSizeFull(); form.setMargin(true); form.setSpacing(true); layout.addComponent(form); tfName = new TextField(BundleUtils.getLanguage("lbl.category.name")); tfName.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfName); tfDescription = new TextField(BundleUtils.getLanguage("lbl.description")); tfDescription.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tfDescription); HorizontalLayout hlStatus = new HorizontalLayout(); hlStatus.setCaption(BundleUtils.getLanguage("lbl.status")); hlStatus.addStyleName("horizontal"); hlStatus.setSpacing(true); form.addComponent(hlStatus); cbActive = new CheckBox(BundleUtils.getLanguage("lbl.active")); cbActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbActive); cbInActive = new CheckBox(BundleUtils.getLanguage("lbl.inActive")); cbInActive.setValue(Boolean.TRUE); hlStatus.addComponent(cbInActive); tagSuggestFieldUI = new TagSuggestFieldUI(false); tagSuggestFieldUI.setWidth(80.0f, Unit.PERCENTAGE); form.addComponent(tagSuggestFieldUI); Map<String, LocaleDTO> mapLocale = ClientServiceImpl.getAllLocales(); if (mapLocale != null && !mapLocale.isEmpty()) { List<LocaleDTO> listLocale = new ArrayList<>(mapLocale.values()); listLocale.stream().map((localeDTO) -> new OptionGroupUI(localeDTO.getLocale()// , localeDTO.getId())).forEach((ogLocale) -> { form.addComponent(ogLocale); listOgLocale.add(ogLocale); }); } HorizontalLayout hlButton = new HorizontalLayout(); hlButton.setSpacing(true); hlButton.setMargin(true); form.addComponent(hlButton); btnSearch = new Button(BundleUtils.getLanguage("lbl.search"), FontAwesome.SEARCH); hlButton.addComponent(btnSearch); btnExportExcel = new Button(BundleUtils.getLanguage("lbl.exportExcel"), FontAwesome.FILE_EXCEL_O); hlButton.addComponent(btnExportExcel); btnExportXML = new Button(BundleUtils.getLanguage("lbl.exportXML"), FontAwesome.FILE_CODE_O); hlButton.addComponent(btnExportXML); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButton.addComponent(btnCancel); }