Example usage for com.vaadin.server FontAwesome SIGN_OUT

List of usage examples for com.vaadin.server FontAwesome SIGN_OUT

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome SIGN_OUT.

Prototype

FontAwesome SIGN_OUT

To view the source code for com.vaadin.server FontAwesome SIGN_OUT.

Click Source Link

Usage

From source file:com.mycollab.mobile.module.project.ui.ProjectMobileMenuPageView.java

License:Open Source License

@Override
protected void buildNavigateMenu() {
    getMenu().setWidth("80%");
    addSection("Views:");

    MButton prjButton = new MButton(UserUIContext.getMessage(ProjectI18nEnum.LIST), clickEvent -> {
        closeMenu();//from  w  w w. ja  v a2 s . co m
        EventBusFactory.getInstance().post(new ProjectEvent.GotoProjectList(this, null));
    }).withIcon(FontAwesome.BUILDING);
    addMenuItem(prjButton);

    // Buttons with styling (slightly smaller with left-aligned text)
    MButton activityBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.M_VIEW_PROJECT_ACTIVITIES),
            clickEvent -> {
                closeMenu();
                EventBusFactory.getInstance().post(
                        new ProjectEvent.MyProjectActivities(this, CurrentProjectVariables.getProjectId()));
            }).withIcon(FontAwesome.INBOX);
    addMenuItem(activityBtn);

    // add more buttons for a more realistic look.
    MButton messageBtn = new MButton(UserUIContext.getMessage(MessageI18nEnum.LIST), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new MessageEvent.GotoList(this, null));
    }).withIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MESSAGE));
    addMenuItem(messageBtn);

    MButton phaseBtn = new MButton(UserUIContext.getMessage(MilestoneI18nEnum.LIST), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new MilestoneEvent.GotoList(this, null));
    }).withIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE));
    addMenuItem(phaseBtn);

    MButton ticketBtn = new MButton(UserUIContext.getMessage(TicketI18nEnum.LIST), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new TicketEvent.GotoDashboard(this, null));
    }).withIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TICKET));
    addMenuItem(ticketBtn);

    MButton userBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.LIST), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(this, null));
    }).withIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MEMBER));
    addMenuItem(userBtn);

    addSection(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS));

    MButton logoutBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new ShellEvent.LogOut(this));
    }).withIcon(FontAwesome.SIGN_OUT);
    addMenuItem(logoutBtn);
}

From source file:com.mycollab.mobile.module.project.view.AllActivityViewImpl.java

License:Open Source License

@Override
protected void buildNavigateMenu() {
    addSection("Views:");

    // Buttons with styling (slightly smaller with left-aligned text)
    Button activityBtn = new Button("Activities", clickEvent -> {
        closeMenu();//from  w w  w . jav  a 2 s.  c  o m
        EventBusFactory.getInstance().post(new ProjectEvent.AllActivities(this));
    });
    activityBtn.setIcon(FontAwesome.INBOX);
    addMenuItem(activityBtn);

    Button prjBtn = new Button(UserUIContext.getMessage(ProjectI18nEnum.LIST), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new ProjectEvent.GotoProjectList(this, null));
    });
    prjBtn.setIcon(FontAwesome.BUILDING);
    addMenuItem(prjBtn);

    addSection("Settings:");

    Button logoutBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new ShellEvent.LogOut(this));
    });
    logoutBtn.setIcon(FontAwesome.SIGN_OUT);
    addMenuItem(logoutBtn);
}

From source file:com.mycollab.mobile.module.project.view.UserProjectListViewImpl.java

License:Open Source License

