List of usage examples for com.vaadin.ui ListSelect ListSelect
public ListSelect(String caption)
From source file:org.processbase.ui.bpm.admin.ActivityWindow.java
License:Open Source License
public void initUI() throws ParticipantNotFoundException, ProcessNotFoundException, VariableNotFoundException, InstanceNotFoundException, ActivityNotFoundException, Exception { setContent(layout);//from w w w.j a v a2s . c o m setCaption(ProcessbaseApplication.getCurrent().getPbMessages().getString("defaultTaskWindowCaption2") + " " + lightActivity.getActivityName()); try { processDefinition = ProcessbaseApplication.getCurrent().getBpmModule() .getProcessDefinition(lightActivity.getProcessDefinitionUUID()); if (lightActivity.isTask()) { task = ProcessbaseApplication.getCurrent().getBpmModule().getTaskInstance(lightActivity.getUUID()); } dfds = ProcessbaseApplication.getCurrent().getBpmModule() .getProcessDataFields(lightActivity.getProcessDefinitionUUID()); } catch (Exception ex) { ex.printStackTrace(); } closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this); reassignBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnReassign"), this); unAssignBtn = new CheckBox(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnUnassign"), this); assignBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAssign"), this); candidatesList = new ListSelect( ProcessbaseApplication.getCurrent().getPbMessages().getString("candidates")); groupList = new ListSelect(ProcessbaseApplication.getCurrent().getPbMessages().getString("actorsGroups")); variablesTable = new Table( ProcessbaseApplication.getCurrent().getPbMessages().getString("processVariables")); tabSheet.addListener((TabSheet.SelectedTabChangeListener) this); tabSheet.setSizeFull(); if (task != null) { addParticipantInfo(); participantLayout.setSizeFull(); tabSheet.addTab(participantLayout, ProcessbaseApplication.getCurrent().getPbMessages().getString("taskPerformer"), null); } try { addVariablesInfo(); variablesLayout.setSizeFull(); tabSheet.addTab(variablesLayout, ProcessbaseApplication.getCurrent().getPbMessages().getString("processVariables"), null); addStateInfo(); stateLayout.setSizeFull(); tabSheet.addTab(stateLayout, ProcessbaseApplication.getCurrent().getPbMessages().getString("taskStateUpdates"), null); } catch (Exception ex) { ex.printStackTrace(); } tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL); buttons.setSpacing(true); buttons.setMargin(true); buttons.addComponent(closeBtn); buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT); buttons.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); vl.setMargin(true); vl.addComponent(tabSheet); layout.setFirstComponent(vl); layout.setSplitPosition(87); layout.setMargin(false); layout.setSecondComponent(buttons); layout.setStyleName(Reindeer.SPLITPANEL_SMALL); setWidth("800px"); setHeight("600px"); setModal(true); setResizable(false); }
From source file:org.robot.gtf.gui.GTFApplication.java
License:Apache License
private void buildNewProjectWindow() { // Reading in Project Data ProjectService projectService = new DummyProjectService(); List<ProjectTO> projectList = projectService.read(); final ListSelect projectSelect = new ListSelect("For main project (please select)"); String firstElement = null;//from ww w. j av a2 s . com for (ProjectTO projectTO : projectList) { projectSelect.addItem(projectTO.getName()); if (firstElement == null) { firstElement = projectTO.getName(); } } projectSelect.setNullSelectionAllowed(false); if (firstElement != null) { projectSelect.select(firstElement); } // Create the window... newProjectWindow = new Window("New Testcase Project"); newProjectWindow.setModal(true); newProjectWindow.setResizable(true); newProjectWindow.setParent(getWindow()); // Configure the window layout; by default a VerticalLayout VerticalLayout layout = (VerticalLayout) newProjectWindow.getContent(); layout.setMargin(true); layout.setSpacing(true); // Input field for the project name final TextField projectName = new TextField("Name: "); newProjectWindow.addComponent(projectName); newProjectWindow.addComponent(projectSelect); // Definition of buttons HorizontalLayout buttons = new HorizontalLayout(); Button loadButton = new Button("Load", new Button.ClickListener() { public void buttonClick(ClickEvent event) { String projectNameValue = (String) projectName.getValue(); String projectSelectValue = (String) projectSelect.getValue(); if (projectNameValue == null || projectNameValue.isEmpty()) { getWindow().showNotification("Mandatory value missing", "Please give a name for the new Testcase Project", Notification.TYPE_ERROR_MESSAGE); } else { getWindow().removeWindow(newProjectWindow); createTestdataProject(projectSelectValue, projectNameValue); } } }); Button abortButton = new Button("Abort", new Button.ClickListener() { public void buttonClick(ClickEvent event) { (newProjectWindow.getParent()).removeWindow(newProjectWindow); } }); buttons.addComponent(loadButton); buttons.addComponent(abortButton); layout.addComponent(buttons); }
From source file:org.vaadin.webinars.springandvaadin.aspectj.ui.RoomsView.java
License:Apache License
@PostConstruct void init() {/*from ww w . j av a 2 s . c om*/ setSizeFull(); setMargin(true); setSpacing(true); HorizontalLayout bar = new HorizontalLayout(); bar.setSpacing(true); addComponent(bar); newRoomField = new TextField(); bar.addComponent(newRoomField); newRoomField.setInputPrompt("Enter name of new room"); newRoomField.setWidth("15em"); addRoom = new Button("Add room", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { chatService.createRoom(newRoomField.getValue()); newRoomField.setValue(""); } }); bar.addComponent(addRoom); rooms = new ListSelect("Rooms"); rooms.setWidth("200px"); rooms.setHeight("100%"); rooms.setNullSelectionAllowed(false); addComponent(rooms); setExpandRatio(rooms, 1); for (String room : chatService.getRooms()) { rooms.addItem(room); } goToRoom = new Button("Go to selected room", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { getUI().getNavigator().navigateTo("chat/" + rooms.getValue()); } }); addComponent(goToRoom); }
From source file:roart.client.MyVaadinUI.java
private ListSelect getReindexLanguage() { ListSelect ls = new ListSelect("Reindex for language"); Set<String> languages = null; try {/* w w w . ja v a 2 s . c o m*/ Set<String> langs = IndexFilesDao.getLanguages(); langs.remove(null); languages = new TreeSet<String>(langs); } catch (Exception e) { log.error(Constants.EXCEPTION, e); return ls; } log.info("languages " + languages); if (languages == null) { return ls; } ls.addItems(languages); ls.setNullSelectionAllowed(false); // Show 5 items and a scrollbar if there are more ls.setRows(5); ls.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { // Assuming that the value type is a String String value = (String) event.getProperty().getValue(); // Do something with the value ControlService maininst = new ControlService(); try { maininst.reindexlanguage(value); Notification.show("Request sent"); } catch (Exception e) { log.error(Constants.EXCEPTION, e); } } }); // Fire value changes immediately when the field loses focus ls.setImmediate(true); return ls; }
From source file:roart.client.MyVaadinUI.java
private ListSelect getReindexConfiguredLanguage() { ListSelect ls = new ListSelect("Reindex for configured language"); String[] languages = null;/*from w w w .ja va 2s . c o m*/ try { languages = LanguageDetect.getLanguages(); } catch (Exception e1) { } ls.addItems(languages); ls.setNullSelectionAllowed(false); // Show 5 items and a scrollbar if there are more ls.setRows(5); ls.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { // Assuming that the value type is a String String value = (String) event.getProperty().getValue(); // Do something with the value ControlService maininst = new ControlService(); try { maininst.reindexlanguage(value); Notification.show("Request sent"); } catch (Exception e) { log.error(Constants.EXCEPTION, e); } } }); // Fire value changes immediately when the field loses focus ls.setImmediate(true); return ls; }
From source file:rs.pupin.jpo.validation.gui.constraints.IC12.java
@Override public void generateGUI() { rootLayout.removeAllComponents();// w w w . j a v a 2 s .c o m if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } rootLayout.addComponent(new Label( "Following observations belong to the same data set and have the same value for all dimensions.")); final ListSelect ls1 = new ListSelect("Observations"); ls1.setNullSelectionAllowed(false); ls1.setImmediate(true); ls1.setWidth("100%"); rootLayout.addComponent(ls1); Iterator<BindingSet> res = icQuery.getResults(); final HashMap<String, List<String>> mapDuplicates = new HashMap<String, List<String>>(); String lastObs = ""; List<String> lastDuplicates = null; while (res.hasNext()) { BindingSet set = res.next(); String obs1 = set.getValue("obs1").stringValue(); if (!obs1.equals(lastObs)) { lastObs = obs1; lastDuplicates = new ArrayList<String>(); mapDuplicates.put(lastObs, lastDuplicates); ls1.addItem(lastObs); } lastDuplicates.add(set.getValue("obs2").stringValue()); } final ListSelect ls2 = new ListSelect("Duplicates"); ls2.setNullSelectionAllowed(false); ls2.setImmediate(true); ls2.setWidth("100%"); rootLayout.addComponent(ls2); ls1.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { ls2.removeAllItems(); for (String duplicate : mapDuplicates.get(event.getProperty().getValue())) { ls2.addItem(duplicate); } } }); Form panelQuickFix = new Form(); panelQuickFix.setCaption("Quick Fix"); panelQuickFix.setSizeFull(); VerticalLayout panelLayout = new VerticalLayout(); panelLayout.setSpacing(true); panelLayout.setSizeFull(); panelQuickFix.setLayout(panelLayout); rootLayout.addComponent(panelQuickFix); rootLayout.setExpandRatio(panelQuickFix, 2.0f); panelLayout.addComponent( new Label("After the fix duplicates of the selected observation will be removed from the graph")); Button fix = new Button("Quick Fix"); panelLayout.addComponent(fix); panelLayout.setExpandRatio(fix, 2.0f); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String obsString = (String) ls1.getValue(); if (obsString == null || obsString.isEmpty()) { Notification.show("Select observation first", Notification.Type.ERROR_MESSAGE); return; } ValueFactory factory = repository.getValueFactory(); for (String duplicateString : mapDuplicates.get(obsString)) { URI duplicateURI = factory.createURI(duplicateString); TupleQueryResult res = getResourceProperties(duplicateString); ArrayList<Statement> stmts = new ArrayList<Statement>(); try { while (res.hasNext()) { BindingSet set = res.next(); URI propURI = factory.createURI(set.getValue("p").stringValue()); Value objValue = set.getValue("o"); stmts.add(factory.createStatement(duplicateURI, propURI, objValue)); } res = getResourceLinks(duplicateString); while (res.hasNext()) { BindingSet set = res.next(); URI propURI = factory.createURI(set.getValue("p").stringValue()); URI subURI = factory.createURI(set.getValue("s").stringValue()); stmts.add(factory.createStatement(subURI, propURI, duplicateURI)); } removeStatements(stmts); } catch (QueryEvaluationException e) { e.printStackTrace(); } } Notification.show("Fix executed"); // evaluate again after the fix icQuery.eval(); } }); }
From source file:ru.codeinside.gses.apservice.ApServiceForm.java
License:Mozilla Public License
private Form createForm() { final Form form = new Form(); form.setCaption(" ?"); form.setWidth("100%"); TextArea field = new TextArea("?"); field.setRequired(true);/*from ww w . ja v a 2 s . c o m*/ field.setWidth("100%"); field.setMaxLength(1500); form.addField(NAME, field); MaskedTextField code = new MaskedTextField(" ?", "# ### ### ### ### ### ###"); code.setColumns(19); code.addValidator(new FilteredLongValidator("[_ ]", " " + ApInfo.formatCode(Long.MAX_VALUE))); form.addField(CODE, code); ListSelect declarantTypes = new ListSelect(" ?"); declarantTypes.setWidth("100%"); declarantTypes.setHeight("50px"); declarantTypes.setMultiSelect(true); LazyQueryContainer container = new LazyQueryContainer(new DeclarantTypeQueryDefinition(), new DeclarantTypeQueryFactory()); declarantTypes.setContainerDataSource(container); declarantTypes.setItemCaptionPropertyId("value"); declarantTypes.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); Flash.bind(DeclarantTypeChanged.class, container, "refresh"); field.setRequired(true); field.setWidth("100%"); field.setMaxLength(1500); form.addField(DeclarantServiceImpl.DECLARANT_TYPES, declarantTypes); Layout footer = form.getFooter(); Button updateButton = createCreateButton(); footer.addComponent(updateButton); ((HorizontalLayout) footer).setSpacing(true); return form; }
From source file:ru.codeinside.gses.apservice.ApServiceForm.java
License:Mozilla Public License
private Form editForm() { final Form form = new Form(); form.setCaption(" ?"); form.setWidth("100%"); TextField idField = new TextField(" ?"); idField.setRequired(false);//from w w w .j a va 2 s . com idField.setEnabled(true); idField.setVisible(true); idField.setReadOnly(true); form.addField(ID, idField); TextArea field = new TextArea("?"); field.setRequired(true); field.setWidth("100%"); field.setMaxLength(1500); form.addField(NAME, field); MaskedTextField code = new MaskedTextField(" ?", "# ### ### ### ### ### ###"); code.setColumns(19); code.addValidator(new FilteredLongValidator("[_ ]", " " + ApInfo.formatCode(Long.MAX_VALUE))); form.addField(CODE, code); ListSelect declarantTypes = new ListSelect(" ?"); declarantTypes.setWidth("100%"); declarantTypes.setHeight("50px"); declarantTypes.setMultiSelect(true); LazyQueryContainer container = new LazyQueryContainer(new DeclarantTypeQueryDefinition(), new DeclarantTypeQueryFactory()); declarantTypes.setContainerDataSource(container); declarantTypes.setItemCaptionPropertyId("value"); declarantTypes.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); Flash.bind(DeclarantTypeChanged.class, container, "refresh"); field.setRequired(true); field.setWidth("100%"); field.setMaxLength(1500); form.addField(DeclarantService.DECLARANT_TYPES, declarantTypes); Layout footer = form.getFooter(); Button updateButton = createUpdateButton(); Button cancelButton = createCancelButton(form); footer.addComponent(updateButton); footer.addComponent(cancelButton); ((HorizontalLayout) footer).setSpacing(true); return form; }
From source file:ru.codeinside.gses.webui.supervisor.TaskFilter.java
License:Mozilla Public License
private ListSelect getControlledOrgGroups(LazyQueryContainer groupsQueryContainer, String comboBoxWidth) { ListSelect cb = new ListSelect(" "); cb.setMultiSelect(true);//from w ww.j a v a 2 s .co m cb.setContainerDataSource(groupsQueryContainer); cb.setNullSelectionAllowed(true); cb.setItemCaptionPropertyId("name"); cb.setWidth(comboBoxWidth); return cb; }
From source file:ru.codeinside.gses.webui.supervisor.TaskFilter.java
License:Mozilla Public License
private ListSelect getControlledEmployeeGroups(LazyQueryContainer empGroupsQueryContainer, String comboBoxWidth) {/* ww w . ja v a2s .c o m*/ ListSelect cb = new ListSelect(" ?"); cb.setMultiSelect(true); cb.setNullSelectionAllowed(true); cb.setContainerDataSource(empGroupsQueryContainer); cb.setItemCaptionPropertyId("name"); cb.setWidth(comboBoxWidth); return cb; }