Example usage for com.vaadin.ui Button setDescription

List of usage examples for com.vaadin.ui Button setDescription

Introduction

In this page you can find the example usage for com.vaadin.ui Button setDescription.

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabNeedAuthors.java

License:Open Source License

public void initGuiTL() {
    AbstractLayout leftLay = getLeftLayout();

    flowLay = new VerticalLayout();
    flowLay.setWidth("100%");
    flowLay.addStyleName("m-padding15");
    leftLay.addComponent(flowLay); //, "top:0px;left:0px");
    flowLay.setSpacing(true);//from  w w  w  . ja va  2 s .c o m

    Label titleLab = new Label("Action Plans needing Authors");
    flowLay.addComponent(titleLab);
    flowLay.setComponentAlignment(titleLab, Alignment.TOP_LEFT);
    titleLab.addStyleName("m-actionplan-mission-title-text");

    Label contentLab = new Label("You may sign up for authorship in any of these plans.");
    flowLay.addComponent(contentLab);
    flowLay.setComponentAlignment(contentLab, Alignment.TOP_LEFT);
    flowLay.addStyleName("m-actionplan-mission-content-text");

    Button requestActionPlanButt = new IDButton("Action Plan Request", ACTIONPLANREQUESTCLICK);
    requestActionPlanButt.setStyleName(BaseTheme.BUTTON_LINK);
    requestActionPlanButt
            .setDescription("Open a page where you can submit a request to be an action plan author");
    flowLay.addComponent(requestActionPlanButt);

    AbsoluteLayout rightLay = getRightLayout();

    flowLay = new VerticalLayout();
    rightLay.addComponent(flowLay, "top:0px;left:0px");
    flowLay.setSpacing(true);
    flowLay.setStyleName("m-actionplan-plan-rightside"); // set the style name so the css's below can use it (e.g.: .m-actionplan-plan-rightside
                                                         // .m-actionplan-plan-headling { blah:blah;} )

    loadTableTL();
}

From source file:eu.eco2clouds.portal.component.apwizard.SuggestionStep.java

License:Apache License