@Override
protected void buildNavigateMenu() {
    addSection("Views:");

    // Buttons with styling (slightly smaller with left-aligned text)
    MButton activityBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.M_VIEW_PROJECT_ACTIVITIES),
            clickEvent -> {/*  w w w . j  a  v a2 s .c  o m*/
                closeMenu();
                EventBusFactory.getInstance().post(new ProjectEvent.AllActivities(this));
            }).withIcon(FontAwesome.INBOX);
    addMenuItem(activityBtn);

    MButton prjBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.LIST), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new ProjectEvent.GotoProjectList(this, null));
    }).withIcon(FontAwesome.BUILDING);
    addMenuItem(prjBtn);

    addSection(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS));

    MButton logoutBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> {
        closeMenu();
        EventBusFactory.getInstance().post(new ShellEvent.LogOut(this));
    }).withIcon(FontAwesome.SIGN_OUT);
    addMenuItem(logoutBtn);
}

From source file:com.mycollab.shell.view.MainViewImpl.java

License:Open Source License

private MHorizontalLayout buildAccountMenuLayout() {
    accountLayout.removeAllComponents();

    if (SiteConfiguration.isDemandEdition()) {
        // display trial box if user in trial mode
        SimpleBillingAccount billingAccount = AppContext.getBillingAccount();
        if (AccountStatusConstants.TRIAL.equals(billingAccount.getStatus())) {
            if ("Free".equals(billingAccount.getBillingPlan().getBillingtype())) {
                Label informLbl = new Label(
                        "<div class='informBlock'>FREE CHARGE<br>UPGRADE</div><div class='informBlock'>&gt;&gt;</div>",
                        ContentMode.HTML);
                informLbl.addStyleName("trialEndingNotification");
                informLbl.setHeight("100%");
                MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withFullHeight()
                        .withStyleName("trialInformBox");
                informBox.setMargin(new MarginInfo(false, true, false, false));
                informBox.addLayoutClickListener(layoutClickEvent -> EventBusFactory.getInstance()
                        .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })));
                accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT);
            } else {
                Label informLbl = new Label("", ContentMode.HTML);
                informLbl.addStyleName("trialEndingNotification");
                informLbl.setHeight("100%");
                MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withStyleName("trialInformBox")
                        .withMargin(new MarginInfo(false, true, false, false)).withFullHeight();
                informBox.addLayoutClickListener(layoutClickEvent -> EventBusFactory.getInstance()
                        .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })));
                accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT);

                Duration dur = new Duration(new DateTime(billingAccount.getCreatedtime()), new DateTime());
                int daysLeft = dur.toStandardDays().getDays();
                if (daysLeft > 30) {
                    informLbl.setValue("<div class='informBlock'>Trial ended<br></div>");
                    AppContext.getInstance().setIsValidAccount(false);
                } else {
                    informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days "
                            + "left</div><div class='informBlock'>&gt;&gt;</div>", 30 - daysLeft));
                }//w  w w. j av  a2  s. c  o m
            }
        }
    }

    Label accountNameLabel = new Label(AppContext.getSubDomain());
    accountNameLabel.addStyleName("subdomain");
    accountLayout.addComponent(accountNameLabel);

    if (SiteConfiguration.isCommunityEdition()) {
        MButton buyPremiumBtn = new MButton("Upgrade to Pro edition",
                clickEvent -> UI.getCurrent().addWindow(new AdWindow())).withIcon(FontAwesome.SHOPPING_CART)
                        .withStyleName("ad");
        accountLayout.addComponent(buyPremiumBtn);
    }

    LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class);
    if (licenseResolver != null) {
        LicenseInfo licenseInfo = licenseResolver.getLicenseInfo();
        if (licenseInfo != null) {
            if (licenseInfo.isExpired()) {
                MButton buyPremiumBtn = new MButton(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION),
                        clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow()))
                                .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad");
                accountLayout.addComponent(buyPremiumBtn);
            } else if (licenseInfo.isTrial()) {
                Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate()));
                int days = dur.toStandardDays().getDays();
                MButton buyPremiumBtn = new MButton(
                        AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days),
                        clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow()))
                                .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad");
                accountLayout.addComponent(buyPremiumBtn);
            }
        }
    }

    NotificationComponent notificationComponent = new NotificationComponent();
    accountLayout.addComponent(notificationComponent);

    if (StringUtils.isBlank(AppContext.getUser().getAvatarid())) {
        EventBusFactory.getInstance()
                .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification()));
    }

    if (!SiteConfiguration.isDemandEdition()) {
        ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class);
        if (!mailService.isMailSetupValid()) {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.NewNotification(this, new SmtpSetupNotification()));
        }

        SimpleUser user = AppContext.getUser();
        GregorianCalendar tenDaysAgo = new GregorianCalendar();
        tenDaysAgo.add(Calendar.DATE, -10);

        if (Boolean.TRUE.equals(user.getRequestad()) && user.getRegisteredtime().before(tenDaysAgo.getTime())) {
            UI.getCurrent().addWindow(new AdRequestWindow(user));
        }
    }

    Resource userAvatarRes = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 24);
    final PopupButton accountMenu = new PopupButton("");
    accountMenu.setIcon(userAvatarRes);
    accountMenu.setDescription(AppContext.getUserDisplayName());

    OptionPopupContent accountPopupContent = new OptionPopupContent();

    MButton myProfileBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE), clickEvent -> {
        accountMenu.setPopupVisible(false);
        EventBusFactory.getInstance()
                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
    }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE));
    accountPopupContent.addOption(myProfileBtn);

    MButton userMgtBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES), clickEvent -> {
        accountMenu.setPopupVisible(false);
        EventBusFactory.getInstance()
                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" }));
    }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS));
    accountPopupContent.addOption(userMgtBtn);

    MButton generalSettingBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING), clickEvent -> {
        accountMenu.setPopupVisible(false);
        EventBusFactory.getInstance()
                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" }));
    }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING));
    accountPopupContent.addOption(generalSettingBtn);

    MButton themeCustomizeBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), clickEvent -> {
        accountMenu.setPopupVisible(false);
        EventBusFactory.getInstance()
                .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" }));
    }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE));
    accountPopupContent.addOption(themeCustomizeBtn);

    if (!SiteConfiguration.isDemandEdition()) {
        MButton setupBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), clickEvent -> {
            accountMenu.setPopupVisible(false);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
        }).withIcon(FontAwesome.WRENCH);
        accountPopupContent.addOption(setupBtn);
    }

    accountPopupContent.addSeparator();

    MButton helpBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_HELP))
            .withIcon(FontAwesome.MORTAR_BOARD);
    ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/");
    BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes);
    helpOpener.extend(helpBtn);
    accountPopupContent.addOption(helpBtn);

    MButton supportBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT))
            .withIcon(FontAwesome.LIFE_SAVER);
    ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/");
    BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes);
    supportOpener.extend(supportBtn);
    accountPopupContent.addOption(supportBtn);

    MButton translateBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE))
            .withIcon(FontAwesome.PENCIL);
    ExternalResource translateRes = new ExternalResource(
            "https://community.mycollab.com/docs/developing-mycollab/translating/");
    BrowserWindowOpener translateOpener = new BrowserWindowOpener(translateRes);
    translateOpener.extend(translateBtn);
    accountPopupContent.addOption(translateBtn);

    if (!SiteConfiguration.isCommunityEdition()) {
        MButton myAccountBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING), clickEvent -> {
            accountMenu.setPopupVisible(false);
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }));
        }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING));
        accountPopupContent.addOption(myAccountBtn);
    }

    accountPopupContent.addSeparator();
    MButton aboutBtn = new MButton("About MyCollab", clickEvent -> {
        accountMenu.setPopupVisible(false);
        Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class);
        UI.getCurrent().addWindow(aboutWindow);
    }).withIcon(FontAwesome.INFO_CIRCLE);
    accountPopupContent.addOption(aboutBtn);

    Button releaseNotesBtn = new Button("Release Notes");
    ExternalResource releaseNotesRes = new ExternalResource(
            "https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/");
    BrowserWindowOpener releaseNotesOpener = new BrowserWindowOpener(releaseNotesRes);
    releaseNotesOpener.extend(releaseNotesBtn);

    releaseNotesBtn.setIcon(FontAwesome.BULLHORN);
    accountPopupContent.addOption(releaseNotesBtn);

    MButton signoutBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> {
        accountMenu.setPopupVisible(false);
        EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null));
    }).withIcon(FontAwesome.SIGN_OUT);
    accountPopupContent.addSeparator();
    accountPopupContent.addOption(signoutBtn);

    accountMenu.setContent(accountPopupContent);
    accountLayout.addComponent(accountMenu);
    return accountLayout;
}

