Example usage for com.vaadin.ui CssLayout setPrimaryStyleName

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

Introduction

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

Prototype

@Override
    public void setPrimaryStyleName(String style) 

Source Link

Usage

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:de.symeda.sormas.ui.SubMenu.java

License:Open Source License

public void addView(final String name, String caption, String params, boolean isBackNavigation) {
    String target = "#!" + name + (params != null ? "/" + params : "");

    CssLayout tabItemCell = new CssLayout();
    tabItemCell.setSizeUndefined();//from  w  w w .  j a  va2  s.  c o m
    tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell");

    CssLayout tabItem = new CssLayout();
    tabItem.setSizeUndefined();
    tabItem.setPrimaryStyleName("v-tabsheet-tabitem");
    if (isBackNavigation) {
        tabItem.addStyleName("back");
    }
    tabItemCell.addComponent(tabItem);

    Link link = new Link(caption, new ExternalResource(target));
    link.addStyleName("v-caption");
    if (isBackNavigation)
        link.setIcon(VaadinIcons.ARROW_CIRCLE_LEFT);
    tabItem.addComponent(link);

    menuItemsLayout.addComponent(tabItemCell);
    viewMenuItemMap.put(name, tabItem);
}

From source file:de.symeda.sormas.ui.SubMenu.java

License:Open Source License

public void addView(final String name, String caption, LayoutClickListener onClick) {
    CssLayout tabItemCell = new CssLayout();
    tabItemCell.setSizeUndefined();//ww w .  j  a va 2s  . com
    tabItemCell.setPrimaryStyleName("v-tabsheet-tabitemcell");

    CssLayout tabItem = new CssLayout();
    tabItem.setSizeUndefined();
    tabItem.setPrimaryStyleName("v-tabsheet-tabitem");
    tabItemCell.addComponent(tabItem);

    Link link = new Link(caption, null);
    link.addStyleName("v-caption");

    tabItem.addComponent(link);
    tabItem.addLayoutClickListener(onClick);
    tabItem.addLayoutClickListener((e) -> {
        this.setActiveView(name);
    });

    menuItemsLayout.addComponent(tabItemCell);
    viewMenuItemMap.put(name, tabItem);
}

From source file:fr.amapj.view.engine.menu.MenuPart.java

License:Open Source License

private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus,
        Navigator navigator, AmapUI ui) {

    final HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName("valo-menu-title");
    menu.addComponent(top);//from  ww w .j a  v a2 s  . co  m

    final Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    String nomAmap = new ParametresService().getParametres().nomAmap;
    Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");

    SessionParameters p = SessionManager.getSessionParameters();
    MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null);
    settingsItem.addItem("Se dconnecter", new MenuBar.Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            new PasswordManager().disconnect();
            ui.buildLoginView(null, null, null);
        }
    });

    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    boolean first = true;
    String firstEntry = null;
    Button firstButton = null;

    for (MenuDescription menuDescription : allMenus) {
        final String view = menuDescription.getMenuName().name().toLowerCase();
        final String titleView = menuDescription.getMenuName().getTitle();

        if (menuDescription.getCategorie() != null) {
            Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML);
            l.setPrimaryStyleName("valo-menu-subtitle");
            l.addStyleName("h4");
            l.setSizeUndefined();
            menuItemsLayout.addComponent(l);
        }

        final Button b = new Button(titleView, new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                setSelected(event.getButton(), menuItemsLayout);
                navigator.navigateTo("/" + view);
            }
        });

        b.setId("amapj.menu." + view);
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName("valo-menu-item");
        b.setIcon(menuDescription.getMenuName().getFont());
        menuItemsLayout.addComponent(b);

        viewNameToMenuButton.put("/" + view, b);

        if (first) {
            first = false;
            firstButton = b;
            firstEntry = view;
        }
    }

    // Gestion de l'url
    String f = Page.getCurrent().getUriFragment();
    if (f != null && f.startsWith("!")) {
        f = f.substring(1);
    }
    if (f == null || f.equals("") || f.equals("/")) {
        navigateWithProtect(navigator, "/" + firstEntry);
        setSelected(firstButton, menuItemsLayout);
    } else {
        navigateWithProtect(navigator, f);
        setSelected(viewNameToMenuButton.get(f), menuItemsLayout);
    }

    return menu;
}

