List of usage examples for com.vaadin.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:com.esofthead.mycollab.module.project.view.user.ProjectUnresolvedAssignmentWidget.java
License:Open Source License
public ProjectUnresolvedAssignmentWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(AppContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(new Property.ValueChangeListener() { @Override// w ww . j a v a2 s. co m public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(AppContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); } }); taskList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectGenericTaskService.class), new GenericTaskRowDisplayHandler(), 10) { @Override protected String stringWhenEmptyList() { return AppContext.getMessage(ProjectI18nEnum.OPT_NO_ASSIGNMENT); } }; addHeaderElement(myItemsSelection); bodyContent.addComponent(taskList); }
From source file:com.esofthead.mycollab.module.project.view.user.TaskStatusComponent.java
License:Open Source License
public TaskStatusComponent() { withSpacing(false).withMargin(false); this.addStyleName("myprojectlist"); MHorizontalLayout header = new MHorizontalLayout().withSpacing(false) .withMargin(new MarginInfo(false, true, false, true)).withHeight("34px"); header.addStyleName("panel-header"); titleLbl = new Label(AppContext.getMessage(ProjectCommonI18nEnum.WIDGET_OPEN_ASSIGNMENTS_TITLE, 0)); final CheckBox overdueSelection = new CheckBox("Overdue"); overdueSelection.addValueChangeListener(new Property.ValueChangeListener() { @Override// w ww . ja v a2 s. c o m public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean isOverdueOption = overdueSelection.getValue(); if (isOverdueOption) { searchCriteria.setDueDate( new DateSearchField(DateSearchField.AND, DateTimeUtils.getCurrentDateWithoutMS())); } else { searchCriteria.setDueDate(null); } updateSearchResult(); } }); final CheckBox myItemsOnly = new CheckBox("My Items"); myItemsOnly.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean selectMyItemsOnly = myItemsOnly.getValue(); if (selectMyItemsOnly) { searchCriteria.setAssignUser(new StringSearchField(AppContext.getUsername())); } else { searchCriteria.setAssignUser(null); } taskComponents.setSearchCriteria(searchCriteria); } }); header.with(titleLbl, overdueSelection, myItemsOnly).withAlign(titleLbl, Alignment.MIDDLE_LEFT) .withAlign(overdueSelection, Alignment.MIDDLE_RIGHT).withAlign(myItemsOnly, Alignment.MIDDLE_RIGHT) .expand(titleLbl); taskComponents = new TaskStatusPagedList(); this.with(header, taskComponents); }
From source file:com.esofthead.mycollab.module.project.view.user.UserUnresolvedAssignmentWidget.java
License:Open Source License
public UserUnresolvedAssignmentWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(AppContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(new Property.ValueChangeListener() { @Override/* w w w . j av a2 s.c om*/ public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean isMyItemsOption = myItemsSelection.getValue(); if (searchCriteria != null) { if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(AppContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); } } }); taskList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectGenericTaskService.class), new GenericTaskRowDisplayHandler(), 10) { @Override protected String stringWhenEmptyList() { return AppContext.getMessage(ProjectI18nEnum.OPT_NO_ASSIGNMENT); } }; this.addHeaderElement(myItemsSelection); this.bodyContent.addComponent(taskList); }
From source file:com.esspl.datagen.generator.impl.SqlDataGenerator.java
License:Open Source License
/** * Actual data generation logic for SQL present here *//*from w w w . j ava2s. c om*/ @Override public String generate(DataGenApplication dataGenApplication, ArrayList<GeneratorBean> rowList) { log.debug("SqlDataGenerator - generate() method start"); sbCreate.setLength(0); sbInsert.setLength(0); int maxRows = Integer.parseInt(dataGenApplication.resultNum.getValue().toString()); tableName = dataGenApplication.tblName.getValue().toString(); database = dataGenApplication.database.getValue().toString(); isCreateScriptRequired = Boolean.valueOf(dataGenApplication.createQuery.getValue().toString()); if (database.equals("Sql Server")) { lineSeparator = "\nGO"; } else { lineSeparator = ";"; } //If generate create script is enabled then create script generatd if (isCreateScriptRequired) { generateCreateData(rowList); } DataFactory df = new DataFactory(); for (int row = 0; row < maxRows; row++) { StringBuilder sbColumnNames = new StringBuilder(); sbColumnNames.append("("); StringBuilder sb = new StringBuilder(); for (GeneratorBean generatorBean : rowList) { String data = ""; String dataType = generatorBean.getDataType(); int iid = generatorBean.getId(); Item item = dataGenApplication.listing.getItem(iid); Select selFormat = (Select) (item.getItemProperty("Format").getValue()); if (dataType.equalsIgnoreCase("name")) { data = "'" + df.getName(selFormat.getValue().toString()) + "'"; } else if (dataType.equalsIgnoreCase("email")) { data = "'" + df.getEmailAddress() + "'"; } else if (dataType.equalsIgnoreCase("date")) { HorizontalLayout hLayout = (HorizontalLayout) (item.getItemProperty("Additional Data") .getValue()); PopupDateField startDate = (PopupDateField) hLayout.getComponent(0); PopupDateField endDate = (PopupDateField) hLayout.getComponent(1); SimpleDateFormat sdf = new SimpleDateFormat(selFormat.getValue().toString()); String formatedStatDate = (startDate.getValue() == null || startDate.getValue().toString().equals("")) ? "" : sdf.format(startDate.getValue()).toString(); String formatedEndDate = (endDate.getValue() == null || endDate.getValue().toString().equals("")) ? "" : sdf.format(endDate.getValue()).toString(); data = "to_date('" + df.getDate(selFormat.getValue().toString(), formatedStatDate, formatedEndDate) + "', '" + selFormat.getValue().toString() + "')"; } else if (dataType.equalsIgnoreCase("city")) { data = "'" + df.getCity() + "'"; } else if (dataType.equalsIgnoreCase("state/provience/county")) { data = "'" + df.getState(selFormat.getValue().toString()) + "'"; } else if (dataType.equalsIgnoreCase("postal/zip")) { data = df.getZipCode(selFormat.getValue().toString()); } else if (dataType.equalsIgnoreCase("street address")) { data = "'" + df.getStreetName() + "'"; } else if (dataType.equalsIgnoreCase("title")) { data = "'" + df.getPrefix() + "'"; } else if (dataType.equalsIgnoreCase("phone/fax")) { data = df.getPhoneNumber(selFormat.getValue().toString()); } else if (dataType.equalsIgnoreCase("country")) { data = "'" + df.getCountry() + "'"; } else if (dataType.equalsIgnoreCase("random text")) { HorizontalLayout hLayout = (HorizontalLayout) (item.getItemProperty("Additional Data") .getValue()); TextField minLengthField = (TextField) hLayout.getComponent(0); TextField maxLengthField = (TextField) hLayout.getComponent(1); int minLength = (minLengthField.getValue() == null || minLengthField.getValue().toString().equals("")) ? 3 : Integer.parseInt(minLengthField.getValue().toString()); int maxLength = (maxLengthField.getValue() == null || maxLengthField.getValue().toString().equals("")) ? 10 : Integer.parseInt(maxLengthField.getValue().toString()); data = "'" + df.getRandomText(minLength, maxLength) + "'"; } else if (dataType.equalsIgnoreCase("incremental number")) { HorizontalLayout hLayout = (HorizontalLayout) (item.getItemProperty("Additional Data") .getValue()); TextField startingFrom = (TextField) hLayout.getComponent(0); int startNumber = (startingFrom.getValue() == null || startingFrom.getValue().toString().equals("")) ? 0 : Integer.parseInt(startingFrom.getValue().toString()); if (startNumber > 0) { data = String.valueOf(row + startNumber); } else { data = String.valueOf(row + 1); } } else if (dataType.equalsIgnoreCase("number range")) { HorizontalLayout hLayout = (HorizontalLayout) (item.getItemProperty("Additional Data") .getValue()); TextField minNumberField = (TextField) hLayout.getComponent(0); TextField maxNumberField = (TextField) hLayout.getComponent(1); int minNumber = (minNumberField.getValue() == null || minNumberField.getValue().toString().equals("")) ? 1 : Integer.parseInt(minNumberField.getValue().toString()); int maxNumber = (maxNumberField.getValue() == null || maxNumberField.getValue().toString().equals("")) ? 1000 : Integer.parseInt(maxNumberField.getValue().toString()); data = String.valueOf(df.getNumberBetween(minNumber, maxNumber)); } else if (dataType.equalsIgnoreCase("alphanumeric")) { HorizontalLayout hLayout = (HorizontalLayout) (item.getItemProperty("Additional Data") .getValue()); TextField startingTextField = (TextField) hLayout.getComponent(0); TextField lengthField = (TextField) hLayout.getComponent(1); String startingText = (startingTextField.getValue() == null || startingTextField.getValue().toString().equals("")) ? "" : startingTextField.getValue().toString(); int length = (lengthField.getValue() == null || lengthField.getValue().toString().equals("")) ? 6 : Integer.parseInt(lengthField.getValue().toString()); data = "'" + df.getAlphaNumericText(startingText, length) + "'"; } else if (dataType.equalsIgnoreCase("maratial status")) { data = "'" + df.getStatus() + "'"; } else if (dataType.equalsIgnoreCase("department name")) { data = "'" + df.getBusinessType() + "'"; } else if (dataType.equalsIgnoreCase("company name")) { data = "'" + df.getCompanyName() + "'"; } else if (dataType.equalsIgnoreCase("fixed text")) { HorizontalLayout hLayout = (HorizontalLayout) (item.getItemProperty("Additional Data") .getValue()); TextField textField = (TextField) hLayout.getComponent(0); String fixedText = (textField.getValue() == null || textField.getValue().toString().equals("")) ? "" : textField.getValue().toString(); CheckBox cb = (CheckBox) hLayout.getComponent(1); if (cb.getValue() != null && Boolean.valueOf(cb.getValue().toString())) { data = fixedText; } else { data = "'" + fixedText + "'"; } } else if (dataType.equalsIgnoreCase("boolean flag")) { data = "'" + df.getBooleanFlag() + "'"; } else if (dataType.equalsIgnoreCase("passport number")) { data = "'" + df.getPassportNumber() + "'"; } if (sb.length() > 0) sb.append(", "); sb.append(data); if (sbColumnNames.length() > 1) sbColumnNames.append(", "); sbColumnNames.append(generatorBean.getColumnName()); } sbColumnNames.append(")"); addResultData("INSERT INTO " + tableName + sbColumnNames.toString() + " VALUES(" + sb.toString() + ")"); } log.debug("SqlDataGenerator - generate() method end"); return getCreateData() + getResultData(); }
From source file:com.github.lsiu.MyVaadinApplication.java
private void initTopBar(HorizontalLayout topBar) { topBar.setWidth("100%"); final CheckBox editableCheckBox = new CheckBox("Editable"); topBar.addComponent(editableCheckBox); topBar.setComponentAlignment(editableCheckBox, Alignment.BOTTOM_RIGHT); editableCheckBox.setValue(table.isEditable()); editableCheckBox.setImmediate(true); editableCheckBox.addListener(new ValueChangeListener() { @Override/*from www . j a v a 2s . c o m*/ public void valueChange(ValueChangeEvent event) { table.setEditable((Boolean) editableCheckBox.getValue()); } }); }
From source file:com.hybridbpm.ui.component.dashboard.tab.TabConfigurationLayout.java
License:Apache License
public List<Permission> getViewPermissions() { List<Permission> list = new ArrayList<>(); for (Object id : accessTable.getItemIds()) { Role role = (Role) id; Item item = accessTable.getItem(id); CheckBox checkBox = (CheckBox) item.getItemProperty("canView").getValue(); if (checkBox.getValue()) { list.add(Permission.create(null, role, Permission.PERMISSION.VIEW)); }//w w w.java 2 s .c o m } return list; }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.crud.CategoryField.java
License:Apache License
/** * Set the collection of categories among which the used can select a * subset./* w w w . j a v a2s . c o m*/ * * @param categories * all available categories */ public void setOptions(Collection<Category> categories) { options.removeAllComponents(); checkboxes.clear(); for (final Category category : categories) { final CheckBox box = new CheckBox(category.getName()); checkboxes.put(category, box); box.addValueChangeListener(new ValueChangeListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (!updatingField) { Set<Category> oldCategories = getValue(); Set<Category> categories; if (oldCategories != null) { categories = new HashSet<Category>(oldCategories); } else { categories = new HashSet<Category>(); } if (box.getValue()) { categories.add(category); } else { categories.remove(category); } setInternalValue(categories); } } }); options.addComponent(box); } }
From source file:com.mechanicshop.components.TableLayout.java
private void customizeTable() { table.setSizeFull();//from w w w . j av a2s .c o m table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.setSizeFull(); table.addGeneratedColumn("", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { boolean selected = false; final CheckBox cb = new CheckBox("", selected); cb.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (selectedItemIds.contains(itemId)) { selectedItemIds.remove(itemId); } else { if (cb.getValue() != false) { selectedItemIds.add(itemId); } } } }); return cb; } }); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); dataEntryLayout.fillDataEntry(item, titleLabel.getValue()); getUI().addWindow(dataEntryLayout); } }); return icon; } }); }
From source file:com.morevaadin.vaadin7.refresh.Vaadin7Root.java
License:Apache License
public Vaadin7Root() { addComponent(mainLayout);/*w w w . j av a 2 s .c om*/ final CheckBox checkBox = new CheckBox("Preserve root"); checkBox.setImmediate(true); checkBox.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { getApplication().setRootPreserved(checkBox.getValue()); } }); mainLayout.addComponent(checkBox); gridLayout.setColumns(2); mainLayout.addComponent(gridLayout); }
From source file:com.mycollab.mobile.module.user.view.LoginViewImpl.java
License:Open Source License
private void initUI() { MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth(); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); Image mainLogo = new Image(null, AccountAssetsResolver.createLogoResource(MyCollabUI.getBillingAccount().getLogopath(), 150)); contentLayout.addComponent(mainLogo); CssLayout welcomeTextWrapper = new CssLayout(); ELabel welcomeText = new ELabel( LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.BUTTON_LOG_IN)) .withStyleName("h1"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeText); final EmailField emailField = new EmailField(); new Dom(emailField).setAttribute("placeholder", LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), GenericI18Enum.FORM_EMAIL)); emailField.setWidth("100%"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); new Dom(pwdField).setAttribute("placeholder", LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.FORM_PASSWORD)); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox( LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.OPT_REMEMBER_PASSWORD), true);/*from ww w . j a v a 2s .co m*/ rememberPassword.setWidth("100%"); contentLayout.addComponent(rememberPassword); MButton signInBtn = new MButton( LocalizationHelper.getMessage(MyCollabUI.getDefaultLocale(), ShellI18nEnum.BUTTON_LOG_IN), clickEvent -> { try { LoginViewImpl.this.fireEvent(new ViewEvent<>(LoginViewImpl.this, new UserEvent.PlainLogin( emailField.getValue(), pwdField.getValue(), rememberPassword.getValue()))); } catch (Exception e) { throw new MyCollabException(e); } }).withStyleName(MobileUIConstants.BUTTON_ACTION); contentLayout.addComponent(signInBtn); this.addComponent(contentLayout); }