From source file:com.toptal.ui.view.MainView.java

License:Open Source License

/**
 * Generates a header for main view./*  w w w  .j  a v  a 2  s. c o m*/
 * @return Header.
 */
private HorizontalLayout header() {
    final User user = SecurityUtils.actualUser();
    final Label info = new Label(
            String.format("<h3>Welcome, %s. You are %s.</h3>", user.getName(), user.getRole().text()),
            ContentMode.HTML);
    final Button logout = new MButton(FontAwesome.SIGN_OUT, e -> this.getUi().getAuth().logout());
    return new MHorizontalLayout(info, logout).withAlign(info, Alignment.MIDDLE_LEFT)
            .withAlign(logout, Alignment.MIDDLE_RIGHT).withFullWidth();
}

From source file:de.fatalix.app.App.java

@Override
protected void init(VaadinRequest request) {
    super.init(request);
    logout = new Button("Logout", logoutClickListener);
    logout.setIcon(FontAwesome.SIGN_OUT);
    logout.addStyleName("user-menu");
    if (!isLoggedIn()) {
        getMenu().setVisible(false);//from  w w  w . j  a  v a  2s . c  om
        getNavigator().navigateTo(LoginView.id);
    } else {
        getMenu().setVisible(isLoggedIn());
        getMenu().addMenuItem(logout);
        if (getNavigator().getState().isEmpty()) {
            getNavigator().navigateTo(HomeView.id);
        }
    }

}

