List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
From source file:org.semanticsoft.vaaclipse.p2.install.ui.impl.P2TreeTable.java
License:Open Source License
@Override public void addSubItem(IInstallableUnit childIInstallableUnit, IInstallableUnit root) { CheckBox checkBoxChild = new CheckBox(childIInstallableUnit.getId()); checkBoxChild.addValueChangeListener(checkBoxChildListener); listChildChecks.add(checkBoxChild);/*from w w w .ja va2 s. c o m*/ treeTable.addItem(new Object[] { checkBoxChild, childIInstallableUnit.getVersion().toString() }, childIInstallableUnit.getId()); treeTable.setParent(childIInstallableUnit.getId(), root.getId()); listCheckBoxChilds.add(checkBoxChild); }
From source file:org.semanticsoft.vaaclipse.p2.sites.ui.impl.SitesView.java
License:Open Source License
@Override public void initUI() { // TODO Auto-generated method stub CssLayout buttonLayout = new CssLayout(); Button buttonAdd = new Button("Add"); buttonAdd.addClickListener(new ClickListener() { @Override/*from w w w .ja va 2 s . c o m*/ public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub addSite(); } }); buttonLayout.addComponent(buttonAdd); Button buttonRemove = new Button("Remove"); buttonRemove.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub if (!isSelected()) { Notification.show("Must select at least one"); return; } Collection<URI> value = getSelected(); for (URI u : value) { removeSite(u.toString()); } loadSites(); } }); buttonLayout.addComponent(buttonRemove); Button buttonEdit = new Button("Edit"); buttonEdit.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub modificSite(); } }); buttonLayout.addComponent(buttonEdit); VerticalLayout verticalLayoutButton = new VerticalLayout(); CheckBox enableChek = new CheckBox("Enable"); verticalLayoutButton.addComponent(enableChek); enableChek.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { // TODO Auto-generated method stub if (!isSelected()) { Notification.show("Must select at least one"); return; } Boolean value = (Boolean) event.getProperty().getValue(); Collection<URI> selected = getSelected(); for (URI uri : selected) { sitesManager.setRepositoryEnabled(agent, uri, value); } loadSites(); } }); Button reloadButton = new Button("Reload"); reloadButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // TODO Auto-generated method stub loadSites(); } }); verticalLayoutButton.addComponent(reloadButton); Button importButton = new Button("Import"); verticalLayoutButton.addComponent(importButton); Button exportButton = new Button("Export"); verticalLayoutButton.addComponent(exportButton); treeTable = new TreeTable("List of avaible software sites"); treeTable.addContainerProperty("Name", String.class, ""); treeTable.addContainerProperty("Location", String.class, ""); treeTable.addContainerProperty("Enable", String.class, ""); treeTable.setPageLength(5); treeTable.setWidth("40em"); treeTable.setSelectable(true); treeTable.setImmediate(true); treeTable.setMultiSelect(true); HorizontalLayout simpleContainer = new HorizontalLayout(); simpleContainer.addComponent(treeTable); simpleContainer.addComponent(verticalLayoutButton); mainLayout.addComponent(buttonLayout); mainLayout.addComponent(simpleContainer); }
From source file:org.tltv.gantt.demo.DemoUI.java
License:Apache License
private void openStepEditor(AbstractStep step) { final Window win = new Window("Step Editor"); win.setResizable(false);// w w w. j a v a 2s . com win.center(); final Collection<Component> hidden = new ArrayList<Component>(); BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step); final FieldGroup group = new FieldGroup(item); group.setBuffered(true); TextField captionField = new TextField("Caption"); captionField.setNullRepresentation(""); group.bind(captionField, "caption"); TextField descriptionField = new TextField("Description"); descriptionField.setNullRepresentation(""); group.bind(descriptionField, "description"); descriptionField.setVisible(false); hidden.add(descriptionField); NativeSelect captionMode = new NativeSelect("Caption Mode"); captionMode.addItem(Step.CaptionMode.TEXT); captionMode.addItem(Step.CaptionMode.HTML); group.bind(captionMode, "captionMode"); captionMode.setVisible(false); hidden.add(captionMode); CheckBox showProgress = new CheckBox("Show progress"); group.bind(showProgress, "showProgress"); showProgress.setVisible(false); hidden.add(showProgress); Slider progress = new Slider("Progress"); progress.setWidth(100, Unit.PERCENTAGE); group.bind(progress, "progress"); progress.setVisible(false); hidden.add(progress); NativeSelect predecessorSelect = new NativeSelect("Predecessor Step"); predecessorSelect.setWidth(100, Unit.PERCENTAGE); fillPredecessorCanditatesToSelect(step, predecessorSelect); predecessorSelect.setEnabled(step instanceof Step); if (step instanceof Step) { group.bind(predecessorSelect, "predecessor"); } predecessorSelect.setVisible(false); hidden.add(predecessorSelect); final NativeSelect parentStepSelect = new NativeSelect("Parent Step"); parentStepSelect.setWidth(100, Unit.PERCENTAGE); parentStepSelect.setEnabled(false); fillParentStepCanditatesToSelect(step, parentStepSelect); parentStepSelect.setVisible(false); hidden.add(parentStepSelect); HorizontalLayout colorLayout = new HorizontalLayout(); colorLayout.setWidth(100, Unit.PERCENTAGE); colorLayout.setVisible(false); hidden.add(colorLayout); final TextField bgField = new TextField("Background color"); bgField.setNullRepresentation(""); group.bind(bgField, "backgroundColor"); bgField.setEnabled(false); final ColorPicker bgColorPicker = new ColorPicker(); bgColorPicker.setPosition(300, 100); bgColorPicker.setColor(new CssColorToColorPickerConverter().convertToModel(step.getBackgroundColor())); bgColorPicker.addColorChangeListener(new ColorChangeListener() { @Override public void colorChanged(ColorChangeEvent event) { bgField.setValue(event.getColor().getCSS()); } }); colorLayout.addComponent(bgField); colorLayout.addComponent(bgColorPicker); colorLayout.setExpandRatio(bgField, 1); colorLayout.setComponentAlignment(bgColorPicker, Alignment.BOTTOM_LEFT); DateField startDate = new DateField("Start date"); startDate.setLocale(gantt.getLocale()); startDate.setTimeZone(gantt.getTimeZone()); startDate.setResolution(Resolution.SECOND); startDate.setConverter(new DateToLongConverter()); group.bind(startDate, "startDate"); DateField endDate = new DateField("End date"); endDate.setLocale(gantt.getLocale()); endDate.setTimeZone(gantt.getTimeZone()); endDate.setResolution(Resolution.SECOND); endDate.setConverter(new DateToLongConverter()); group.bind(endDate, "endDate"); CheckBox showMore = new CheckBox("Show all settings"); showMore.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { for (Component c : hidden) { c.setVisible((Boolean) event.getProperty().getValue()); } win.center(); } }); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); win.setContent(content); content.addComponent(captionField); content.addComponent(captionMode); content.addComponent(descriptionField); content.addComponent(showProgress); content.addComponent(progress); content.addComponent(predecessorSelect); content.addComponent(parentStepSelect); content.addComponent(colorLayout); content.addComponent(startDate); content.addComponent(endDate); content.addComponent(showMore); HorizontalLayout buttons = new HorizontalLayout(); content.addComponent(buttons); Button ok = new Button("Ok", new ClickListener() { @Override public void buttonClick(ClickEvent event) { commit(win, group, parentStepSelect); } }); Button cancel = new Button("Cancel", new ClickListener() { @Override public void buttonClick(ClickEvent event) { cancel(win, group); } }); Button delete = new Button("Delete", new ClickListener() { @Override public void buttonClick(ClickEvent event) { delete(win, group); } }); buttons.addComponent(ok); buttons.addComponent(cancel); buttons.addComponent(delete); win.setClosable(true); getUI().addWindow(win); }
From source file:org.vaadin.alump.fancylayouts.demo.CssLayoutDemo.java
License:Apache License
public CssLayoutDemo() { setMargin(true);/*w w w . jav a 2s .c o m*/ setSpacing(true); setSizeFull(); final FancyCssLayout cssLayout = new FancyCssLayout(); Label todo = new Label("FancyCssLayout adds transitions when you add or remove components from it."); addComponent(todo); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setWidth("100%"); addComponent(hLayout); Button addContent = new Button("Add new content item"); hLayout.addComponent(addContent); CheckBox middleCbox = new CheckBox("add middle"); middleCbox.setImmediate(true); middleCbox.setValue(addCssMiddle); hLayout.addComponent(middleCbox); CheckBox marginCbox = new CheckBox("slide"); marginCbox.setImmediate(true); marginCbox.setValue(cssLayout.isTransitionEnabled(FancyTransition.SLIDE)); hLayout.addComponent(marginCbox); CheckBox styleCbox = new CheckBox("cards"); styleCbox.setImmediate(true); styleCbox.setValue(boxMode); hLayout.addComponent(styleCbox); final Label counterLabel = new Label(getClickCounterCaption()); hLayout.addComponent(counterLabel); cssLayout.setSizeFull(); addComponent(cssLayout); setExpandRatio(cssLayout, 1.0f); for (int i = 0; i < 10; ++i) { addCssLayoutContent(cssLayout); } addContent.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { addCssLayoutContent(cssLayout); } }); middleCbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { addCssMiddle = (Boolean) event.getProperty().getValue(); } }); marginCbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { cssLayout.setSlideEnabled((Boolean) event.getProperty().getValue()); } }); styleCbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); Iterator<Component> iter = cssLayout.iterator(); while (iter.hasNext()) { Component component = iter.next(); if (value) { component.addStyleName("demo-removable-two"); } else { component.removeStyleName("demo-removable-two"); } } boxMode = value; } }); cssLayout.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { ++clickCounter; if (event.getChildComponent() == null) { ++layoutClickCounter; } counterLabel.setValue(getClickCounterCaption()); } }); }
From source file:org.vaadin.alump.fancylayouts.demo.ImageDemo.java
License:Apache License
public ImageDemo() { setMargin(true);//w ww . j a va2s .co m setSpacing(true); setWidth("100%"); Label desc = new Label( "FancyImage can be used when you want to present multiple images in one place. This component allows you to select which image to show when or just enabled the automatic slide show mode."); addComponent(desc); final FancyImage image = new FancyImage(); image.setWidth("500px"); image.setHeight("281px"); // Setting images used final List<Resource> resources = getImageResources(); for (Resource resource : resources) { image.addResource(resource); } // Setting slideshow timeout to 3 seconds (3000 millisecs) image.setSlideShowTimeout(3000); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); addComponent(buttonLayout); addComponent(image); setComponentAlignment(image, Alignment.TOP_CENTER); for (int i = 0; i < resources.size(); ++i) { final Button button = new Button("Pic " + (i + 1)); buttonLayout.addComponent(button); final Resource res = resources.get(i); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { image.showResource(res); } }); disableWhenAutoPlay.add(button); } CheckBox auto = new CheckBox("Slide show"); auto.setImmediate(true); buttonLayout.addComponent(auto); CheckBox fade = new CheckBox("Fade"); fade.setDescription("Fade image when changing"); fade.setImmediate(true); fade.setValue(image.isFadeTransition()); buttonLayout.addComponent(fade); CheckBox rotate = new CheckBox("Rotate"); rotate.setDescription("Rotate image when changing"); rotate.setImmediate(true); rotate.setValue(image.isRotateTransition()); buttonLayout.addComponent(rotate); horizontal = new CheckBox("Horizontal"); horizontal.setDescription("Should rotate happen horizontally or vertically."); horizontal.setValue(true); buttonLayout.addComponent(horizontal); TextField timeout = new TextField(); timeout.setCaption("Slide show millisecs"); timeout.setValue(String.valueOf(image.getSlideShowTimeout())); timeout.setDescription("How many millisec the slideshow shows one image"); buttonLayout.addComponent(timeout); timeout.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { try { int value = Integer.parseInt(event.getText()); // Change slide show value image.setSlideShowTimeout(value); } catch (NumberFormatException e) { } } }); auto.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean value = (Boolean) event.getProperty().getValue(); // Enable/disable slideshow mode image.setSlideShowEnabled(value); for (Component component : disableWhenAutoPlay) { component.setEnabled(!value); } } }); fade.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean value = (Boolean) event.getProperty().getValue(); image.setFadeTransition(value.booleanValue()); } }); rotate.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { Boolean value = (Boolean) event.getProperty().getValue(); image.setRotateTransition(value.booleanValue(), horizontal.getValue()); } }); horizontal.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (image.isRotateTransition()) { image.setRotateTransition(true, (Boolean) event.getProperty().getValue()); } } }); }
From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java
License:Apache License
public PanelDemo() { setMargin(true);/*from w w w . ja v a2 s.c om*/ 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 ww w . j a v a 2s . co 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);//from www . ja v 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.spring.samples.security.shared.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();/*from www .ja v a2 s . co m*/ userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
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);//www . ja v a 2 s . co 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; }