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:com.rex.components.valo.CommonParts.java

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);//from www.j  a  v  a 2  s .  c  om
    content.setSpacing(true);
    content.setMargin(true);
    content.addComponent(new Label("You can test the loading indicator by pressing the buttons."));

    CssLayout group = new CssLayout();
    group.setCaption("Show the loading indicator for");
    group.addStyleName("v-component-group");
    content.addComponent(group);
    Button loading = new Button("0.8");
    loading.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(800);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(loading);

    Button delay = new Button("3");
    delay.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(delay);

    Button wait = new Button("15");
    wait.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(15000);
            } catch (InterruptedException e) {
            }
        }
    });
    wait.addStyleName("last");
    group.addComponent(wait);
    Label label = new Label("   seconds", ContentMode.HTML);
    label.setSizeUndefined();
    group.addComponent(label);

    Label spinnerDesc = new Label(
            "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added.");
    spinnerDesc.addStyleName("small");
    spinnerDesc.setCaption("Spinner");
    content.addComponent(spinnerDesc);

    if (!ReportEngineUI.isTestMode()) {
        final Label spinner = new Label();
        spinner.addStyleName("spinner");

        Button showSpinnerButton = new Button("Show spinner", new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                content.replaceComponent(event.getComponent(), spinner);
            }
        });
        content.addComponent(showSpinnerButton);
    }

    return p;
}

From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java

License:Open Source License

@Override
public void init() {
    logger.info("Dynamic Vaadin OSGi demo init...");
    setTheme(Reindeer.THEME_NAME);// w ww.  j av  a2s  . c  o m
    // setTheme(Runo.THEME_NAME);
    // setTheme("demo");
    main = new Window("Dynamic Vaadin OSGi Demo");
    mainLayout = (VerticalLayout) main.getContent();
    mainLayout.setMargin(false);
    mainLayout.setStyleName("blue");
    setMainWindow(main);

    mainLayout.setSizeFull();
    mainLayout.addComponent(getMenu());

    HorizontalLayout header = new HorizontalLayout();

    header.addComponent(getHeader());
    header.addComponent(getToolbar());
    mainLayout.addComponent(header);

    CssLayout margin = new CssLayout();
    margin.setMargin(false, true, true, true);
    margin.setSizeFull();
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    margin.addComponent(tabSheet);
    mainLayout.addComponent(margin);
    mainLayout.setExpandRatio(margin, 1);

    for (IViewContribution viewContribution : viewContributions) {
        tabSheet.addTab(viewContribution.getView(this), viewContribution.getName(),
                new ThemeResource(viewContribution.getIcon()));
    }

    for (IActionContribution actionContribution : actionContributions) {
        addActionContribution(actionContribution);
    }

    // Create the indicator
    // this is used for a simple poll mechanism
    // so that manual server-side starting/stopping of bundles has a direct
    // effect on the client UI
    ProgressIndicator indicator = new ProgressIndicator();
    // Set polling frequency to 1 seconds.
    indicator.setPollingInterval(1000);
    // Add it to Application's main window
    main.addComponent(indicator);
    // Hide the component does not work...
    indicator.setWidth("1px");
    indicator.setHeight("1px");
    indicator.setVisible(true);

    initialized = true;
}

From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java

License:Open Source License

private Layout getHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setMargin(true);//from   w ww.jav a 2  s . co  m
    header.setSpacing(true);
    // header.setStyleName(Reindeer.LAYOUT_BLACK);

    CssLayout titleLayout = new CssLayout();
    H2 title = new H2("Dynamic Vaadin OSGi Demo");
    titleLayout.addComponent(title);
    SmallText description = new SmallText(
            "Select the \"Bundle View\" tab and activate/stop OSGi bundles dynamically.");
    description.setSizeUndefined();
    titleLayout.addComponent(description);

    header.addComponent(titleLayout);

    return header;
}

From source file:com.siemens.ct.osgi.vaadin.pm.main.MainApplication.java

License:Open Source License

private Window getAboutDialog() {
    if (aboutWindow == null) {
        aboutWindow = new Window("About...");
        aboutWindow.setModal(true);//from   w w w  .  ja  va2s.c om
        aboutWindow.setWidth("400px");

        VerticalLayout layout = (VerticalLayout) aboutWindow.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName("blue");

        CssLayout titleLayout = new CssLayout();
        H2 title = new H2("Dynamic Vaadin OSGi Demo");
        titleLayout.addComponent(title);
        SmallText description = new SmallText("<br>Copyright (c) Siemens AG, Kai Tdter and others.<br>"
                + "Licensed under Eclipse Public License (EPL).<br><br>"
                + "This software contains modules licenced under<br>"
                + " the Apache Software Foundation 2.0 license (ASF) and EPL<br><br>"
                + "Many thanks to Chris Brind, Neil Bartlett and<br>"
                + " Petter Holmstrm for their OSGi and Vaadin<br>"
                + " related work, blogs, and bundles.<br><br>"
                + "The icons are from the Silk icon set by Mark James<br>"
                + "<a href=\"http://www.famfamfam.com/lab/icons/silk/\">http://www.famfamfam.com/lab/icons/silk/</a>");
        description.setSizeUndefined();
        description.setContentMode(Label.CONTENT_XHTML);

        titleLayout.addComponent(description);
        aboutWindow.addComponent(titleLayout);

        @SuppressWarnings("serial")
        Button close = new Button("Close", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                (aboutWindow.getParent()).removeWindow(aboutWindow);
            }

        });
        layout.addComponent(close);
        layout.setComponentAlignment(close, "right");
    }
    return aboutWindow;
}