From source file:fr.univlorraine.mondossierweb.MainUI.java

License:Apache License

/**
 * Construction du menu tudiant//from w  w  w  . ja va 2 s .c o  m
 */
private void buildMainMenuEtudiant() {

    //Si l'tudiant dont on affiche le dossier est renseign
    if (etudiant != null) {

        //Ajout du style au menu
        mainMenu.setPrimaryStyleName(ValoTheme.MENU_PART);
        //On fixe la largeur du menu
        mainMenu.setWidth("233px");

        //Si on a une url pour la photo de l'tudiant
        if (etudiant.getPhoto() != null) {
            //Layout contenant la photo
            HorizontalLayout photoLayout = new HorizontalLayout();

            //Ajout du style au layout
            photoLayout.addStyleName(ValoTheme.MENU_SUBTITLE);
            //On fixe la largeur du layout
            photoLayout.setWidth(213, Unit.PIXELS);
            //La layout a des marges
            photoLayout.setMargin(true);

            //Bouton qui indique, en fonction de l'icone, si l'tudiant est inscrit pour l'anne en cours. Par dfaut, icone indiquant que l'tudiant est inscrit
            Button etuInscritBtn = new Button("", FontAwesome.CHECK_CIRCLE);
            //Ajout du style au bouton
            etuInscritBtn.setPrimaryStyleName(ValoTheme.BUTTON_BORDERLESS);

            //Si l'tudiant est inscrit pour l'anne en cours
            if (etudiant.isInscritPourAnneeEnCours()) {
                //On fixe la description du bouton
                etuInscritBtn.setDescription("Inscrit pour l'anne universitaire "
                        + Utils.getAnneeUniversitaireEnCours(etudiantController.getAnneeUnivEnCours(this)));
            } else {
                //On change l'icone du bouton pour indiquer que l'tudiant n'est pas inscrit
                etuInscritBtn.setIcon(FontAwesome.EXCLAMATION_CIRCLE);
                //On fixe la description du bouton
                etuInscritBtn.setDescription("Non Inscrit pour l'anne universitaire "
                        + Utils.getAnneeUniversitaireEnCours(etudiantController.getAnneeUnivEnCours(this)));
            }

            //Ajout d'un lment vide dans le layout
            photoLayout.addComponent(new HorizontalLayout());

            //Cration de l'image contenant la photo
            Image fotoEtudiant = new Image(null, new ExternalResource(etudiant.getPhoto()));
            fotoEtudiant.setWidth("120px");
            //Ajout de la photo au layout
            photoLayout.addComponent(fotoEtudiant);
            //Alignement de la photo
            photoLayout.setComponentAlignment(fotoEtudiant, Alignment.MIDDLE_CENTER);
            //La photo prend toute la place disponible dans son layout
            photoLayout.setExpandRatio(fotoEtudiant, 1);

            //Ajout au layout du bouton, qui indique, en fonction de l'icone, si l'tudiant est inscrit pour l'anne en cours
            photoLayout.addComponent(etuInscritBtn);

            //Ajout du layout de la photo au menu
            mainMenu.addComponent(photoLayout);
        }

        //Ajout du Prnom/Nom et codetu de l'tudiant dans le menu
        Label usernameLabel = new Label(etudiant.getNom() + "<br />" + etudiant.getCod_etu(), ContentMode.HTML);
        usernameLabel.addStyleName(ValoTheme.MENU_SUBTITLE);
        usernameLabel.addStyleName("retourALaLigneAutomatique");
        usernameLabel.setSizeUndefined();
        mainMenu.addComponent(usernameLabel);

        /* Etat Civil */
        addItemMenu("Etat-civil", EtatCivilView.NAME, FontAwesome.USER);

        //info annuelles visibles que si tudiant inscrit pour l'anne en cours
        if (etudiant.isInscritPourAnneeEnCours()) {
            addItemMenu("Informations annuelles", InformationsAnnuellesView.NAME, FontAwesome.INFO_CIRCLE);
        }

        /* Adresses */
        addItemMenu(applicationContext.getMessage(AdressesView.NAME + ".title", null, getLocale()),
                AdressesView.NAME, FontAwesome.HOME);

        /* Inscriptions */
        addItemMenu("Inscriptions", InscriptionsView.NAME, FontAwesome.FILE_TEXT);

        /* Calendrier */
        addItemMenu("Calendrier des preuves", CalendrierView.NAME, FontAwesome.CALENDAR);

        /* Notes et Rsultats */
        addItemMenu(applicationContext.getMessage(NotesView.NAME + ".title", null, getLocale()), NotesView.NAME,
                FontAwesome.LIST);

        /* Sparation avant Bouton "Aide" */
        CssLayout bottomMainMenu1 = new CssLayout();
        bottomMainMenu1.setStyleName(ValoTheme.MENU_SUBTITLE);
        bottomMainMenu1.setSizeUndefined();
        mainMenu.addComponent(bottomMainMenu1);

        /* Aide */
        Button helpBtn = new Button(applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),
                FontAwesome.SUPPORT);
        helpBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM);
        helpBtn.addClickListener(e -> {
            UI.getCurrent()
                    .addWindow(new HelpBasicWindow(
                            applicationContext.getMessage("helpWindow.text.etudiant", null, getLocale()),
                            applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()), true));
        });
        mainMenu.addComponent(helpBtn);

        /* Deconnexion */
        //Voir si on peut accder  l'appli hors ENT, le dtecter, et afficher le bouton dconnexion
        if (configController.isLogoutCasPropose() && userController.isEtudiant()) {
            Button decoBtn = new Button("Dconnexion", FontAwesome.SIGN_OUT);
            decoBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM);
            decoBtn.addClickListener(e -> {
                getUI().getPage().setLocation("j_spring_security_logout");
            });
            mainMenu.addComponent(decoBtn);
        }
        /* Sparation */
        CssLayout bottomMainMenu = new CssLayout();
        bottomMainMenu.setStyleName(ValoTheme.MENU_SUBTITLE);
        bottomMainMenu.setSizeUndefined();
        mainMenu.addComponent(bottomMainMenu);

    }
}

