Example usage for com.vaadin.ui CssLayout addComponent

List of usage examples for com.vaadin.ui CssLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui CssLayout addComponent.

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:org.escidoc.browser.ui.maincontent.SearchResultsView.java

License:Open Source License

private void addAdvancedSearchBtn(final CssLayout cssLayout) {
    // here comes the Advanced search label
    // Login/*w  w w.  j  av a2s .c  o  m*/
    btnAdvancedSearch = new Button("Advanced Search", this, "onClick");
    btnAdvancedSearch.setStyleName(BaseTheme.BUTTON_LINK);
    btnAdvancedSearch.setImmediate(true);
    btnAdvancedSearch.setStyleName("v-button-link floatright");
    cssLayout.addComponent(btnAdvancedSearch);
}

From source file:org.escidoc.browser.ui.view.helpers.BreadCrumbMenu.java

License:Open Source License

/**
 * This is a Breadcrumb for the ContainerView
 * /*ww w  .j av a 2s.  co  m*/
 * @param cssLayout
 * @param resourceProxy
 * @param mainWindow
 * @param escidocServiceLocation
 * @param repositories
 */
public BreadCrumbMenu(final CssLayout cssLayout, final ContainerProxy resourceProxy, final Window mainWindow,
        final EscidocServiceLocation escidocServiceLocation, final Repositories repositories) {
    final ResourceHierarchy rs = new ResourceHierarchy(escidocServiceLocation, repositories);
    final StringBuffer buf = new StringBuffer();
    try {
        final List<ResourceModel> hierarchy = rs.getHierarchy(resourceProxy);
        Collections.reverse(hierarchy);
        for (final ResourceModel resourceModel : hierarchy) {
            try {
                buf.append("<li><a href='"
                        + this.generateLink(resourceModel.getId(),
                                resourceModel.getType().getLabel().toUpperCase(),
                                escidocServiceLocation.getEscidocUrl().toString())
                        + "'>" + resourceModel.getName() + "</a></li>");
            } catch (final MalformedURLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } catch (final EscidocClientException e) {
        buf.append("<li><a href='#'>" + resourceProxy.getContext().getXLinkTitle() + "</a></li>");
    }
    cssLayout.addComponent(new Label(
            bCstring + buf.toString() + "<li>" + resourceProxy.getName() + "</li></ul>", Label.CONTENT_RAW));
}

From source file:org.escidoc.browser.ui.view.helpers.BreadCrumbMenu.java

License:Open Source License

/**
 * BreadCrumb for the Item//from   w w  w  .j  a  v a 2s . c o  m
 * 
 * @param cssLayout
 * @param resourceProxy
 * @param mainWindow
 * @param escidocServiceLocation
 */
public BreadCrumbMenu(final CssLayout cssLayout, final ItemProxyImpl resourceProxy, final Window mainWindow,
        final EscidocServiceLocation escidocServiceLocation, final Repositories repositories) {

    final String bCstring = "<ul id='crumbs'><li><a href='#'>Home Item</a></li>";
    final ResourceHierarchy rs = new ResourceHierarchy(escidocServiceLocation, repositories);

    final StringBuffer buf = new StringBuffer();
    try {
        final List<ResourceModel> hierarchy = rs.getHierarchy(resourceProxy);
        Collections.reverse(hierarchy);
        for (final ResourceModel resourceModel : hierarchy) {
            buf.append("<li><a href='"
                    + this.generateLink(resourceModel.getId(), resourceModel.getType().getLabel().toUpperCase(),
                            escidocServiceLocation.getEscidocUrl().toString())
                    + "'>" + resourceModel.getName() + "</a></li>");
        }
        buf.append("<li><a href=''>" + resourceProxy.getName() + "</a></li>");
    } catch (final Exception e) {
        buf.append("<li><a href='#'>" + resourceProxy.getContext().getXLinkTitle() + "</a></li>");
    }
    cssLayout.addComponent(new Label(bCstring + buf.toString(), Label.CONTENT_RAW));
}

From source file:org.escidoc.browser.ui.view.helpers.DirectMember.java

License:Open Source License

@SuppressWarnings("serial")
private CssLayout headerButton() throws EscidocClientException {
    CssLayout cssLayout = new CssLayout();
    cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext");
    cssLayout.setWidth("100%");
    cssLayout.setMargin(false);//from  www.  java2 s .c  o  m

    final Label nameofPanel = new Label(ViewConstants.DIRECT_MEMBERS, Label.CONTENT_RAW);
    nameofPanel.setStyleName("accordion v-captiontext");
    nameofPanel.setWidth("70%");
    cssLayout.addComponent(nameofPanel);

    ThemeResource plusIcon = new ThemeResource("images/assets/plus.png");
    if (resourceType == ResourceType.CONTAINER.toString()) {
        resourceProxy = new ContainerProxyImpl(
                router.getRepositories().container().findContainerById(parentId));
        contextId = resourceProxy.getContext().getObjid();
    } else {
        // It has to be a context
        resourceProxy = router.getRepositories().context().findById(parentId);
    }

    final Button addResourceButton = new Button();
    addResourceButton.setStyleName(BaseTheme.BUTTON_LINK);
    addResourceButton.addStyleName("floatright paddingtop3");
    addResourceButton.setWidth("20px");
    addResourceButton.setIcon(plusIcon);
    addResourceButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
            try {
                new ResourceAddViewImpl(resourceProxy, contextId, router).openSubWindow();
            } catch (final EscidocClientException e) {
                mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });
    cssLayout.addComponent(nameofPanel);
    cssLayout.addComponent(addResourceButton);
    return cssLayout;
}

From source file:org.hip.vif.web.util.UploadComponent.java

License:Open Source License

private Component createDropBox(final IBibliographyTask inTask) {
    final CssLayout lDropPane = new CssLayout();
    lDropPane.setWidth("200px"); //$NON-NLS-1$
    lDropPane.setHeight("40px"); //$NON-NLS-1$
    lDropPane.addStyleName("v-textfield"); //$NON-NLS-1$
    final Label lHint = new Label(Activator.getMessages().getMessage("ui.upload.drop.box")); //$NON-NLS-1$
    lHint.setStyleName("vif-drop-hint"); //$NON-NLS-1$
    lDropPane.addComponent(lHint);

    final DragAndDropWrapper outDrop = new DragAndDropWrapper(lDropPane);
    outDrop.setDropHandler(new DropHandler() {
        @Override/* w  w  w  . j  a  v  a 2s .c  o  m*/
        public AcceptCriterion getAcceptCriterion() { // NOPMD
            return AcceptAll.get();
        }

        @Override
        public void drop(final DragAndDropEvent inEvent) { // NOPMD
            final Transferable lTransferable = inEvent.getTransferable();
            if (lTransferable instanceof WrapperTransferable) {
                final Html5File[] lFiles = ((WrapperTransferable) lTransferable).getFiles();
                for (final Html5File lFile : lFiles) {
                    lFile.setStreamVariable(createStreamVariable(lFile.getFileName(), inTask));
                }
            }
        }
    });

    outDrop.setSizeUndefined();
    outDrop.setImmediate(true);
    return outDrop;
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

void buildMainView() {
    _mainLayout.setSizeFull();//from   w  w  w .  ja  v a2  s . co m

    _lblLoginMessage = new Label("");
    _lblLoginMessage.setStyleName(Reindeer.LABEL_H2);

    HorizontalLayout topMenuLayout = getTopMenu();
    CssLayout headerImageLayout = getHeader();

    VerticalLayout topLayout = new VerticalLayout();
    topLayout.addComponent(headerImageLayout);
    topLayout.addComponent(topMenuLayout);
    topLayout.setComponentAlignment(topMenuLayout, Alignment.TOP_RIGHT);
    topLayout.addComponent(_lblLoginMessage);
    topLayout.setComponentAlignment(_lblLoginMessage, Alignment.TOP_RIGHT);
    topLayout.setMargin(false, true, true, true);
    _mainLayout.addComponent(topLayout);

    CssLayout mainCSSLayout = new CssLayout();
    mainCSSLayout.setMargin(false, true, true, true);
    mainCSSLayout.setSizeFull();

    _tabsheet = new TabSheet();
    _tabsheet.setSizeFull();

    mainCSSLayout.addComponent(_tabsheet);
    _mainLayout.addComponent(mainCSSLayout);
    _mainLayout.setExpandRatio(mainCSSLayout, 1);

    buildWelcomeScreen = buildWelcomeScreen();
    buildAboutScreen = buildAboutScreen();
    buildUploadDataWindow = new UploadComponent(this);
    buildUploadDataWindow.setImmediate(true);
    buildUploadDataWindow.setEnabled(false);
    buildUploadDataWindow.addListener(this);
    buildUploadDataWindow.setWidth("100%");

    buildRetrieveWindow = new RetrieveComponent(this);
    buildRetrieveWindow.setImmediate(true);
    buildRetrieveWindow.setEnabled(false);
    buildRetrieveWindow.addListener(this);
    buildRetrieveWindow.setWidth("100%");

    buildDeleteWindow = new DeleteComponent(this);
    buildDeleteWindow.setImmediate(true);
    buildDeleteWindow.setEnabled(false);
    buildDeleteWindow.addListener(this);
    buildRetrieveWindow.setWidth("100%");

    _tabsheet.addComponent(buildWelcomeScreen);
    _tabsheet.addComponent(buildAboutScreen);
    _tabsheet.addComponent(buildUploadDataWindow);
    _tabsheet.addComponent(buildRetrieveWindow);
    _tabsheet.addComponent(buildDeleteWindow);

    /*if (null == _gdmsModel.getLoggedInUser()){
       buildUploadDataWindow.setEnabled(false);
       buildRetrieveWindow.setEnabled(false);
       buildDeleteWindow.setEnabled(false);
    } else {
       buildUploadDataWindow.setEnabled(true);
       buildRetrieveWindow.setEnabled(true);
       buildDeleteWindow.setEnabled(true);
    }*/

    if (null == _gdmsModel.getLoggedInUser()) {
        _tabsheet.getTab(1).setEnabled(false);
        _tabsheet.getTab(2).setEnabled(false);
        _tabsheet.getTab(3).setEnabled(false);
    } else {
        _tabsheet.getTab(1).setEnabled(true);
        _tabsheet.getTab(2).setEnabled(true);
        _tabsheet.getTab(3).setEnabled(true);
    }

    _tabsheet.addListener(new SelectedTabChangeListener() {

        private static final long serialVersionUID = 1L;

        public void selectedTabChange(SelectedTabChangeEvent event) {
            User loggedInUser = _gdmsModel.getLoggedInUser();
            //System.out.println("loggedInUser:"+loggedInUser);
            if (null == loggedInUser) {
                if (!(buildWelcomeScreen == _tabsheet.getSelectedTab())) {
                    getMainWindow().showNotification("Please login inorder to Upload, Retrieve or Delete data.",
                            Notification.TYPE_HUMANIZED_MESSAGE);
                    return;
                }
            } else {
                if (event.getTabSheet().getSelectedTab().getCaption() == "Upload") {
                    updateUploadTabComponent();
                } else if (event.getTabSheet().getSelectedTab().getCaption() == "Retrieve") {
                    updateRetrieveTabComponent();
                } else if (event.getTabSheet().getSelectedTab().getCaption() == "View") {
                    updateDeleteTabComponent();
                }
            }

        }

    });

    CssLayout bottomPanelLayout = getBottomPanelLayout();
    VerticalLayout bottomContactLayout = new VerticalLayout();
    bottomContactLayout.addComponent(bottomPanelLayout);
    bottomContactLayout.setComponentAlignment(bottomPanelLayout, Alignment.BOTTOM_LEFT);
    bottomContactLayout.setMargin(false, true, false, true);
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

VerticalLayout buildWelcomeScreen() {
    VerticalLayout layoutForWelcomeTab = new VerticalLayout();
    layoutForWelcomeTab.setMargin(true);
    layoutForWelcomeTab.setSpacing(true);
    layoutForWelcomeTab.setCaption("Welcome");
    layoutForWelcomeTab.setStyleName(Reindeer.LAYOUT_WHITE);

    CssLayout cssLayout = new CssLayout();
    cssLayout.setMargin(true);/*from   w w w  .ja v a  2  s .  c  o m*/
    cssLayout.setWidth("100%");
    layoutForWelcomeTab.addComponent(cssLayout);

    HeadingOne title = new HeadingOne("Welcome to Genotyping Data Management");
    cssLayout.addComponent(title);

    HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout();

    horizLayoutForIntroPara.setSpacing(true);
    horizLayoutForIntroPara.setWidth("100%");
    horizLayoutForIntroPara.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayoutForIntroPara);

    String strIntroPara1 = "<p>The Genotyping Data Management System aims to provide a comprehensive public repository "
            + "for genotype, linkage map and QTL data from crop species relevant in the semi-arid tropics.</p>";

    String strIntroPara2 = "<p>This system is developed in Java and the database is MySQL. The initial release record "
            + "details of current genotype datasets generated for GCP mandate crops along with details of "
            + "molecular markers and related metadata. The Retrieve tab is a good starting point to browse "
            + "or query the database contents. The datasets available for each crop species can be queried. "
            + "Access to data sets requires a login.</p>";

    String strIntroPara3 = "<p>Data may be currently exported to the following formats: 2x2 matrix and flapjack software formats. "
            + "Data submission is through templates; upload templates are available for genotype, QTL and "
            + "map data(type of markers - SSR, SNP and DArt). The templates are in the form of excel sheets with built-in "
            + "validation functions.</p>";

    Label lblPara = new Label(strIntroPara1 + strIntroPara2 + strIntroPara3, Label.CONTENT_XHTML);
    horizLayoutForIntroPara.addComponent(lblPara);
    horizLayoutForIntroPara.setExpandRatio(lblPara, 1);

    //Spacer
    lblPara = new Label("");
    lblPara.setWidth("20px");
    horizLayoutForIntroPara.addComponent(lblPara);

    ThemeResource themeResource = new ThemeResource("images/FlowChart.jpg");
    Embedded headerImage = new Embedded("", themeResource);

    headerImage.setWidth("500px");
    headerImage.setHeight("400px");
    horizLayoutForIntroPara.addComponent(headerImage);

    return layoutForWelcomeTab;
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

VerticalLayout buildAboutScreen() {
    VerticalLayout layoutForAboutTab = new VerticalLayout();
    layoutForAboutTab.setMargin(true);/*  w  w w  . ja va  2  s .c om*/
    layoutForAboutTab.setSpacing(true);
    layoutForAboutTab.setCaption("About");
    layoutForAboutTab.setStyleName(Reindeer.LAYOUT_WHITE);

    CssLayout cssLayout = new CssLayout();
    cssLayout.setMargin(true);
    cssLayout.setWidth("100%");
    layoutForAboutTab.addComponent(cssLayout);

    HeadingOne title = new HeadingOne("About GDMS Version");
    cssLayout.addComponent(title);

    HorizontalLayout horizLayoutForIntroPara = new HorizontalLayout();

    horizLayoutForIntroPara.setSpacing(true);
    //horizLayoutForIntroPara.setWidth("100%");
    horizLayoutForIntroPara.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayoutForIntroPara);
    //_main.getApplication().getContext().getBaseDirectory();
    WebApplicationContext ctx = (WebApplicationContext) _main.getApplication().getContext();
    //System.out.println(ctx.getHttpSession().getServletContext().getRealPath("\\"));

    final String strTemplateFolderPath = ctx.getHttpSession().getServletContext().getRealPath("\\");
    final String strFileName = "License Agreement for software rev.doc";

    final String licensePath = strTemplateFolderPath + "\\" + strFileName;
    final String strApplicationVersion = "<p>Application Version : 2.1.10</p>";
    final String strLicense = "";

    String strDBVersion = "<p>Database Verison : IBDBv2</p>";
    String strContact = "<p>Contact : <a href='mailto:bioinformatics@cgiar.org'>bioinformatics@cgiar.org </a></p>";
    Label lblPara = new Label(strApplicationVersion + strDBVersion + strContact, Label.CONTENT_XHTML);
    horizLayoutForIntroPara.addComponent(lblPara);
    horizLayoutForIntroPara.setExpandRatio(lblPara, 1);

    HorizontalLayout horizLayout = new HorizontalLayout();
    horizLayout.setSpacing(true);
    //horizLayout.setWidth("50%");
    horizLayout.setMargin(true, false, true, false);
    cssLayout.addComponent(horizLayout);
    //cssLayout.setWidth("600px");

    btnDownloadMarker = new Button("License Information");
    btnDownloadMarker.setImmediate(true);
    btnDownloadMarker.setStyleName(Reindeer.BUTTON_LINK);
    btnDownloadMarker.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            //strLicense = "License Information";

            File strFileLoc = new File(strTemplateFolderPath + "\\" + strFileName);
            FileResource fileResource = new FileResource(strFileLoc, _main.getApplication());
            if (strFileName.endsWith(".doc")) {
                _main.getWindow().open(fileResource, "", true);
            }
        }

    });
    //Spacer
    lblPara = new Label("");
    //lblPara.setWidth("20px");
    horizLayout.addComponent(lblPara);
    horizLayout.addComponent(btnDownloadMarker);
    horizLayout.setComponentAlignment(btnDownloadMarker, Alignment.MIDDLE_LEFT);

    return layoutForAboutTab;
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

CssLayout getHeader() {
    CssLayout cssLayoutForHeaderImage = new CssLayout();
    cssLayoutForHeaderImage.setWidth("100%");

    ThemeResource themeResource = new ThemeResource("images/GDMS.gif");
    //ThemeResource themeResource = new ThemeResource("images/Banner3.jpg");
    Embedded headerImage = new Embedded("", themeResource);

    headerImage.setSizeFull();//from  w  ww .  j  ava 2  s . com
    cssLayoutForHeaderImage.setSizeFull();
    cssLayoutForHeaderImage.addComponent(headerImage);
    cssLayoutForHeaderImage.setMargin(false, false, false, false);

    return cssLayoutForHeaderImage;
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

CssLayout getBottomPanelLayout() {
    CssLayout cssLayoutForContactImage = new CssLayout();
    cssLayoutForContactImage.setWidth("100%");

    ThemeResource themeResource = new ThemeResource("images/GDMS_Footer.gif");
    Embedded contactImage = new Embedded("", themeResource);

    contactImage.setWidth("1000px");
    contactImage.setHeight("20px");
    cssLayoutForContactImage.addComponent(contactImage);

    return cssLayoutForContactImage;
}