List of usage examples for com.vaadin.ui TwinColSelect setItems
@Override public default void setItems(Collection<T> items)
From source file:org.geant.sat.ui.EntityListViewer.java
License:BSD License
/** * Creates a subwindow for editing survey details of entity. * //ww w. jav a 2 s . c o m * @param details * entity */ private void editSurveys(EntityDetails details) { Window subWindowNewEntity = new Window(getString("lang.window.newentity.editsids.title")); subWindowNewEntity.setModal(true); VerticalLayout subContent = new VerticalLayout(); TwinColSelect<String> selectSids = new TwinColSelect<>(getString("lang.window.newentity.editsids.sids")); selectSids.setData(details); ListAllSurveysResponse resp = getMainUI().getSatApiClient().getSurveys(); if (!verifySuccess(resp)) { return; } List<SurveyDetails> surveyDetails = resp.getSurveys(); // parse active sids List<String> activeSurveyDetails = new ArrayList<String>(); for (SurveyDetails surveyDetail : surveyDetails) { if (surveyDetail.getActive()) { activeSurveyDetails.add(surveyDetail.getSid()); } } selectSids.setItems(activeSurveyDetails); // set current sids as selection selectSids.updateSelection(details.getSids(), new HashSet<String>()); subContent.addComponent(selectSids, 0); Button editButton = new Button(getString("lang.window.newentity.buttonModify")); subContent.addComponent(editButton, 1); editButton.addClickListener(this::editedSurveys); Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel")); subContent.addComponent(cancelButton, 2); cancelButton.addClickListener(this::canceledEditSurveys); subWindowNewEntity.setContent(subContent); getMainUI().addWindow(subWindowNewEntity); }
From source file:org.geant.sat.ui.EntityListViewer.java
License:BSD License
/** * Creates a subwindow for editing assessor details of entity. * /*from w ww . j a v a 2 s . co m*/ * @param details * entity */ private void editAssessors(EntityDetails details) { Window subWindowNewEntity = new Window(getString("lang.window.newentity.editassessors.title")); subWindowNewEntity.setWidth("80%"); subWindowNewEntity.setModal(true); VerticalLayout subContent = new VerticalLayout(); subContent.setWidth("100%"); TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>( getString("lang.window.newentity.editassessors.assessors")); selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper()); selectAssessors.setWidth("100%"); selectAssessors.setData(details); ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors(); if (!verifySuccess(resp)) { return; } List<AssessorDetails> assessorDetails = resp.getAssessors(); selectAssessors.setItems(assessorDetails); selectAssessors.updateSelection( AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()), new HashSet<AssessorDetails>()); subContent.addComponent(selectAssessors, 0); Button editButton = new Button(getString("lang.window.newentity.buttonModify")); subContent.addComponent(editButton, 1); editButton.addClickListener(this::editedAssessors); Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel")); subContent.addComponent(cancelButton, 2); cancelButton.addClickListener(this::canceledEditAssessors); subWindowNewEntity.setContent(subContent); getMainUI().addWindow(subWindowNewEntity); }
From source file:org.geant.sat.ui.ScheduleSurveyViewer.java
License:BSD License
/** * Creates a subwindow for editing survey details of entity. * /* www . jav a2s . c om*/ * @param details * entity */ private void editSurveys(EntityDetails details) { Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editsids.title")); subWindowNewEntity.setModal(true); VerticalLayout subContent = new VerticalLayout(); TwinColSelect<String> selectSids = new TwinColSelect<>(getString("lang.window.newentity.editsids.sids")); selectSids.setData(details); ListAllSurveysResponse resp = getMainUI().getSatApiClient().getSurveys(); if (!verifySuccess(resp)) { return; } List<SurveyDetails> surveyDetails = resp.getSurveys(); // parse active sids List<String> activeSurveyDetails = new ArrayList<String>(); for (SurveyDetails surveyDetail : surveyDetails) { if (surveyDetail.getActive()) { activeSurveyDetails.add(surveyDetail.getSid()); } } selectSids.setItems(activeSurveyDetails); // set current sids as selection selectSids.updateSelection(details.getSids(), new HashSet<String>()); subContent.addComponent(selectSids, 0); Button editButton = new Button(getString("lang.window.newentity.buttonModify")); subContent.addComponent(editButton, 1); editButton.addClickListener(this::editedSurveys); Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel")); subContent.addComponent(cancelButton, 2); cancelButton.addClickListener(this::canceledEditSurveys); subWindowNewEntity.setContent(subContent); getMainUI().addWindow(subWindowNewEntity); }
From source file:org.geant.sat.ui.ScheduleSurveyViewer.java
License:BSD License
/** * Creates a subwindow for editing assessor details of entity. * //from w w w .j a v a2 s . c o m * @param details * entity */ private void editAssessors(EntityDetails details) { Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editassessors.title")); subWindowNewEntity.setWidth("80%"); subWindowNewEntity.setModal(true); VerticalLayout subContent = new VerticalLayout(); subContent.setWidth("100%"); TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>( getString("lang.window.newentity.editassessors.assessors")); selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper()); selectAssessors.setWidth("100%"); selectAssessors.setData(details); ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors(); if (!verifySuccess(resp)) { return; } List<AssessorDetails> assessorDetails = resp.getAssessors(); selectAssessors.setItems(assessorDetails); selectAssessors.updateSelection( AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()), new HashSet<AssessorDetails>()); subContent.addComponent(selectAssessors, 0); Button editButton = new Button(getString("lang.window.newentity.buttonModify")); subContent.addComponent(editButton, 1); editButton.addClickListener(this::editedAssessors); Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel")); subContent.addComponent(cancelButton, 2); cancelButton.addClickListener(this::canceledEditAssessors); subWindowNewEntity.setContent(subContent); getMainUI().addWindow(subWindowNewEntity); }