Example usage for com.vaadin.ui VerticalLayout setCaption

List of usage examples for com.vaadin.ui VerticalLayout setCaption

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setCaption.

Prototype

@Override
    public void setCaption(String caption) 

Source Link

Usage

From source file:facs.components.Statistics.java

License:Open Source License

private Component initialGrid() {

    VerticalLayout gridLayout = new VerticalLayout();

    createInvoice.setEnabled(false);/*from w  ww .  j  a  v  a  2 s.  c  om*/
    downloadInvoice.setEnabled(false);

    String buttonRefreshTitle = "Refresh";
    Button refresh = new Button(buttonRefreshTitle);
    refresh.setIcon(FontAwesome.REFRESH);
    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();

        }
    });

    Date dNow = new Date();
    SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");
    System.out.println(ft.format(dNow) + "  INFO  Statistics accessed! - User: "
            + LiferayAndVaadinUtils.getUser().getScreenName());

    // Add some generated properties
    IndexedContainer container = getEmptyContainer();
    gpcontainer = new GeneratedPropertyContainer(container);

    Grid grid = new Grid(gpcontainer);

    grid.setWidth("100%");
    setRenderers(grid);
    fillRows(grid);

    // compute total costs
    float totalCosts = 0.0f;
    for (Object itemId : gpcontainer.getItemIds())
        totalCosts += ((Number) gpcontainer.getContainerProperty(itemId, costCaption).getValue()).floatValue();

    // compute total time in milliseconds
    long total = 0;
    for (Object itemId : gpcontainer.getItemIds()) {
        long s = ((Date) gpcontainer.getContainerProperty(itemId, startCaption).getValue()).getTime();
        long e = ((Date) gpcontainer.getContainerProperty(itemId, endCaption).getValue()).getTime();
        total += e - s;
    }

    // set footer to contain total cost and time in hours:minutes
    FooterRow footer = grid.appendFooterRow();
    FooterCell footerCellCost = footer.getCell(costCaption);
    footerCellCost.setText(String.format("%1$.2f  total", totalCosts));

    FooterCell footerCellEnd = footer.getCell(endCaption);
    footerCellEnd.setText(Formatter.toHoursAndMinutes(total)); // "%1$.0f hours"

    // Set up a filter for all columns
    HeaderRow filterRow = grid.appendHeaderRow();
    addRowFilter(filterRow, deviceCaption, container, footer, gpcontainer);
    addRowFilter(filterRow, kostenstelleCaption, container, footer, gpcontainer);

    Label infoLabel = new Label(
            DBManager.getDatabaseInstance().getUserNameByUserID(LiferayAndVaadinUtils.getUser().getScreenName())
                    + "  " + LiferayAndVaadinUtils.getUser().getScreenName());
    infoLabel.addStyleName("h4");

    // createInvoice.setSizeFull();
    // downloadInvoice.setSizeFull();

    gridLayout.setWidth("100%");
    gridLayout.setCaption("Statistics");
    // add components to the grid layout
    // gridLayout.addComponent(infoLabel, 0, 0, 3, 0);
    // gridLayout.addComponent(grid, 0, 1, 5, 1);
    // gridLayout.addComponent(createInvoice, 0, 3);
    // gridLayout.addComponent(downloadInvoice, 1, 3);

    gridLayout.addComponent(grid);
    gridLayout.addComponent(refresh);
    gridLayout.addComponent(createInvoice);
    gridLayout.addComponent(downloadInvoice);

    gridLayout.setMargin(true);
    gridLayout.setSpacing(true);

    // grid.setEditorEnabled(true);
    grid.setSelectionMode(SelectionMode.SINGLE);
    grid.addSelectionListener(new SelectionListener() {

        /**
         * 
         */
        private static final long serialVersionUID = -2683274060620429050L;

        @Override
        public void select(SelectionEvent event) {
            // Notification.show("Select row: " + grid.getSelectedRow() + " Name: "
            // + gpcontainer.getContainerProperty(grid.getSelectedRow(), nameCaption).getValue());
            downloadInvoice.setEnabled(false);
            ReceiverPI = (String) gpcontainer.getContainerProperty(grid.getSelectedRow(), nameCaption)
                    .getValue();
            createInvoice.setEnabled(true);
        }
    });

    createInvoice.addClickListener(new ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 5512585967145932560L;
        private File bill;
        private FileDownloader fileDownloader;

        @Override
        public void buttonClick(ClickEvent event) {
            String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

            Paths.get(basepath, "WEB-INF/billingTemplates");

            // System.out.println("Basepath: " + basepath);

            try {

                int setUserId = DBManager.getDatabaseInstance().findUserByFullName(ReceiverPI);

                if (setUserId > 0) {

                    Billing billing = new Billing(Paths.get(basepath, "WEB-INF/billingTemplates").toFile(),
                            "Angebot.tex");

                    UserBean user = setUserId > 0 ? DBManager.getDatabaseInstance().getUserById(setUserId)
                            : null;

                    billing.setReceiverPI(ReceiverPI);
                    billing.setReceiverInstitution(user.getInstitute());
                    billing.setReceiverStreet(user.getStreet());
                    billing.setReceiverPostalCode(user.getPostcode());
                    billing.setReceiverCity(user.getCity());

                    billing.setSenderName("Dr. rer. nat. Stella Autenrieth");
                    billing.setSenderFunction("Leiterin");
                    billing.setSenderPostalCode("72076");
                    billing.setSenderCity("Tbingen");
                    billing.setSenderStreet("Otfried-Mller-Strae 10");
                    billing.setSenderPhone("+49 (0) 7071 29-83156");
                    billing.setSenderEmail("stella.autenrieth@med.uni-tuebingen.de");
                    billing.setSenderUrl("www.medizin.uni-tuebingen.de");
                    billing.setSenderFaculty("Medizinischen Fakultt");

                    if (user.getKostenstelle() != null)
                        billing.setProjectDescription("Kostenstelle: " + user.getKostenstelle());
                    else
                        billing.setProjectDescription("Keine kostenstelle verfgbar.");

                    billing.setProjectShortDescription("Dieses Angebot beinhaltet jede Menge Extras.");

                    if (user.getProject() != null)
                        billing.setProjectNumber("Kostenstelle: " + user.getKostenstelle());
                    else
                        billing.setProjectNumber("Keine project nummer verfgbar.");

                    float cost = ((Number) gpcontainer.getContainerProperty(grid.getSelectedRow(), costCaption)
                            .getValue()).floatValue();
                    long s = ((Date) gpcontainer.getContainerProperty(grid.getSelectedRow(), startCaption)
                            .getValue()).getTime();
                    long e = ((Date) gpcontainer.getContainerProperty(grid.getSelectedRow(), endCaption)
                            .getValue()).getTime();
                    long timeFrame = e - s;
                    Date start = ((Date) gpcontainer.getContainerProperty(grid.getSelectedRow(), startCaption)
                            .getValue());
                    SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy");
                    String date = ft.format(start);
                    String description = "No Description is Available";
                    String time_frame = Formatter.toHoursAndMinutes(timeFrame);

                    ArrayList<CostEntry> entries = new ArrayList<CostEntry>();
                    entries.add(billing.new CostEntry(date, time_frame, description, cost));
                    billing.setCostEntries(entries);
                    float totalCosts = 0.0f;

                    // calculates the total cost of items
                    // for (Object itemId : gpcontainer.getItemIds()) {
                    // totalCosts +=
                    // ((Number) gpcontainer.getContainerProperty(itemId, costCaption).getValue())
                    // .floatValue();
                    // }

                    totalCosts = ((Number) gpcontainer.getContainerProperty(grid.getSelectedRow(), costCaption)
                            .getValue()).floatValue();

                    billing.setTotalCost(String.format("%1$.2f", totalCosts));

                    bill = billing.createPdf();
                    // System.out.println(bill.getAbsolutePath());
                    if (fileDownloader != null)
                        downloadInvoice.removeExtension(fileDownloader);
                    fileDownloader = new FileDownloader(new FileResource(bill));
                    fileDownloader.extend(downloadInvoice);
                    downloadInvoice.setEnabled(true);
                    showSuccessfulNotification("Congratulations!",
                            "Invoice is created and available for download.");
                    downloadInvoice.setEnabled(true);
                } else {
                    createInvoice.setEnabled(false);
                    downloadInvoice.setEnabled(false);
                    showErrorNotification("No such user found!",
                            "An error occured while trying to create the invoice. The common problem occurs to be: this no such user in the database.");
                }
            }

            catch (Exception e) {
                showErrorNotification("What the heck!",
                        "An error occured while trying to create the invoice. The common problem occurs to be: this no such user or it can not run program 'pdflatex'.");
                e.printStackTrace();
            }

            // for all entries
            /*
             * try { Billing billing = new Billing(Paths.get(basepath,
             * "WEB-INF/billingTemplates").toFile(), "Angebot.tex");
             * billing.setRecieverInstitution("BER - Berliner Flughafen");
             * billing.setRecieverPI("Klaus Something");
             * billing.setRecieverStreet("am berliner flughafen 12");
             * billing.setRecieverPostalCode("D-12345"); billing.setRecieverCity("Berlin");
             * 
             * billing.setSenderName("Dr. rer. nat. Stella Autenrieth");
             * billing.setSenderFunction("Leiterin"); billing.setSenderPostalCode("72076");
             * billing.setSenderCity("Tbingen"); billing.setSenderStreet("Otfried-Mller-Strae 10");
             * billing.setSenderPhone("+49 (0) 7071 29-83156");
             * billing.setSenderEmail("stella.autenrieth@med.uni-tuebingen.de");
             * billing.setSenderUrl("www.medizin.uni-tuebingen.de");
             * billing.setSenderFaculty("Medizinischen Fakultt");
             * 
             * billing.setProjectDescription("Dieses Angebot beinhaltet jede Menge Extras.");
             * billing.setProjectShortDescription("jede Menge Extras.");
             * billing.setProjectNumber("QA2014016");
             * 
             * ArrayList<CostEntry> entries = new ArrayList<CostEntry>(); for (Object itemId :
             * gpcontainer.getItemIds()) { float cost = ((Number)
             * gpcontainer.getContainerProperty(itemId, costCaption).getValue()) .floatValue(); long s =
             * ((Date) gpcontainer.getContainerProperty(itemId, startCaption).getValue()) .getTime();
             * long e = ((Date) gpcontainer.getContainerProperty(itemId,
             * endCaption).getValue()).getTime(); long timeFrame = e - s; Date start = ((Date)
             * gpcontainer.getContainerProperty(itemId, startCaption).getValue()); SimpleDateFormat ft =
             * new SimpleDateFormat("dd.MM.yyyy"); String date = ft.format(start); String description =
             * "No Description is Available"; String time_frame =
             * Formatter.toHoursAndMinutes(timeFrame); entries.add(billing.new CostEntry(date,
             * time_frame, description, cost)); } billing.setCostEntries(entries); float totalCosts =
             * 0.0f; for (Object itemId : gpcontainer.getItemIds()) { totalCosts += ((Number)
             * gpcontainer.getContainerProperty(itemId, costCaption).getValue()) .floatValue(); }
             * 
             * billing.setTotalCost(String.format("%1$.2f", totalCosts));
             * 
             * bill = billing.createPdf(); System.out.println(bill.getAbsolutePath()); if
             * (fileDownloader != null) downloadBill.removeExtension(fileDownloader); fileDownloader =
             * new FileDownloader(new FileResource(bill)); fileDownloader.extend(downloadBill);
             * downloadBill.setEnabled(true); showSuccessfulNotification("Congratulations!",
             * "Invoice is created and available for download."); } catch (Exception e) {
             * showErrorNotification( "What the heck!",
             * "An error occured while trying to create the invoice. The common problem occurs to be: cannot run program 'pdflatex'"
             * ); e.printStackTrace(); }
             */

        }

    });

    return gridLayout;

}

