Example usage for com.vaadin.server Responsive makeResponsive

List of usage examples for com.vaadin.server Responsive makeResponsive

Introduction

In this page you can find the example usage for com.vaadin.server Responsive makeResponsive.

Prototype

public static void makeResponsive(Component... components) 

Source Link

Document

Enable responsive width and height range styling for the target component or UI instance.

Usage

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:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java

public DashboardMenu() {
    setPrimaryStyleName("valo-menu");
    setId(ID);//w w w  . j  ava2  s.  c om
    setSizeUndefined();

    // There's only one DashboardMenu per UI so this doesn't need to be
    // unregistered from the UI-scoped DashboardEventBus.
    DashboardEventBus.register(this);

    //  setCompositionRoot(buildContent());
    Responsive.makeResponsive(this);
}

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

private Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();/*ww  w .  j  a  v a2 s. c  o m*/
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    loginPanel.addComponent(new CheckBox("Remember me", true));
    return loginPanel;
}

From source file:de.fatalix.bookery.AppLayout.java

License:Open Source License

@PostConstruct
private void postInit() {
    setSpacing(false);/* w  w w.ja v  a  2s.  c o m*/
    setMargin(false);
    setSizeFull();

    content = new CssLayout();
    content.setPrimaryStyleName("valo-content");
    content.addStyleName("v-scrollable");
    content.setWidth(100, Unit.PERCENTAGE);

    addComponents(appHeader, content);
    expand(content);
    addAttachListener(new AttachListener() {

        @Override
        public void attach(AttachEvent event) {
            Responsive.makeResponsive(getUI());
        }
    });
}

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

License:Apache License

@Override
protected void init(VaadinRequest vaadinRequest) {
    Responsive.makeResponsive(this);
    setLocale(vaadinRequest.getLocale());
    i18n.setLocale(vaadinRequest.getLocale());
    getPage().setTitle(translate("application.name"));

    if (userStore.getCurrentUser() == null) {
        LOG.info("Starting log-in for session: {}", vaadinRequest.getWrappedSession().getId());

        setContent(new LoginScreen(accessControl, this::showMainView, i18n, bus));
    } else {/* w  w  w. j  a v a 2 s . com*/
        LOG.info("New Request in session: {}", vaadinRequest.getWrappedSession().getId());
        showMainView();
    }
}

From source file:de.symeda.sormas.ui.login.LoginUI.java

License:Open Source License

@Override
public void init(VaadinRequest vaadinRequest) {

    setErrorHandler(SormasErrorHandler.get());
    setLocale(vaadinRequest.getLocale());

    Responsive.makeResponsive(this);

    VaadinSession.getCurrent().setConverterFactory(new SormasDefaultConverterFactory());

    getPage().setTitle("SORMAS");

    setContent(new LoginScreen(new LoginListener() {
        @Override/*w  ww .ja  v  a  2  s .c om*/
        public void loginSuccessful() {
            UI.getCurrent().getPage()
                    .setLocation(VaadinServletService.getCurrentServletRequest().getContextPath() + "#"
                            + DataHelper.toStringNullable(UI.getCurrent().getPage().getUriFragment()));
        }
    }));

}

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

License:Open Source License

@Override
public void init(VaadinRequest vaadinRequest) {

    setErrorHandler(SormasErrorHandler.get());
    setLocale(vaadinRequest.getLocale());

    Responsive.makeResponsive(this);

    VaadinSession.getCurrent().setConverterFactory(new SormasDefaultConverterFactory());

    getPage().setTitle("SORMAS");

    initMainScreen();//from   w  w w. j a  v a 2  s.com
}

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

@Override
protected void init(VaadinRequest vaadinRequest) {
    Responsive.makeResponsive(this);
    setLocale(vaadinRequest.getLocale());
    getPage().setTitle("POS");
    if (!accessControl.isUserSignedIn()) {
        setContent(new LoginScreen(accessControl, new LoginListener() {
            @Override/*from   w w  w .  ja  v  a  2s  . c o m*/
            public void loginSuccessful() {
                showMainView();
            }
        }));
    } else {
        showMainView();
    }
}

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 w  ww  . j  a 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:fr.univlorraine.mondossierweb.views.AdressesView.java

