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:com.github.tempora.view.TemporaUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    setLocale(Locale.US);/*  w ww .  j  a  va2s.  c  o  m*/
    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);

    setContent(mainView);

    // Update the user profile
    Profile profile = currentUser.getProfile().get();
    if (profile == null)
        return;

    mainView.getCurrentUserEmail().setValue(profile.getEmailAddress());
    mainView.getCurrentHistoryId().setValue(profile.getHistoryId().toString());
    mainView.getMessagesTotal().setValue(profile.getMessagesTotal().toString());
    mainView.getThreadsTotal().setValue(profile.getThreadsTotal().toString());

    // Using Vaadin Push to fetch the Mailbox statistics
    // out of RDF4J store
    top5JobHandle = executorService.scheduleWithFixedDelay(updateTop5Job, 500, 3000, TimeUnit.MILLISECONDS);
    generalInfoJobHandle = executorService.scheduleWithFixedDelay(updateGeneralInfoJob, 500, 3000,
            TimeUnit.MILLISECONDS);
}

From source file:com.hybridbpm.ui.HybridbpmUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    Responsive.makeResponsive(this);
    setLocale(request.getLocale());//  ww  w.  ja  v a  2s .c om
    dashboardListenerId = HazelcastServer.getDashboardEventTopic()
            .addMessageListener(new DashBoardMessageListener(this));
    addStyleName(ValoTheme.UI_WITH_MENU);

    mainLayout.setExpandRatio(viewContent, 1f);
    mainLayout.setSizeFull();
    mainLayout.addStyleName("mainview");
    viewContent.setSizeFull();
    viewContent.addStyleName("view-content");
    rootLayout.setSizeFull();
    updateContent();
}

From source file:com.selzlein.lojavirtual.vaadin.core.LspsUI.java

License:Open Source License

@Override
public void init(VaadinRequest request) {
    Responsive.makeResponsive(this);
    getUI().addStyleName(ValoTheme.UI_WITH_MENU);

    //register self for error handling
    setErrorHandler(this);

    connector = new LspsAppConnectorImpl(this);
    connector.getInjector().inject(this);

    initLayout();/*from  w  w  w. j a  v a2s .co  m*/
}

From source file:com.toptal.ui.VaadinUI.java

License:Open Source License

@Override
public void init(final VaadinRequest request) {
    Responsive.makeResponsive(this);
    this.addStyleName(ValoTheme.UI_WITH_MENU);
    this.update();
}

From source file:de.kaiserpfalzEdv.vaadin.PiraccUI.java

License:Apache License

protected void showMainView() {
    HorizontalLayout screen = new HorizontalLayout();

    CssLayout viewContainer = new CssLayout();
    viewContainer.addStyleName("valo-content");
    viewContainer.setSizeFull();/* ww  w . j  ava 2s. c o  m*/

    screen.setStyleName("main-screen");
    screen.addComponent(menu);
    screen.addComponent(viewContainer);
    screen.setExpandRatio(viewContainer, 1);
    screen.setSizeFull();

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);

    addStyleName(ValoTheme.UI_WITH_MENU);
    setContent(screen);

    if (isNotBlank(getNavigator().getState())) {
        getNavigator().navigateTo(getNavigator().getState());
    }

    menu.generate();
}

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

License:Open Source License

protected void initMainScreen() {
    addStyleName(ValoTheme.UI_WITH_MENU);
    setContent(new MainScreen(SormasUI.this));
}

From source file:ed.cracken.pos.ui.ApplicationUI.java

protected void showMainView() {
    addStyleName(ValoTheme.UI_WITH_MENU);
    setContent(new MainScreen(ApplicationUI.this));
    getNavigator().navigateTo(getNavigator().getState());
}

