List of usage examples for com.vaadin.ui ComboBox ComboBox
public ComboBox()
From source file:org.processbase.ui.bpm.admin.ProcessDefinitionWindow.java
License:Open Source License
private void addTableMembershipRow(Membership membership) throws Exception { String uuid = membership != null ? membership.getUUID() : "NEW_MEMBERSHIP_UUID_" + UUID.randomUUID().toString(); Item woItem = tableMembership.addItem(uuid); if (membership != null) { Label groups = new Label(getGroups() .getItem(membership != null ? membership.getGroup().getUUID() : null).getItemProperty("path")); woItem.getItemProperty("group").setValue(groups); Label roles = new Label(getRoles().getItem(membership != null ? membership.getRole().getUUID() : null) .getItemProperty("name")); woItem.getItemProperty("role").setValue(roles); } else {//from w ww . j a va 2s . c o m ComboBox groups = new ComboBox(); groups.setWidth("100%"); groups.setContainerDataSource(getGroups()); groups.setItemCaptionPropertyId("path"); groups.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); groups.setValue(membership != null ? membership.getGroup().getUUID() : null); woItem.getItemProperty("group").setValue(groups); ComboBox roles = new ComboBox(); roles.setWidth("100%"); roles.setContainerDataSource(getRoles()); roles.setItemCaptionPropertyId("name"); roles.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); roles.setValue(membership != null ? membership.getRole().getUUID() : null); woItem.getItemProperty("role").setValue(roles); } TableLinkButton tlb = new TableLinkButton( ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDelete"), "icons/cancel.png", uuid, this, Constants.ACTION_DELETE); woItem.getItemProperty("actions").setValue(tlb); }
From source file:org.processbase.ui.bpm.admin.UserWindow.java
License:Open Source License
private void addTableMembershipRow(Membership membership) throws Exception { String uuid = membership != null ? membership.getUUID() : "NEW_MEMBERSHIP_UUID_" + UUID.randomUUID().toString(); Item woItem = tableMembership.addItem(uuid); if (membership != null) { Label groups = new Label(getGroups() .getItem(membership != null ? membership.getGroup().getUUID() : null).getItemProperty("path")); woItem.getItemProperty("group").setValue(groups); Label roles = new Label(getRoles().getItem(membership != null ? membership.getRole().getUUID() : null) .getItemProperty("name")); woItem.getItemProperty("role").setValue(roles); } else {/* w ww. j a va2 s .c o m*/ ComboBox groups = new ComboBox(); groups.setWidth("100%"); groups.setContainerDataSource(getGroups()); groups.setItemCaptionPropertyId("path"); groups.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); groups.setValue(membership != null ? membership.getGroup().getUUID() : null); woItem.getItemProperty("group").setValue(groups); ComboBox roles = new ComboBox(); roles.setWidth("100%"); roles.setContainerDataSource(getRoles()); roles.setItemCaptionPropertyId("name"); roles.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); roles.setValue(membership != null ? membership.getRole().getUUID() : null); woItem.getItemProperty("role").setValue(roles); } TableLinkButton tlb = new TableLinkButton(ProcessbaseApplication.getString("btnDelete"), "icons/cancel.png", uuid, this, Constants.ACTION_DELETE); woItem.getItemProperty("actions").setValue(tlb); }
From source file:org.processbase.ui.bpm.panel.BPMConfigurationPanel.java
License:Open Source License
private void prepareButtonBar() { buttonBar.removeAllComponents();//from www . java 2 s .c om // prepare categoriesBtn button categoriesBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("categoriesBtn"), this); categoriesBtn.setDescription( ProcessbaseApplication.getCurrent().getPbMessages().getString("categoriesBtnTooltip")); categoriesBtn.setStyleName(Reindeer.BUTTON_LINK); buttonBar.addComponent(categoriesBtn, 0); buttonBar.setComponentAlignment(categoriesBtn, Alignment.MIDDLE_LEFT); // prepare myProcessesBtn button processDefinitionBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("processDefinitionBtn"), this); processDefinitionBtn.setStyleName("special"); processDefinitionBtn.setEnabled(false); buttonBar.addComponent(processDefinitionBtn, 1); buttonBar.setComponentAlignment(processDefinitionBtn, Alignment.MIDDLE_LEFT); // prepare myTaskListBtn button processInstancesBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("processInstancesBtn"), this); processInstancesBtn.setStyleName(Reindeer.BUTTON_LINK); buttonBar.addComponent(processInstancesBtn, 2); buttonBar.setComponentAlignment(processInstancesBtn, Alignment.MIDDLE_LEFT); // prepare myTaskArchiveBtn button activityInstancesBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("activityInstancesBtn"), this); activityInstancesBtn.setStyleName(Reindeer.BUTTON_LINK); buttonBar.addComponent(activityInstancesBtn, 3); buttonBar.setComponentAlignment(activityInstancesBtn, Alignment.MIDDLE_LEFT); // add expand label Label expandLabel = new Label(""); buttonBar.addComponent(expandLabel, 4); buttonBar.setExpandRatio(expandLabel, 1); // prepare processesComboBox processesComboBox = new ComboBox(); processesComboBox.setWidth("100px"); processesComboBox.setInputPrompt( ProcessbaseApplication.getCurrent().getPbMessages().getString("selectProcessDefinition")); processesComboBox.setDescription( ProcessbaseApplication.getCurrent().getPbMessages().getString("selectProcessDefinition")); buttonBar.addComponent(processesComboBox, 5); buttonBar.setComponentAlignment(processesComboBox, Alignment.MIDDLE_LEFT); processesComboBox.setVisible(false); // prepare refresh button refreshBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnRefresh"), this); buttonBar.addComponent(refreshBtn, 6); buttonBar.setComponentAlignment(refreshBtn, Alignment.MIDDLE_RIGHT); // prepare add button btnAdd = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this); buttonBar.addComponent(btnAdd, 7); buttonBar.setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); buttonBar.setWidth("100%"); }
From source file:org.qa82.analyzer.ui.AnalyzerUI.java
License:Open Source License
protected HorizontalLayout getMenu() { final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSpacing(true);/*from www. ja v a 2 s .co m*/ Project project = new Project(); project.setRepository(userData.getRepository()); Analyzer analyzer = new Analyzer(project); List<String> uris = analyzer.getResultUris(List.class, null); System.out.println(uris.size()); ComboBox elements = new ComboBox(); elements.addItems(uris); TextField condition = new TextField(); elements.setImmediate(true); OnEnterKeyHandler onEnterHandler = new OnEnterKeyHandler() { @Override public void onEnterKeyPressed() { Notification.show("Test", Notification.Type.HUMANIZED_MESSAGE); } }; onEnterHandler.installOn(condition); Button executeButton = new Button("Run"); executeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Project project = new Project(); project.setRepository(userData.getRepository()); Analyzer analyzer = new Analyzer(project); Object result = analyzer.execute((String) elements.getValue(), null); showResult(result); } }); Button preferencesButton = new Button("Preferences"); preferencesButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { PreferencesDialog dialog = new PreferencesDialog(); UI.getCurrent().addWindow(dialog); } }); horizontalLayout.addComponent(elements); horizontalLayout.addComponent(condition); horizontalLayout.addComponent(executeButton); horizontalLayout.addComponent(preferencesButton); return horizontalLayout; }
From source file:org.rdflivenews.annotator.gui.AnnotatorGuiApplication.java
License:Apache License
@Override public void init() { setMainWindow(main);/*from ww w .jav a 2s. c o m*/ setTheme("mytheme"); if (!patterns.isEmpty()) { mainLayout.removeAllComponents(); main.removeAllComponents(); this.pattern = patterns.remove(0); this.writeTodoPatterns(); GridLayout grid = new GridLayout(4, 6); grid.setSpacing(true); HorizontalLayout labels = new HorizontalLayout(); labels.setSizeFull(); subject = new Label("<span style=\"font-size:130%\">" + this.pattern.entityOne + "</span>"); subject.setContentMode(Label.CONTENT_XHTML); subject.setSizeFull(); patternLabel = new Label("<span style=\"font-size:130%;color:red;\">" + this.pattern.nlr + "</span>"); patternLabel.setContentMode(Label.CONTENT_XHTML); patternLabel.setSizeFull(); patternLabel.setStyleName("center"); object = new Label( "<span style=\"font-size:130%;text-align:right;\">" + this.pattern.entityTwo + "</span>"); object.setContentMode(Label.CONTENT_XHTML); object.setSizeFull(); object.setStyleName("right"); String sentenceLabel = "<a href=\"" + this.pattern.url + "\">" + "<span style=\"font-size:130%\">" + this.pattern.sentence .replace(this.pattern.entityOne, "<span style=\"font-weight:bold\">" + this.pattern.entityOne + "</span>") .replace(this.pattern.entityTwo, "<span style=\"font-weight:bold\">" + this.pattern.entityTwo + "</span>") .replace(this.pattern.nlr, "<span style=\"color:red\">" + this.pattern.nlr + "</span>") + "</span></a>"; sentence = new Label(sentenceLabel); sentence.setContentMode(Label.CONTENT_XHTML); grid.addComponent(sentence, 0, 0, 3, 0); labels.addComponent(subject); labels.addComponent(patternLabel); labels.addComponent(object); // grid.addComponent(subject, 0, 1); // grid.addComponent(patternLabel, 1, 1, 2, 1); // grid.addComponent(object, 3, 1); labels.setComponentAlignment(subject, Alignment.MIDDLE_LEFT); labels.setComponentAlignment(patternLabel, Alignment.MIDDLE_CENTER); labels.setComponentAlignment(object, Alignment.MIDDLE_RIGHT); grid.addComponent(labels, 0, 1, 3, 1); AutocompleteWidget subject = new AutocompleteWidget(index); subject.addSelectionListener(new SelectionListener() { @Override public void itemSelected(SolrItem item) { subjectUri.setValue(item.getUri()); } }); grid.addComponent(subject, 0, 2, 1, 2); AutocompleteWidget object = new AutocompleteWidget(index); object.addSelectionListener(new SelectionListener() { @Override public void itemSelected(SolrItem item) { objectUri.setValue(item.getUri()); } }); grid.addComponent(object, 2, 2, 3, 2); saidObject = new TextArea("Say Cluster Object Value"); saidObject.setWidth("100%"); grid.addComponent(saidObject, 0, 5, 1, 5); comment = new TextArea("Comments"); comment.setWidth("100%"); grid.addComponent(comment, 2, 5, 3, 5); HorizontalLayout urisAndCluster = new HorizontalLayout(); subjectUri = new TextField("Subject URI"); objectUri = new TextField("Object URI"); subjectUri.setSizeFull(); objectUri.setSizeFull(); //cluster category combobox clusterCategoriesBox = new ComboBox(); clusterCategoriesBox.setWidth("40%"); clusterCategoriesBox.setCaption("Cluster Category"); clusterCategoriesBox.addContainerProperty("name", String.class, null); clusterCategoriesBox.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM); for (ClusterCategory cat : ClusterCategory.values()) { clusterCategoriesBox.addItem(cat).getItemProperty("name").setValue(cat.getName()); } clusterCategoriesBox.setImmediate(true); clusterCategoriesBox.setValue(ClusterCategory.UNKNOWN); clusterCategoriesBox.setNullSelectionAllowed(false); urisAndCluster.setSizeFull(); urisAndCluster.addComponent(subjectUri); urisAndCluster.addComponent(clusterCategoriesBox); urisAndCluster.addComponent(objectUri); urisAndCluster.setComponentAlignment(subjectUri, Alignment.MIDDLE_LEFT); urisAndCluster.setComponentAlignment(clusterCategoriesBox, Alignment.MIDDLE_CENTER); urisAndCluster.setComponentAlignment(objectUri, Alignment.MIDDLE_RIGHT); grid.addComponent(urisAndCluster, 0, 3, 3, 3); // grid.addComponent(clusterCategoriesBox, 1, 3, 2, 3); // grid.setComponentAlignment(clusterCategoriesBox, Alignment.BOTTOM_CENTER); mainLayout.addComponent(grid); HorizontalLayout submitButtonslayout = new HorizontalLayout(); nextButton = new NativeButton("Next"); trashButton = new NativeButton("Trash"); stopButton = new NativeButton("Stop"); nextButton.addListener(this); trashButton.addListener(this); stopButton.addListener(this); submitButtonslayout.setSpacing(true); submitButtonslayout.setWidth("100%"); submitButtonslayout.addComponent(trashButton); submitButtonslayout.addComponent(stopButton); submitButtonslayout.addComponent(nextButton); submitButtonslayout.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT); submitButtonslayout.setComponentAlignment(stopButton, Alignment.MIDDLE_RIGHT); mainLayout.addComponent(submitButtonslayout); mainLayout.setSpacing(true); mainLayout.setWidth(null); mainLayout.setHeight("100%"); Panel panel = new Panel(); panel.setWidth(null); panel.addComponent(mainLayout); main.addComponent(panel); ((VerticalLayout) main.getContent()).setHeight("100%"); ((VerticalLayout) main.getContent()).setComponentAlignment(panel, Alignment.MIDDLE_CENTER); //force URI search with given labels subject.setSearchTerm(this.pattern.entityOne); object.setSearchTerm(this.pattern.entityTwo); } else getMainWindow().showNotification("No patterns anymore..."); }
From source file:org.tylproject.vaadin.addon.fieldbinder.FieldBinderFieldFactory.java
License:Apache License
@Override protected AbstractSelect createCompatibleSelect(Class<? extends AbstractSelect> fieldType) { AbstractSelect select;/*ww w. j a va 2 s . c o m*/ if (fieldType.isAssignableFrom(ComboBox.class)) { select = new ComboBox(); select.setImmediate(true); select.setNullSelectionAllowed(false); return select; } else if (OptionGroup.class.isAssignableFrom(fieldType)) { select = new OptionGroup(); select.setMultiSelect(false); return select; } else { return super.createCompatibleSelect(fieldType); } }
From source file:org.tylproject.vaadin.addon.fields.search.SearchPatternComboBox.java
License:Apache License
public SearchPatternComboBox(Object propertyId, Class<? extends java.lang.Enum> propertyType) { super(new ComboBox(), Object.class, propertyId, propertyType); setFieldDefaults(getBackingField()); }
From source file:org.tylproject.vaadin.addon.fields.search.SearchPatternComboBox.java
License:Apache License
public SearchPatternComboBox(Object propertyId, Class<?> propertyType, Container.Filterable targetContainer) { super(new ComboBox(), Object.class, propertyId, propertyType, targetContainer); setFieldDefaults(getBackingField()); addDefaultBackingFieldListeners();/*from w ww . j a va 2 s .c o m*/ }
From source file:pl.exsio.frameset.vaadin.ui.support.component.ComponentFactory.java
License:Open Source License
public static ComboBox createIconComboBox(String caption) throws UnsupportedOperationException { ComboBox icon = new ComboBox(); List iconsList = Arrays.asList(FontAwesome.class.getEnumConstants()); Collections.sort(iconsList, new Comparator<FontAwesome>() { @Override// ww w .j a v a 2 s .com public int compare(FontAwesome o1, FontAwesome o2) { return o1.toString().compareTo(o2.toString()); } }); for (Object object : iconsList) { icon.addItem(object); icon.setItemIcon(object, (FontAwesome) object); } icon.setCaption(caption); return icon; }
From source file:pl.exsio.frameset.vaadin.ui.support.component.ComponentFactory.java
License:Open Source License
public static ComboBox createEnumComboBox(String caption, Class<? extends Enum> target) { ComboBox combo = new ComboBox(); List list = Arrays.asList(target.getEnumConstants()); Collections.sort(list, new Comparator() { @Override/*from w ww .j a va 2 s . co m*/ public int compare(Object o1, Object o2) { return o1.toString().compareTo(o2.toString()); } }); for (Object object : list) { combo.addItem(object); } combo.setCaption(caption); return combo; }