Example usage for com.vaadin.ui.themes ValoTheme UI_WITH_MENU

List of usage examples for com.vaadin.ui.themes ValoTheme UI_WITH_MENU

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme UI_WITH_MENU.

Prototype

String UI_WITH_MENU

To view the source code for com.vaadin.ui.themes ValoTheme UI_WITH_MENU.

Click Source Link

Document

When you use the Valo menu and wish to enable responsive features of the menu, you need to add this style name to the UI containing the menu.

Usage

From source file:org.eclipse.hawkbit.ui.AbstractHawkbitUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest vaadinRequest) {
    LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId());
    if (pushStrategy != null) {
        pushStrategy.init(getUI());//from   w w  w.  ja v  a2 s  . co  m
    }
    addDetachListener(this);
    SpringContextHelper.setContext(context);

    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);
    setResponsive(Boolean.TRUE);

    final HorizontalLayout rootLayout = new HorizontalLayout();
    rootLayout.setSizeFull();

    HawkbitCommonUtil.initLocalization(this, uiProperties.getLocalization(), i18n);

    dashboardMenu.init();
    dashboardMenu.setResponsive(true);

    final VerticalLayout contentVerticalLayout = new VerticalLayout();
    contentVerticalLayout.setSizeFull();
    contentVerticalLayout.setStyleName("main-content");
    contentVerticalLayout.addComponent(buildHeader());
    contentVerticalLayout.addComponent(buildViewTitle());

    final Panel content = buildContent();
    contentVerticalLayout.addComponent(content);
    contentVerticalLayout.setExpandRatio(content, 1);

    rootLayout.addComponent(dashboardMenu);
    rootLayout.addComponent(contentVerticalLayout);
    rootLayout.setExpandRatio(contentVerticalLayout, 1);
    setContent(rootLayout);

    final Navigator navigator = new Navigator(this, content);
    navigator.addViewChangeListener(new ViewChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean beforeViewChange(final ViewChangeEvent event) {
            return true;
        }

        @Override
        public void afterViewChange(final ViewChangeEvent event) {
            final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName());
            dashboardMenu.postViewChange(new PostViewChangeEvent(view));
            if (view == null) {
                viewTitle.setCaption(null);
                return;
            }
            viewTitle.setCaption(view.getDashboardCaptionLong());
            notificationUnreadButton.setCurrentView(event.getNewView());
        }
    });

    navigator.setErrorView(errorview);
    navigator.addProvider(new ManagementViewProvider());
    setNavigator(navigator);
    navigator.addView(EMPTY_VIEW, new Navigator.EmptyView());

    if (UI.getCurrent().getErrorHandler() == null) {
        UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler());
    }

    LOG.info("Current locale of the application is : {}", getLocale());
}

From source file:org.eclipse.hawkbit.ui.HawkbitUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest vaadinRequest) {
    LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId());
    if (pushStrategy != null) {
        pushStrategy.init(getUI());/*from   ww  w .  ja  v a  2 s  . co m*/
    }
    addDetachListener(this);
    SpringContextHelper.setContext(context);

    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);
    setResponsive(Boolean.TRUE);

    final HorizontalLayout rootLayout = new HorizontalLayout();
    rootLayout.setSizeFull();

    dashboardMenu.init();
    dashboardMenu.setResponsive(true);

    final VerticalLayout contentVerticalLayout = new VerticalLayout();
    contentVerticalLayout.setSizeFull();
    contentVerticalLayout.setStyleName("main-content");
    contentVerticalLayout.addComponent(buildHeader());
    contentVerticalLayout.addComponent(buildViewTitle());

    final Panel content = buildContent();
    contentVerticalLayout.addComponent(content);
    contentVerticalLayout.setExpandRatio(content, 1);

    rootLayout.addComponent(dashboardMenu);
    rootLayout.addComponent(contentVerticalLayout);
    rootLayout.setExpandRatio(contentVerticalLayout, 1);
    setContent(rootLayout);

    final Navigator navigator = new Navigator(this, content);
    navigator.addViewChangeListener(new ViewChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean beforeViewChange(final ViewChangeEvent event) {
            return true;
        }

        @Override
        public void afterViewChange(final ViewChangeEvent event) {
            final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName());
            dashboardMenu.postViewChange(new PostViewChangeEvent(view));
            if (view == null) {
                viewTitle.setCaption(null);
                return;
            }
            viewTitle.setCaption(view.getDashboardCaptionLong());
            notificationUnreadButton.setCurrentView(event.getNewView());
        }
    });

    navigator.setErrorView(errorview);
    navigator.addProvider(new ManagementViewProvider());
    setNavigator(navigator);
    navigator.addView(EMPTY_VIEW, new Navigator.EmptyView());
    // set locale is required for I18N class also, to get the locale from
    // cookie
    final String locale = getLocaleId(SPUIDefinitions.getAvailableLocales());
    setLocale(new Locale(locale));

    if (UI.getCurrent().getErrorHandler() == null) {
        UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler());
    }

    LOG.info("Current locale of the application is : {}", HawkbitCommonUtil.getLocale());
}

