List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:pl.exsio.plupload.examples.SimpleUploaderExample.java
License:Open Source License
@Override protected void decorateActionPane(VerticalLayout pane) { final Plupload uploader = Util.createUploader(); uploader.addFileUploadedListener(new Plupload.FileUploadedListener() { @Override//from w w w .j a v a 2 s .com public void onFileUploaded(PluploadFile file) { Notification.show("I've just uploaded file: " + file.getName()); } }); final Label info = new Label(); uploader.addUploadProgressListener(new Plupload.UploadProgressListener() { @Override public void onUploadProgress(PluploadFile file) { info.setValue("I'm uploading " + file.getName() + " and I'm at " + file.getPercent() + "%"); } }); uploader.addFilesAddedListener(new Plupload.FilesAddedListener() { @Override public void onFilesAdded(PluploadFile[] files) { uploader.start(); } }); uploader.addUploadCompleteListener(new Plupload.UploadCompleteListener() { @Override public void onUploadComplete() { info.setValue("upload is completed!"); } }); uploader.addErrorListener(new Plupload.ErrorListener() { @Override public void onError(PluploadError error) { Notification.show("There was an error: " + error.getMessage() + " (" + error.getType() + ")", Notification.Type.ERROR_MESSAGE); } }); pane.addComponent(uploader); pane.addComponent(info); }
From source file:probe.com.view.body.quantdatasetsoverview.quantproteinstabsheet.studies.PeptidesComparisonsSequenceLayout.java
/** * * @param cp//from w w w . jav a 2s . co m * @param width * @param Quant_Central_Manager */ public PeptidesComparisonsSequenceLayout(QuantCentralManager Quant_Central_Manager, final DiseaseGroupsComparisonsProteinLayout cp, int width) { this.studiesMap = new LinkedHashMap<String, StudyInfoData>(); this.setColumns(4); this.setRows(3); this.setWidthUndefined(); this.setSpacing(true); this.setMargin(new MarginInfo(true, false, false, false)); comparisonTitle = new Label(); comparisonTitle.setContentMode(ContentMode.HTML); comparisonTitle.setStyleName("custChartLabelHeader"); comparisonTitle.setWidth((width - 55) + "px"); this.addComponent(comparisonTitle, 1, 0); this.setComponentAlignment(comparisonTitle, Alignment.TOP_LEFT); closeBtn = new VerticalLayout(); closeBtn.setWidth("20px"); closeBtn.setHeight("20px"); closeBtn.setStyleName("closebtn"); this.addComponent(closeBtn, 2, 0); this.setComponentAlignment(closeBtn, Alignment.TOP_RIGHT); //end of toplayout //init comparison study layout GridLayout proteinSequenceComparisonsContainer = new GridLayout(2, cp.getComparison().getDatasetIndexes().length); proteinSequenceComparisonsContainer.setWidthUndefined(); proteinSequenceComparisonsContainer.setHeightUndefined(); proteinSequenceComparisonsContainer.setStyleName(Reindeer.LAYOUT_WHITE); proteinSequenceComparisonsContainer.setSpacing(true); proteinSequenceComparisonsContainer.setMargin(new MarginInfo(true, false, false, false)); this.addComponent(proteinSequenceComparisonsContainer, 1, 1); coverageWidth = (width - 100 - 180); Map<Integer, Set<QuantPeptide>> dsQuantPepMap = new HashMap<Integer, Set<QuantPeptide>>(); for (QuantPeptide quantPep : cp.getQuantPeptidesList()) { if (!dsQuantPepMap.containsKey(quantPep.getDsKey())) { Set<QuantPeptide> subList = new HashSet<QuantPeptide>(); dsQuantPepMap.put(quantPep.getDsKey(), subList); } Set<QuantPeptide> subList = dsQuantPepMap.get(quantPep.getDsKey()); subList.add(quantPep); dsQuantPepMap.put(quantPep.getDsKey(), subList); } int numb = 0; int panelWidth = Page.getCurrent().getBrowserWindowWidth() - 100; String groupCompTitle = cp.getComparison().getComparisonHeader(); String updatedHeader = groupCompTitle.split(" / ")[0].split("\n")[0] + " / " + groupCompTitle.split(" / ")[1].split("\n")[0];//+ " ( " + groupCompTitle.split(" / ")[1].split("\n")[1] + " )"; ; final StudyInformationPopupComponent studyInformationPopupPanel = new StudyInformationPopupComponent( panelWidth, cp.getProtName(), cp.getUrl(), cp.getComparison().getComparisonFullName()); studyInformationPopupPanel.setVisible(false); LayoutEvents.LayoutClickListener studyListener = new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { Integer dsId; if (event.getComponent() instanceof AbsoluteLayout) { dsId = (Integer) ((AbsoluteLayout) event.getComponent()).getData(); } else { dsId = (Integer) ((VerticalLayout) event.getComponent()).getData(); } studyInformationPopupPanel.updateContent(dsToStudyLayoutMap.get(dsId)); } }; TreeSet<QuantProtein> orderSet = new TreeSet<QuantProtein>(cp.getDsQuantProteinsMap().values()); for (QuantProtein quantProtein : orderSet) { StudyInfoData exportData = new StudyInfoData(); exportData.setCoverageWidth(coverageWidth); Label studyTitle = new Label();//"Study " + (numb + 1)); studyTitle.setStyleName("peptideslayoutlabel"); studyTitle.setHeightUndefined(); studyTitle.setWidth("200px"); Label iconTitle = new Label("#Patients (" + (quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()) + ")"); exportData.setSubTitle(iconTitle.getValue()); iconTitle.setStyleName("peptideslayoutlabel"); iconTitle.setHeightUndefined(); if (quantProtein.getStringPValue().equalsIgnoreCase("Not Significant") || quantProtein.getStringFCValue().equalsIgnoreCase("Not regulated")) { iconTitle.setStyleName("notregicon"); exportData.setTrend(0); } else if (quantProtein.getStringFCValue().equalsIgnoreCase("Decreased")) { iconTitle.setStyleName("downarricon"); exportData.setTrend(-1); } else { exportData.setTrend(1); iconTitle.setStyleName("uparricon"); } iconTitle.setDescription(cp.getProteinAccssionNumber() + " : #Patients (" + (quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()) + ") " + quantProtein.getStringFCValue() + " " + quantProtein.getStringPValue() + ""); VerticalLayout labelContainer = new VerticalLayout(); labelContainer.addComponent(studyTitle); labelContainer.addComponent(iconTitle); proteinSequenceComparisonsContainer.addComponent(labelContainer, 0, numb); proteinSequenceComparisonsContainer.setComponentAlignment(labelContainer, Alignment.TOP_CENTER); Map<Integer, ComparisonDetailsBean> patientGroupsNumToDsIdMap = new HashMap<Integer, ComparisonDetailsBean>(); ComparisonDetailsBean pGr = new ComparisonDetailsBean(); patientGroupsNumToDsIdMap .put((quantProtein.getPatientsGroupIINumber() + quantProtein.getPatientsGroupINumber()), pGr); QuantDatasetObject ds; ds = Quant_Central_Manager.getFullQuantDatasetMap().get(quantProtein.getDsKey()); StudyPopupLayout study = new StudyPopupLayout(panelWidth, quantProtein, ds, cp.getProteinAccssionNumber(), cp.getUrl(), cp.getProtName(), Quant_Central_Manager.getDiseaseHashedColorMap()); Set<QuantDatasetObject> qdsSet = new HashSet<QuantDatasetObject>(); qdsSet.add(ds); study.setInformationData(qdsSet, cp); dsToStudyLayoutMap.put(ds.getDsKey(), study); labelContainer.addLayoutClickListener(studyListener); labelContainer.setData(ds.getDsKey()); studyTitle.setValue("[" + (numb + 1) + "] " + ds.getAuthor()); exportData.setTitle(ds.getAuthor()); if (dsQuantPepMap.get(quantProtein.getDsKey()) == null) { Label noPeptidesInfoLabel = new Label("No Peptide Information Available "); noPeptidesInfoLabel.setHeightUndefined(); noPeptidesInfoLabel.setStyleName("peptideslayoutlabel"); VerticalLayout labelValueContainer = new VerticalLayout(); labelValueContainer.addComponent(noPeptidesInfoLabel); labelValueContainer.addLayoutClickListener(studyListener); labelValueContainer.setData(ds.getDsKey()); proteinSequenceComparisonsContainer.addComponent(labelValueContainer, 1, numb); proteinSequenceComparisonsContainer.setComponentAlignment(labelValueContainer, Alignment.TOP_CENTER); numb++; studiesMap.put((numb + 1) + ds.getAuthor(), exportData); continue; } String key = "_-_" + quantProtein.getDsKey() + "_-_" + cp.getProteinAccssionNumber() + "_-_"; PeptidesInformationOverviewLayout peptideInfoLayout = new PeptidesInformationOverviewLayout( cp.getSequence(), dsQuantPepMap.get(quantProtein.getDsKey()), coverageWidth, true, studyListener, ds.getDsKey()); exportData.setPeptidesInfoList(peptideInfoLayout.getStackedPeptides()); exportData.setLevelsNumber(peptideInfoLayout.getLevel()); hasPTM = peptideInfoLayout.isHasPTM(); peptidesInfoLayoutDSIndexMap.put(key, peptideInfoLayout); proteinSequenceComparisonsContainer.addComponent(peptideInfoLayout, 1, numb); numb++; studiesMap.put((numb + 1) + ds.getAuthor(), exportData); } String rgbColor = Quant_Central_Manager .getDiseaseHashedColor(groupCompTitle.split(" / ")[1].split("\n")[1]); comparisonTitle.setValue("<font color='" + rgbColor + "' style='font-weight: bold;'>" + updatedHeader + " (#Datasets " + numb + "/" + cp.getComparison().getDatasetIndexes().length + ")</font>"); comparisonTitle.setDescription(cp.getComparison().getComparisonFullName()); VerticalLayout bottomSpacer = new VerticalLayout(); bottomSpacer.setWidth((width - 100) + "px"); bottomSpacer.setHeight("10px"); bottomSpacer.setStyleName("dottedline"); this.addComponent(bottomSpacer, 1, 2); }
From source file:probe.com.view.core.SingleStudyFilterLayout.java
/** * * @param dataset// w ww . ja v a 2s. c om * @param datasetIndex * @param uniqueAttr * @param view */ public SingleStudyFilterLayout(QuantDatasetObject dataset, int datasetIndex, boolean[] uniqueAttr, boolean view) { init(); this.setMargin(new MarginInfo(false, false, false, false)); VerticalLayout miniLayout = new VerticalLayout(); Label miniAttrLabel = new Label(); if (!dataset.getUniqueValues().equalsIgnoreCase("")) { miniAttrLabel.setValue("[ " + dataset.getUniqueValues() + "]"); } miniLayout.addComponent(miniAttrLabel); GridLayout studyInfo = new GridLayout(); studyInfo.setColumns(3); studyInfo.setWidth("100%"); SubTreeHideOnClick layout = new SubTreeHideOnClick("Dataset " + datasetIndex, studyInfo, miniLayout, view); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.MIDDLE_CENTER); for (int i = 0; i < uniqueAttr.length; i++) { boolean check = uniqueAttr[i]; if (check) { if (!dataset.getProperty(i).toString().trim().equalsIgnoreCase("Not Available") && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("0") && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("-1")) { if (publicationInfoLayoutComponents[i] != null) { studyInfo.addComponent(publicationInfoLayoutComponents[i]); ((InformationField) publicationInfoLayoutComponents[i]) .setValue(dataset.getProperty(i).toString(), null); } } } } Button btn = new Button("Load Dataset"); btn.setStyleName(Reindeer.BUTTON_SMALL); VerticalLayout btnLayout = new VerticalLayout(); btnLayout.setMargin(true); btnLayout.setHeight("30px"); btnLayout.addComponent(btn); int rowNum = studyInfo.getRows(); if (studyInfo.getComponentCount() % 3 != 0) { studyInfo.addComponent(btnLayout, 2, rowNum - 1); } else { studyInfo.setRows(rowNum + 1); studyInfo.addComponent(btnLayout, 2, rowNum); } studyInfo.setComponentAlignment(btnLayout, Alignment.BOTTOM_LEFT); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC01.java
@Override public void generateGUI() { Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label);//from www . j a va 2s. c o m return; } final HashMap<String, String> map = new HashMap<String, String>(); while (res.hasNext()) { BindingSet set = res.next(); map.put(set.getValue("obs").stringValue(), set.getValue("dsNum").stringValue()); } if (map.isEmpty()) { Label label = new Label(); label.setValue("All observations have links to data sets"); rootLayout.addComponent(label); return; } Label label = new Label(); label.setValue( "Below is the list of observations that are not linked to exactly one data set. Click on any of them to get more information and either edit the resource in OntoWiki or choose a quick solution"); rootLayout.addComponent(label); final ListSelect listObs = new ListSelect("Observations", map.keySet()); listObs.setNullSelectionAllowed(false); rootLayout.addComponent(listObs); listObs.setImmediate(true); listObs.setWidth("100%"); final Table detailsTable = new Table("Details"); detailsTable.setHeight("250px"); detailsTable.setWidth("100%"); detailsTable.addContainerProperty("Property", String.class, null); detailsTable.addContainerProperty("Object", String.class, null); rootLayout.addComponent(detailsTable); final Label lblProblem = new Label("<b>Problem description: </b>", ContentMode.HTML); rootLayout.addComponent(lblProblem); Button editInOW = new Button("Edit in OntoWiki"); editInOW.setEnabled(owUrl != null); editInOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listObs.getValue()); } }); 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 the selected observation will belong only to the data set selected below or you can choose to edit the selected observation manually in OntoWiki")); final ComboBox comboDataSets = new ComboBox(null, getDataSets()); comboDataSets.setNullSelectionAllowed(false); comboDataSets.setWidth("100%"); comboDataSets.setImmediate(true); panelLayout.addComponent(comboDataSets); final Button fix = new Button("Quick Fix"); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); buttonsLayout.addComponent(fix); buttonsLayout.addComponent(editInOW); panelLayout.addComponent(buttonsLayout); panelLayout.setExpandRatio(buttonsLayout, 2.0f); listObs.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { TupleQueryResult res = getResourceProperties((String) event.getProperty().getValue()); int i = 1; detailsTable.removeAllItems(); try { while (res.hasNext()) { BindingSet set = res.next(); detailsTable.addItem( new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() }, i++); } } catch (QueryEvaluationException e) { e.printStackTrace(); } String chosenObs = (String) event.getProperty().getValue(); lblProblem.setValue("<b>Problem description: </b>The selected observation belongs to " + map.get(chosenObs) + " data sets. It should belong to exactly one."); } }); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String chosenDataSet = (String) comboDataSets.getValue(); String observation = (String) listObs.getValue(); if (chosenDataSet == null) { Notification.show("DataSet was not selected", Notification.Type.ERROR_MESSAGE); return; } if (observation == null) { Notification.show("Observation was not selected", Notification.Type.ERROR_MESSAGE); return; } String dataSetProp = "http://purl.org/linked-data/cube#dataSet"; List<String> forRemoval = getObsDataSets(observation); if (forRemoval.size() > 0) { ArrayList<Statement> stmts = new ArrayList<Statement>(); for (String ds : forRemoval) stmts.add(getStatementFromUris(observation, dataSetProp, ds)); removeStatements(stmts); } ArrayList<Statement> addStmts = new ArrayList<Statement>(); addStmts.add(getStatementFromUris(observation, dataSetProp, chosenDataSet)); uploadStatements(addStmts); Notification.show("Fix executed"); icQuery.eval(); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC02.java
@Override public void generateGUI() { rootLayout.removeAllComponents();// w w w. j ava2s .com Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final HashMap<String, String> map = new HashMap<String, String>(); while (res.hasNext()) { BindingSet set = res.next(); map.put(set.getValue("dataSet").stringValue(), set.getValue("dsdNum").stringValue()); } if (map.isEmpty()) { Label label = new Label(); label.setValue("All data sets have exactly one link to the DSD"); rootLayout.addComponent(label); return; } Label label = new Label(); label.setValue( "Below is the list of data sets that are not linked to exactly one DSD. Click on any of them to get more information and either edit the data set in OntoWiki or choose a quick solution"); rootLayout.addComponent(label); final ListSelect listDataSets = new ListSelect("Data Sets", map.keySet()); listDataSets.setNullSelectionAllowed(false); rootLayout.addComponent(listDataSets); listDataSets.setImmediate(true); listDataSets.setWidth("100%"); final Table detailsTable = new Table("Details"); detailsTable.setHeight("250px"); detailsTable.setWidth("100%"); detailsTable.addContainerProperty("Property", String.class, null); detailsTable.addContainerProperty("Object", String.class, null); rootLayout.addComponent(detailsTable); final Label lblProblem = new Label("<b>Problem description: </b>", ContentMode.HTML); rootLayout.addComponent(lblProblem); Button editInOW = new Button("Edit in OntoWiki"); editInOW.setEnabled(owUrl != null); editInOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listDataSets.getValue()); } }); 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 the selected data sets will link only to the DSD selected below or you can choose to edit the selected data set manually in OntoWiki")); final ComboBox comboDSDs = new ComboBox(null, getDataStructureDefinitions()); comboDSDs.setNullSelectionAllowed(false); comboDSDs.setWidth("100%"); comboDSDs.setImmediate(true); panelLayout.addComponent(comboDSDs); final Button fix = new Button("Quick Fix"); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); buttonsLayout.addComponent(fix); buttonsLayout.addComponent(editInOW); panelLayout.addComponent(buttonsLayout); panelLayout.setExpandRatio(buttonsLayout, 2.0f); listDataSets.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { TupleQueryResult res = getResourceProperties((String) event.getProperty().getValue()); int i = 1; detailsTable.removeAllItems(); try { while (res.hasNext()) { BindingSet set = res.next(); detailsTable.addItem( new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() }, i++); } } catch (QueryEvaluationException e) { e.printStackTrace(); } String chosenDataSet = (String) event.getProperty().getValue(); lblProblem.setValue("<b>Problem description: </b>The selected data set belongs to " + map.get(chosenDataSet) + " DSDs. It should belong to exactly one."); } }); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String chosenDSD = (String) comboDSDs.getValue(); String dataSet = (String) listDataSets.getValue(); if (chosenDSD == null) { Notification.show("DSD was not selected", Notification.Type.ERROR_MESSAGE); return; } if (dataSet == null) { Notification.show("Data set was not selected", Notification.Type.ERROR_MESSAGE); return; } String structProp = "http://purl.org/linked-data/cube#structure"; List<String> forRemoval = getDataSetDSDs(dataSet); if (forRemoval.size() > 0) { ArrayList<Statement> stmts = new ArrayList<Statement>(); for (String dsd : forRemoval) { stmts.add(getStatementFromUris(dataSet, structProp, dsd)); } removeStatements(stmts); } ArrayList<Statement> addStmts = new ArrayList<Statement>(); addStmts.add(getStatementFromUris(dataSet, structProp, chosenDSD)); uploadStatements(addStmts); Notification.show("Fix executed"); icQuery.eval(); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC03.java
@Override public void generateGUI() { rootLayout.removeAllComponents();/*from w w w .j av a2s . com*/ Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final List<String> dsdList = new ArrayList<String>(); while (res.hasNext()) { BindingSet set = res.next(); dsdList.add(set.getValue("dsd").stringValue()); } if (dsdList.isEmpty()) { Label label = new Label(); label.setValue("All DSDs contain at least one measure"); rootLayout.addComponent(label); return; } Label lbl = new Label(); lbl.setValue("Following DSDs do not have at least one measure defined"); rootLayout.addComponent(lbl); final ListSelect listDSDs = new ListSelect("DSDs", dsdList); listDSDs.setNullSelectionAllowed(false); listDSDs.setImmediate(true); rootLayout.addComponent(listDSDs); 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); Label fixLabel = new Label(); fixLabel.setContentMode(ContentMode.HTML); fixLabel.setValue("After the fix, component selected in the combo box below will be turned to measure, " + "or you can choose to edit the above selected DSD manually in OntoWiki"); panelLayout.addComponent(fixLabel); final ComboBox comboComponents = new ComboBox(); comboComponents.setWidth("100%"); comboComponents.setNullSelectionAllowed(false); comboComponents.setImmediate(true); panelLayout.addComponent(comboComponents); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSpacing(true); Button editOW = new Button("Edit in OntoWiki"); editOW.setEnabled(owUrl != null); Button turnToMeasure = new Button("Turn to measure"); btnLayout.addComponent(turnToMeasure); btnLayout.addComponent(editOW); panelLayout.addComponent(btnLayout); panelLayout.setExpandRatio(btnLayout, 2.0f); listDSDs.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String dsd = event.getProperty().getValue().toString(); if (dsd == null || dsd.equalsIgnoreCase("")) { return; } comboComponents.removeAllItems(); TupleQueryResult qRes = executeTupleQuery( ValidationFixUtils.ic03_getRequiredAttributes(graph, dsd)); try { while (qRes.hasNext()) { comboComponents.addItem(qRes.next().getValue("attr").toString()); } } catch (QueryEvaluationException e) { e.printStackTrace(); } } }); turnToMeasure.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Object selVal = comboComponents.getValue(); if (selVal == null) { Notification.show("No component was selected in the combo box"); return; } GraphQueryResult resFix = executeDoubleGraphQuery( ValidationFixUtils.ic03_turnToMeasure(graph, selVal.toString()), ValidationFixUtils.ic03_turnToMeasure2(graph, selVal.toString())); if (resFix != null) { Notification.show("Fix executed"); icQuery.eval(); } } }); editOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listDSDs.getValue()); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC04.java
@Override public void generateGUI() { rootLayout.removeAllComponents();/*w ww . ja v a 2 s . c o m*/ Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final List<String> dimList = new ArrayList<String>(); while (res.hasNext()) { BindingSet set = res.next(); dimList.add(set.getValue("dim").stringValue()); } if (dimList.isEmpty()) { Label label = new Label(); label.setValue("All dimensions have a defined range"); rootLayout.addComponent(label); return; } Label lbl = new Label(); lbl.setValue("Following dimensions do not have a defined range"); rootLayout.addComponent(lbl); final ListSelect listDimensions = new ListSelect("Dimensions", dimList); listDimensions.setNullSelectionAllowed(false); listDimensions.setImmediate(true); rootLayout.addComponent(listDimensions); 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); Label fixLabel = new Label(); fixLabel.setContentMode(ContentMode.HTML); fixLabel.setValue("After the fix, dimension chosen above will have a range chosen in the combo box below. " + "Alternatively, the problematic dimension can be edited manually in OntoWiki"); panelLayout.addComponent(fixLabel); final ComboBox comboType = new ComboBox(); comboType.setWidth("100%"); comboType.setNullSelectionAllowed(false); comboType.setImmediate(true); panelLayout.addComponent(comboType); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSpacing(true); Button editOW = new Button("Edit in OntoWiki"); editOW.setEnabled(owUrl != null); Button fix = new Button("Quick fix"); btnLayout.addComponent(fix); btnLayout.addComponent(editOW); panelLayout.addComponent(btnLayout); panelLayout.setExpandRatio(btnLayout, 2.0f); editOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listDimensions.getValue()); } }); listDimensions.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String dim = event.getProperty().getValue().toString(); String query = ValidationFixUtils.ic04_getMathingRange(graph, dim); TupleQueryResult qRes = executeTupleQuery(query); comboType.removeAllItems(); try { while (qRes.hasNext()) { comboType.addItem(qRes.next().getValue("type").stringValue()); } } catch (QueryEvaluationException e) { e.printStackTrace(); } } }); fix.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { Object selDim = listDimensions.getValue(); Object selType = comboType.getValue(); if (selDim == null || selType == null) { Notification.show("Dimension or type was not selected"); return; } GraphQueryResult fixRes = executeGraphQuery( ValidationFixUtils.ic04_insertRange(graph, selDim.toString(), selType.toString())); if (fixRes != null) { Notification.show("Fix executed"); // update GUI after the fix icQuery.eval(); } } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC05.java
@Override public void generateGUI() { rootLayout.removeAllComponents();/* www .j av a 2s. c o m*/ Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final List<String> dimList = new ArrayList<String>(); while (res.hasNext()) { BindingSet set = res.next(); dimList.add(set.getValue("dim").stringValue()); } if (dimList.isEmpty()) { Label label = new Label(); label.setValue("No problems were detected - every dimension with range skos:Concept has a code list"); rootLayout.addComponent(label); return; } Label lbl = new Label(); lbl.setValue("Following dimensions with range skos:Concept do not have a code list"); rootLayout.addComponent(lbl); final ListSelect listDimensions = new ListSelect("Dimensions", dimList); listDimensions.setNullSelectionAllowed(false); listDimensions.setImmediate(true); rootLayout.addComponent(listDimensions); 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); Label fixLabel = new Label(); fixLabel.setContentMode(ContentMode.HTML); fixLabel.setValue( "After the fix, dimension chosen above will be associated with the code list chosen in the combo box below. " + "Alternatively, the problematic dimension can be edited manually in OntoWiki"); panelLayout.addComponent(fixLabel); final ComboBox comboCodeLists = new ComboBox(); comboCodeLists.setWidth("100%"); comboCodeLists.setNullSelectionAllowed(false); comboCodeLists.setImmediate(true); panelLayout.addComponent(comboCodeLists); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSpacing(true); Button editOW = new Button("Edit in OntoWiki"); editOW.setEnabled(owUrl != null); Button fix = new Button("Quick fix"); btnLayout.addComponent(fix); btnLayout.addComponent(editOW); panelLayout.addComponent(btnLayout); panelLayout.setExpandRatio(btnLayout, 2.0f); editOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listDimensions.getValue()); } }); listDimensions.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String dim = event.getProperty().getValue().toString(); String query = ValidationFixUtils.ic05_getMathingCodeLists(graph, dim); TupleQueryResult qRes = executeTupleQuery(query); comboCodeLists.removeAllItems(); try { while (qRes.hasNext()) { comboCodeLists.addItem(qRes.next().getValue("list").stringValue()); } } catch (QueryEvaluationException e) { e.printStackTrace(); } } }); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Object selDim = listDimensions.getValue(); Object selList = comboCodeLists.getValue(); if (selDim == null || selList == null) { Notification.show("Dimension or code list was not selected"); return; } GraphQueryResult fixRes = executeGraphQuery( ValidationFixUtils.ic05_insertCodeList(graph, selDim.toString(), selList.toString())); if (fixRes != null) { Notification.show("Fix executed"); icQuery.eval(); } } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC06.java
@Override public void generateGUI() { rootLayout.removeAllComponents();// w ww. java 2 s . c o m Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final HashMap<String, String> compMap = new HashMap<String, String>(); while (res.hasNext()) { BindingSet set = res.next(); compMap.put(set.getValue("component").stringValue(), set.getValue("dsd").stringValue()); } if (compMap.isEmpty()) { Label label = new Label(); label.setValue("No problems were detected - if there are any optional components, they are attributes"); rootLayout.addComponent(label); return; } Label lbl = new Label(); lbl.setValue("Following components are marked as optional, but they are not attributes"); rootLayout.addComponent(lbl); final ListSelect listComponents = new ListSelect("Component Properties", compMap.keySet()); listComponents.setNullSelectionAllowed(false); listComponents.setImmediate(true); rootLayout.addComponent(listComponents); final Table detailsTable = new Table("Details"); detailsTable.setHeight("250px"); detailsTable.setWidth("100%"); detailsTable.addContainerProperty("Property", String.class, null); detailsTable.addContainerProperty("Object", String.class, null); rootLayout.addComponent(detailsTable); listComponents.addValueChangeListener(new DetailsListener(detailsTable)); // final Label lblProblem = new Label("<b>Problem description: </b>", Label.CONTENT_XHTML); // validationTab.addComponent(lblProblem); 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); Label fixLabel = new Label(); fixLabel.setContentMode(ContentMode.HTML); fixLabel.setValue(""); // TODO panelLayout.addComponent(fixLabel); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSpacing(true); Button editOW = new Button("Edit in OntoWiki"); editOW.setEnabled(owUrl != null); Button removeCompReq = new Button("Remove qb:componentRequired"); Button turnToAttr = new Button("Turn to attribute"); btnLayout.addComponent(removeCompReq); btnLayout.addComponent(turnToAttr); btnLayout.addComponent(editOW); panelLayout.addComponent(btnLayout); panelLayout.setExpandRatio(btnLayout, 2.0f); removeCompReq.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String chosenComponent = (String) listComponents.getValue(); if (chosenComponent == null) { Notification.show("Cannot execute the action", "A component needs to be chosen first", Notification.Type.ERROR_MESSAGE); return; } String chosenDSD = compMap.get(chosenComponent); String query = ValidationFixUtils.ic06_removeComponentRequired(graph, chosenDSD, chosenComponent); GraphQueryResult resFix = executeGraphQuery(query); if (resFix != null) { Notification.show("Fix executed"); // evaluate again after the fix icQuery.eval(); } } }); turnToAttr.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String chosenComponent = (String) listComponents.getValue(); if (chosenComponent == null) { Notification.show("Cannot execute the action", "A component needs to be chosen first", Notification.Type.ERROR_MESSAGE); return; } String query = ValidationFixUtils.ic06_changeToAttribute(graph, chosenComponent); String query2 = ValidationFixUtils.ic06_changeToAttribute2(graph, chosenComponent); GraphQueryResult resFix = executeDoubleGraphQuery(query, query2); if (resFix != null) { Notification.show("Fix executed"); // evaluate again after the fix icQuery.eval(); } } }); editOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listComponents.getValue()); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC07.java
@Override public void generateGUI() { rootLayout.removeAllComponents();/*w w w . j a v a2s.c o m*/ final Iterator<BindingSet> res = icQuery.getResults(); if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final ArrayList<String> listSliceKeys = new ArrayList<String>(); while (res.hasNext()) { BindingSet set = res.next(); listSliceKeys.add(set.getValue("sliceKey").stringValue()); } if (listSliceKeys.isEmpty()) { Label label = new Label(); label.setValue( "No problems were detected - either there are no slice keys or every slice key is associated with a DSD"); rootLayout.addComponent(label); return; } Label label = new Label(); label.setValue("Following slice keys should be associated with a DSD"); rootLayout.addComponent(label); final ListSelect lsSliceKeys = new ListSelect("Slice keys", listSliceKeys); lsSliceKeys.setImmediate(true); lsSliceKeys.setNullSelectionAllowed(false); rootLayout.addComponent(lsSliceKeys); final Table detailsTable = new Table("Slice key details"); detailsTable.setHeight("250px"); detailsTable.setWidth("100%"); detailsTable.addContainerProperty("Property", String.class, null); detailsTable.addContainerProperty("Object", String.class, null); rootLayout.addComponent(detailsTable); 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); Label fixLabel = new Label(); fixLabel.setContentMode(ContentMode.HTML); fixLabel.setValue( "After the fix, slice key chosen above will be associated with the DSD chosen below, or you can edit the slice key manually."); panelLayout.addComponent(fixLabel); final ComboBox comboDSDs = new ComboBox(); comboDSDs.setNullSelectionAllowed(false); comboDSDs.setWidth("100%"); comboDSDs.setImmediate(true); panelLayout.addComponent(comboDSDs); HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSpacing(true); Button editOW = new Button("Edit in OntoWiki"); editOW.setEnabled(owUrl != null); Button fix = new Button("Quick fix"); btnLayout.addComponent(fix); btnLayout.addComponent(editOW); panelLayout.addComponent(btnLayout); panelLayout.setExpandRatio(btnLayout, 2.0f); editOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) lsSliceKeys.getValue()); } }); lsSliceKeys.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { TupleQueryResult res = getResourceProperties((String) event.getProperty().getValue()); int i = 1; detailsTable.removeAllItems(); try { while (res.hasNext()) { BindingSet set = res.next(); detailsTable.addItem( new Object[] { set.getValue("p").stringValue(), set.getValue("o").stringValue() }, i++); } } catch (QueryEvaluationException e) { e.printStackTrace(); } } }); lsSliceKeys.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { String sk = event.getProperty().getValue().toString(); if (sk == null || sk.equalsIgnoreCase("")) { return; } TupleQueryResult resSliceKeys = executeTupleQuery( ValidationFixUtils.ic07_getMatchingDSDs(graph, sk)); comboDSDs.removeAllItems(); try { while (resSliceKeys.hasNext()) { comboDSDs.addItem(resSliceKeys.next().getValue("dsd").stringValue()); } } catch (QueryEvaluationException e) { e.printStackTrace(); } } }); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Object selVal = comboDSDs.getValue(); if (selVal == null) { Notification.show("No DSD was selected"); return; } GraphQueryResult fixRes = executeGraphQuery(ValidationFixUtils.ic07_insertConnection(graph, selVal.toString(), lsSliceKeys.getValue().toString())); if (fixRes != null) { Notification.show("Fix executed"); // evaluate again thereby also updating the GUI icQuery.eval(); } } }); }