From source file:fr.amapj.view.engine.ui.AmapUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    logger.info("Demarrage d'une nouvelle session:" + getSession().getCsrfToken());

    // Register broadcast listener
    SessionManager.register(this);

    ////from  www .ja v a  2  s. c om
    setErrorHandling();

    //
    setLocale(Locale.FRANCE);

    // Rcupration du nom de la base et vrification de celui ci 
    String dbName = getDbName(request);
    DataBaseInfo dataBaseInfo = DbUtil.findDataBaseFromName(dbName);
    if (dataBaseInfo == null) {
        String contextPath = AppConfiguration.getConf().getContextPath();
        getPage().setLocation(contextPath + "/infoservlet/liste-amaps");
        return;
    }
    if (dataBaseInfo.getState() != AppState.ON) {
        String contextPath = AppConfiguration.getConf().getContextPath();
        getPage().setLocation(contextPath + "/infoservlet/maintenance");
        return;
    }

    // Cration du contexte et enregistrement du nom de la base
    SessionManager.initSessionData(dataBaseInfo);

    // Mode test
    String testClass = getTestClass();
    if (testClass != null) {
        invokeTestClass(testClass, request);
        return;
    }

    String username = request.getParameter("username");
    String password = request.getParameter("password");
    String sudo = request.getParameter("sudo");

    String resetPasswordSalt = request.getParameter("resetPassword");
    if (resetPasswordSalt != null) {
        saisieNewPassword(resetPasswordSalt);
    }

    // Affichage graphique 
    Responsive.makeResponsive(this);
    setContent(root);
    root.setSizeFull();
    addStyleName(ValoTheme.UI_WITH_MENU);

    // Construction de la page de login
    buildLoginView(username, password, sudo);

}

From source file:io.mateu.ui.vaadin.framework.MyUI.java

License:Apache License

/**
 * por aqu entramos. se llama al inicio, cuando refrescamos la pgina (si no est anotado @preserveonrefresh) o la abrimos en otra pestaa
 * @param request/*www  .  j  ava  2  s  .  c om*/
 */