From source file:com.thingtrack.konekti.map.ui.LicenseView.java

private void buildView() {
    setCaption("Licencia");

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

    mainLayout.addComponent(buildLicenseNodeLayout());

    setContent(mainLayout);
}

From source file:com.thingtrack.konekti.map.ui.SettingsView.java

private void buildView() {
    setCaption("Ajustes");

    mainLayout = new CssLayout();
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);//from   w w  w .j av  a 2s  .c  o m
    mainLayout.setSizeFull();

    mainLayout.addComponent(buildMenuAboutLayout());
    mainLayout.addComponent(buildEmailNodeLayout());

    setContent(mainLayout);
}

From source file:com.thingtrack.myToolbar.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    setTheme("konekti");

    mainWindow = new Window("My dynamic toolbar");
    mainWindow.setStyleName("background");

    toolbarLayout = new CssLayout() {

        int brickCounter = 0;

        @Override/* ww  w.  j a va2 s  .  co  m*/
        protected String getCss(Component c) {

            // colorize every third rendered brick
            if (c instanceof Brick) {
                brickCounter++;
                if (brickCounter % 3 == 0) {
                    // make every third brick colored and italic
                    return "color: #ff6611; font-style: italic;";
                }
            }
            return null;
        }

        public void removeComponent(Component c) {

            brickCounter--;
            super.removeComponent(c);
        };
    };

    toolbarLayout.setStyleName("toolbar_layout");
    toolbarLayout.setWidth("100%");

    mainWindow.addComponent(toolbarLayout);

    setMainWindow(mainWindow);

    //Buttons
    HorizontalLayout buttonLayout = new HorizontalLayout();
    mainWindow.addComponent(buttonLayout);

    Button btnAddToolbar = new Button("Add Toolbar");
    btnAddToolbar.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {

            //               toolbarLayout.addComponent(new NavigationToolbar());
            //               toolbarLayout.addComponent(new Brick());
            //               toolbarLayout.addComponent(new SimplifiedNavigationToolbar());
            CssLayout layout = new CssLayout();
            layout.setStyleName("toolbar");
            layout.addComponent(new Button("Botn 1"));
            layout.addComponent(new Button("Botn 2"));
            layout.addComponent(new Button("Botn 3"));
            toolbarLayout.addComponent(layout);

        }
    });

    buttonLayout.addComponent(btnAddToolbar);

    Button btnBoxToolbar = new Button("Box Toolbar");
    btnBoxToolbar.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            //toolbarLayout2.addToolbar(new BoxToolbar());
            toolbarLayout.addComponent(new BoxToolbar());

        }
    });

    buttonLayout.addComponent(btnBoxToolbar);

    Button btnRemoveToolbar = new Button("Remove Toolbar");
    btnRemoveToolbar.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            //               if (toolBarPanel.getToolbarLayout().getToolbars().length == 0)
            //                  return;
            //               
            //               Component toolbar = toolBarPanel.getToolbarLayout().getToolbars()[toolBarPanel.getToolbarLayout().getToolbars().length - 1];
            //               
            //               toolbarLayout.removeComponent((CustomComponent) toolbar);

            if (toolbarLayout.getComponentCount() == 0)
                return;

            toolbarLayout.removeComponent(toolbarLayout.getComponent(toolbarLayout.getComponentCount() - 1));
            //               
        }
    });

    buttonLayout.addComponent(btnRemoveToolbar);
}

From source file:com.wintindustries.pfserver.interfaces.container.components.PFUpload.PFDDragAndDropUpload.java

public PFDDragAndDropUpload() {
    this.setSizeFull();
    this.setId("DragDropWrapper");
    contentArea = new CssLayout();
    contentArea.setSizeFull();//from w ww .j a va 2s.c om
    //  addComponent(contentArea);
    prepareDropZone();
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

private Component buildContent() {
    final CssLayout menuContent = new CssLayout();
    menuContent.addStyleName("sidebar");
    menuContent.addStyleName(ValoTheme.MENU_PART);
    menuContent.addStyleName("no-vertical-drag-hints");
    menuContent.addStyleName("no-horizontal-drag-hints");
    menuContent.setWidth(null);//from  w  w w.j  av  a2s.c  om
    menuContent.setHeight("100%");

    menuContent.addComponent(buildTitle());
    menuContent.addComponent(buildUserMenu());
    menuContent.addComponent(buildToggleButton());
    menuContent.addComponent(new PFSearchBar());

    reloadFolderUI();
    //   menuContent.addComponent(buildMenuItems());
    menuContent.addComponent(folderUI);

    return menuContent;
}

From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

private Component buildFolderUI() {
    final CssLayout folderUIComponent = new CssLayout();
    folderUIComponent.setWidth("100%");
    folderUIComponent.addComponent(buildFolderTree());
    return folderUIComponent;

}