List of usage examples for com.vaadin.ui Panel setContent
@Override public void setContent(Component content)
From source file:eu.lod2.EnrichmentTab.java
License:Apache License
public EnrichmentTab(LOD2DemoState st) { // The internal state and state = st;/*from w w w . j a va 2s . c om*/ VerticalLayout enrichmentTab = new VerticalLayout(); final Panel panel = new Panel("LOD2 components interfaces"); VerticalLayout panelContent = new VerticalLayout(); Link l1 = new Link("SILK", new ExternalResource(state.getHostName() + "/silk")); l1.setTargetName("_blank"); l1.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l1); Link l = new Link("ORE", new ExternalResource("http://web.ore-tool.net")); l.setTargetName("_blank"); l.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l); panel.setContent(panelContent); enrichmentTab.addComponent(panel); // The composition root MUST be set setCompositionRoot(enrichmentTab); }
From source file:eu.lod2.OnlineToolsTab.java
License:Apache License
public OnlineToolsTab(String g, LOD2DemoState st) { // The internal state and state = st;//ww w. jav a2 s .c om storeInGraph = g; //************************************************************************ // OnlineToolsTab VerticalLayout onlineToolsTab = new VerticalLayout(); TextField sid = new TextField("search sameAs id's for:"); sid.setDebugId(this.getClass().getSimpleName() + "_sid"); final Label sidenc = new Label(""); // configure & add to layout sid.setImmediate(true); sid.setColumns(30); sid.addListener(new TextChangeListener() { public void textChange(TextChangeEvent event) { sameasid = event.getText(); } }); Button sidbutton = new Button("convert", new ClickListener() { public void buttonClick(ClickEvent event) { try { URI encoded = new URI(sameasid); sidenc.setValue("http://sameAs.org/rdf?uri=" + encoded.toASCIIString()); } catch (Exception e) { e.printStackTrace(); } ; try { // java.net.URL sameAsData = new java.net.URL("http://sameAs.org/rdf?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FGermany"); URI sidencoded = new URI(sameasid); java.net.URL sameAsData = new java.net.URL( "http://sameAs.org/rdf?uri=" + sidencoded.toASCIIString()); String baseURI = "http://sameAs.org#"; RepositoryConnection con = state.getRdfStore().getConnection(); Resource contextURI = con.getValueFactory().createURI(storeInGraph); Resource[] contexts = new Resource[] { contextURI }; con.add(sameAsData, baseURI, RDFFormat.RDFXML, contexts); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (RDFParseException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } ; }; }); onlineToolsTab.addComponent(sid); onlineToolsTab.addComponent(sidenc); onlineToolsTab.addComponent(sidbutton); /* Sigma EE is temporarily deprecated try { URL url2 = new URL(state.getHostName() + "/lod2.sigma.html"); Embedded browser2 = new Embedded("", new ExternalResource(url2)); browser2.setType(Embedded.TYPE_BROWSER); browser2.setWidth("100%"); browser2.setHeight(500); onlineToolsTab.addComponent(browser2); } catch (MalformedURLException e) { e.printStackTrace(); }; */ /* The online resources link page */ final Panel panel = new Panel("LOD2 online components"); VerticalLayout panelContent = new VerticalLayout(); Link l = new Link("SameAs Inference", new ExternalResource("http://sameAs.org/")); l.setTargetName("_blank"); l.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l); Link l2 = new Link("Sig.ma", new ExternalResource("http://sig.ma/")); l2.setTargetName("_blank"); l2.setTargetBorder(Link.TARGET_BORDER_NONE); //panelContent.addComponent(l2); Link l3 = new Link("LOD cloud", new ExternalResource("http://lod.openlinksw.com/")); l3.setTargetName("_blank"); l3.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l3); panel.setContent(panelContent); onlineToolsTab.addComponent(panel); // The composition root MUST be set setCompositionRoot(onlineToolsTab); }
From source file:eu.lod2.QueryingTab.java
License:Apache License
public QueryingTab(LOD2DemoState st) { // The internal state and state = st;//from w ww . j a v a 2 s . c o m VerticalLayout queryingTab = new VerticalLayout(); Form t2f = new Form(); t2f.setDebugId(this.getClass().getSimpleName() + "_t2f"); t2f.setCaption("Information Source Querying"); graphname = new TextField("repository graph name:"); graphname.setDebugId(this.getClass().getSimpleName() + "_graphname"); /* if (state == null | state.getCurrentGraph() == null | state.getCurrentGraph().equals("")) { graphname.setValue(""); } else { graphname.setValue(state.getCurrentGraph()); }; */ // configure & add to layout graphname.setImmediate(true); graphname.addListener(this); graphname.setColumns(30); graphname.setRequired(true); graphname.setRequiredError("Name of the graph is missing. No query will be issued."); t2f.getLayout().addComponent(graphname); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); Button okbutton = new Button("List graph content", new ClickListener() { public void buttonClick(ClickEvent event) { extractionQuery(event); } }); okbutton.setDebugId(this.getClass().getSimpleName() + "_okbutton"); okbutton.setDescription( "View the result from the SPARQL query: 'select * from <graphname> where {?s ?p ?o.} LIMIT 100'"); // okbutton.addListener(this); // react to tclicks ExternalResource ontowikiquery = new ExternalResource( state.getHostName() + "/ontowiki/queries/editor/?query=&m=http://mytest.com"); ontowikiquerylink = new Link("Query via Ontowiki", ontowikiquery); ontowikiquerylink.setTargetName("_blank"); ontowikiquerylink.setTargetBorder(Link.TARGET_BORDER_NONE); ontowikiquerylink.setEnabled(false); ThemeResource ontoWikiIcon = new ThemeResource("app_images/OntoWiki.logo.png"); ontowikiquerylink.setIcon(ontoWikiIcon); t2f.getFooter().addComponent(okbutton); t2ffooterlayout.setComponentAlignment(okbutton, Alignment.TOP_RIGHT); t2f.getFooter().addComponent(ontowikiquerylink); t2ffooterlayout.setComponentAlignment(ontowikiquerylink, Alignment.TOP_RIGHT); queryingTab.addComponent(t2f); queryingTab.addComponent(sparqlResult); final Panel t2components = new Panel("LOD2 components interfaces"); VerticalLayout t2ComponentsContent = new VerticalLayout(); // dummy request ExternalResource ontowikiquery2 = new ExternalResource( state.getHostName() + "/ontowiki/queries/editor/?query=&m="); Link ontowikiquerylink2 = new Link("Ontowiki", ontowikiquery2); ontowikiquerylink2.setTargetName("_blank"); ontowikiquerylink2.setTargetBorder(Link.TARGET_BORDER_NONE); ThemeResource ontoWikiIcon2 = new ThemeResource("app_images/OntoWiki.logo.png"); ontowikiquerylink2.setIcon(ontoWikiIcon2); t2ComponentsContent.addComponent(ontowikiquerylink2); t2components.setContent(t2ComponentsContent); queryingTab.addComponent(t2components); // The composition root MUST be set setCompositionRoot(queryingTab); }
From source file:eu.maxschuster.vaadin.signaturefield.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle(pageTitle);/* w ww . j av a 2 s . co m*/ final VerticalLayout margin = new VerticalLayout(); setContent(margin); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setWidth("658px"); margin.addComponent(layout); margin.setComponentAlignment(layout, Alignment.TOP_CENTER); final Label header1 = new Label(pageTitle); header1.addStyleName("h1"); header1.setSizeUndefined(); layout.addComponent(header1); layout.setComponentAlignment(header1, Alignment.TOP_CENTER); final TabSheet tabSheet = new TabSheet(); tabSheet.setWidth("100%"); layout.addComponent(tabSheet); layout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER); final Panel signaturePanel = new Panel(); signaturePanel.addStyleName("signature-panel"); signaturePanel.setWidth("100%"); tabSheet.addTab(signaturePanel, "Demo"); final VerticalLayout signatureLayout = new VerticalLayout(); signatureLayout.setMargin(true); signatureLayout.setSpacing(true); signatureLayout.setSizeFull(); signaturePanel.setContent(signatureLayout); final SignatureField signatureField = new SignatureField(); signatureField.setWidth("100%"); signatureField.setHeight("318px"); signatureField.setPenColor(Color.ULTRAMARINE); signatureField.setBackgroundColor("white"); signatureField.setConverter(new StringToDataUrlConverter()); signatureField.setPropertyDataSource(dataUrlProperty); signatureField.setVelocityFilterWeight(0.7); signatureLayout.addComponent(signatureField); signatureLayout.setComponentAlignment(signatureField, Alignment.MIDDLE_CENTER); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); signatureLayout.addComponent(buttonLayout); final Button clearButton = new Button("Clear", new ClickListener() { @Override public void buttonClick(ClickEvent event) { signatureField.clear(); } }); buttonLayout.addComponent(clearButton); buttonLayout.setComponentAlignment(clearButton, Alignment.MIDDLE_LEFT); final Label message = new Label("Sign above"); message.setSizeUndefined(); buttonLayout.addComponent(message); buttonLayout.setComponentAlignment(message, Alignment.MIDDLE_CENTER); final ButtonLink saveButtonLink = new ButtonLink("Save", null); saveButtonLink.setTargetName("_blank"); buttonLayout.addComponent(saveButtonLink); buttonLayout.setComponentAlignment(saveButtonLink, Alignment.MIDDLE_RIGHT); final Panel optionsPanel = new Panel(); optionsPanel.setSizeFull(); tabSheet.addTab(optionsPanel, "Options"); final FormLayout optionsLayout = new FormLayout(); optionsLayout.setMargin(true); optionsLayout.setSpacing(true); optionsPanel.setContent(optionsLayout); final ComboBox mimeTypeComboBox = new ComboBox(null, mimeTypeContainer); optionsLayout.addComponent(mimeTypeComboBox); mimeTypeComboBox.setItemCaptionPropertyId("mimeType"); mimeTypeComboBox.setNullSelectionAllowed(false); mimeTypeComboBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { MimeType mimeType = (MimeType) event.getProperty().getValue(); signatureField.setMimeType(mimeType); } }); mimeTypeComboBox.setValue(MimeType.PNG); mimeTypeComboBox.setCaption("Result MIME-Type"); final CheckBox immediateCheckBox = new CheckBox("immediate", false); optionsLayout.addComponent(immediateCheckBox); immediateCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean immediate = (Boolean) event.getProperty().getValue(); signatureField.setImmediate(immediate); } }); final CheckBox readOnlyCheckBox = new CheckBox("readOnly", false); optionsLayout.addComponent(readOnlyCheckBox); readOnlyCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean readOnly = (Boolean) event.getProperty().getValue(); signatureField.setReadOnly(readOnly); mimeTypeComboBox.setReadOnly(readOnly); clearButton.setEnabled(!readOnly); } }); final CheckBox requiredCheckBox = new CheckBox("required (causes bug that clears field)", false); optionsLayout.addComponent(requiredCheckBox); requiredCheckBox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean required = (Boolean) event.getProperty().getValue(); signatureField.setRequired(required); } }); final CheckBox clearButtonEnabledButton = new CheckBox("clearButtonEnabled", false); optionsLayout.addComponent(clearButtonEnabledButton); clearButtonEnabledButton.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean clearButtonEnabled = (Boolean) event.getProperty().getValue(); signatureField.setClearButtonEnabled(clearButtonEnabled); } }); final Panel resultPanel = new Panel("Results:"); resultPanel.setWidth("100%"); layout.addComponent(resultPanel); final VerticalLayout resultLayout = new VerticalLayout(); resultLayout.setMargin(true); resultPanel.setContent(resultLayout); final Image stringPreviewImage = new Image("String preview image:"); stringPreviewImage.setWidth("500px"); resultLayout.addComponent(stringPreviewImage); final Image dataUrlPreviewImage = new Image("DataURL preview image:"); dataUrlPreviewImage.setWidth("500px"); resultLayout.addComponent(dataUrlPreviewImage); final TextArea textArea = new TextArea("DataURL:"); textArea.setWidth("100%"); textArea.setHeight("300px"); resultLayout.addComponent(textArea); final Label emptyLabel = new Label(); emptyLabel.setCaption("Is Empty:"); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); resultLayout.addComponent(emptyLabel); signatureField.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String signature = (String) event.getProperty().getValue(); stringPreviewImage.setSource(signature != null ? new ExternalResource(signature) : null); textArea.setValue(signature); emptyLabel.setValue(String.valueOf(signatureField.isEmpty())); } }); dataUrlProperty.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { try { final DataUrl signature = (DataUrl) event.getProperty().getValue(); dataUrlPreviewImage.setSource( signature != null ? new ExternalResource(serializer.serialize(signature)) : null); StreamResource streamResource = null; if (signature != null) { StreamSource streamSource = new StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(signature.getData()); } }; MimeType mimeType = MimeType.valueOfMimeType(signature.getMimeType()); String extension = null; switch (mimeType) { case JPEG: extension = "jpg"; break; case PNG: extension = "png"; break; } streamResource = new StreamResource(streamSource, "signature." + extension); streamResource.setMIMEType(signature.getMimeType()); streamResource.setCacheTime(0); } saveButtonLink.setResource(streamResource); } catch (MalformedURLException e) { logger.error(e.getMessage(), e); } } }); }
From source file:eu.unifiedviews.plugins.transformer.metadata.MetadataVaadinDialog.java
License:Creative Commons License
@Override protected void buildDialogLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(true);// w ww . j av a2 s. c om mainLayout.setWidth("100%"); mainLayout.setHeight(null); mainLayout.setMargin(false); //mainLayout.setSpacing(true); // top-level component properties setWidth("100%"); setHeight("100%"); txtOutSymbolicName = new TextField(); txtOutSymbolicName.setCaption("Output graph name:"); txtOutSymbolicName.setWidth("100%"); mainLayout.addComponent(txtOutSymbolicName); tfComsodeDatasetId = new TextField(); tfComsodeDatasetId.setCaption("COMSODE Dataset ID (will be used as part of the URI)"); tfComsodeDatasetId.setWidth("100%"); tfComsodeDatasetId.setInputPrompt("MICR_3"); mainLayout.addComponent(tfComsodeDatasetId); tfDatasetUri = new TextField(); tfDatasetUri.setCaption("Dataset URI:"); tfDatasetUri.setWidth("100%"); mainLayout.addComponent(tfDatasetUri); tfDistributionUri = new TextField(); tfDistributionUri.setCaption("Distribution URI:"); tfDistributionUri.setWidth("100%"); mainLayout.addComponent(tfDistributionUri); tfDataDumpUrl = new TextField(); tfDataDumpUrl.setCaption("Data dump URL:"); tfDataDumpUrl.setWidth("100%"); mainLayout.addComponent(tfDataDumpUrl); cbMime = new ComboBox(); cbMime.setCaption("Media Type:"); cbMime.setNewItemsAllowed(false); cbMime.setNullSelectionAllowed(false); cbMime.setWidth("100%"); for (String u : mimes) { cbMime.addItem(u); } mainLayout.addComponent(cbMime); tfSparqlEndpointUrl = new TextField(); tfSparqlEndpointUrl.setCaption("Sparql Endpoint URI:"); tfSparqlEndpointUrl.setWidth("100%"); tfSparqlEndpointUrl.setNullRepresentation(""); tfSparqlEndpointUrl.setNullSettingAllowed(true); mainLayout.addComponent(tfSparqlEndpointUrl); tfContactPoint = new TextField(); tfContactPoint.setCaption("Contact Point URL:"); tfContactPoint.setWidth("100%"); mainLayout.addComponent(tfContactPoint); tfLanguage = new TextField(); tfLanguage.setCaption("Original language - RDF language tag:"); tfLanguage.setInputPrompt("cs|sk|it"); tfLanguage.setWidth("100%"); mainLayout.addComponent(tfLanguage); tfTitle = new TextField(); tfTitle.setCaption("Title original language:"); tfTitle.setWidth("100%"); mainLayout.addComponent(tfTitle); tfTitleEn = new TextField(); tfTitleEn.setCaption("Title in English:"); tfTitleEn.setWidth("100%"); mainLayout.addComponent(tfTitleEn); tfDesc = new TextField(); tfDesc.setCaption("Description original language:"); tfDesc.setWidth("100%"); mainLayout.addComponent(tfDesc); tfDescEn = new TextField(); tfDescEn.setCaption("Description in English:"); tfDescEn.setWidth("100%"); mainLayout.addComponent(tfDescEn); chkQb = new CheckBox(); chkQb.setCaption("Dataset is RDF Data Cube"); chkQb.setWidth("100%"); mainLayout.addComponent(chkQb); dfModified = new DateField(); dfModified.setCaption("Modified:"); dfModified.setWidth("100%"); dfModified.setResolution(Resolution.DAY); mainLayout.addComponent(dfModified); chkNow = new CheckBox(); chkNow.setCaption("Always use current date instead"); chkNow.setWidth("100%"); mainLayout.addComponent(chkNow); cbPeriodicity = new ComboBox(); cbPeriodicity.setCaption("Periodicity:"); cbPeriodicity.setNewItemsAllowed(false); cbPeriodicity.setNullSelectionAllowed(false); cbPeriodicity.setItemCaptionMode(ItemCaptionMode.EXPLICIT); cbPeriodicity.setWidth("100%"); for (URLandCaption u : periodicities) { cbPeriodicity.addItem(u.url.toString()); cbPeriodicity.setItemCaption(u.url.toString(), u.caption); } mainLayout.addComponent(cbPeriodicity); tcsLicenses = new TwinColSelect(); tcsLicenses.setWidth("97%"); tcsLicenses.setNewItemsAllowed(true); tcsLicenses.setLeftColumnCaption("Available licenses"); tcsLicenses.setRightColumnCaption("Selected licenses"); mainLayout.addComponent(tcsLicenses); tcsExamples = new TwinColSelect(); tcsExamples.setWidth("97%"); tcsExamples.setNewItemsAllowed(true); tcsExamples.setLeftColumnCaption("Available example resources"); tcsExamples.setRightColumnCaption("Selected example resources"); mainLayout.addComponent(tcsExamples); tcsSources = new TwinColSelect(); tcsSources.setWidth("97%"); tcsSources.setNewItemsAllowed(true); tcsSources.setLeftColumnCaption("Available sources"); tcsSources.setRightColumnCaption("Selected sources"); mainLayout.addComponent(tcsSources); tcsKeywords = new TwinColSelect(); tcsKeywords.setWidth("97%"); tcsKeywords.setNewItemsAllowed(true); tcsKeywords.setLeftColumnCaption("Available keywords"); tcsKeywords.setRightColumnCaption("Selected keywords"); mainLayout.addComponent(tcsKeywords); tcsThemes = new TwinColSelect(); tcsThemes.setWidth("97%"); tcsThemes.setNewItemsAllowed(true); tcsThemes.setLeftColumnCaption("Available themes"); tcsThemes.setRightColumnCaption("Selected themes"); mainLayout.addComponent(tcsThemes); tcsLanguages = new TwinColSelect(); tcsLanguages.setWidth("97%"); tcsLanguages.setNewItemsAllowed(true); tcsLanguages.setLeftColumnCaption("Available languages"); tcsLanguages.setRightColumnCaption("Selected languages"); mainLayout.addComponent(tcsLanguages); tcsAuthors = new TwinColSelect(); tcsAuthors.setWidth("97%"); tcsAuthors.setNewItemsAllowed(true); tcsAuthors.setLeftColumnCaption("Available authors"); tcsAuthors.setRightColumnCaption("Selected authors"); mainLayout.addComponent(tcsAuthors); tcsPublishers = new TwinColSelect(); tcsPublishers.setWidth("97%"); tcsPublishers.setNewItemsAllowed(true); tcsPublishers.setLeftColumnCaption("Available publishers"); tcsPublishers.setRightColumnCaption("Selected publishers"); mainLayout.addComponent(tcsPublishers); Panel p = new Panel(); p.setSizeFull(); p.setContent(mainLayout); setCompositionRoot(p); }
From source file:facs.components.Booking.java
License:Open Source License
public Booking(final BookingModel bookingModel, Date referenceDate) { String[] sayHello = { "Kon'nichiwa", "Hello", "Halo", "Hiya", "Hej", "Hallo", "Hola", "Grezi", "Servus", "Merhaba", "Bonjour", "Ahoj", "Moi", "Ciao", "Buongiorno" }; this.bookingModel = bookingModel; this.referenceDate = referenceDate; Label infoLabel = new Label(); infoLabel.addStyleName("h4"); Label selectDeviceLabel = new Label(); selectDeviceLabel.addStyleName("h4"); selectDeviceLabel.setValue("Please Select a Device"); final Label versionLabel = new Label(); versionLabel.addStyleName("h4"); versionLabel.setValue("Version 0.1.160727"); // showSuccessfulNotification(sayHello[(int) (Math.random() * sayHello.length)] + ", " // + bookingModel.userName() + "!", ""); Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); System.out.println(ft.format(dNow) + " INFO Calendar initiated! - User: " + bookingModel.getLDAP() + " " + versionLabel);/* w ww . j a v a 2 s . c om*/ // only users who are allowed to book devices will be able to do so if (bookingModel.isNotAllowed()) { VerticalLayout errorLayout = new VerticalLayout(); infoLabel.setValue("ACCESS DENIED"); errorLayout.addComponent(infoLabel); showErrorNotification("Access Denied!", "Sorry, you're not allowed to see anything here, at least your username told us so. Do you need assistance? Please contact 'info@qbic.uni-tuebingen.de'."); setCompositionRoot(errorLayout); return; } Panel book = new Panel(); book.addStyleName(ValoTheme.PANEL_BORDERLESS); DBManager.getDatabaseInstance(); db = Database.Instance; db.userLogin(bookingModel.getLDAP()); selectedDevice = initCalendars(bookingModel.getDevicesNames()); selectedService = new NativeSelect("Please select a service:"); selectedService.setDescription("Please select the service you would like to receive!"); selectedKostenstelle = new NativeSelect("Please select konstenstelle:"); selectedKostenstelle.setDescription("Please select the Kostenstelle you would like to use!"); selectedDevice.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 8153818693511960689L; @Override public void valueChange(ValueChangeEvent event) { versionLabel.setValue(db.getUserRoleDescByLDAPId(bookingModel.getLDAP(), getCurrentDevice())); selectedKostenstelle.setVisible(true); if (bookMap.containsKey(getCurrentDevice())) { cal.removeAllComponents(); setCalendar(); if (selectedDevice.getValue().equals("Aria")) { selectedService.removeAllItems(); selectedService.addItems("Full Service", "Partial Service", "Self Service"); selectedService.setValue("Full Service"); selectedService.setVisible(true); } else if (selectedDevice.getValue().equals("Mac")) { selectedService.removeAllItems(); selectedService.addItems("Self", "Service"); selectedService.setValue("Service"); selectedService.setVisible(true); } else { selectedService.setValue(null); selectedService.setVisible(false); } } else { bookMap.put(getCurrentDevice(), initCal(bookingModel, getCurrentDevice())); cal.removeAllComponents(); setCalendar(); if (selectedDevice.getValue().equals("Aria")) { selectedService.removeAllItems(); selectedService.addItems("Full Service", "Partial Service", "Self Service"); selectedService.setValue("Full Service"); selectedService.setVisible(true); } else if (selectedDevice.getValue().equals("Mac")) { selectedService.removeAllItems(); selectedService.addItems("Self", "Service"); selectedService.setValue("Service"); selectedService.setVisible(true); } else { selectedService.setValue(null); selectedService.setVisible(false); } } } }); if (bookingModel.getProject().isEmpty()) { infoLabel.setValue(bookingModel.userName() + " Kostenstelle: " + bookingModel.getKostenstelle() + " Institute: " + bookingModel.getInstitute()); } else { infoLabel.setValue(bookingModel.userName() + " Kostenstelle: " + bookingModel.getKostenstelle() + " Project: " + bookingModel.getProject() + " Institute: " + bookingModel.getInstitute()); } // bookDeviceLayout.addComponent(infoLabel); cal.setLocale(Locale.getDefault()); cal.setImmediate(true); selectedService.setImmediate(true); cal.setSizeFull(); String submitTitle = "Book"; Button submit = new Button(submitTitle); submit.setIcon(FontAwesome.CALENDAR); submit.setDescription("Please select a device and a time frame at first then click 'BOOK'!"); submit.setSizeFull(); // submit.setVisible(false); submit.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { submit(bookingModel.getLDAP(), getCurrentDevice()); newEvents.clear(); refreshDataSources(); } }); String buttonTitle = "Refresh"; Button refresh = new Button(buttonTitle); refresh.setIcon(FontAwesome.REFRESH); refresh.setSizeFull(); refresh.setDescription("Click here to reload the data from the database!"); refresh.addStyleName(ValoTheme.BUTTON_FRIENDLY); refresh.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); gridLayout.setWidth("100%"); // add components to the grid layout gridLayout.addComponent(infoLabel, 0, 4, 3, 4); gridLayout.addComponent(versionLabel, 4, 4, 5, 4); // gridLayout.addComponent(selectDeviceLabel,0,1); gridLayout.addComponent(selectedDevice, 0, 0); gridLayout.addComponent(selectedService, 1, 0); gridLayout.addComponent(selectedKostenstelle, 2, 0); selectedService.setVisible(false); gridLayout.addComponent(cal, 0, 2, 5, 2); gridLayout.addComponent(refresh, 0, 3); gridLayout.addComponent(submit, 1, 3, 5, 3); // gridLayout.addComponent(myBookings(), 0, 5, 5, 5); gridLayout.setMargin(true); gridLayout.setSpacing(true); gridLayout.setSizeFull(); book.setContent(gridLayout); booking = new TabSheet(); booking.addStyleName(ValoTheme.TABSHEET_FRAMED); booking.addTab(book).setCaption("Calendar"); booking.addTab(myNext24HoursBookings()).setCaption("Next 24 Hours"); booking.addTab(myUpcomingBookings()).setCaption("Upcoming"); booking.addTab(myPastBookings()).setCaption("Past Bookings"); // booking.addTab(myUpcomingBookingsSQLContainer()).setCaption("Test"); setCompositionRoot(booking); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
private void createTab_Sites() { VerticalLayout tab_site = new VerticalLayout(); tab_site.setCaption("Sites"); tabsheet.addTab(tab_site);//from ww w . ja v a 2 s . c o m Panel p_project = new Panel("Create a sites"); p_project.setWidth("400"); HorizontalLayout hor_sites = new HorizontalLayout(); hor_sites.addComponent(sites_tree); final VerticalLayout project_browser4Sites = new VerticalLayout(); hor_sites.addComponent(project_browser4Sites); tab_site.addComponent(hor_sites); htmlView_Project(project_browser4Sites, "Structural"); sites_tree.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 7237016481874141615L; public void valueChange(ValueChangeEvent event) { if (!sites_tree.hasChildren(sites_tree.getValue())) { if (sites_tree.getValue() != null) htmlView_Project(project_browser4Sites, sites_tree.getValue().toString()); } } }); sites_tree.setImmediate(true); Button newRealEstate_button = new Button("Create", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String realEstate_name = site_textField.getValue(); if (realEstate_name != null && realEstate_name.length() > 0) { marmotta_sparql.create_RealEstate(realEstate_name); listSites(); } } }); HorizontalLayout newproject_layout = new HorizontalLayout(); newproject_layout.setSizeUndefined(); site_textField.setImmediate(true); newproject_layout.addComponent(site_textField); newproject_layout.addComponent(newRealEstate_button); newproject_layout.setSpacing(true); p_project.setContent(newproject_layout); tab_site.addComponent(p_project); Button removeRealEstate_button = new Button("Remove the selected site", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { TreeNode realEstate = (TreeNode) sites_tree.getValue(); if (realEstate != null) { //Only real estates Object parent = sites_tree.getParent(realEstate); if (parent == null) { marmotta_sparql.remove_RealEstate(realEstate.getInternal_name()); listSites(); } } } }); tab_site.addComponent(removeRealEstate_button); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
@SuppressWarnings("deprecation") private void createTab_Datasets() { VerticalLayout tab_datasets = new VerticalLayout(); tab_datasets.setCaption("Data sets"); tabsheet.addTab(tab_datasets);//from w w w . j a va 2 s . co m tab_datasets.addComponent(datasets_tree); Link void_link = new Link("Void description of the data sets", new ExternalResource("http://drumbeat.cs.hut.fi/void.ttl")); tab_datasets.addComponent(void_link); Panel p_model = new Panel("Upload and convert an IFC file"); p_model.setWidth("900"); tab_datasets.addComponent(p_model); HorizontalLayout hor1 = new HorizontalLayout(); hor1.setSizeFull(); // Use all available space hor1.setMargin(true); p_model.setContent(hor1); VerticalLayout upload_selections = new VerticalLayout(); hor1.addComponent(upload_selections); upload_selections.addComponent(sites_tree_4upload); VerticalLayout upload_panels = new VerticalLayout(); hor1.addComponent(upload_panels); Panel p_model_file = new Panel("Upload a file"); p_model_file.setWidth("400"); upload_panels.addComponent(p_model_file); Panel p_model_url = new Panel("Upload from a URL"); p_model_url.setWidth("400"); upload_panels.addComponent(p_model_url); // Create the upload with a caption and set receiver later Upload upload = new Upload("Select a file and press Upload", drumbeat_fileReceiver); upload.addSucceededListener(drumbeat_fileReceiver); upload.addFailedListener(drumbeat_fileReceiver); p_model_file.setContent(upload); url_textField.setImmediate(true); Button button = new Button("Upload from the URL", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { drumbeat_fileReceiver.receiveFileFromURL(url_textField.getValue()); } }); HorizontalLayout url_upload = new HorizontalLayout(); url_upload.setSizeUndefined(); url_upload.addComponent(url_textField); url_upload.addComponent(button); url_upload.setSpacing(true); p_model_url.setContent(url_upload); bim_projects_selection.setInvalidAllowed(false); bim_projects_selection.setNullSelectionAllowed(false); bim_projects_selection.setNewItemsAllowed(false); bim_projects_selection.setWidth("400"); final VerticalLayout project_browser = new VerticalLayout(); bim_projects_selection.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; public void valueChange(ValueChangeEvent event) { if (bim_projects_selection.getValue() != null) { htmlView_BIMProject(project_browser, bim_projects.get(bim_projects_selection.getValue())); } } }); tab_datasets.addComponent(bim_projects_selection); tab_datasets.addComponent(project_browser); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
@SuppressWarnings("deprecation") private void createTab_Queries() { VerticalLayout tab_queries = new VerticalLayout(); tab_queries.setCaption("Queries"); tabsheet.addTab(tab_queries);// w w w . j a v a 2s . c o m Panel p_sparql = new Panel("Sparql query"); p_sparql.setWidth("900"); VerticalLayout sparql_layout = new VerticalLayout(); final ComboBox queries = new ComboBox("Select a query"); queries.setInvalidAllowed(false); queries.setNullSelectionAllowed(false); queries.setNewItemsAllowed(false); queries.addItem("Sites"); queries.setValue("Sites"); queries.addItem("Structural model links"); queries.addItem("Project name"); queries.addItem("List implements links"); queries.setWidth("400"); queries.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; public void valueChange(ValueChangeEvent event) { if (queries.getValue() != null) { if (queries.getValue().equals("Sites")) sparql_query_area.setValue(DrumbeatConstants.query_sites); if (queries.getValue().equals("Structural model links")) sparql_query_area.setValue(DrumbeatConstants.query_structural_links); if (queries.getValue().equals("Project name")) sparql_query_area.setValue(DrumbeatConstants.query_structural_project); if (queries.getValue().equals("List implements links")) sparql_query_area.setValue(DrumbeatConstants.query_implemens); } } }); sparql_layout.addComponent(queries); sparql_layout.addComponent(sparql_query_area); sparql_query_area.setValue(DrumbeatConstants.query_sites); Button sparql_button = new Button("Query", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { sparql_result_rtarea.setValue(marmotta.httpGetQuery2html(sparql_query_area.getValue())); } }); Button sparql_button_json = new Button("Query and download JSON"); OnDemandFileDownloader jsonDownloader = new OnDemandFileDownloader(createOnDemandJSON_Resource(), "JSON", this); jsonDownloader.extend(sparql_button_json); Button sparql_button_xml = new Button("Query and download XML"); OnDemandFileDownloader xmlDownloader = new OnDemandFileDownloader(createOnDemandXMLResource(), "XML", this); xmlDownloader.extend(sparql_button_xml); HorizontalLayout hor_sparql_buttons = new HorizontalLayout(); hor_sparql_buttons.addComponent(sparql_button); hor_sparql_buttons.addComponent(sparql_button_json); hor_sparql_buttons.addComponent(sparql_button_xml); sparql_layout.addComponent(hor_sparql_buttons); sparql_layout.addComponent(sparql_result_rtarea); sparql_query_area.setWidth("800"); sparql_query_area.setHeight("400"); sparql_result_rtarea.setWidth("800"); p_sparql.setContent(sparql_layout); tab_queries.addComponent(p_sparql); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
private void createTab_Links() { VerticalLayout tab_links = new VerticalLayout(); tab_links.setCaption("Links"); tabsheet.addTab(tab_links);/* w ww. j av a2 s .c o m*/ Panel p_links = new Panel("Implements query"); p_links.setWidth("900"); VerticalLayout links_layout = new VerticalLayout(); contexts_selection.setInvalidAllowed(false); contexts_selection.setNullSelectionAllowed(false); contexts_selection.setNewItemsAllowed(false); contexts_selection.setWidth("800"); links_layout.addComponent(contexts_selection); Button links_button = new Button("List links", new Button.ClickListener() { @SuppressWarnings("unchecked") @Override public void buttonClick(Button.ClickEvent event) { if (contexts_selection.getValue() != null && contexts_selection.getValue().toString().length() > 0) { String query = ToolkitString.strReplaceLike(DrumbeatConstants.querytemplate_links, "<context>", "<" + contexts_selection.getValue() + ">"); List<Pair> links = marmotta.httpGetLinks(query); links_table.removeAllItems(); generated_links.clear(); for (Pair p : links) { Object newItemId = links_table.addItem(); Item row = links_table.getItem(newItemId); String short_from = ToolkitString.strReplaceLike(p.getS1(), DrumbeatConstants.resource_baseurl, "resourse:"); String short_to = ToolkitString.strReplaceLike(p.getS2(), DrumbeatConstants.resource_baseurl, "resourse:"); row.getItemProperty("From").setValue(short_from); row.getItemProperty("property").setValue("ifc:implements"); row.getItemProperty("To").setValue(short_to); generated_links.add(p); } } } }); links_layout.addComponent(links_button); links_table.addContainerProperty("From", String.class, null); links_table.addContainerProperty("property", String.class, null); links_table.addContainerProperty("To", String.class, null); links_table.setSelectable(false); links_layout.addComponent(links_table); links_table.setWidth("800"); Button insert_links_button = new Button("Insert links to the RDF Store", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { marmotta_sparql.add_linkset2Model(generated_links); } }); Button remove_links_button = new Button("Remove links from the RDF Store", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { marmotta_sparql.remove_linksetFromModel(generated_links); } }); HorizontalLayout hor_links_buttons = new HorizontalLayout(); hor_links_buttons.addComponent(insert_links_button); hor_links_buttons.addComponent(remove_links_button); links_layout.addComponent(hor_links_buttons); p_links.setContent(links_layout); tab_links.addComponent(p_links); }