From source file:facs.components.UserAdmin.java

License:Open Source License

private Component usersGrid() {
    VerticalLayout devicesLayout = new VerticalLayout();
    devicesLayout.setCaption("Users");
    // HorizontalLayout buttonLayout = new HorizontalLayout();

    // there will now be space around the test component
    // components added to the test component will now not stick together but have space between
    // them// www  .ja  v  a  2s  .  co  m
    devicesLayout.setMargin(true);
    devicesLayout.setSpacing(true);

    // BeanItemContainer<UserBean> users = getUsers();

    // GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(users);

    // usersGrid = new Grid(gpc);
    // Create a grid

    usersGrid.setWidth("100%");
    usersGrid.setSelectionMode(SelectionMode.SINGLE);

    // System.out.println(usersGrid.getColumns());

    // usersGrid.setColumnOrder("id", "LDAP", "name", "email", "phone", "workgroup", "institute",
    // "kostenstelle", "project");
    // usersGrid.removeColumn("status");
    // usersGrid.removeColumn("role");

    usersGrid.setColumnOrder("user_id", "user_ldap", "user_name", "email", "phone", "workgroup_id", "group_id",
            "kostenstelle", "project", "admin_panel");

    usersGrid.removeColumn("workgroup_id");
    usersGrid.removeColumn("group_id");
    usersGrid.removeColumn("admin_panel");

    usersGrid.getColumn("user_id").setHeaderCaption("ID");
    usersGrid.getColumn("user_ldap").setHeaderCaption("Username");
    usersGrid.getColumn("user_name").setHeaderCaption("Name");

    // usersGrid.getColumn("user_ldap").setEditable(false);

    usersGrid.setEditorEnabled(true);

    devicesLayout.addComponent(usersGrid);

    // TODO filtering
    // HeaderRow filterRow = devicesGrid.prependHeaderRow();

    return devicesLayout;
}

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);/* w w w  . jav  a 2  s.co 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 . jav a 2 s  .  c o 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);/*from   w w  w  . ja v a  2  s  . 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  w  w. j a  v  a  2  s  .com*/

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