private void render() {

    this.removeAllComponents();

    if (this.mainLayout != null && this.mainLayout.getMenu() != null
            && this.mainLayout.getMenu().getResourcesStep() != null
            && this.mainLayout.getMenu().getResourcesStep().getNewResourceTable() != null
            && this.mainLayout.getMenu().getGeneralStep().getDuration() != null
            && this.mainLayout.getMenu().getGeneralStep().getDuration().getValue() != null
            && !this.mainLayout.getMenu().getGeneralStep().getDuration().getValue().equals("")) {

        VerticalLayout vlCpuLoad = new VerticalLayout();
        vlCpuLoad.setMargin(false);/*from w  ww.j ava 2 s. com*/
        vlCpuLoad.setSpacing(true);
        Label lblCpuLoad = new Label("Average Cpu Load");
        vlCpuLoad.addComponent(lblCpuLoad);

        this.sliderCpuLoad.addValueChangeListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                updateChart();
            }
        });

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(false);
        hl.setSpacing(true);
        hl.addComponent(new Label("min 0", ContentMode.HTML));
        hl.addComponent(sliderCpuLoad);
        hl.addComponent(new Label("100 max", ContentMode.HTML));

        vlCpuLoad.addComponent(hl);

        vlCpuLoad.setComponentAlignment(lblCpuLoad, Alignment.MIDDLE_LEFT);
        vlCpuLoad.setComponentAlignment(hl, Alignment.MIDDLE_LEFT);

        this.deploymentTable.setContainerDataSource(this.getCombination());
        this.deploymentTable.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(final Property.ValueChangeEvent event) {

                DeploymentTableBean item = (DeploymentTableBean) deploymentTable.getValue();
                System.out.println("item is " + item);
                int selected = item.getId() - 1;

                long duration = Long.parseLong(mainLayout.getMenu().getGeneralStep().getDuration().getValue());

                System.out.println("selected " + selected);
                System.out.println("power fr" + power_fr[selected]);
                System.out.println("power uk" + power_uk[selected]);
                System.out.println("power de" + power_de[selected]);

                TrendWindow trendWindow = new TrendWindow(power_fr[selected], power_uk[selected],
                        power_de[selected], duration);
                UI.getCurrent().addWindow(trendWindow);

            }
        });

        this.deploymentTable.addGeneratedColumn("GEC", new ColumnGenerator() {

            @Override
            public Object generateCell(final Table source, final Object itemId, Object columnId) {

                ArrayList<String> locations = new ArrayList<String>();
                String[] vms = ((DeploymentTableBean) itemId).getCombination().split(" ");
                for (int i = 0; i < vms.length; i++) {

                    String vmName = vms[i].split("@")[0];
                    String vmLocation = vms[i].split("@")[1];
                    if (!locations.contains(vmLocation)) {
                        locations.add(vmLocation);
                    }

                }

                SourcePercentage sp = SchedulerManagerFactory.getInstance().getGEC(locations);

                return new Label(Double.toString(sp.getGEC()));
            }
        });

        this.deploymentTable.addGeneratedColumn("", new ColumnGenerator() {

            @Override
            public Object generateCell(final Table source, final Object itemId, Object columnId) {

                Button button = new Button("");
                button.setStyleName(Reindeer.BUTTON_LINK);
                button.setIcon(new ThemeResource("img/pie.png"));
                button.setDescription("GEC");

                button.addClickListener(new Button.ClickListener() {

                    @Override
                    public void buttonClick(Button.ClickEvent event) {

                        ArrayList<String> locations = new ArrayList<String>();
                        String[] vms = ((DeploymentTableBean) itemId).getCombination().split(" ");
                        for (int i = 0; i < vms.length; i++) {

                            String vmName = vms[i].split("@")[0];
                            String vmLocation = vms[i].split("@")[1];
                            if (!locations.contains(vmLocation)) {
                                locations.add(vmLocation);
                            }

                        }

                        SourcePercentage sp = SchedulerManagerFactory.getInstance().getGEC(locations);
                        GECWindow gecWindow = new GECWindow(((DeploymentTableBean) itemId).getCombination(),
                                sp);
                        UI.getCurrent().addWindow(gecWindow);

                    }
                });

                return button;
            }
        });

        this.deploymentTable.addGeneratedColumn(" ", new ColumnGenerator() {

            @Override
            public Object generateCell(final Table source, final Object itemId, Object columnId) {

                Button button = new Button("");
                button.setStyleName(Reindeer.BUTTON_LINK);
                button.setIcon(new ThemeResource("img/trend.png"));
                button.setDescription("CO2 trend");
                button.addClickListener(new Button.ClickListener() {

                    @Override
                    public void buttonClick(Button.ClickEvent event) {

                        //DeploymentTableBean item = (DeploymentTableBean) deploymentTable.getValue();
                        System.out.println("item is " + itemId);
                        int selected = ((DeploymentTableBean) itemId).getId() - 1;

                        long duration = Long
                                .parseLong(mainLayout.getMenu().getGeneralStep().getDuration().getValue());

                        System.out.println("selected " + selected);
                        System.out.println("power fr" + power_fr[selected]);
                        System.out.println("power uk" + power_uk[selected]);
                        System.out.println("power de" + power_de[selected]);

                        TrendWindow trendWindow = new TrendWindow(power_fr[selected], power_uk[selected],
                                power_de[selected], duration);
                        UI.getCurrent().addWindow(trendWindow);

                    }
                });

                return button;
            }
        });

        vlCpuLoad.addComponent(deploymentTable);

        OptionGroup chartAspect = new OptionGroup("Chart aspect");
        chartAspect.addItem(1);
        chartAspect.setItemCaption(1, "NORMAL");
        chartAspect.addItem(2);
        chartAspect.setItemCaption(2, "PERCENTAGE");

        chartAspect.select(1);
        chartAspect.setNullSelectionAllowed(false);
        chartAspect.setImmediate(true);

        chartAspect.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(final ValueChangeEvent event) {
                //final String valueString = String.valueOf(event.getProperty()
                //        .getValue());

                if (co2CountryChart != null) {
                    co2CountryChart.toggleAspect();
                }
            }
        });

        vlCpuLoad.addComponent(chartAspect);

        chartHl.addComponent(vlCpuLoad);

        this.compute();

        this.co2CountryChart = new CO2CountryChart(sdf.format(new Date()),
                this.deploymentTable.getItemIds().size(), co2_fr, co2_uk, co2_de,
                this.sliderCpuLoad.getValue());

        chartHl.addComponent(this.co2CountryChart);

        chartHl.setComponentAlignment(vlCpuLoad, Alignment.TOP_LEFT);
        chartHl.setComponentAlignment(this.co2CountryChart, Alignment.TOP_RIGHT);

        this.addComponent(chartHl);

    } else {
        Label lblEmpty = new Label("No resources defined.");
        this.addComponent(lblEmpty);
    }

}

From source file:eu.eco2clouds.portal.component.MainMenu.java

License:Apache License