License:Apache License

/**
 * Initialise la vue/*from ww w .  jav a  2  s. c o  m*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())
            && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) {
        removeAllComponents();

        /* Style */
        setMargin(true);
        setSpacing(true);

        /* Titre */
        Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale()));
        title.addStyleName(ValoTheme.LABEL_H1);
        addComponent(title);

        VerticalLayout globalLayout = new VerticalLayout();
        globalLayout.setSizeFull();
        globalLayout.setSpacing(true);

        //Layout avec les infos etatcivil et contact
        CssLayout idLayout = new CssLayout();
        idLayout.setSizeFull();
        idLayout.setStyleName("flexwrap");

        globalLayout.addComponent(idLayout);
        // Enable Responsive CSS selectors for the layout
        Responsive.makeResponsive(idLayout);

        if (MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) {

            FormLayout formAdresseAnnuelleLayout = new FormLayout();
            formAdresseAnnuelleLayout.setSpacing(true);
            formAdresseAnnuelleLayout.setMargin(true);

            Panel panelAdresseAnnuelle = new Panel(
                    applicationContext.getMessage(NAME + ".adresseannuelle.title", null, getLocale()) + " "
                            + MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAnnee());

            String captionAdresseAnnuelle = applicationContext.getMessage(NAME + ".adresse.title", null,
                    getLocale());
            Label fieldAdresseAnnuelle = new Label();
            formatLabel(fieldAdresseAnnuelle, captionAdresseAnnuelle,
                    MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse1());
            formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle);

            String annuelle2 = valuateTextFieldFromMultipleValues(
                    MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse2(),
                    MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse3());
            if (annuelle2 != null) {
                Label fieldAdresseAnnuelle2 = new Label();
                formatLabel(fieldAdresseAnnuelle2, null, annuelle2);
                formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle2);
            }
            String captionVilleAnnuelle = applicationContext.getMessage(NAME + ".ville.title", null,
                    getLocale());
            Label fieldVilleAnnuelle = new Label();
            formatLabel(fieldVilleAnnuelle, captionVilleAnnuelle,
                    valuateTextFieldFromMultipleValues(
                            MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresseetranger(),
                            MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getCodePostal(),
                            MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getVille()));
            formAdresseAnnuelleLayout.addComponent(fieldVilleAnnuelle);

            String captionPaysAnnuelle = applicationContext.getMessage(NAME + ".pays.title", null, getLocale());
            Label fieldPaysAnnuelle = new Label();
            formatLabel(fieldPaysAnnuelle, captionPaysAnnuelle,
                    MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getPays());
            formAdresseAnnuelleLayout.addComponent(fieldPaysAnnuelle);

            String captionTelephoneAnnuelle = applicationContext.getMessage(NAME + ".telephone.title", null,
                    getLocale());
            Label fieldTelephoneAnnuelle = new Label();
            formatLabel(fieldTelephoneAnnuelle, captionTelephoneAnnuelle,
                    MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getNumerotel());
            formAdresseAnnuelleLayout.addComponent(fieldTelephoneAnnuelle);

            panelAdresseAnnuelle.setContent(formAdresseAnnuelleLayout);

            HorizontalLayout adresseAnnuelleGlobalLayout = new HorizontalLayout();
            adresseAnnuelleGlobalLayout.setSizeUndefined();
            adresseAnnuelleGlobalLayout.setStyleName("firstitembox");
            adresseAnnuelleGlobalLayout.addComponent(panelAdresseAnnuelle);
            adresseAnnuelleGlobalLayout.setExpandRatio(panelAdresseAnnuelle, 1);
            idLayout.addComponent(adresseAnnuelleGlobalLayout);
        }

        if (MainUI.getCurrent().getEtudiant().getAdresseFixe() != null) {
            FormLayout formAdresseFixeLayout = new FormLayout();
            formAdresseFixeLayout.setSpacing(true);
            formAdresseFixeLayout.setMargin(true);

            Panel panelAdresseFixe = new Panel(
                    applicationContext.getMessage(NAME + ".adressefixe.title", null, getLocale()));

            String captionAdresseFixe = applicationContext.getMessage(NAME + ".adresse.title", null,
                    getLocale());
            Label fieldAdresseFixe = new Label();
            formatLabel(fieldAdresseFixe, captionAdresseFixe,
                    MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse1());
            formAdresseFixeLayout.addComponent(fieldAdresseFixe);

            String adfixe2 = valuateTextFieldFromMultipleValues(
                    MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse2(),
                    MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse3());
            if (adfixe2 != null) {
                Label fieldAdresseFixe2 = new Label();
                formatLabel(fieldAdresseFixe2, null, adfixe2);
                formAdresseFixeLayout.addComponent(fieldAdresseFixe2);
            }

            String captionVilleFixe = applicationContext.getMessage(NAME + ".ville.title", null, getLocale());
            Label fieldVilleFixe = new Label();
            formatLabel(fieldVilleFixe, captionVilleFixe,
                    valuateTextFieldFromMultipleValues(
                            MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresseetranger(),
                            MainUI.getCurrent().getEtudiant().getAdresseFixe().getCodePostal(),
                            MainUI.getCurrent().getEtudiant().getAdresseFixe().getVille()));
            formAdresseFixeLayout.addComponent(fieldVilleFixe);

            String captionPaysFixe = applicationContext.getMessage(NAME + ".pays.title", null, getLocale());
            Label fieldPaysFixe = new Label();
            formatLabel(fieldPaysFixe, captionPaysFixe,
                    MainUI.getCurrent().getEtudiant().getAdresseFixe().getPays());
            formAdresseFixeLayout.addComponent(fieldPaysFixe);

            String captionTelephoneFixe = applicationContext.getMessage(NAME + ".telephone.title", null,
                    getLocale());
            Label fieldTelephoneFixe = new Label();
            formatLabel(fieldTelephoneFixe, captionTelephoneFixe,
                    MainUI.getCurrent().getEtudiant().getAdresseFixe().getNumerotel());
            formAdresseFixeLayout.addComponent(fieldTelephoneFixe);

            panelAdresseFixe.setContent(formAdresseFixeLayout);

            HorizontalLayout adresseFixeGlobalLayout = new HorizontalLayout();
            adresseFixeGlobalLayout.setSizeUndefined();
            adresseFixeGlobalLayout.setStyleName("itembox");
            adresseFixeGlobalLayout.addComponent(panelAdresseFixe);
            adresseFixeGlobalLayout.setExpandRatio(panelAdresseFixe, 1);
            idLayout.addComponent(adresseFixeGlobalLayout);

        }

        addComponent(globalLayout);

        if (userController.isEtudiant() && configController.isModificationAdressesAutorisee()
                && MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) {
            HorizontalLayout btnLayout = new HorizontalLayout();
            btnLayout.setSizeFull();
            btnLayout.setSpacing(true);

            Button btnModifAdresses = new Button(
                    applicationContext.getMessage(NAME + ".bouton.modifieradresses", null, getLocale()));
            btnModifAdresses.setStyleName(ValoTheme.BUTTON_PRIMARY);
            btnModifAdresses.setIcon(FontAwesome.EDIT);
            btnModifAdresses.addClickListener(e -> {
                ModificationAdressesWindow maw = new ModificationAdressesWindow(
                        MainUI.getCurrent().getEtudiant());
                maw.addCloseListener(f -> {
                    init();
                });
                UI.getCurrent().addWindow(maw);
            });
            btnLayout.addComponent(btnModifAdresses);
            btnLayout.setComponentAlignment(btnModifAdresses, Alignment.MIDDLE_LEFT);
            addComponent(btnLayout);
        }
    }
}