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.haulmont.cuba.web.gui.components.CubaCurrencyField.java

License:Apache License

protected void initLayout() {
    container = new CssLayout();
    container.setSizeFull();/*from  w w w.j  av  a 2  s .  c  o  m*/
    container.setPrimaryStyleName(CURRENCYFIELD_LAYOUT_STYLENAME);

    container.addComponent(currencyLabel);

    if (useWrapper()) {
        ie9InputWrapper = new CssLayout(textField);
        ie9InputWrapper.setSizeFull();
        ie9InputWrapper.setPrimaryStyleName(IE9_INPUT_WRAP_STYLENAME);

        container.addComponent(ie9InputWrapper);
    } else {
        container.addComponent(textField);
    }

    setFocusDelegate(textField);
}

From source file:com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea.java

License:Apache License

public WebAppWorkArea() {
    component = new CssLayout();
    component.setPrimaryStyleName(WORKAREA_STYLENAME);
    component.addStyleName(MODE_TABBED_STYLENAME);
    component.addStyleName(STATE_INITIAL_STYLENAME);

    ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME);
    setInitialLayout(cf.createComponent(VBoxLayout.class));

    tabbedContainer = createTabbedModeContainer();

    UserSettingsTools userSettingsTools = AppBeans.get(UserSettingsTools.NAME);
    setMode(userSettingsTools.loadAppWindowMode());
}

From source file:com.haulmont.cuba.web.gui.components.mainwindow.WebFtsField.java

License:Apache License

public WebFtsField() {
    component = new CssLayout();
    component.setPrimaryStyleName(FTS_FIELD_STYLENAME);

    ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME);
    com.haulmont.cuba.gui.components.TextField searchFieldComponent = cf
            .createComponent(com.haulmont.cuba.gui.components.TextField.class);
    searchField = (TextField) WebComponentsHelper.unwrap(searchFieldComponent);
    searchField.setStyleName("c-ftsfield-text");

    AppUI ui = AppUI.getCurrent();//from   w ww . j  a  v a  2 s.  c  o  m
    if (ui.isTestMode()) {
        searchField.setCubaId("ftsField");
        searchField.setId(ui.getTestIdManager().reserveId("ftsField"));
    }
    searchField.addShortcutListener(
            new ShortcutListener("fts", com.vaadin.event.ShortcutAction.KeyCode.ENTER, null) {
                @Override
                public void handleAction(Object sender, Object target) {
                    openSearchWindow();
                }
            });

    searchBtn = new CubaButton();
    searchBtn.setStyleName("c-ftsfield-button");
    searchBtn.setIcon(WebComponentsHelper.getIcon("app/images/fts-button.png"));
    searchBtn.addClickListener((Button.ClickListener) event -> openSearchWindow());

    component.addComponent(searchField);
    component.addComponent(searchBtn);

    adjustHeight();
    adjustWidth();
}

From source file:com.haulmont.cuba.web.gui.components.WebAbstractTree.java

License:Apache License

public void initComponent(CubaTree component) {
    componentComposition = new CssLayout();
    componentComposition.setPrimaryStyleName("c-tree-composition");
    componentComposition.setWidthUndefined();
    componentComposition.addComponent(component);

    component.setSizeFull();/*from  w  w w  . j  ava 2 s  .  com*/

    component.addShortcutListener(
            new ShortcutListener("tableEnter", com.vaadin.event.ShortcutAction.KeyCode.ENTER, null) {
                @Override
                public void handleAction(Object sender, Object target) {
                    if (target == WebAbstractTree.this.component) {
                        if (enterPressAction != null) {
                            enterPressAction.actionPerform(WebAbstractTree.this);
                        } else {
                            handleClickAction();
                        }
                    }
                }
            });
}

From source file:com.haulmont.cuba.web.sys.WindowBreadCrumbs.java

License:Apache License

protected Layout createEnclosingLayout() {
    Layout enclosingLayout = new CssLayout();
    enclosingLayout.setPrimaryStyleName("c-breadcrumbs-container");
    return enclosingLayout;
}

From source file:com.haulmont.cuba.web.sys.WindowBreadCrumbs.java

License:Apache License

protected Layout createLinksLayout() {
    CssLayout linksLayout = new CssLayout();
    linksLayout.setPrimaryStyleName("c-breadcrumbs");
    return linksLayout;
}

From source file:com.haulmont.cuba.web.sys.WindowBreadCrumbs.java

License:Apache License

protected Layout createLogoLayout() {
    CssLayout logoLayout = new CssLayout();
    logoLayout.setPrimaryStyleName("c-breadcrumbs-logo");
    return logoLayout;
}

From source file:com.haulmont.cuba.web.toolkit.ui.CubaPickerField.java

License:Apache License

