List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
From source file:com.wcs.wcslib.vaadin.widget.multifileupload.WidgetTestApplication.java
License:Apache License
private void addUploadAttachedCheckBoxes() { for (final MultiFileUpload multiFileUpload : uploads) { final CheckBox cb = new CheckBox(multiFileUpload.getCaption() + " attached"); cb.setValue(true);/*from w w w . ja v a2 s . c o m*/ cb.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (cb.getValue()) { form.addComponent(multiFileUpload, 0); } else { form.removeComponent(multiFileUpload); } } }); form.addComponent(cb); } }
From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.ConfigComponent.java
License:Apache License
private Layout createLangconfLayout() throws FieldGroup.BindException { VerticalLayout langLayout = new VerticalLayout(); langField = new TextField("lang"); langLayout.addComponent(new FormLayout(langField)); final FormLayout translationsLayout = new FormLayout(); translationsLayout.setSpacing(false); useTranslations = new CheckBox("use translations below"); langLayout.addComponent(useTranslations); useTranslations.addValueChangeListener(new Property.ValueChangeListener() { @Override//from w w w. j av a 2 s .c om public void valueChange(Property.ValueChangeEvent event) { Boolean checked = useTranslations.getValue(); for (Component c : translationsLayout) { c.setEnabled(checked); } } }); translations = new CustomTranslationsBean(); BeanFieldGroup<CustomTranslationsBean> translationsFieldGroup = new BeanFieldGroup<CustomTranslationsBean>( CustomTranslationsBean.class); translationsFieldGroup.setItemDataSource((CustomTranslationsBean) translations); Collection<Object> propertyIds = translationsFieldGroup.getUnboundPropertyIds(); translationsFieldGroup.setBuffered(false); for (Object property : propertyIds) { Field<?> field = translationsFieldGroup.buildAndBind(property); ((TextField) field).setNullRepresentation(""); field.setCaption(field.getCaption().toLowerCase()); field.setEnabled(false); translationsLayout.addComponent(field); } langLayout.addComponent(translationsLayout); return langLayout; }
From source file:cz.iivos.todo.components.InputFormLayout.java
/** * Vytvori checkBox a zviaze ho s FG.//from ww w . ja va 2s . c o m * * @param fn * @return */ public CheckBox bindCheckBox(String fn) { CheckBox field = new CheckBox(fn); fg.bind(field, fn); return field; }
From source file:de.catma.ui.analyzer.querybuilder.AbstractSearchPanel.java
License:Open Source License
protected void initSearchPanelComponents(Component content) { setSizeFull();/*from w ww. j a va2 s. com*/ setSpacing(true); cbComplexQuery = new CheckBox("continue to build a complex query"); cbComplexQuery.setImmediate(true); addComponent(cbComplexQuery); setExpandRatio(content, 0.99f); setExpandRatio(cbComplexQuery, 0.01f); setComponentAlignment(cbComplexQuery, Alignment.BOTTOM_RIGHT); initSearchPanelActions(); }
From source file:de.catma.ui.repository.wizard.IndexerOptionsPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);/* w w w . j a v a 2 s. c om*/ setSizeFull(); Label infoLabel = new Label(); infoLabel.setContentMode(Label.CONTENT_XHTML); infoLabel.setValue("<p>This section allows you to finetune the creation " + "of the word list of your Source Document.</p>" + "<p>If you are unsure what to do, just select the language " + "and leave everything else unmodified.</p>"); addComponent(infoLabel, 0, 0, 2, 0); cbUseApostrophe = new CheckBox("always use the apostrophe as a word separator"); addComponent(cbUseApostrophe, 0, 1, 2, 1); Locale[] all = Locale.getAvailableLocales(); sortedLangs = new TreeSet<LanguageItem>(); for (Locale locale : all) { sortedLangs.add(new LanguageItem(locale)); } languagesListSelect = new ListSelect("Please select the predominant language of the Source Document:", sortedLangs); languagesListSelect.setNullSelectionAllowed(false); languagesListSelect.setSizeFull(); languagesListSelect.setImmediate(true); addComponent(languagesListSelect, 0, 2, 0, 3); unseparableCharacterSequencesListSelect = new ListSelect("Unseparable character sequences:"); unseparableCharacterSequencesListSelect.setNullSelectionAllowed(false); unseparableCharacterSequencesListSelect.setSizeFull(); unseparableCharacterSequencesListSelect.setImmediate(true); addComponent(unseparableCharacterSequencesListSelect, 1, 2, 1, 3); HorizontalLayout ucsAddRemoveLayout = new HorizontalLayout(); Panel ucsAddRemovePanel = new Panel(ucsAddRemoveLayout); ucsAddRemovePanel.setStyleName(Reindeer.PANEL_LIGHT); ucsAddRemoveLayout.setSpacing(true); ucsAddRemoveLayout.setSizeFull(); btAddUcs = new Button("Add entry"); btAddUcs.setEnabled(false); ucsAddRemovePanel.addComponent(btAddUcs); tfUcs = new TextField(); tfUcs.setInputPrompt("Add things like 'e.g.' as you see fit."); tfUcs.setImmediate(true); tfUcs.setTextChangeEventMode(TextChangeEventMode.EAGER); tfUcs.setWidth("100%"); ucsAddRemovePanel.addComponent(tfUcs); ucsAddRemoveLayout.setExpandRatio(tfUcs, 2); btRemoveUcs = new Button("Remove entry"); btRemoveUcs.setEnabled(false); ucsAddRemovePanel.addComponent(btRemoveUcs); addComponent(ucsAddRemovePanel, 1, 4); VerticalLayout loadSavePanel = new VerticalLayout(); loadSavePanel.setSpacing(true); loadSavePanel.setWidth("80px"); btLoadUcsList = new Button("Load list"); loadSavePanel.addComponent(btLoadUcsList); btSaveUcsList = new Button("Save list"); loadSavePanel.addComponent(btSaveUcsList); addComponent(loadSavePanel, 2, 2); setColumnExpandRatio(0, 2); setColumnExpandRatio(1, 2); setRowExpandRatio(2, 2); setRowExpandRatio(3, 2); }
From source file:de.decidr.ui.view.uibuilder.FieldBuilder.java
License:Apache License
@Override public Field createControl(String label, String value) { CheckBox field = new CheckBox(label); field.setValue(value.equals(TBoolean.YES.value())); return field; }
From source file:de.decidr.ui.view.windows.FieldBuilder.java
License:Apache License
@Override public Field createControl(TTaskItem taskItem, String value) { CheckBox field = new CheckBox(taskItem.getLabel()); field.setValue(value.equals(TBoolean.YES.value())); return field; }
From source file:de.escidoc.admintool.view.util.LayoutHelper.java
License:Open Source License
/** * @param className/*from w ww . ja v a 2 s . c o m*/ * @param item * @param readOnly * @param text * @param propertyName * @return AbstractComponent */ public static synchronized AbstractComponent createCheckBoxElement(final String className, final POJOItem<?> item, final boolean readOnly, final String text, final String propertyName) { final AbstractComponent comp = new CheckBox(text); comp.setReadOnly(readOnly); ((CheckBox) comp).setWriteThrough(false); ((CheckBox) comp).setPropertyDataSource(item.getItemProperty(propertyName)); List<Field> attachedFields = ATTACHED_FIELD_MAP.get(className); if (attachedFields == null) { attachedFields = new ArrayList<Field>(); ATTACHED_FIELD_MAP.put(className, attachedFields); } attachedFields.add((Field) comp); return comp; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java
License:Apache License
private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); nameTextField = new TextField(); HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField); layout.addComponent(nameLay);/*from w w w . j a v a2 s .c o m*/ typeComboBox = new ComboBox(); for (String type : roomTypes) { typeComboBox.addItem(type); } HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typeLay); layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER); Label devicesLabel = new Label(); devicesLabel.setImmediate(false); devicesLabel.setWidth("100%"); devicesLabel.setHeight("50"); devicesLabel.setValue("<b>Gerte</b>"); devicesLabel.setContentMode(Label.CONTENT_XHTML); layout.addComponent(devicesLabel); layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER); List<Device> deviceList = parent.server.getDeviceManager().getDevices(); devicesCheckBox = new CheckBox[deviceList.size()]; for (int i = 0; i < deviceList.size(); i++) { devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName()); layout.addComponent(devicesCheckBox[i]); layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER); } Button saveButton = new Button("Speichern"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> names = new LinkedList<String>(); for (CheckBox checkbox : devicesCheckBox) { if (checkbox.booleanValue()) names.add(checkbox.getCaption()); } Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(), names); MessageResponse response = parent.server.getStructureManager().createNewStructure(struc); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getStructureManager().rereadFromFHEM(); parent.reloadTree(); } }); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:de.kaiserpfalzEdv.piracc.organization.adv.editor.DataProcessingContractEditor.java
License:Apache License
public DataProcessingContractEditor( de.kaiserpfalzEdv.piracc.organization.adv.editor.DataProcessingContractEditorPresenter presenter) { super(presenter, DataProcessingContract.class); layout = new VerticalLayout(); layout.setSizeFull();// w ww . j a v a 2s . c o m layout.setSpacing(true); layout.setResponsive(false); setCompositionRoot(layout); client = createDropdownSelect("advs.client.commonName", "commonName", 1, Organization.class); layout.addComponent(client); acting = createDropdownSelect("advs.acting.commonName", "commonName", 2, Organization.class); layout.addComponent(acting); documentLink = createTextField("advs.documentLink", 3); layout.addComponent(documentLink); from = createDateField("base.from", 4); layout.addComponent(from); till = createDateField("base.till", 5); layout.addComponent(till); comment = createTextArea("base.comment", 6, 5); layout.addComponent(comment); locked = new CheckBox(presenter.translate("base.locked")); locked.setTabIndex(7); layout.addComponent(locked); }