List of usage examples for com.vaadin.ui CheckBox setValue
@Override public void setValue(Boolean value)
From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java
License:Apache License
public PanelDemo() { setMargin(true);/* w w w .java 2s. c o m*/ setSizeFull(); setSpacing(true); panel = new FancyPanel(createPanelContentStart()); Label label = new Label("FancyPanel is panel that offer scrolling and transition when " + "you replace it's content with setContent() call. It's like " + "Vaadin Panel, but I haven't added panel styling DOM " + "elements to keep this clean and simple."); addComponent(label); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); addComponent(buttonLayout); Button contA = new Button("Panel content A"); buttonLayout.addComponent(contA); Button contB = new Button("Panel content B"); buttonLayout.addComponent(contB); Button contC = new Button("Panel content C"); buttonLayout.addComponent(contC); CheckBox scrollable = new CheckBox("scrollable"); scrollable.setValue(panel.isScrollable()); scrollable.setImmediate(true); buttonLayout.addComponent(scrollable); fade = new CheckBox("fade"); fade.setImmediate(true); buttonLayout.addComponent(fade); zoom = new CheckBox("zoom"); zoom.setImmediate(true); buttonLayout.addComponent(zoom); rotate = new CheckBox("rotate"); rotate.setImmediate(true); buttonLayout.addComponent(rotate); horizontal = new CheckBox("horizontal"); horizontal.setValue(true); horizontal.setImmediate(true); buttonLayout.addComponent(horizontal); panel.setSizeFull(); addComponent(panel); setExpandRatio(panel, 1.0f); contA.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (panelA == null) { panelA = createPanelContentA(); } panel.showComponent(panelA); removeIntro(); } }); contB.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (panelB == null) { panelB = createPanelContentB(); } panel.showComponent(panelB); removeIntro(); } }); contC.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (panelC == null) { panelC = createPanelContentD(); } panel.showComponent(panelC); removeIntro(); } }); scrollable.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean enable = (Boolean) event.getProperty().getValue(); // Set scrollable value of panel panel.setScrollable(enable); } }); fade.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean enable = (Boolean) event.getProperty().getValue(); // Enable/disable transitions panel.setFadeTransition(enable); updateTransitionCheckboxes(); } }); zoom.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean enable = (Boolean) event.getProperty().getValue(); // Enable/disable transitions panel.setZoomTransition(enable); updateTransitionCheckboxes(); } }); rotate.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean enable = (Boolean) event.getProperty().getValue(); // Enable/disable transitions panel.setRotateTransition(enable, horizontal.getValue()); updateTransitionCheckboxes(); } }); horizontal.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (rotate.getValue()) { boolean enable = (Boolean) event.getProperty().getValue(); // Enable/disable transitions panel.setRotateTransition(true, enable); updateTransitionCheckboxes(); } } }); updateTransitionCheckboxes(); }
From source file:org.vaadin.johannes.VaadingraphApplication.java
License:LGPL
private Component getStyleOptimizedBox() { final CheckBox cb = new CheckBox("Node specific styles enabled"); cb.setImmediate(true);//from w w w. j a v a 2s. c o m cb.setValue(true); cb.addListener(new CheckBox.ClickListener() { private static final long serialVersionUID = 4837240993197391750L; public void buttonClick(final ClickEvent event) { graph.setOptimizedStyles(!(Boolean) cb.getValue()); } }); return cb; }
From source file:org.vaadin.johannes.VaadingraphApplication.java
License:LGPL
private Component getTextHideBox() { final CheckBox cb = new CheckBox("Hide texts"); cb.setImmediate(true);//www.jav a 2 s . c o m cb.setValue(true); cb.addListener(new CheckBox.ClickListener() { private static final long serialVersionUID = 1981652250991931328L; public void buttonClick(final ClickEvent event) { graph.setTextsVisible(!(Boolean) cb.getValue()); } }); return cb; }
From source file:org.vaadin.tori.component.DebugControlPanel.java
License:Apache License
private Component createPostControl(final Method setter, final List<Post> posts) throws Exception { if (posts == null || posts.isEmpty()) { final Label label = new Label(getNameForCheckBox(setter)); label.setEnabled(false);/*from w w w.ja v a2 s .c o m*/ return label; } Component content = new CustomComponent() { { final CssLayout root = new CssLayout(); root.addStyleName("postselect-content"); root.addStyleName(setter.getName()); setCompositionRoot(root); root.setWidth("100%"); setWidth("400px"); root.addComponent(new Label(setter.getName())); for (final Post post : posts) { final Method getter = getGetterFrom(setter); final boolean getterValue = (Boolean) getter.invoke(authorizationService, post.getId()); final String authorName = post.getAuthor().getDisplayedName(); String postBody = post.getBodyRaw(); if (postBody.length() > 20) { postBody = postBody.substring(0, 20); } final CheckBox checkbox = new CheckBox(authorName + " :: " + postBody); checkbox.setValue(getterValue); checkbox.addValueChangeListener(new PostCheckboxListener(post, setter)); checkbox.setImmediate(true); checkbox.setWidth("100%"); root.addComponent(checkbox); } } }; final PopupView popup = new PopupView(getNameForCheckBox(setter), content); popup.setHideOnMouseOut(false); popup.setHeight(30.0f, Unit.PIXELS); return popup; }
From source file:org.vaadin.tori.component.DebugControlPanel.java
License:Apache License
private Component createRegularControl(final Method setter) throws SecurityException, NoSuchMethodException, Exception { final CheckBox checkbox = new CheckBox(getNameForCheckBox(setter)); try {//from ww w .j ava2s .co m final boolean getterValue = callGetter(getGetterFrom(setter)); checkbox.setValue(getterValue); checkbox.addValueChangeListener(new CheckboxListener(data, setter)); checkbox.setImmediate(true); } catch (final CheckBoxShouldBeDisabledException e) { /* * Because our context doesn't have data to set up this object, we * disable the checkbox. E.g. DashboardView doesn't have context * data on a particular Category or Thread */ checkbox.setEnabled(false); } return checkbox; }
From source file:rds.vaadin.beanfaces.ExtendedTable.java
License:Apache License
private void addGeneratedCheckboxColumn() { // Keep references on all Checkbox final List<CheckBox> data = new ArrayList<CheckBox>(); addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override// ww w . j ava 2s.co m public void itemClick(ItemClickEvent event) { if (ExtendedTable.this.isReadOnly()) { return; } boolean selected = ExtendedTable.this.isSelected(event.getItemId()); for (CheckBox c : data) { if (c.getData().toString().equals(event.getItemId().toString())) { c.setReadOnly(false); if (!selected) { c.setValue(Boolean.TRUE); } else { c.setValue(Boolean.FALSE); } c.setReadOnly(true); } } } }); addGeneratedColumn("", new ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { final CheckBox checkBox = new CheckBox(); checkBox.setImmediate(false); checkBox.setBuffered(true); checkBox.setData(itemId); data.add(checkBox); // Update if (source.isSelected(itemId)) { checkBox.setValue(Boolean.TRUE); } checkBox.setReadOnly(true); return checkBox; } }); // Attach the list of checkbox in order to be linked // with the component, and accessible outside. setData(data); }
From source file:ro.zg.opengroups.views.UserNotificationRuleView.java
License:Apache License
private void displayEnabledCheckBox(final MultitypeNotificationRule rule) { CheckBox checkBox = new CheckBox(); checkBox.setImmediate(true);/*from www. ja v a2 s . co m*/ checkBox.setValue(rule.getCommonFields().isEnabled()); checkBox.addStyleName("notification-rules-list-row-cell-content"); // container.addComponent(cell); addToContainer(checkBox); checkBox.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { rule.getCommonFields().setEnabled((Boolean) event.getProperty().getValue()); rule.getRulesList().onRuleUpdated(); } }); }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
private RefreshableTab createSettings() { final Form systemForm; {/*from w w w . j ava 2 s. co m*/ final ComboBox serviceLocation; { String[][] defs = { { "? ", "http://195.245.214.33:7777/esv" }, { "? ", "http://oraas.rt.ru:7777/gateway/services/SID0003318" } }; serviceLocation = new ComboBox("?? ?? "); serviceLocation.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_EXPLICIT); for (String[] def : defs) { addOption(serviceLocation, def[1], def[0], false); } serviceLocation.setImmediate(true); serviceLocation.setInputPrompt("http://"); serviceLocation.setNewItemsAllowed(true); serviceLocation.setNewItemHandler(new AbstractSelect.NewItemHandler() { @Override public void addNewItem(String newItemCaption) { addOption(serviceLocation, newItemCaption, newItemCaption, true); } }); String href = AdminServiceProvider.get() .getSystemProperty(CertificateVerifier.VERIFY_SERVICE_LOCATION); addOption(serviceLocation, href, href, true); } final CheckBox allowValidate; { allowValidate = new CheckBox(" ? "); allowValidate.setRequired(true); allowValidate.setImmediate(true); allowValidate.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { serviceLocation.setRequired(Boolean.TRUE.equals(event.getProperty().getValue())); } }); allowValidate.setValue(AdminServiceProvider .getBoolProperty(CertificateVerifier.ALLOW_VERIFY_CERTIFICATE_PROPERTY)); } systemForm = new Form(); systemForm.addField("location", serviceLocation); systemForm.addField("allowVerify", allowValidate); systemForm.setImmediate(true); systemForm.setWriteThrough(false); systemForm.setInvalidCommitted(false); Button commit = new Button("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { systemForm.commit(); set(CertificateVerifier.VERIFY_SERVICE_LOCATION, serviceLocation.getValue()); set(CertificateVerifier.ALLOW_VERIFY_CERTIFICATE_PROPERTY, allowValidate.getValue()); event.getButton().getWindow().showNotification("?? ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); } catch (Validator.InvalidValueException ignore) { } } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(commit); systemForm.getFooter().addComponent(buttons); } Panel b1 = new Panel(); b1.setSizeFull(); Label b1label = new Label(" ?"); b1label.addStyleName(Reindeer.LABEL_H2); b1.addComponent(b1label); b1.addComponent(systemForm); VerticalLayout certificates = new VerticalLayout(); certificates.setSizeFull(); certificates.setSpacing(true); HorizontalLayout topHl = new HorizontalLayout(); topHl.setSizeFull(); topHl.setSpacing(true); Panel certificatesPanel = new Panel("", certificates); certificatesPanel.setSizeFull(); certificatesPanel.addStyleName(Reindeer.PANEL_LIGHT); boolean linkCertificate = AdminServiceProvider.getBoolProperty(CertificateVerifier.LINK_CERTIFICATE); final CheckBox switchLink = new CheckBox("? "); switchLink.setValue(linkCertificate); switchLink.setImmediate(true); switchLink.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { set(CertificateVerifier.LINK_CERTIFICATE, switchLink.getValue()); event.getButton().getWindow().showNotification("?? ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); } }); Panel b2 = new Panel(); b2.setSizeFull(); Label b2label = new Label("? ?"); b2label.addStyleName(Reindeer.LABEL_H2); b2.addComponent(b2label); b2.addComponent(switchLink); certificates.addComponent(b1); certificates.addComponent(b2); certificates.setExpandRatio(b1, 0.7f); certificates.setExpandRatio(b2, 0.3f); CheckBox productionMode = new CheckBox("? ", AdminServiceProvider.getBoolProperty(API.PRODUCTION_MODE)); productionMode.setImmediate(true); productionMode.setDescription( " ? ? ?? ?? testMsg"); productionMode.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { boolean value = Boolean.TRUE.equals(event.getProperty().getValue()); set(API.PRODUCTION_MODE, value); } }); Panel smevPanel = new Panel(" "); smevPanel.setSizeFull(); smevPanel.addComponent(productionMode); HorizontalLayout bottomHl = new HorizontalLayout(); bottomHl.setSizeFull(); bottomHl.setSpacing(true); LogSettings logSettings = new LogSettings(); Panel emailDatesPanel = createEmailDatesPanel(); Panel mailTaskConfigPanel = createMilTaskConfigPanel(); topHl.addComponent(certificatesPanel); topHl.addComponent(emailDatesPanel); topHl.addComponent(mailTaskConfigPanel); topHl.setExpandRatio(certificatesPanel, 0.4f); topHl.setExpandRatio(emailDatesPanel, 0.6f); topHl.setExpandRatio(mailTaskConfigPanel, 0.5f); Panel esiaPanel = buildEsiaPanel(); Panel printTemplatesPanel = buildPrintTemplatesPanel(); bottomHl.addComponent(smevPanel); bottomHl.addComponent(esiaPanel); bottomHl.addComponent(printTemplatesPanel); bottomHl.setExpandRatio(smevPanel, 0.2f); bottomHl.setExpandRatio(esiaPanel, 0.4f); bottomHl.setExpandRatio(printTemplatesPanel, 0.4f); final VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setSizeFull(); layout.addComponent(topHl); layout.addComponent(logSettings); layout.addComponent(bottomHl); layout.setExpandRatio(topHl, 0.40f); layout.setExpandRatio(logSettings, 0.40f); layout.setExpandRatio(bottomHl, 0.20f); layout.setMargin(true); layout.setSpacing(true); return new RefreshableTab(layout, logSettings); }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
private Panel buildEsiaPanel() { boolean isEsiaAuth = "true".equals(get(API.ALLOW_ESIA_LOGIN)); final TextField esiaServiceLocation = new TextField("?? ?? "); esiaServiceLocation.setValue(get(API.ESIA_SERVICE_ADDRESS)); esiaServiceLocation.setEnabled(isEsiaAuth); esiaServiceLocation.setRequired(isEsiaAuth); esiaServiceLocation.setWidth(370, Sizeable.UNITS_PIXELS); final CheckBox allowEsiaLogin = new CheckBox(" ?"); allowEsiaLogin.setValue(isEsiaAuth); allowEsiaLogin.setImmediate(true);//from w w w.jav a 2 s . co m allowEsiaLogin.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { Boolean newValue = (Boolean) valueChangeEvent.getProperty().getValue(); esiaServiceLocation.setEnabled(newValue); esiaServiceLocation.setRequired(newValue); } }); final Form form = new Form(); form.addField(API.ALLOW_ESIA_LOGIN, allowEsiaLogin); form.addField(API.ESIA_SERVICE_ADDRESS, esiaServiceLocation); form.setImmediate(true); form.setWriteThrough(false); form.setInvalidCommitted(false); Button commit = new Button("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { form.commit(); set(API.ALLOW_ESIA_LOGIN, allowEsiaLogin.getValue()); set(API.ESIA_SERVICE_ADDRESS, esiaServiceLocation.getValue()); event.getButton().getWindow().showNotification("?? ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); } catch (Validator.InvalidValueException ignore) { } } }); Panel panel = new Panel("?? ?"); panel.setSizeFull(); panel.addComponent(form); panel.addComponent(commit); return panel; }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
private Panel buildPrintTemplatesPanel() { boolean isUseService = "true".equals(get(API.PRINT_TEMPLATES_USE_OUTER_SERVICE)); final TextField serviceLocation = new TextField("?? ??"); serviceLocation.setValue(get(API.PRINT_TEMPLATES_SERVICELOCATION)); serviceLocation.setEnabled(isUseService); serviceLocation.setRequired(isUseService); serviceLocation.setWidth(370, Sizeable.UNITS_PIXELS); final CheckBox useOuterService = new CheckBox("? ??"); useOuterService.setValue(isUseService); useOuterService.setImmediate(true);//w ww.j av a2 s. co m useOuterService.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { Boolean newValue = (Boolean) valueChangeEvent.getProperty().getValue(); serviceLocation.setEnabled(newValue); serviceLocation.setRequired(newValue); } }); final Form form = new Form(); form.addField(API.PRINT_TEMPLATES_USE_OUTER_SERVICE, useOuterService); form.addField(API.PRINT_TEMPLATES_SERVICELOCATION, serviceLocation); form.setImmediate(true); form.setWriteThrough(false); form.setInvalidCommitted(false); Button commit = new Button("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { form.commit(); set(API.PRINT_TEMPLATES_USE_OUTER_SERVICE, useOuterService.getValue()); set(API.PRINT_TEMPLATES_SERVICELOCATION, serviceLocation.getValue()); event.getButton().getWindow().showNotification("?? ?", Window.Notification.TYPE_HUMANIZED_MESSAGE); } catch (Validator.InvalidValueException ignore) { } } }); Panel panel = new Panel(" "); panel.setSizeFull(); panel.addComponent(form); panel.addComponent(commit); return panel; }