From source file:fr.univlorraine.mondossierweb.views.AdminView.java

License:Apache License

private void ajoutGestionSwap() {

    layoutSwapUser.setMargin(true);// w ww  . ja  v a  2 s  .  c o m
    layoutSwapUser.setSpacing(true);
    /* Boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    layoutSwapUser.addComponent(buttonsLayout);

    btnEditSwap = new Button(applicationContext.getMessage(NAME + ".btnEdit", null, getLocale()),
            FontAwesome.PENCIL);
    btnEditSwap.setEnabled(false);
    btnEditSwap.addClickListener(e -> {
        if (confSwapTable.getValue() instanceof UtilisateurSwap) {
            //configController.editConfApp((PreferencesApplication) confAppTable.getValue());
            SwapUtilisateurWindow suw = new SwapUtilisateurWindow((UtilisateurSwap) confSwapTable.getValue(),
                    false);
            suw.addCloseListener(f -> init());
            tabSelectedPosition = 1;
            MainUI.getCurrent().addWindow(suw);
        }
    });
    buttonsLayout.addComponent(btnEditSwap);
    buttonsLayout.setComponentAlignment(btnEditSwap, Alignment.MIDDLE_LEFT);

    btnAddSwap = new Button(applicationContext.getMessage(NAME + ".btnAdd", null, getLocale()),
            FontAwesome.PLUS);
    btnAddSwap.setEnabled(true);
    btnAddSwap.addClickListener(e -> {

        SwapUtilisateurWindow suw = new SwapUtilisateurWindow(new UtilisateurSwap(), true);
        suw.addCloseListener(f -> init());
        tabSelectedPosition = 1;
        MainUI.getCurrent().addWindow(suw);

    });
    buttonsLayout.addComponent(btnAddSwap);
    buttonsLayout.setComponentAlignment(btnAddSwap, Alignment.MIDDLE_CENTER);

    // Deconnexion 
    Button decoBtn = new Button("Se Dconnecter", FontAwesome.SIGN_OUT);
    decoBtn.setEnabled(true);
    decoBtn.addClickListener(e -> {
        getUI().getPage().setLocation("j_spring_security_logout");
    });
    buttonsLayout.addComponent(decoBtn);
    buttonsLayout.setComponentAlignment(decoBtn, Alignment.MIDDLE_RIGHT);

    /* Table des conf */
    confSwapTable = new Table(null,
            new BeanItemContainer<>(UtilisateurSwap.class, configController.getSwapUtilisateurs()));
    confSwapTable.setSizeFull();
    confSwapTable.setVisibleColumns((Object[]) SWAP_FIELDS_ORDER);
    for (String fieldName : SWAP_FIELDS_ORDER) {
        confSwapTable.setColumnHeader(fieldName,
                applicationContext.getMessage(NAME + ".confSwapTable." + fieldName, null, getLocale()));
    }
    confSwapTable.setSortContainerPropertyId("loginSource");
    confSwapTable.setColumnCollapsingAllowed(true);
    confSwapTable.setColumnReorderingAllowed(true);
    confSwapTable.setSelectable(true);
    confSwapTable.setImmediate(true);
    confSwapTable.addItemSetChangeListener(e -> confSwapTable.sanitizeSelection());
    confSwapTable.addValueChangeListener(e -> {
        // Le bouton d'dition est actif seulement si un parametre est slectionn. 
        boolean confIsSelected = confSwapTable.getValue() instanceof UtilisateurSwap;
        btnEditSwap.setEnabled(confIsSelected);

    });
    confSwapTable.addItemClickListener(e -> {
        if (e.isDoubleClick()) {
            confSwapTable.select(e.getItemId());
            btnEditSwap.click();
        }
    });
    layoutSwapUser.addComponent(confSwapTable);
    layoutSwapUser.setExpandRatio(confSwapTable, 1);
}