protected void initLayout() {
    container = new CubaCssActionsLayout();
    container.setPrimaryStyleName("c-pickerfield-layout");

    field.setWidth(100, Unit.PERCENTAGE);

    Page current = Page.getCurrent();//  w w  w . j  a  va 2s. c o  m
    if (current != null) {
        WebBrowser browser = current.getWebBrowser();
        if (browser != null
                && (browser.isIE() && browser.getBrowserMajorVersion() <= 10 || browser.isSafari())) {
            ie9InputWrapper = new CssLayout();
            ie9InputWrapper.setWidth(100, Unit.PERCENTAGE);
            ie9InputWrapper.setPrimaryStyleName("ie9-input-wrap");
            ie9InputWrapper.addComponent(field);

            container.addComponent(ie9InputWrapper);
        } else {
            container.addComponent(field);
        }
    } else {
        container.addComponent(field);
    }

    if (App.isBound()) {
        ThemeConstants theme = App.getInstance().getThemeConstants();
        setWidth(theme.get("cuba.web.CubaPickerField.width"));
    }

    setFocusDelegate(field);
}

From source file:com.haulmont.cuba.web.WebWindowManager.java

License:Apache License

protected Layout createNewTabLayout(final Window window, final boolean multipleOpen,
        WindowBreadCrumbs breadCrumbs, Component... additionalComponents) {
    Layout layout = new CssLayout();
    layout.setPrimaryStyleName("c-app-window-wrap");
    layout.setSizeFull();/*w  ww  .jav a2  s .  c om*/

    layout.addComponent(breadCrumbs);
    if (additionalComponents != null) {
        for (final Component c : additionalComponents) {
            layout.addComponent(c);
        }
    }

    final Component component = WebComponentsHelper.getComposition(window);
    component.setSizeFull();
    layout.addComponent(component);

    WebAppWorkArea workArea = getConfiguredWorkArea(createWorkAreaContext(window));

    if (workArea.getMode() == Mode.TABBED) {
        layout.addStyleName("c-app-tabbed-window");
        TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();

        String tabId;
        Integer hashCode = getWindowHashCode(window);
        ComponentContainer tab = null;
        if (hashCode != null) {
            tab = findTab(hashCode);
        }
        if (tab != null && !multipleOpen) {
            tabSheet.replaceComponent(tab, layout);
            tabSheet.removeComponent(tab);
            tabs.put(layout, breadCrumbs);
            tabId = tabSheet.getTab(layout);
        } else {
            tabs.put(layout, breadCrumbs);

            tabId = "tab_" + uuidSource.createUuid();

            tabSheet.addTab(layout, tabId);

            if (ui.isTestMode()) {
                String id = "tab_" + window.getId();

                tabSheet.setTabTestId(tabId, ui.getTestIdManager().getTestId(id));
                tabSheet.setTabCubaId(tabId, id);
            }
        }
        String windowContentSwitchMode = window.getContentSwitchMode().name();
        ContentSwitchMode contentSwitchMode = ContentSwitchMode.valueOf(windowContentSwitchMode);
        tabSheet.setContentSwitchMode(tabId, contentSwitchMode);

        String formattedCaption = formatTabCaption(window.getCaption(), window.getDescription());
        tabSheet.setTabCaption(tabId, formattedCaption);
        String formattedDescription = formatTabDescription(window.getCaption(), window.getDescription());
        if (!Objects.equals(formattedCaption, formattedDescription)) {
            tabSheet.setTabDescription(tabId, formattedDescription);
        } else {
            tabSheet.setTabDescription(tabId, null);
        }

        tabSheet.setTabIcon(tabId, WebComponentsHelper.getIcon(window.getIcon()));
        tabSheet.setTabClosable(tabId, true);
        tabSheet.setTabCloseHandler(layout, (targetTabSheet, tabContent) -> {
            //noinspection SuspiciousMethodCalls
            WindowBreadCrumbs breadCrumbs1 = tabs.get(tabContent);

            if (!canWindowBeClosed(breadCrumbs1.getCurrentWindow())) {
                return;
            }

            Runnable closeTask = new TabCloseTask(breadCrumbs1);
            closeTask.run();

            // it is needed to force redraw tabsheet if it has a lot of tabs and part of them are hidden
            targetTabSheet.markAsDirty();
        });
        tabSheet.setSelectedTab(layout);
    } else {
        tabs.put(layout, breadCrumbs);
        layout.addStyleName("c-app-single-window");

        VerticalLayout mainLayout = workArea.getSingleWindowContainer();
        mainLayout.removeAllComponents();
        mainLayout.addComponent(layout);
    }

    return layout;
}

From source file:com.hivesys.dashboard.view.search.TextualView.java

public TextualView() {
    this.setSizeFull();
    css = new CssLayout();
    css.setStyleName("search-textual-view");

    this.setContent(css);
}