From source file:org.opencms.ui.apps.CmsFileExplorer.java

License:Open Source License

/**
 * @see org.opencms.ui.apps.I_CmsWorkplaceApp#initUI(org.opencms.ui.apps.I_CmsAppUIContext)
 *///from   ww  w. j  av  a2 s .  co  m
public void initUI(I_CmsAppUIContext context) {

    m_appContext = context;
    m_appContext.setMenuDialogContext(
            new CmsExplorerDialogContext(ContextType.appToolbar, m_fileTable, this, null));
    HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setSizeFull();
    sp.setFirstComponent(m_fileTree);
    CmsFileExplorerSettings settings;
    try {
        settings = OpenCms.getWorkplaceAppManager().getAppSettings(A_CmsUI.getCmsObject(),
                CmsFileExplorerSettings.class);

        m_fileTable.setTableState(settings);
    } catch (Exception e) {
        LOG.error("Error while reading file explorer settings from user.", e);
    }
    sp.setSecondComponent(m_fileTable);

    sp.setSplitPosition(LAYOUT_SPLIT_POSITION, Unit.PIXELS);

    context.setAppContent(sp);
    context.showInfoArea(true);
    HorizontalLayout inf = new HorizontalLayout();
    inf.setSizeFull();
    inf.setSpacing(true);
    inf.setMargin(true);
    m_siteSelector.setWidth("379px");
    inf.addComponent(m_siteSelector);
    CssLayout crumbWrapper = new CssLayout();
    crumbWrapper.setSizeFull();
    crumbWrapper.setPrimaryStyleName(OpenCmsTheme.CRUMB_WRAPPER);
    crumbWrapper.addComponent(m_crumbs);

    m_infoPath.setWidth("100%");
    crumbWrapper.addComponent(m_infoPath);
    inf.addComponent(crumbWrapper);
    inf.setExpandRatio(crumbWrapper, 1);

    m_searchField.setWidth("200px");
    inf.addComponent(m_searchField);
    context.setAppInfo(inf);

    initToolbarButtons(context);
    m_fileTable.updateColumnWidths(A_CmsUI.get().getPage().getBrowserWindowWidth() - LAYOUT_SPLIT_POSITION);
}

From source file:org.opennms.features.vaadin.surveillanceviews.ui.SurveillanceView.java

License:Open Source License

/**
 * Set the view to be displayed by this component.
 *
 * @param view the view to be displayed//from   w ww .  ja va 2  s  .c o m
 */