From source file:fr.univlorraine.mondossierweb.views.AssistanceView.java

License:Apache License

/**
 * Initialise la vue/*from  www  .j a  va2  s .co m*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (userController.isEnseignant()) {
        // Style 
        setMargin(true);
        setSpacing(true);

        // Rcupration de la configuration pour cette vue
        String docUrl = configController.getAssistanceDocUrl();
        String helpdeskUrl = configController.getAssistanceHelpdeskUrl();
        String mailContact = configController.getAssistanceContactMail();

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

        // Texte
        if (StringUtils.hasText(applicationContext.getMessage(NAME + ".text", null, getLocale()))) {
            addComponent(new Label(applicationContext.getMessage(NAME + ".text", null, getLocale()),
                    ContentMode.HTML));
        }

        // Afficher la pop-up de dmarrage 
        Button popupBtn = new Button(applicationContext.getMessage(NAME + ".btnPopUp", null, getLocale()),
                FontAwesome.INFO);
        popupBtn.addStyleName(ValoTheme.BUTTON_LINK);
        popupBtn.addClickListener(e -> MainUI.getCurrent().afficherMessageIntroEnseignants(true, false));
        addComponent(popupBtn);

        // Accs  la documentation 
        if (StringUtils.hasText(docUrl)) {
            Button docBtn = new Button(applicationContext.getMessage(NAME + ".btnDoc", null, getLocale()),
                    FontAwesome.FILE_TEXT);
            docBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener docBwo = new BrowserWindowOpener(docUrl);
            docBwo.extend(docBtn);
            addComponent(docBtn);
        }

        // Envoyer un ticket 
        if (StringUtils.hasText(helpdeskUrl)) {
            Button helpDeskBtn = new Button(
                    applicationContext.getMessage(NAME + ".btnHelpdesk", null, getLocale()),
                    FontAwesome.AMBULANCE);
            helpDeskBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener helpDeskBwo = new BrowserWindowOpener(helpdeskUrl);
            helpDeskBwo.extend(helpDeskBtn);
            addComponent(helpDeskBtn);
        }

        // Envoyer un mail 
        if (StringUtils.hasText(mailContact)) {
            Button contactBtn = new Button(applicationContext.getMessage(NAME + ".btnContact",
                    new Object[] { mailContact }, getLocale()), FontAwesome.ENVELOPE);
            contactBtn.addStyleName(ValoTheme.BUTTON_LINK);
            BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact);
            contactBwo.extend(contactBtn);
            addComponent(contactBtn);
        }

        /* Deconnexion */
        //Voir si on peut accder  l'appli hors ENT, le dtecter, et afficher le bouton dconnexion
        if (configController.isLogoutCasPropose()) {
            Button decoBtn = new Button("Dconnexion", FontAwesome.SIGN_OUT);
            decoBtn.addStyleName(ValoTheme.BUTTON_LINK);
            decoBtn.addClickListener(e -> {
                getUI().getPage().setLocation("j_spring_security_logout");
            });
            addComponent(decoBtn);
        }
    }
}

