/** {@inheritDoc} */ @Override public Component doCreateWidget(Object parent) { if (checkBox == null) { checkBox = new CheckBox(); checkBox.addStyleName(CSS_CLASS_CONTROL); checkBox.setImmediate(true); setupComponent(checkBox, getCastedModel()); associateWidget(checkBox, modelAccess.yField); if (modelAccess.isCssIdValid()) { checkBox.setId(modelAccess.getCssID()); } else { checkBox.setId(getEditpart().getId()); } property = new ObjectProperty<Boolean>(false, Boolean.class); checkBox.setPropertyDataSource(property); // creates the binding for the field createBindings(modelAccess.yField, checkBox); if (modelAccess.isCssClassValid()) { checkBox.addStyleName(modelAccess.getCssClass()); } applyCaptions(); initializeField(checkBox); } return checkBox; }
public CheckBoxes() { setMargin(true); Label h1 = new Label("Check Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); CheckBox check = new CheckBox("Checked", true); row.addComponent(check); check = new CheckBox("Checked, explicit width, so that the caption should wrap", true); row.addComponent(check); check.setWidth("150px"); check = new CheckBox("Not checked"); row.addComponent(check); check = new CheckBox(null, true); check.setDescription("No caption"); row.addComponent(check); check = new CheckBox("Custom color", true); check.addStyleName("color1"); row.addComponent(check); TestIcon testIcon = new TestIcon(30); check = new CheckBox("Custom color", true); check.addStyleName("color2"); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox("With Icon", true); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox(); check.setIcon(testIcon.get(true)); row.addComponent(check); check = new CheckBox("Small", true); check.addStyleName("small"); row.addComponent(check); check = new CheckBox("Large", true); check.addStyleName("large"); row.addComponent(check); h1 = new Label("Option Groups"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); OptionGroup options = new OptionGroup("Choose one, explicit width"); options.setWidth("200px"); options.addItem("Option One"); Item two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, explicit width"); options.setMultiSelect(true); options.setWidth("200px"); options.addItem("Option One"); two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, small"); options.addStyleName("small"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, small"); options.addStyleName("small"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, large"); options.addStyleName("large"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, large"); options.addStyleName("large"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Horizontal items"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); options = new OptionGroup("Horizontal items, explicit width"); options.setMultiSelect(true); options.setWidth("500px"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); }
// Build the UI components private void buildview() { logger.info( "Company ID : " + companyid + " | User Name : " + username + " > " + "Painting Email logger UI"); btnAdd.setVisible(false); btnDownload.setVisible(false); btnEdit.setVisible(false); btnAuditRecords.setVisible(false); // Email-id text box tfemailid = new TextField("Email Id"); // product combo box cbproduct = new GERPComboBox("Product Name"); cbproduct.setItemCaptionPropertyId("prodname"); loadProductList(); // Email start date dfemailStartdate = new GERPPopupDateField("Log Start Dt"); dfemailStartdate.setInputPrompt("Select Date"); // Email End date dfemailEndDate = new GERPPopupDateField("Log End Dt"); dfemailEndDate.setInputPrompt("Select Date"); btndelete = new Button("Delete"); btndelete.addStyleName("delete"); btndelete.setEnabled(true); btndelete.setVisible(true); btndelete.addClickListener( new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { btndelete.setEnabled(true); if (cockeckall.getValue().equals(true)) { for (EmailLoggerDM obj : emailList) { serviceemailLogger.delete(obj.getEmaillogId()); } } else { delete(); } loadSrchRslt(); /* btndelete.setEnabled(false); cockeckall.setValue(false);*/ } }); cockeckall = new CheckBox("Select All"); cockeckall.addStyleName("delete"); cockeckall.setEnabled(true); cockeckall.setVisible(true); setCheckBoxTable(); cockeckall.setImmediate(true); cockeckall.addValueChangeListener( new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue().equals(true)) { loadSrchRslt(); btndelete.setEnabled(true); } else { loadSrchRslt(); btndelete.setEnabled(false); } } }); hlCmdBtnLayout.addComponent(cockeckall); hlCmdBtnLayout.setSpacing(true); hlCmdBtnLayout.setComponentAlignment(cockeckall, Alignment.MIDDLE_RIGHT); hlCmdBtnLayout.addComponent(btndelete); hlCmdBtnLayout.setComponentAlignment(btndelete, Alignment.MIDDLE_RIGHT); hlCmdBtnLayout.setExpandRatio(btndelete, 1); // build search layout hlSearchLayout = new GERPAddEditHLayout(); assembleSearchLayout(); hlSrchContainer.addComponent(GERPPanelGenerator.createPanel(hlSearchLayout)); resetFields(); loadSrchRslt(); }