public void setView(View view) {
    /**
     * set the field
     */
    m_view = view;

    /**
     * check whether refreshing is enabled
     */
    m_refreshEnabled = (m_view.getRefreshSeconds() > 0);
    m_countdown = m_view.getRefreshSeconds();

    /**
     * alter the table header
     */
    m_surveillanceViewTableHeader.setCaptionText("Surveillance view: " + m_view.getName());
    m_surveillanceViewTableHeader.select(m_view.getName());
    m_surveillanceViewTableHeader.getNativeSelect().setEnabled(m_enabled);

    /**
     * remove old components
     */
    removeAllComponents();

    /**
     * create the layout
     */
    upperLayout = new VerticalLayout();
    upperLayout.setId("surveillance-window");
    upperLayout.setSpacing(false);

    /**
     * create surveillance view table...
     */
    m_surveillanceViewTable = new SurveillanceViewTable(m_view, m_surveillanceViewService, m_dashboard,
            m_enabled);

    /**
     * ...and add the header and the table itself
     */

    upperLayout.addComponent(new Label("<div id=\"surveillanceview\"/>", ContentMode.HTML));
    upperLayout.addComponent(m_surveillanceViewTableHeader);
    upperLayout.addComponent(m_surveillanceViewTable);

    if (!m_dashboard) {
        addComponent(upperLayout);
    } else {
        /**
         * if dashboard should be displayed add the detail tables and components
         */

        CssLayout leftCssLayout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                return "padding-bottom: 6px;";
            }
        };

        leftCssLayout.setPrimaryStyleName("col-md-11");
        leftCssLayout.setId("dashboard-content");

        CssLayout rightCssLayout = new CssLayout();
        rightCssLayout.setPrimaryStyleName("col-md-1");

        lowerLayout = new VerticalLayout();
        lowerLayout.setSpacing(true);

        /**
         * create the tables and components
         */
        SurveillanceViewAlarmTable surveillanceViewAlarmTable = new SurveillanceViewAlarmTable(
                m_surveillanceViewService, m_enabled);
        SurveillanceViewNotificationTable surveillanceViewNotificationTable = new SurveillanceViewNotificationTable(
                m_surveillanceViewService, m_enabled);
        SurveillanceViewNodeRtcTable surveillanceViewNodeRtcTable = new SurveillanceViewNodeRtcTable(
                m_surveillanceViewService, m_enabled);
        SurveillanceViewGraphComponent surveillanceViewGraphComponent = new SurveillanceViewGraphComponent(
                m_surveillanceViewService, m_enabled);

        /**
         * add them to the layout
         */
        surveillanceViewAlarmTable.setId("alarms");
        lowerLayout.addComponent(surveillanceViewAlarmTable);

        surveillanceViewNotificationTable.setId("notifications");
        lowerLayout.addComponent(surveillanceViewNotificationTable);

        surveillanceViewNodeRtcTable.setId("outages");
        lowerLayout.addComponent(surveillanceViewNodeRtcTable);

        surveillanceViewGraphComponent.setId("resourcegraphs");
        lowerLayout.addComponent(surveillanceViewGraphComponent);

        /**
         * associate the detail tables and components with the surveillance view table
         */
        m_surveillanceViewTable.addDetailsTable(surveillanceViewAlarmTable);
        m_surveillanceViewTable.addDetailsTable(surveillanceViewNotificationTable);
        m_surveillanceViewTable.addDetailsTable(surveillanceViewNodeRtcTable);
        m_surveillanceViewTable.addDetailsTable(surveillanceViewGraphComponent);

        /**
         * add the layout to this component
         */
        addComponent(lowerLayout);

        leftCssLayout.addComponent(upperLayout);
        leftCssLayout.addComponent(lowerLayout);

        CssLayout resultsSidebar = new CssLayout();
        resultsSidebar
                .setPrimaryStyleName("resource-graphs-sidebar hidden-print hidden-xs hidden-sm sidebar-fixed");
        resultsSidebar.setId("results-sidebar");

        resultsSidebar.addComponent(new Label("<ul class=\"nav nav-stacked\">\n" + "                <li>\n"
                + "                    <a href=\"#surveillanceview\" data-target=\"#surveillanceview\">Surveillance View</a>\n"
                + "                </li>\n" + "                <li>\n"
                + "                    <a href=\"#alarms\" data-target=\"#alarms\">Alarms</a>\n"
                + "                </li>\n" + "                <li>\n"
                + "                    <a href=\"#notifications\" data-target=\"#notifications\">Notifications</a>\n"
                + "                </li>\n" + "                <li>\n"
                + "                    <a href=\"#outages\" data-target=\"#outages\">Outages</a>\n"
                + "                </li>\n" + "                <li>\n"
                + "                    <a href=\"#resourcegraphs\" data-target=\"#resourcegraphs\">Resource Graphs</a>\n"
                + "                </li>\n" + "            </ul>" + "<script type=\"text/javascript\">\n"
                + "            $('body').scrollspy({ target: '#results-sidebar' });\n" + "</script>\n",
                ContentMode.HTML));

        rightCssLayout.addComponent(resultsSidebar);

        addComponent(leftCssLayout);
        addComponent(rightCssLayout);
    }

}