@Override
protected void init(VaadinRequest request) {

    /*
    inicializamos la configuracin del tooltip para las ayudas
     */
    TooltipConfiguration ttc = super.getTooltipConfiguration();
    ttc.setOpenDelay(200);
    ttc.setQuickOpenDelay(300);
    ttc.setQuickOpenTimeout(300);

    /*
    si no tenemos la app en la sesin, entonces la buscamos utilizando SPI y la metemos en la sesin
     */
    if (getApp() == null) {
        Iterator<App> apps = ServiceLoader.load(App.class).iterator();

        while (apps.hasNext()) {
            setApp((AbstractApplication) apps.next());
            System.out.println("app " + getApp().getName() + " loaded");
            break;
        }

        String u = "" + Page.getCurrent().getLocation();
        if (u.contains("#"))
            u = u.substring(0, u.indexOf("#"));

        if (getApp() == null) {

            // creamos una app al vuelo para probar la interfaz

            setApp(new AbstractApplication() {
                @Override
                public String getName() {
                    return "Test app";
                }

                @Override
                public List<AbstractArea> buildAreas() {
                    return Lists.newArrayList(new AbstractArea("Area 1") {
                        @Override
                        public List<AbstractModule> buildModules() {
                            return Lists.newArrayList(new AbstractModule() {
                                @Override
                                public String getName() {
                                    return "Mdulo 1";
                                }

                                @Override
                                public List<MenuEntry> buildMenu() {
                                    return Lists.newArrayList(new AbstractAction("Opcin 1") {
                                        @Override
                                        public void run() {
                                            io.mateu.ui.core.client.app.MateuUI.alert("hola!");
                                        }
                                    });
                                }
                            });
                        }
                    });
                }
            });

        }

        getApp().setBaseUrl(u);
    }

    /*
    corregimos el acho de la barra izda para IE9
     */
    if (getPage().getWebBrowser().isIE() && getPage().getWebBrowser().getBrowserMajorVersion() == 9) {
        menu.setWidth("320px");
    }

    /*
    ponemos el ttulo de la pgina
     */
    getPage().setTitle(getApp().getName());

    /*
    fijamos el componente root como contenido de la pgina y lo ajustamos al 100% del ancho de la pgina
     */
    setContent(root);
    root.setWidth("100%");

    /*
    creamos un navigator
     */
    navigator = new Navigator(this, viewDisplay);

    /*
    aadimos el componente men
     */
    root.addMenu(buildMenu(request));
    addStyleName(ValoTheme.UI_WITH_MENU);

    /*
    buscamos view providers utilizando SPI. Los view providers convierten de url a vista vaadin
     */
    ServiceLoader<ViewProvider> sl = ServiceLoader.load(ViewProvider.class);

    for (ViewProvider p : sl)
        navigator.addProvider(new com.vaadin.navigator.ViewProvider() {
            @Override
            public String getViewName(String viewNameAndParameters) {
                return p.getViewName(viewNameAndParameters);
            }

            @Override
            public View getView(String viewName) {
                return getVaadinView(p.getView(viewName));
            }
        });

    /*
    actualizar los settings (datos del usuario en la parte izda)
     */
    refreshSettings();

    /*
    ponemos una vista por defecto
     */
    navigator.setErrorView(HomeView.class);

    /*
    aadimos un listener para cuando cambia la url. Aqu es donde se gestiona la navegacin
     */
    navigator.addViewChangeListener(new ViewChangeListener() {

        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
            /*
            aqu controlamos si el usuario tiene acceso a esta vista
             */
            boolean ok = true;

            return ok;
        }

        @Override
        public void afterViewChange(ViewChangeEvent event) {

            View v = event.getNewView();
            if (v instanceof ViewLayout) {

                ViewLayout vl = (ViewLayout) v;

                if (!vl.getView().isGranted()) { // esta opcin no est en nuestro men, as que pedimos login
                    openLoginDialog(false);
                } else {

                    vl.getView().addListener(new ViewListener() {
                        @Override
                        public void onClose() {
                            UI.getCurrent().getPage().getJavaScript().execute("history.back()");
                        }
                    });

                    if (vl.getView() instanceof AbstractEditorView) {
                        Object id = null;
                        if (id != null) {
                            ((AbstractEditorView) vl.getView()).setInitialId(id);
                            ((AbstractEditorView) vl.getView()).load();
                        }
                    } else if (vl.getView() instanceof AbstractListView) {
                        AbstractListView lv = (AbstractListView) vl.getView();
                        Data data = null;

                        int page = 0;
                        String s = vl.getView().getParametros();
                        if (!Strings.isNullOrEmpty(s)) {

                            String d = s;
                            if (s.contains("/")) {
                                d = s.split("/")[0];
                                page = Integer.parseInt(s.split("/")[1]);
                            }

                            data = new Data(new String(BaseEncoding.base64().decode(d)));
                        }

                        if (data != null) {
                            lv.setData(data);
                        }

                        if (lv.isSearchOnOpen() || (data != null && data.getPropertyNames().size() > 0)) {
                            lv.set("_data_currentpageindex", page);
                            List<String> errors = lv.getForm().validate();
                            if (errors.size() > 0) {
                                io.mateu.ui.core.client.app.MateuUI.notifyErrors(errors);
                            } else {
                                lv.rpc();
                            }
                        }

                    }

                    getViewDisplay().removeAllComponents();
                    getViewDisplay().addComponent(v.getViewComponent());

                    refreshMenu(((ViewLayout) v).getView().getArea(), ((ViewLayout) v).getView().getMenu());

                    getPage().setTitle(((ViewLayout) v).getView().getTitle());
                }

            }

            for (Iterator<Component> it = menuItemsLayout.iterator(); it.hasNext();) {
                it.next().removeStyleName("selected");
            }
            menu.removeStyleName("valo-menu-visible");

        }
    });

    /*
    si hemos entrado por la raz y no hay contenidos pblicos, entonces pedir el login inmediatamente
     */
    String f = Page.getCurrent().getUriFragment();
    System.out.println("Page.getCurrent().getUriFragment()=" + f);
    if (f == null || f.equals("")) {
        boolean hayPartePublica = false;
        for (AbstractArea a : getApp().getAreas()) {
            hayPartePublica |= a.isPublicAccess();
        }
        if (!hayPartePublica)
            openLoginDialog(true);
    }

}

From source file:me.uni.emuseo.EMuseoUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    WrappedSession session = request.getWrappedSession();
    HttpSession httpSession = ((WrappedHttpSession) session).getHttpSession();
    ServletContext servletContext = httpSession.getServletContext();
    applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
    securityContext = SecurityContextHolder.getContext();
    authenticationManager = applicationContext.getBean(AuthManager.class);

    getPage().setTitle(PAGE_TITLE);//  w ww. j av  a  2 s.  c  o m
    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);

    navigator = new EMuseoNavigator(this, this, authenticationManager);
    navigator.addView(Permissions.LOGIN_VIEW, LoginView.class);
    navigator.addView(Permissions.MENU_VIEW, MenuView.class);
}