List of usage examples for com.vaadin.ui Link Link
public Link(String caption, Resource resource)
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreement.java
License:Open Source License
public RegistrationPageAgreement(Button.ClickListener listener) { super(listener); super.initGui(); setTitleString(getTitle()); //"User Agreement 1"); contentVLayout.setSpacing(true);/*from www .j a v a2 s . com*/ Label lab = new HtmlLabel(getLabelText()); //"First, please confirm your willingness to meet game requirements. I also confirm that I am at least 18 years of age."); lab.addStyleName(topLabelStyle); contentVLayout.addComponent(lab); HorizontalLayout hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); String readUrl = getReadUrlTL(); if (readUrl != null) { Link readLink = new Link("Read", new ExternalResource(getReadUrlTL())); //REGISTRATIONCONSENTURL)); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); hlayout.setComponentAlignment(readLink, Alignment.MIDDLE_LEFT); } lab = new HtmlLabel(getReadLabel()); //"<i>Consent to Participate in Anonymous Survey</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); hlayout.setComponentAlignment(lab, Alignment.TOP_LEFT); contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("98%"); //"100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); // Mmowgli2UI.getGlobals().mediaLocator().decorateDialogRejectButton(rejectButt); rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); //Mmowgli2UI.getGlobals().mediaLocator().decorateDialogAcceptAndContinueButton(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreementCombo.java
License:Open Source License
public RegistrationPageAgreementCombo(Button.ClickListener listener) { super(listener); super.initGui(); setTitleString("User Agreement"); contentVLayout.setSpacing(true);// ww w . j a v a 2 s .c om Label lab = new Label("I confirm my willingness to meet game requirements:"); lab.addStyleName(topLabelStyle); contentVLayout.addComponent(lab); // First contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space contentVLayout.addComponent(lab = new HtmlLabel( "First, I confirm that I am at least 18 years of age, I have been informed of risks<br/>and benefits, and I consent to participate.")); lab.addStyleName(labelStyle); HorizontalLayout hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); // First read hlayout.addComponent(lab = new HtmlLabel(" ")); lab.setHeight("10px"); GameLinks gl = GameLinks.getTL(); Link readLink = new Link("Read", new ExternalResource(gl.getInformedConsentLink())); //REGISTRATIONCONSENTURL)); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); lab = new HtmlLabel("<i>Informed Consent to Participate in Research</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); // Second contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space lab = new HtmlLabel( "Second, I understand that <b style='color:red;'>no classified or sensitive information can be<br/>posted</b> to the game since participation is open. Violation of this policy may<br/>lead to serious consequences."); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); // Second read hlayout.addComponent(lab = new HtmlLabel(" ")); readLink = new Link("Read", new ExternalResource(gl.getUserAgreementLink())); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); lab = new HtmlLabel("<i>Department of Defense Social Media User Agreement</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); // Third contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space lab = new HtmlLabel( "Third, the official language of the MMOWGLI game is English. Other languages<br/>are not supported in order to ensure that player postings are appropriate."); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); //new way rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); // new way continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
@Override public void initGui() { setWidth("988px"); // same width as included panel setHeight(BIGGESTWINDOW_HEIGHT_S); // try to handle making the popup miss the video Instrumentation.addInstrumentation(this); Game game = Game.getTL();/* w w w.jav a2s . c o m*/ MovePhase phase = game.getCurrentMove().getCurrentMovePhase(); HorizontalLayout outerLayout = new HorizontalLayout(); outerLayout.setSpacing(true); addComponent(outerLayout); outerLayout.setWidth("988px"); setExpandRatio(outerLayout, 1); Label spacer; outerLayout.addComponent(baseVLayout = new VerticalLayout()); baseVLayout.setWidth("988px"); outerLayout.setComponentAlignment(baseVLayout, Alignment.TOP_CENTER); baseVLayout.setSpacing(true); // This is just to give us a hidden widget to update to keep push channel alive through Akamai outerLayout.addComponent(pushPingLab = new HtmlLabel("")); pushPingLab.setWidth("5px"); String headingStr = phase.getOrientationCallToActionText(); String summaryStr = phase.getOrientationHeadline(); String textStr = phase.getOrientationSummary(); Media vid = phase.getOrientationVideo(); vidPan = new VideoWithRightTextPanel(vid, headingStr, summaryStr, textStr, null); vidPan.setLargeText(true); baseVLayout.addComponent(vidPan); vidPan.initGui(); HorizontalLayout bottomHLayout = new HorizontalLayout(); bottomHLayout.addComponent(spacer = new Label()); // special spacer bottomHLayout.setExpandRatio(spacer, 1.0f); Label[] spacers = new Label[5]; Label lab; int numButts = 0; // Email signup button //----------------------- if (phase.isSignupButtonShow()) { VerticalLayout signupVL = new VerticalLayout(); signupVL.setHeight("50px"); signupVL.setMargin(false); if (mockupOnly) signupVL.addComponent(signupButt = new NativeButton(null)); // no handler else signupVL.addComponent(signupButt = new NativeButton(null, this)); signupButt.addStyleName("signupbutton"); signupButt.setEnabled(phase.isSignupButtonEnabled()); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(signupButt, phase.getSignupButtonIcon()); signupVL.setComponentAlignment(signupButt, Alignment.MIDDLE_CENTER); signupVL.addComponent(lab = new Label()); lab.setHeight("1px"); signupVL.setExpandRatio(lab, 1.0f); signupVL.addComponent(lab = new HtmlLabel(phase.getSignupButtonSubText())); lab.addStyleName("m-text-align-center"); signupButt.setDescription(phase.getSignupButtonToolTip()); lab.setDescription(phase.getSignupButtonToolTip()); lab.setEnabled(phase.isSignupButtonEnabled()); signupVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); bottomHLayout.addComponent(signupVL); numButts++; } // New player reg button //---------------------- if (phase.isNewButtonShow()) { if (numButts > 0) bottomHLayout.addComponent(spacers[numButts] = new Label()); VerticalLayout newButtVL = new VerticalLayout(); newButtVL.setHeight("50px"); newButtVL.setMargin(false); if (mockupOnly) newButtVL.addComponent(imNewButt = new NativeButton(null)); // no handler else newButtVL.addComponent(imNewButt = new NativeButton(null, this)); imNewButt.setEnabled(phase.isNewButtonEnabled()); imNewButt.addStyleName("newuserbutton"); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imNewButt, phase.getNewButtonIcon()); newButtVL.setComponentAlignment(imNewButt, Alignment.MIDDLE_CENTER); newButtVL.addComponent(lab = new Label()); lab.setHeight("1px"); newButtVL.setExpandRatio(lab, 1.0f); /* boolean gameRO = game.isReadonly(); boolean gameClamped = game.isRegisteredLogonsOnly(); imNewButt.setEnabled(!gameRO & !gameClamped); // Label lab; if (gameRO) { newButtVL.addComponent(lab = new Label("No new player accounts, for now")); // "Player registration is currently closed")); // //"Sorry, no more new players")); String s; lab.setDescription(s = "New player accounts will open when game play starts"); imNewButt.setDescription(s); } else if (gameClamped) newButtVL.addComponent(lab = new Label("The game is full, please retry later")); // "Sorry, no more new players")); else newButtVL.addComponent(lab = new Label("You can get started in 2 minutes...")); */ newButtVL.addComponent(lab = new HtmlLabel(phase.getNewButtonSubText())); newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); lab.addStyleName("m-text-align-center"); lab.setEnabled(phase.isNewButtonEnabled()); imNewButt.setDescription(phase.getNewButtonToolTip()); lab.setDescription(phase.getNewButtonToolTip()); newButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); bottomHLayout.addComponent(newButtVL); numButts++; } // Existing player button //----------------------- if (phase.isLoginButtonShow()) { if (numButts > 0) bottomHLayout.addComponent(spacers[numButts] = new Label()); VerticalLayout rightButtVL = new VerticalLayout(); rightButtVL.setHeight("50px"); rightButtVL.setMargin(false); if (mockupOnly) rightButtVL.addComponent(imRegisteredButt = new NativeButton(null)); // no handler else rightButtVL.addComponent(imRegisteredButt = new NativeButton(null, this)); imRegisteredButt.addStyleName("loginbutton"); imRegisteredButt.setEnabled(phase.isLoginButtonEnabled()); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(imRegisteredButt, phase.getLoginButtonIcon()); rightButtVL.setComponentAlignment(imRegisteredButt, Alignment.MIDDLE_CENTER); rightButtVL.addComponent(lab = new Label()); lab.setHeight("1px"); rightButtVL.setExpandRatio(lab, 1.0f); rightButtVL.addComponent(lab = new HtmlLabel(phase.getLoginButtonSubText())); lab.addStyleName("m-text-align-center"); lab.setEnabled(phase.isLoginButtonEnabled()); rightButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); imRegisteredButt.setDescription(phase.getLoginButtonToolTip()); lab.setDescription(phase.getLoginButtonToolTip()); bottomHLayout.addComponent(rightButtVL); numButts++; checkQuickCACLoginTL(); } // Guest signup button //----------------------- if (phase.isGuestButtonShow()) { if (numButts > 0) bottomHLayout.addComponent(spacers[numButts] = new Label()); VerticalLayout guestButtVL = new VerticalLayout(); guestButtVL.setHeight("50px"); guestButtVL.setMargin(false); if (mockupOnly) guestButtVL.addComponent(guestButt = new NativeButton(null)); else guestButtVL.addComponent(guestButt = new NativeButton(null, this)); guestButt.addStyleName("guestbutton"); guestButt.setEnabled(phase.isGuestButtonEnabled()); Mmowgli2UI.getGlobals().mediaLocator().decorateImageButton(guestButt, phase.getGuestButtonIcon()); guestButtVL.setComponentAlignment(guestButt, Alignment.MIDDLE_CENTER); guestButtVL.addComponent(lab = new Label()); lab.setHeight("1px"); guestButtVL.setExpandRatio(lab, 1.0f); guestButtVL.addComponent(lab = new HtmlLabel(phase.getGuestButtonSubText())); lab.addStyleName("m-text-align-center"); guestButtVL.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); guestButt.setDescription(phase.getGuestButtonToolTip()); lab.setDescription(phase.getGuestButtonToolTip()); lab.setEnabled(phase.isGuestButtonEnabled()); bottomHLayout.addComponent(guestButtVL); numButts++; } for (int i = 0; i < numButts; i++) if (spacers[i] != null) spacers[i].setWidth(BUTTON_SPACING[numButts]); bottomHLayout.addComponent(spacer = new Label()); // special spacer bottomHLayout.setExpandRatio(spacer, 1.0f); baseVLayout.addComponent(bottomHLayout); baseVLayout.setComponentAlignment(bottomHLayout, Alignment.TOP_CENTER); lab = new HtmlLabel( "<center>Each MMOWGLI game is independent.<br> You need a new account for every game. </center>"); lab.setSizeUndefined(); lab.addStyleName("m-margintop-20"); lab.addStyleName("m-greyborder"); lab.addStyleName("m-background-white"); lab.addStyleName("m-opacity-75"); baseVLayout.addComponent(lab); baseVLayout.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); String troubleUrl = GameLinks.getTL().getTroubleLink(); Link lnk = new Link("Trouble signing in?", new ExternalResource(troubleUrl)); baseVLayout.addComponent(lnk); lnk.setTargetName(PORTALTARGETWINDOWNAME); lnk.setTargetBorder(BorderStyle.DEFAULT); lnk.addStyleName("m-margin-top-20"); baseVLayout.setComponentAlignment(lnk, Alignment.MIDDLE_CENTER); //checkUserLimits(); done from app entry point }
From source file:eu.lod2.AuthoringTab.java
License:Apache License
public AuthoringTab(LOD2DemoState st) { // The internal state and state = st;//from www . ja v a 2s. com VerticalLayout authoringTab = new VerticalLayout(); // Activate a graph in Virtuoso be editable in OntoWiki. // Remark: the accessrightsnull in Virtuoso have be set correct [check this] Form activateform = new Form(); activateform.setDebugId(this.getClass().getSimpleName() + "_activateform"); activateform.setCaption("Activate graph in OntoWiki"); // the localhost ip-address activategraph = new TextField("graphname:", state.getCurrentGraph()); activategraph.setColumns(50); activateform.getLayout().addComponent(activategraph); Button activateButton = new Button("Activate graph", new ClickListener() { public void buttonClick(ClickEvent event) { activateGraph(event); } }); activateButton.setDebugId(this.getClass().getSimpleName() + "_activateButton"); activateButton.setDescription("Activate the graph in Virtuoso to become editable in OntoWiki."); activateform.getFooter().addComponent(activateButton); authoringTab.addComponent(activateform); // add a form widget to edit with OntoWiki (or other editor) a specific resource Form t2f = new Form(); t2f.setCaption("Edit resource content"); TextField resToEdit = new TextField("Resource:"); resToEdit.setDebugId(this.getClass().getSimpleName() + "_resToEdit"); resToEdit.setImmediate(false); resToEdit.addListener(this); resToEdit.setColumns(50); t2f.getLayout().addComponent(resToEdit); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); ontowikil = new Link("Edit with Ontowiki", new ExternalResource(state.getHostName() + "/ontowiki/view/?r=&m=http://mytest.com")); ontowikil.setTargetName("_blank"); ontowikil.setTargetBorder(Link.TARGET_BORDER_NONE); ThemeResource ontoWikiIconl = new ThemeResource("app_images/OntoWiki.logo.png"); ontowikil.setIcon(ontoWikiIconl); ontowikil.setEnabled(false); t2f.getFooter().addComponent(ontowikil); t2ffooterlayout.setComponentAlignment(ontowikil, Alignment.TOP_RIGHT); authoringTab.addComponent(t2f); final Panel panel = new Panel("LOD2 components interfaces"); VerticalLayout panelContent = new VerticalLayout(); Link l = new Link("Ontowiki", new ExternalResource(state.getHostName() + "/ontowiki/view/?r=&m=http://mytest.com")); l.setTargetName("_blank"); l.setTargetBorder(Link.TARGET_BORDER_NONE); ThemeResource ontoWikiIcon = new ThemeResource("app_images/OntoWiki.logo.png"); l.setIcon(ontoWikiIcon); panelContent.addComponent(l); panel.setContent(panelContent); authoringTab.addComponent(panel); // The composition root MUST be set setCompositionRoot(authoringTab); }
From source file:eu.lod2.DebCKAN.java
License:Apache License
public DebCKAN(LOD2DemoState st) { // The internal state state = st;/*w w w .j a v a 2s.c o m*/ VerticalLayout panel = new VerticalLayout(); Label intro = new Label(introduction, Label.CONTENT_XHTML); panel.addComponent(intro); for (int i = 0; i < packages.length; i++) { Link l = new Link(packages[i], new ExternalResource("apt:" + packages[i])); panel.addComponent(l); } ; // The composition root MUST be set setCompositionRoot(panel); }
From source file:eu.lod2.EnrichmentTab.java
License:Apache License
public EnrichmentTab(LOD2DemoState st) { // The internal state and state = st;/*from www . ja v a 2 s . c o m*/ 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.Limes.java
License:Apache License
public Limes(LOD2DemoState st) { // The internal state and state = st;// ww w. ja v a2s. c om VerticalLayout colanutspatiallayout = new VerticalLayout(); initColanut = new LOD2DemoInitApp(st, "http://localhost/colanut"); // Configuration form start // Set all properties at once for the moment. Form t2f = new Form(); t2f.setDebugId(this.getClass().getSimpleName() + "_t2f"); t2f.setCaption("Configuration"); sourceGraph = new ExportSelector3(state, false, "Select graph with Source Limes data:"); sourceGraph.setDebugId(this.getClass().getSimpleName() + "_sourceGraph"); sourceGraph.graphSelector.setDebugId(this.getClass().getSimpleName() + "_graphSelector" + "_sourceGraph"); t2f.getLayout().addComponent(sourceGraph); targetGraph = new ExportSelector3(state, false, "Select graph with Target Limes data:"); targetGraph.setDebugId(this.getClass().getSimpleName() + "_targetGraph"); targetGraph.graphSelector.setDebugId(this.getClass().getSimpleName() + "_graphSelector" + "_targetGraph"); t2f.getLayout().addComponent(targetGraph); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); Button commitButton = new Button("Set configuration", new ClickListener() { public void buttonClick(ClickEvent event) { storeConfiguration(event); } }); commitButton.setDebugId(this.getClass().getSimpleName() + "_commitButton"); commitButton.setDescription("Commit the new configuration settings."); t2f.getFooter().addComponent(commitButton); colanutspatiallayout.addComponent(t2f); try { URL url = new URL(initColanut.service + "?se=" + URLEncoder.encode("http://localhost:8890/sparql", "UTF-8") + "&te=" + URLEncoder.encode("http://localhost:8890/sparql", "UTF-8") + "&sgp=source&tgp=target"); colanutLink = new Link("Open ColaNut - the web interface for Limes", new ExternalResource(url)); colanutLink.setTargetName("second"); colanutLink.setTargetHeight(500); colanutLink.setTargetWidth(1000); colanutLink.setTargetBorder(Link.TARGET_BORDER_DEFAULT); colanutLink.setVisible(false); colanutspatiallayout.addComponent(colanutLink); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } ; // Configuration form end /* do not use it as the visualisation is not so nice colanutbrowser = new Embedded(); try { URL url = new URL(state.getHostName() + "/colanut?se="+ URLEncoder.encode("http://localhost:8890/sparql", "UTF-8") + "&te=" + URLEncoder.encode("http://localhost:8890/sparql", "UTF-8") + "&sgp=source&tgp=target"); colanutbrowser = new Embedded("", new ExternalResource(url)); colanutbrowser.setType(Embedded.TYPE_BROWSER); colanutspatiallayout.addComponent(colanutbrowser); colanutbrowser.setHeight(1000, Sizeable.UNITS_PIXELS); colanutbrowser.setWidth(1000, Sizeable.UNITS_PIXELS); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); }; */ // The composition root MUST be set setCompositionRoot(colanutspatiallayout); }
From source file:eu.lod2.OnlineToolsTab.java
License:Apache License
public OnlineToolsTab(String g, LOD2DemoState st) { // The internal state and state = st;// www. j av a 2 s .com 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;/* ww w . j av a2s.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: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);/* w w w .jav a 2s .c om*/ 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); }