From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java

License:Open Source License

private void creatTab_Resources() {
    VerticalLayout tab_internaldata = new VerticalLayout();
    tab_internaldata.setCaption("Internal resources");
    tabsheet.addTab(tab_internaldata);//www .j  a v  a2 s  . c om

    BrowserFrame browser = new BrowserFrame("", new ExternalResource("http://drumbeat.cs.hut.fi/home.html"));
    browser.setWidth("900px");
    browser.setHeight("450px");
    tab_internaldata.addComponent(browser);

    files_table.addContainerProperty("File name", String.class, null);
    listUploaded_IFCFiles();
    tab_internaldata.addComponent(files_table);

    contexts_table.addContainerProperty("Graph", String.class, null);
    contexts_table.addContainerProperty("Size", Long.class, null);
    tab_internaldata.addComponent(contexts_table);
}

From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropAccordionDemo.java

License:Apache License

@Override
public Component getLayout() {
    // start-source
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();/*w w w .  j a v a 2  s  . c o  m*/
    v.setSpacing(true);

    Label lb = new Label(
            "This demo shows you how you can drag components into a Accordion and reorder the tabs. "
                    + "Try dragging some Buttons on to the accordion to add them as tabs. You can "
                    + "reorder the tabs by dragging on them");
    v.addComponent(lb);

    // Add some buttons to a vertical layout with dragging enabled
    final DDHorizontalLayout btns = new DDHorizontalLayout();
    btns.setSpacing(true);
    btns.setDragMode(LayoutDragMode.CLONE);
    btns.addComponent(new Button("One Button"));
    btns.addComponent(new Button("Second Button"));
    btns.addComponent(new Button("Third Button"));
    btns.addComponent(new Button("Fourth Button"));
    btns.addComponent(new Button("Fifth Button"));
    v.addComponent(btns);

    // Create an Accordion
    final DDAccordion acc = new DDAccordion();
    acc.setSizeFull();

    acc.setDragMode(LayoutDragMode.CLONE);

    acc.setComponentVerticalDropRatio(EQUAL_DROP_RATIO);

    acc.setDropHandler(new DefaultAccordionDropHandler());

    // Add a tab to the accordion
    VerticalLayout layout = new VerticalLayout();
    layout.setCaption("Tab 1");
    layout.addComponent(new Label("This is an example tab already in the accordion."));
    acc.addComponent(layout);

    layout = new VerticalLayout();
    layout.setCaption("Tab 2");
    layout.addComponent(new Label("This is an example tab already in the accordion."));
    acc.addComponent(layout);

    layout = new VerticalLayout();
    layout.setCaption("Tab 3");
    layout.addComponent(new Label("This is an example tab already in the accordion."));
    acc.addComponent(layout);

    v.addComponent(acc);
    v.setExpandRatio(acc, 1);

    // end-source
    return v;
}