public MainMenu() {

    this.setHeight("50px");
    this.setSpacing(true);
    this.setMargin(true);
    this.setWidth("100%");

    Label spaceLabel = new Label("  ");
    this.addComponent(spaceLabel);

    Button homePageBtn = new Button("");
    homePageBtn.setIcon(new ThemeResource("img/homepage.png"));
    homePageBtn.setDescription("Home page");

    homePageBtn.setStyleName(Reindeer.BUTTON_LINK);
    homePageBtn.addClickListener(new Button.ClickListener() {

        @Override/*  w ww .jav a  2s.c o m*/
        public void buttonClick(ClickEvent event) {

            int status = ((E2CPortal) UI.getCurrent()).getSessionStatus().getStatus();
            if (status != SessionStatus.HOME) {
                ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.HOME);
                ((E2CPortal) UI.getCurrent()).render();

            }

        }
    });

    this.addComponent(homePageBtn);

    Button addExperimentBtn = new Button("");
    addExperimentBtn.setIcon(new ThemeResource("img/add.png"));
    addExperimentBtn.setDescription("Add new experiment");

    addExperimentBtn.setStyleName(Reindeer.BUTTON_LINK);
    addExperimentBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            int status = ((E2CPortal) UI.getCurrent()).getSessionStatus().getStatus();
            if (status != SessionStatus.SUBMITAP) {
                ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.SUBMITAP);
                ((E2CPortal) UI.getCurrent()).render();

            }

        }
    });

    this.addComponent(addExperimentBtn);

    Button notificationBtn = new Button("Notifications");
    notificationBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            int status = ((E2CPortal) UI.getCurrent()).getSessionStatus().getStatus();
            if (status != SessionStatus.NOTIFICATIONS) {
                ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.NOTIFICATIONS);
                ((E2CPortal) UI.getCurrent()).render();

            }

        }
    });

    //this.addComponent(notificationBtn);

    Button logoutBtn = new Button("");
    logoutBtn.setIcon(new ThemeResource("img/logout.png"));
    logoutBtn.setDescription("Logout");
    logoutBtn.setStyleName(Reindeer.BUTTON_LINK);
    logoutBtn.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            ((E2CPortal) UI.getCurrent()).getSessionStatus().setStatus(SessionStatus.UNLOGGED);
            ((E2CPortal) UI.getCurrent()).render();

        }
    });

    this.addComponent(logoutBtn);

    /*Button refreshBtn = new Button(" ");
     if (Configuration.refreshUIActive) {
     refreshBtn.setCaption("Disable autorefresh");
     } else {
     refreshBtn.setCaption("Enable autorefresh");
     }
     refreshBtn.addClickListener(new Button.ClickListener() {
            
     @Override
     public void buttonClick(ClickEvent event) {
            
     ((E2CPortal) UI.getCurrent()).toggleRefresh();
     Configuration.refreshUIActive = !Configuration.refreshUIActive;
     if (Configuration.refreshUIActive) {
     event.getButton().setCaption("Disable autorefresh");
     } else {
     event.getButton().setCaption("Enable autorefresh");
     }
            
     }
     });
            
     this.addComponent(refreshBtn);*/
    this.setExpandRatio(spaceLabel, 20.0f);

    this.setComponentAlignment(homePageBtn, Alignment.MIDDLE_RIGHT);
    this.setComponentAlignment(addExperimentBtn, Alignment.MIDDLE_RIGHT);
    //this.setComponentAlignment(notificationBtn, Alignment.MIDDLE_LEFT);
    this.setComponentAlignment(logoutBtn, Alignment.MIDDLE_RIGHT);
    //this.setComponentAlignment(refreshBtn, Alignment.MIDDLE_RIGHT);

}

From source file:eu.lod2.AuthoringTab.java

License:Apache License

public AuthoringTab(LOD2DemoState st) {

    // The internal state and 
    state = st;//from  w ww .  ja  va2s  . c  om

    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.ConfigurationTab.java

License:Apache License

public ConfigurationTab(LOD2DemoState st) {

    // The internal state and 
    state = st;//from w ww.  j ava 2s.  c  o m

    VerticalLayout configurationTab = new VerticalLayout();

    // Configuration form start
    // Set all properties at once for the moment.
    Form t2f = new Form();
    //t2f.setDebugId(this.getClass().getSimpleName()+"_t2f");
    t2f.setCaption("Configuration");

    // the graph selector
    // it displays all acceptable graphs in Virtuoso
    currentGraphPicker = new GraphPicker("Select default graph: ", state);
    //currentGraphPicker.setDebugId(this.getClass().getSimpleName()+"_graphSelector2");
    addCandidateGraphs(currentGraphPicker);

    currentGraphPicker.setValue(this.state.getCurrentGraph());

    currentGraphPicker.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
    t2f.getLayout().addComponent(currentGraphPicker);

    // 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);

    configurationTab.addComponent(t2f);

    // Configuration form end

    // The composition root MUST be set
    setCompositionRoot(configurationTab);
}

From source file:eu.lod2.EURL.java

License:Apache License

public EURL(LOD2DemoState st) {

    // The internal state
    state = st;/*from   w  w  w.  j av a 2s  .c om*/

    VerticalLayout panel = new VerticalLayout();
    Label description = new Label("Import the RDF available at a URL");
    panel.addComponent(description);

    exportGraph = new ExportSelector(state);
    exportGraph.setDebugId(this.getClass().getSimpleName() + "_exportGraph");
    panel.addComponent(exportGraph);

    uriSelector = new TextField("Enter URL to extract from: ");
    uriSelector.setDebugId(this.getClass().getSimpleName() + "_uriSelector");
    uriSelector.setDescription(
            "From this URL the RDF will be extracted and imported in the above selected graph.");
    panel.addComponent(uriSelector);

    Button importURL = new Button("Extract Links", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            doImportURL();
        }

        ;
    });
    importURL.setDebugId(this.getClass().getSimpleName() + "_importURL");
    importURL.setEnabled(true);
    importURL.setDescription("The operation is active only if the exported graph has been selected.");
    panel.addComponent(importURL);

    resultUser = new Label("");
    panel.addComponent(resultUser);

    /*
        // if an uri is given 
        if (!uriSelector.getValue().equals("")) {
            // activate button
            importURL.setEnabled(true);
        };
    */

    // The composition root MUST be set
    setCompositionRoot(panel);
}