From source file:org.geant.sat.ui.MainUI.java

License:BSD License

/**
 * Initialize Main UI./*from  w w w. jav a 2 s  .co  m*/
 */
@Override
protected void init(VaadinRequest vaadinRequest) {
    addStyleName(ValoTheme.UI_WITH_MENU);
    initLanguageBundle();
    user.setSatApiClient(satApiClient);
    navigator = new Navigator(this, this);
    StartView startView = new StartView(this);
    MainView mainView = new MainView(this);
    navigator.addView(STARTVIEW, startView);
    navigator.addView(MAINVIEW, mainView);
    navigator.navigateTo(STARTVIEW);
}

From source file:org.ikasan.dashboard.ui.IkasanUI.java

License:BSD License

@Override
protected void init(VaadinRequest request) {
    VaadinSession.getCurrent().setAttribute(DashboardSessionValueConstants.TOPOLOGY_STATE_CACHE,
            this.topologyStateCache);

    addStyleName(ValoTheme.UI_WITH_MENU);

    this.mainLayout.setSizeFull();
    this.setContent(this.mainLayout);

    this.imagePanelLayout.removeAllComponents();
    this.imagePanelLayout.setHeight("70px");

    this.mainLayout.removeAllComponents();
    this.mainLayout.addComponent(imagePanelLayout, 0, 0);

    this.imagePanelLayout.setStyleName("v-header");

    this.imagePanelLayout.addComponent(this.bannerImage);
    this.bannerImage.setHeight("150%");
    this.imagePanelLayout.setExpandRatio(this.bannerImage, 0.5f);

    this.bannerLabel.setStyleName("ikasan-maroon");
    this.bannerLabel.setHeight("100%");
    this.imagePanelLayout.addComponent(this.bannerLabel);
    this.imagePanelLayout.setExpandRatio(this.bannerLabel, 0.5f);
    this.imagePanelLayout.setComponentAlignment(this.bannerLabel, Alignment.BOTTOM_LEFT);

    this.mainLayout.addComponent(navigationPanel, 0, 1);

    loadTopLevelNavigator();/*  w  w w.  jav a 2 s .  c  om*/
    buildContent();
    this.menuLayout.addMenu(this.menuContent);
    this.mainLayout.addComponent(this.menuLayout, 0, 2);

    this.mainLayout.setRowExpandRatio(2, 1);

    this.navigationPanel.resetCurrentView();
    this.navigationPanel.setToggleButton(buildToggleButton());

    for (Component component : menu.getMenuComponents().keySet()) {
        component.setVisible(false);
    }

    this.navigationPanel.setMenuComponents(menu.getMenuComponents());

    UI.getCurrent().getNavigator().navigateTo("landingView");
    this.navigationPanel.setVisible(true);
}

From source file:uk.co.intec.keyDatesApp.MainUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    try {/*from w  ww.j a  v a 2 s . c  o m*/
        setRequest(request);

        Responsive.makeResponsive(this);

        addStyleName(ValoTheme.UI_WITH_MENU);

        getPage().setTitle("Key Dates App");

        setStyleName("main-screen");

        final VerticalLayout layout = new VerticalLayout();
        setHeader(new HeaderComponent(this));
        layout.addComponent(getHeader());
        setContent(layout);

        setBody(new VerticalLayout());
        getBody().setMargin(new MarginInfo(false, true, false, true));
        layout.addComponent(getBody());

        setUiNavigator(new Navigator(this, body));
        getUiNavigator().setErrorView(ErrorView.class);

        addNewMenuItem(HomeView.VIEW_NAME, HomeView.VIEW_LABEL, new HomeView());
        addNewMenuItem(MainView.VIEW_NAME, MainView.VIEW_LABEL, new MainView());
        addNewMenuItem(CalendarView.VIEW_NAME, CalendarView.VIEW_LABEL, new CalendarView());
        addNewMenuItem(KeyDateView.VIEW_NAME, KeyDateView.VIEW_LABEL, new KeyDateView());

        if (!GenericDatabaseUtils.doesDbExist() || "Anonymous".equals(GenericDatabaseUtils.getUserName())) {
            getUiNavigator().navigateTo(HomeView.VIEW_NAME);
        }
    } catch (final Exception e) {
        e.printStackTrace();
    }

}