From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropLayoutDraggingDemo.java

License:Apache License

@Override
public Component getLayout() {
    // start-source
    final DDAbsoluteLayout layout = new DDAbsoluteLayout();
    layout.setSizeFull();/*from   w w w .  j  a  va2 s  .co m*/

    // Enable dragging components
    layout.setDragMode(LayoutDragMode.CLONE);

    // Enable dropping components
    layout.setDropHandler(new DefaultAbsoluteLayoutDropHandler());

    // Add some components
    layout.addComponent(new Label(
            "This demo shows how you can drag a layout with buttons in it. Try to drag the button group to see what happens"),
            "left:5px;top:5px");

    // A vertical layout which has dragging turned off by default
    VerticalLayout buttons = new VerticalLayout();
    buttons.setSizeUndefined();
    buttons.setCaption("Button group");
    buttons.setSpacing(true);
    buttons.addComponent(new Button("Button1"));
    buttons.addComponent(new Button("Button2"));
    buttons.addComponent(new Button("Button3"));
    buttons.addComponent(new Button("Button4"));

    layout.addComponent(buttons, "left:50px;top:50px");
    // end-source
    return layout;
}

From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropTabsheetDemo.java

License:Apache License

@Override
public Component getLayout() {
    // start-source
    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();//from   w  w  w .j a  va 2 s . c  o  m
    v.setSpacing(true);

    Label lb = new Label(
            "This demo shows you how you can drag components into a tabsheet and reorder the tabs. "
                    + "Try dragging some Buttons into the tab area to add them as tabs. You can then "
                    + "reorder the tabs by dragging on them");
    v.addComponent(lb);

    // Add some buttons to a vertical layout with dragging enabled
    final DDHorizontalLayout btns = new DDHorizontalLayout();
    btns.setSpacing(true);
    btns.setDragMode(LayoutDragMode.CLONE);
    btns.addComponent(new Button("One Button"));
    btns.addComponent(new Button("Second Button"));
    btns.addComponent(new Button("Third Button"));
    btns.addComponent(new Button("Fourth Button"));
    btns.addComponent(new Button("Fifth Button"));
    v.addComponent(btns);

    // Create a tabsheet
    final DDTabSheet tabSheet = new DDTabSheet();
    tabSheet.setSizeFull();

    // Add a tab
    VerticalLayout layout = new VerticalLayout();
    layout.setCaption("Example");
    layout.addComponent(new Label("This is an example tab already in the tabsheet."));
    tabSheet.addComponent(layout);

    // Enable dragging
    tabSheet.setDragMode(LayoutDragMode.CLONE);

    // Enable dropping
    tabSheet.setDropHandler(new DefaultTabSheetDropHandler());

    v.addComponent(tabSheet);
    v.setExpandRatio(tabSheet, 1);
    // end-source
    return v;
}