From source file:eu.lod2.GeoSpatial.java

License:Apache License

public GeoSpatial(LOD2DemoState st) {

    // The internal state and 
    state = st;//from  w  w  w.j  a va  2 s  . c o m

    initLogin();

    HorizontalLayout geospatiallayout = new HorizontalLayout();

    // Configuration form start
    // Set all properties at once for the moment.
    Form t2f = new Form();
    t2f.setDebugId(this.getClass().getSimpleName() + "_t2f");
    t2f.setCaption("Configuration");

    exportGraph = new ExportSelector3(state, true, "Select graph with geo data:");
    exportGraph.setDebugId(this.getClass().getSimpleName() + "_exportGraph");
    t2f.getLayout().addComponent(exportGraph);

    // 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);

    geospatiallayout.addComponent(t2f);

    // Configuration form end
    geobrowser = new Embedded();
    try {

        URL url = new URL(service);
        geobrowser = new Embedded("", new ExternalResource(url));
        geobrowser.setType(Embedded.TYPE_BROWSER);
        geospatiallayout.addComponent(geobrowser);
        //geobrowser.setHeight(-1, Sizeable.UNITS_PERCENTAGE);
        geobrowser.setSizeFull();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    ;

    // The composition root MUST be set
    setCompositionRoot(geospatiallayout);
    geospatiallayout.setSizeFull();
}

From source file:eu.lod2.Limes.java

License:Apache License

public Limes(LOD2DemoState st) {

    // The internal state and 
    state = st;/*from   w  w w . j a va 2s .  c o  m*/

    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.QueryingTab.java

License:Apache License

public QueryingTab(LOD2DemoState st) {

    // The internal state and 
    state = st;/*from w  w w  . ja  va2s.  co 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.lod2.SameAsLinking.java

License:Apache License

public SameAsLinking(LOD2DemoState st) {

    // The internal state 
    state = st;//from  ww w.j  a  va2  s . co m

    VerticalLayout panel = new VerticalLayout();
    Label description = new Label(
            "Import public links between individuals (URI's) from the current graph to external resources using "
                    + "the online service SameAs.org.");
    panel.addComponent(description);

    exportGraph = new ExportSelector(state);
    exportGraph.setDebugId(this.getClass().getSimpleName() + "_exportGraph");
    panel.addComponent(exportGraph);

    uriSelector = new ComboBox("Select URI to link: ");
    uriSelector.setDebugId(this.getClass().getSimpleName() + "_uriSelector");
    uriSelector.setDescription("The selector contains uri's only if a current graph has a value.");
    panel.addComponent(uriSelector);

    Button sameAsLinking = new Button("Extract Links", new ClickListener() {
        public void buttonClick(ClickEvent event) {
            doSameAsLinking();
        };
    });
    sameAsLinking.setDebugId(this.getClass().getSimpleName() + "_sameAsLinking");
    sameAsLinking.setEnabled(false);
    sameAsLinking.setDescription("The operation is active only if a current graph has a value.");
    panel.addComponent(sameAsLinking);

    resultUser = new Label("");
    panel.addComponent(resultUser);

    // if the current graph is selected then
    if (state.getCurrentGraph() != null && !state.getCurrentGraph().equals("")) {
        // activate linking button
        sameAsLinking.setEnabled(true);
        // retrieve list of candidate uri's
        addCandidateURIs(uriSelector);
    }
    ;

    // The composition root MUST be set
    setCompositionRoot(panel);
}