List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:rs.pupin.jpo.validation.gui.constraints.IC18.java
@Override public void generateGUI() { rootLayout.removeAllComponents();//from w w w . j ava2 s. c o m Iterator<BindingSet> res = icQuery.getResults(); @SuppressWarnings("unused") final class DataSetSlicePair { String dataset; String slice; } if (icQuery.getStatus() == ICQuery.Status.ERROR) { Label label = new Label(); label.setValue("ERROR \n" + icQuery.getErrorMessage()); rootLayout.addComponent(label); return; } final HashMap<String, DataSetSlicePair> obsMap = new HashMap<String, DataSetSlicePair>(); while (res.hasNext()) { BindingSet set = res.next(); DataSetSlicePair pair = new DataSetSlicePair(); pair.dataset = set.getValue("dataset").stringValue(); pair.slice = set.getValue("slice").stringValue(); obsMap.put(set.getValue("obs").stringValue(), pair); } if (obsMap.isEmpty()) { Label label = new Label(); label.setValue( "No problems were detected - If a qb:DataSet D has a qb:slice S, and S has an qb:observation O, then the qb:dataSet corresponding to O must be D"); rootLayout.addComponent(label); return; } Label lbl = new Label(); lbl.setValue("Following observations are missing a link to the appropriate data set"); rootLayout.addComponent(lbl); final ListSelect listObservations = new ListSelect("Observations", obsMap.keySet()); listObservations.setNullSelectionAllowed(false); listObservations.setImmediate(true); rootLayout.addComponent(listObservations); // TODO: add label that tells which dataset and slice are in question, perhaps details table Button fix = new Button("Edit in OntoWiki"); fix.setEnabled(owUrl != null); rootLayout.addComponent(fix); rootLayout.setExpandRatio(fix, 2.0f); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { editManually((String) listObservations.getValue()); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC19.java
@Override public void generateGUI() { rootLayout.removeAllComponents();// w w w . j a v a2 s.com 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 HashMap<String, String> map = new HashMap<String, String>(); while (res.hasNext()) { BindingSet set = res.next(); map.put(set.getValue("v").stringValue(), set.getValue("list").stringValue()); } if (map.isEmpty()) { Label label = new Label(); label.setValue("All values of coded dimensions are linked to the code lists"); rootLayout.addComponent(label); return; } Label label = new Label(); label.setValue( "Following resources should be of type skos:Concept and linked to the appropriate code list"); rootLayout.addComponent(label); final ListSelect listValues = new ListSelect("Resources", map.keySet()); listValues.setNullSelectionAllowed(false); listValues.setImmediate(true); rootLayout.addComponent(listValues); 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) listValues.getValue()); } }); HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setSpacing(true); Button fix = new Button("Quick Fix"); rootLayout.addComponent(buttonsLayout); rootLayout.setExpandRatio(buttonsLayout, 2.0f); buttonsLayout.addComponent(fix); buttonsLayout.addComponent(editInOW); fix.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String resource = (String) listValues.getValue(); String codeList = map.get(resource); getUI().addWindow(new QuickFixCodesFromCodeLists(resource, codeList)); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC20.java
@Override public void generateGUI() { rootLayout.removeAllComponents();//from w w w.j av a2s . c om 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 HashMap<String, String> map = new HashMap<String, String>(); while (res.hasNext()) { BindingSet set = res.next(); map.put(set.getValue("dim").stringValue(), set.getValue("p").stringValue()); } if (map.isEmpty()) { Label label = new Label(); label.setValue( "All values of hierarchical dimensions with a non-blank qb:parentChildProperty are reachable from a root of the hierarchy"); rootLayout.addComponent(label); return; } Label label = new Label(); label.setValue( "Following dimensions need to be fixed because some of its values cannot be reached from root of the hierarchy along the qb:parentChildProperty links"); rootLayout.addComponent(label); final ListSelect listValues = new ListSelect("Resources", map.keySet()); listValues.setNullSelectionAllowed(false); listValues.setImmediate(true); rootLayout.addComponent(listValues); 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) listValues.getValue()); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.IC21.java
@Override public void generateGUI() { rootLayout.removeAllComponents();/* ww w .jav a2 s . 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 HashMap<String, String> map = new HashMap<String, String>(); while (res.hasNext()) { BindingSet set = res.next(); map.put(set.getValue("dim").stringValue(), set.getValue("p").stringValue()); } if (map.isEmpty()) { Label label = new Label(); label.setValue( "All values of hierarchical dimensions with an inverse qb:parentChildProperty are reachable from a root of the hierarchy"); rootLayout.addComponent(label); return; } Label label = new Label(); label.setValue( "Following dimensions need to be fixed becaue some of its values cannot be reached from root of the hierarchy along the inverse qb:parentChildProperty links"); rootLayout.addComponent(label); final ListSelect listValues = new ListSelect("Resources", map.keySet()); listValues.setNullSelectionAllowed(false); listValues.setImmediate(true); rootLayout.addComponent(listValues); 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) listValues.getValue()); } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.Provenance.java
@Override public void generateGUI() { rootLayout.removeAllComponents();//from w w w . j ava 2 s . co m final String[] metaProps = new String[] { "rdfs:label", "rdfs:comment", "dct:title", "dct:description", "dct:issued", "dct:modified", "dct:subject", "dct:publisher", "dct:licence" }; final Label label = new Label( "It is recommended to mark datasets with metadata tu support discovery, presentation and processing. Choose a dataset below and check the values for recommended core set of metadata", Label.CONTENT_TEXT); rootLayout.addComponent(label); Iterator<BindingSet> res = icQuery.getResults(); if (res == null) { label.setValue("ERROR"); return; } final HashMap<String, ArrayList<Value>> map = new HashMap<String, ArrayList<Value>>(); while (res.hasNext()) { BindingSet set = res.next(); String ds = set.getValue("ds").stringValue(); ArrayList<Value> values = new ArrayList<Value>(9); values.add(set.getValue("label")); values.add(set.getValue("comment")); values.add(set.getValue("title")); values.add(set.getValue("description")); values.add(set.getValue("issued")); values.add(set.getValue("modified")); values.add(set.getValue("subject")); values.add(set.getValue("publisher")); values.add(set.getValue("licence")); map.put(ds, values); } final ComboBox combo = new ComboBox("Choose dataset", map.keySet()); combo.setWidth("100%"); combo.setNullSelectionAllowed(false); combo.setImmediate(true); rootLayout.addComponent(combo); final Table table = new Table("Metadata of the chosen dataset"); table.setWidth("100%"); table.addContainerProperty("Property", String.class, null); table.addContainerProperty("Value", Value.class, null); rootLayout.addComponent(table); Button editInOW = new Button("Edit in OntoWiki"); rootLayout.addComponent(editInOW); rootLayout.setExpandRatio(editInOW, 2.0f); editInOW.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // TODO do something here } }); combo.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { ArrayList<Value> list = map.get((String) event.getProperty().getValue()); table.removeAllItems(); for (int i = 0; i < metaProps.length; i++) { table.addItem(new Object[] { metaProps[i], list.get(i) }, i); } } }); }
From source file:rs.pupin.jpo.validation.gui.constraints.Summary.java
@Override public void generateGUI() { rootLayout.removeAllComponents();/* w w w . ja v a2 s .c om*/ Label label = new Label("", ContentMode.HTML); List<String> obsList = getObservations(); List<String> dsList = getDataSets(); List<String> dsdList = getDataStructureDefinitions(); StringBuilder sb = new StringBuilder(); sb.append("<h2>Summary</h2>"); sb.append("This page contains summary information about the working graph, i.e. "); sb.append("number of observations, data sets, DSDs, dimensions, etc. "); sb.append("Therefore, this page only detects if some resources are missing, for more information, e.g. "); sb.append(" missing links refer to other validation criteria."); sb.append("<p>Summary information: <ul><li>"); if (obsList == null || dsList == null || dsdList == null) { sb.append("ERROR - the endpoint could not be queries"); sb.append("</li></ul></p>"); } else { if (obsList.isEmpty()) { sb.append("ERROR - the graph is missing observations"); } else { sb.append("There are ").append(obsList.size()).append(" observations"); } sb.append("</li><li>"); if (dsList.isEmpty()) { sb.append("ERROR - the graph is missing data sets"); } else { sb.append("There are ").append(dsList.size()).append(" data sets"); } sb.append("</li><li>"); if (dsdList.isEmpty()) { sb.append("ERROR - the graph is missing data structure definitions"); } else { sb.append("There are ").append(dsdList.size()).append(" data structure definitions"); } sb.append("</li></ul></p>"); // sb.append("<p>TODO: add info about dimensions, maybe include pointers on cubeviz possibilities</p>"); } label.setValue(sb.toString()); rootLayout.addComponent(label); }
From source file:ru.codeinside.adm.ui.TreeTableOrganization.java
License:Mozilla Public License
private Component buttonEditOrganization(final Organization org, final Label nameLabel) { setSpacing(true);//w ww .j av a 2s . c om HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(false, true, false, false); addComponent(buttons); final Button createOrg = new Button(" ", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { showOrganizationLabelsAndButtons(org.getId()); final String oldNameOrg = org.getName(); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); panel.addComponent(layout); final Form form = new Form(); form.addField(NAME_ORG, new TextField(NAME_ORG)); form.getField(NAME_ORG).addValidator(new StringLengthValidator( "? 255 ?", 0, 255, true)); form.getField(NAME_ORG).setWidth("500px"); form.getField(NAME_ORG).setValue(oldNameOrg); layout.addComponent(form); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button save = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { form.commit(); } catch (Exception e) { return; } String newNameOrg = form.getField(NAME_ORG).getValue().toString(); if (!(newNameOrg.equals(oldNameOrg) || newNameOrg.equals(""))) { org.setName(newNameOrg); AdminServiceProvider.get().updateOrganization(org); treetable.getItem(org.getId()) .getItemProperty(TreeTableOrganization.NAME_PROPERTY) .setValue(newNameOrg); treetable.requestRepaint(); nameLabel.setValue("?: " + newNameOrg); nameLabel.requestRepaint(); // TODO : userInfoPanel //if (AdminServiceProvider.get() // .findEmployeeByLogin(getApplication().getUser().toString()).getOrganization() // .getId() == org.getId()) { // ((AdminApp) getApplication()).getUserInfoPanel().setOrganization(newNameOrg); //} showOrganization(org.getId()); getWindow().showNotification( "? " + oldNameOrg + " "); } else { showOrganization(org.getId()); getWindow().showNotification(" "); } } }); buttons.addComponent(save); addButtonCancel(org, buttons); form.getFooter().addComponent(buttons); } }); buttons.addComponent(createOrg); return buttons; }
From source file:ru.codeinside.gses.manager.processdefeniton.ProcessDefenitionQuery.java
License:Mozilla Public License
PropertysetItem createItem(final ProcedureProcessDefinition p) { PropertysetItem item = new PropertysetItem(); ClickListener listener = new ClickListener() { private static final long serialVersionUID = -8900212370037948964L; @Override/* w ww .jav a 2s. com*/ public void buttonClick(ClickEvent event) { Window mainWin = event.getButton().getApplication().getMainWindow(); ProcessDefinition processDefinition = Functions.withRepository(Flash.login(), new Function<RepositoryService, ProcessDefinition>() { public ProcessDefinition apply(RepositoryService srv) { return srv.createProcessDefinitionQuery() .processDefinitionId(p.getProcessDefinitionId()).singleResult(); } }); String caption = "?? " + df.format(p.getVersion()); Window win = Components.createWindow(mainWin, caption); win.center(); ContentWindowChanger changer = new ContentWindowChanger(win); ProcessDefinitionShowUi putComponent = new ProcessDefinitionShowUi(processDefinition, changer); changer.set(putComponent, caption); } }; ObjectProperty<Component> versionProperty = Components.buttonProperty(df.format(p.getVersion()), listener); item.addItemProperty("version", versionProperty); HorizontalLayout ll = new HorizontalLayout(); ll.setSpacing(true); DefinitionStatus status = p.getStatus(); final Label label = new Label(status.getLabelName()); label.setWidth("100px"); ll.addComponent(label); final ComboBox comboBox = new ComboBox(); comboBox.setWidth("100px"); comboBox.setNullSelectionAllowed(false); for (DefinitionStatus s : status.getAvailableStatus()) { comboBox.addItem(s.getLabelName()); comboBox.setValue(s.getLabelName()); } if (!status.equals(DefinitionStatus.PathToArchive) && !status.getAvailableStatus().isEmpty()) { ll.addComponent(comboBox); Button c = new Button("ok"); c.addListener(new ClickListener() { private static final long serialVersionUID = 2966059295049064338L; @Override public void buttonClick(ClickEvent event) { Object value = comboBox.getValue(); final String newValue = value.toString(); final DefinitionStatus newStatus = DefinitionStatus.getStatusByLabelName(newValue); if (DefinitionStatus.Work.equals(newStatus)) { final List<ProcedureProcessDefinition> works = ManagerService.get() .getProcessDefenitionWithStatus(p, DefinitionStatus.Work); if (!works.isEmpty()) { final Window thisWindow = event.getButton().getWindow(); comfirmAction(thisWindow, p, label, newValue, newStatus, works); return; } } ManagerService.get().updateProcessDefinationStatus(p.getProcessDefinitionId(), newStatus); label.setValue(null); label.setCaption(newValue); paramLazyLoadingContainer.fireItemSetChange(); proceduresContainer.fireItemSetChange(); } private void comfirmAction(final Window thisWindow, final ProcedureProcessDefinition p, final Label label, final String newValue, final DefinitionStatus newStatus, final List<ProcedureProcessDefinition> works) { final Window window = new Window(); window.setModal(true); window.setContent(new HorizontalLayout()); window.setCaption(" ? " + df.format(works.get(0).getVersion()) + " ? ?? "); Button save = new Button(""); save.addListener(new ClickListener() { private static final long serialVersionUID = 3229924940535642819L; @Override public void buttonClick(ClickEvent event) { ManagerService.get().updateProcessDefinationStatus(p.getProcessDefinitionId(), newStatus); label.setValue(null); label.setCaption(newValue); paramLazyLoadingContainer.fireItemSetChange(); proceduresContainer.fireItemSetChange(); closeWindow(thisWindow, window); } }); window.addComponent(save); Button c2 = new Button("?"); c2.addListener(new ClickListener() { private static final long serialVersionUID = 4502614143261892063L; @Override public void buttonClick(ClickEvent event) { closeWindow(thisWindow, window); } }); window.addComponent(c2); thisWindow.addWindow(window); } }); ll.addComponent(c); } item.addItemProperty("status", new ObjectProperty<Component>(ll)); item.addItemProperty("date", Components.stringProperty(formatter.format(p.getDateCreated()))); Employee creator = p.getCreator(); item.addItemProperty("user", Components.stringProperty(creator == null ? null : creator.getLogin())); Button b = new Button(""); b.addListener(new ClickListener() { private static final long serialVersionUID = 1362078893385574138L; @Override public void buttonClick(ClickEvent event) { StreamSource streamSource = new StreamSource() { private static final long serialVersionUID = 456334952891567271L; public InputStream getStream() { return Functions.withEngine(new PF<InputStream>() { private static final long serialVersionUID = 1L; public InputStream apply(ProcessEngine s) { return s.getRepositoryService().getProcessModel(p.getProcessDefinitionId()); } }); } }; final Application application = event.getButton().getApplication(); StreamResource resource = new StreamResource(streamSource, "test" + ".xml", application) { private static final long serialVersionUID = -3869546661105572851L; public DownloadStream getStream() { final StreamSource ss = getStreamSource(); if (ss == null) { return null; } final DownloadStream ds = new DownloadStream(ss.getStream(), getMIMEType(), getFilename()); ds.setBufferSize(getBufferSize()); ds.setCacheTime(getCacheTime()); ds.setParameter("Content-Disposition", "attachment; filename=" + getFilename()); return ds; } }; Window window = event.getButton().getWindow(); window.open(resource); } }); item.addItemProperty("getRoute", new ObjectProperty<Component>(b)); ObjectProperty<Component> buttonProperty = null; if (status.equals(DefinitionStatus.Debugging)) { DeploymentUploadReceiver receiver = new DeploymentUploadReceiver(); DeploymentSucceededListener succeededListener = new DeploymentSucceededListener(receiver, procedureId, p.getProcessDefinitionId()); succeededListener.addLoadingContainer(paramLazyLoadingContainer); succeededListener.addLoadingContainer(proceduresContainer); DeploymentAddUi addUi = new DeploymentAddUi(new DeploymentStartListener(), receiver, succeededListener); addUi.setSizeFull(); buttonProperty = new ObjectProperty<Component>(addUi); } else { ClickListener l = new ClickListener() { private static final long serialVersionUID = 1362078893385574138L; @Override public void buttonClick(ClickEvent event) { } }; buttonProperty = Components.buttonProperty("", l); } item.addItemProperty("download", buttonProperty); return item; }
From source file:uk.co.intec.keyDatesApp.pages.HomeView.java
License:Apache License
/** * Loads the main content for the page. Only called on first entry to the * page, because calling method sets <i>isLoaded</i> to true after * successfully completing.//from ww w .j a v a 2 s . com */ public void loadContent() { if ("Anonymous".equals(GenericDatabaseUtils.getUserName())) { final Label warning = new Label(); warning.setStyleName(ValoTheme.LABEL_H2); warning.setStyleName(ValoTheme.LABEL_FAILURE); warning.setValue("Anonymous access is not allowed on this application!"); addComponent(warning); } else { if (GenericDatabaseUtils.doesDbExist()) { final Label intro = new Label(); intro.setStyleName(ValoTheme.LABEL_H2); intro.setValue("Welcome to Key Dates OSGi Application"); addComponent(intro); } else { final Label warning = new Label(); warning.setStyleName(ValoTheme.LABEL_H2); warning.setStyleName(ValoTheme.LABEL_FAILURE); warning.setContentMode(ContentMode.HTML); warning.setValue( "We cannot open the data database. Most likely reasons are:<ul><li>You don't have access to the database, in which case you should contact IT.</li>" + "<li>The Key Dates database has not been set up at the filepath " + AppUtils.getDataDbFilepath() + ". Create the data database at that location or amend the 'dataDbFilePath' context parameter in WebContent > WEB-INF > web.xml of the application and issue 'restart task http' to the Domino server</li></ul>"); addComponent(warning); } } }
From source file:uk.co.intec.keyDatesApp.pages.MainView.java
License:Apache License
/** * Removes any existing row data loaded to the page and loads * ViewEntryWrappers passed to this method. If no entries were passed to the * method, the message "No entries found matching criteria" is displayed. * Otherwise writes the entries to the page, grouped under the date each Key * Date is for./*from w w w .j a v a 2s . c o m*/ * * @param data * Map of data where key is a java.sql.Date (so does not include * a time element) and value is the wrapped ViewEntries for that * date. */ public void loadRowData(final Map<Object, List<ViewEntryWrapper>> data) { body.removeAllComponents(); if (null == data || data.isEmpty()) { final Label msg = new Label("No entries found matching criteria"); msg.setStyleName(ValoTheme.LABEL_FAILURE); body.addComponent(msg); } else { for (final Object key : data.keySet()) { if (key instanceof java.sql.Date) { // It will be! // Add the header final VerticalLayout catContainer = new VerticalLayout(); catContainer.addStyleName(ValoTheme.MENU_TITLE); catContainer.addStyleName("category-header"); final Label category = new Label(); final java.sql.Date sqlDate = (java.sql.Date) key; category.setValue(DATE_ONLY.format(sqlDate)); catContainer.addComponent(category); body.addComponent(catContainer); // Load the entries for (final ViewEntryWrapper veWrapped : data.get(key)) { final VerticalLayout entryRow = new VerticalLayout(); final KeyDateEntryWrapper entry = (KeyDateEntryWrapper) veWrapped; final StringBuilder suffixTitle = new StringBuilder(""); if (getViewWrapper().getViewName().equals(KeyDateViewWrapper.ViewType.BY_DATE)) { if (StringUtils.isNotEmpty(entry.getCustomer())) { suffixTitle.append(" (" + entry.getCustomer()); if (StringUtils.isNotEmpty(entry.getContact())) { suffixTitle.append(" - " + entry.getContact()); } suffixTitle.append(")"); } } else { if (StringUtils.isNotEmpty(entry.getContact())) { suffixTitle.append(" - " + entry.getContact()); } } final Button title = new Button(entry.getTitle() + suffixTitle.toString()); title.addStyleName(ValoTheme.BUTTON_LINK); // Add click event title.addClickListener(new DocLinkListener(KeyDateView.VIEW_NAME, entry.getNoteId())); entryRow.addComponent(title); // Add summary, if appropriate if (StringUtils.isNotEmpty(entry.getDescription())) { final Label summary = new Label(entry.getDescription()); summary.setContentMode(ContentMode.HTML); summary.addStyleName(ValoTheme.LABEL_SMALL); summary.addStyleName("view-desc"); entryRow.addComponent(summary); } body.addComponent(entryRow); } } } } }