From source file:org.apache.tamaya.ui.NavBar.java

License:Apache License

private void addLogoutAndSettingsButton(final ApplicationLayout appLayout) {
    MessageProvider messages = ServiceContextManager.getServiceContext().getService(MessageProvider.class);
    Button logout = new Button(messages.getMessage("default.label.logout"), new Button.ClickListener() {
        @Override/*from  w  w w.ja v  a  2 s.c o  m*/
        public void buttonClick(Button.ClickEvent clickEvent) {
            User user = CurrentUser.get();
            if (user != null) {
                user.logout();
                EventBus.post(new LogoutEvent(user));
            }
            CurrentUser.set(null);
        }
    });
    logout.addStyleName(UIConstants.BUTTON_LOGOUT);
    logout.addStyleName(UIConstants.BUTTON_BORDERLESS);
    logout.setIcon(FontAwesome.SIGN_OUT);
    Button settings = new Button("...", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            //                UISettingsDialog dlog = new UISettingsDialog(appLayout.getNavigationBar());
            //                dlog.show();
        }
    });
    settings.addStyleName(UIConstants.BUTTON_SETTINGS);
    settings.addStyleName(UIConstants.BUTTON_BORDERLESS);
    VerticalLayout buttons = new VerticalLayout(logout, settings);
    addComponent(buttons);
}