Example usage for com.vaadin.ui CssLayout CssLayout

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

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:org.example.skalli.ext.simplehelloworld.ui.ExtensionServiceProjectHelloWorldBox.java

License:Open Source License

@Override
public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.setSizeFull();//from w  w  w. java2s.co  m
    layout.addComponent(new Label("The project you are viewing is called \"" + project.getName() + "\"."));

    return layout;
}

From source file:org.freakz.hokan_ng_springboot.bot.MainScreen.java

License:Apache License

@Autowired
public MainScreen(final VaadinSecurity vaadinSecurity, SpringViewProvider springViewProvider,
        ValoSideBar sideBar) {//from   w w w . j  a v  a2 s. c o  m
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    setCompositionRoot(layout);
    setSizeFull();

    // By adding a security item filter, only views that are accessible to the user will show up in the side bar.
    sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity));
    layout.addComponent(sideBar);

    CssLayout viewContainer = new CssLayout();
    viewContainer.setSizeFull();
    layout.addComponent(viewContainer);
    layout.setExpandRatio(viewContainer, 1f);

    Navigator navigator = new Navigator(UI.getCurrent(), viewContainer);
    // Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all.
    springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class);
    navigator.addProvider(springViewProvider);
    navigator.setErrorView(ErrorView.class);
    navigator.navigateTo(navigator.getState());
}

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);//from  ww  w .  j a  va2  s. co  m

    final DragAndDropWrapper outDrop = new DragAndDropWrapper(lDropPane);
    outDrop.setDropHandler(new DropHandler() {
        @Override
        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();//ww  w  .  j a  v a  2  s. c  o 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);//  w  w  w .  ja  va 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.  j  a v a  2s.com
    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  w w . j ava 2  s  .  c o m
    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;
}

From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java

License:BSD License

private Component createContentWrapper(final Component content) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("dashboard-panel-slot");

    CssLayout card = new CssLayout();
    card.setWidth("100%");
    card.addStyleName(ValoTheme.LAYOUT_CARD);

    HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addStyleName("dashboard-panel-toolbar");
    toolbar.setWidth("100%");

    Label caption = new Label(content.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    content.setCaption(null);/*from  ww w  .  j a  v  a 2s  .  com*/

    MenuBar tools = new MenuBar();
    tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() {

        @Override
        public void menuSelected(final MenuItem selectedItem) {
            if (!slot.getStyleName().contains("max")) {
                selectedItem.setIcon(FontAwesome.COMPRESS);
                toggleMaximized(slot, true);
            } else {
                slot.removeStyleName("max");
                selectedItem.setIcon(FontAwesome.EXPAND);
                toggleMaximized(slot, false);
            }
        }
    });
    max.setStyleName("icon-only");
    MenuItem root = tools.addItem("", VaadinIcons.COG, null);
    root.addItem("Configure", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });
    root.addSeparator();
    root.addItem("Close", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });

    toolbar.addComponents(caption, tools);
    toolbar.setExpandRatio(caption, 1);
    toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);

    card.addComponents(toolbar, content);
    slot.addComponent(card);
    return slot;
}

From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java

License:BSD License

private Component buildContent() {
    dashboardPanels = new CssLayout();
    dashboardPanels.addStyleName("dashboard-panels");
    Responsive.makeResponsive(dashboardPanels);

    dashboardPanels.addComponent(buildDashboard(this.eventExclusionsTable));
    //        dashboardPanels.addComponent(buildDashboardChart());
    //        dashboardPanels.addComponent(buildAnotherChart());
    dashboardPanels.addComponent(buildDashboard(this.flowStateTable));

    return dashboardPanels;
}