Example usage for com.vaadin.server FontAwesome HOME

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

Introduction

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

Prototype

FontAwesome HOME

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

Click Source Link

Usage

From source file:com.terralcode.gestion.frontend.view.widgets.incomingAppointments.IncomingAppointments.java

public AppointmentPreview(Appointment app) {
    this.appointment = app;
    this.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(false);//w  ww. j a  va  2s  . c om

    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
    String scheduleText = sdf.format(app.getProgramDateStart().getTime());
    if (app.getTimeLapse() != null) {
        scheduleText += " (" + app.getTimeLapse().toString() + ")";
    }
    schedule = new Button(scheduleText);
    schedule.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            onAppointmentClicked(appointment);
        }
    });
    schedule.addStyleName(ValoTheme.BUTTON_LINK);
    schedule.setWidth("100%");
    hl.addComponent(schedule);
    //type = new Label();
    if (app.getAppointmentType().getCode().equals("VIS")) {
        schedule.setIcon(FontAwesome.HOME);
    }
    if (app.getAppointmentType().getCode().equals("COM")) {
        schedule.setIcon(FontAwesome.PHONE);
    }
    if (app.getAppointmentType().getCode().equals("CON")) {
        schedule.setIcon(FontAwesome.USER);
    }
    //hl.addComponent(type);
    //hl.setComponentAlignment(type, Alignment.MIDDLE_RIGHT);
    hl.setExpandRatio(schedule, 1);
    this.addComponent(hl);

    if (app.getAppointmentType().getCode().equals("VIS") || app.getAppointmentType().getCode().equals("COM")) {
        customer = new Label(app.getCustomer().toString());
        //customer.addStyleName(ValoTheme.LABEL_H3);
        customer.setWidth("100%");
        this.addComponent(customer);
    }

    if ("VIS".equals(app.getAppointmentType().getCode())) {
        address = new Label(Objects.toString(app.getAddress(), "Direccin no disponible"));
        //address.addStyleName(ValoTheme.LABEL_H3);
        address.setWidth("100%");
        this.addComponent(address);
    }
    if ("CON".equals(app.getAppointmentType().getCode())) {
        contact = new Label(app.getContactNotes());
        //address.addStyleName(ValoTheme.LABEL_H3);
        contact.setWidth("100%");
        this.addComponent(contact);
    }

}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.QbicmainportletUI.java

License:Open Source License

/**
 * //  www .  j a  va  2  s.  com
 * @param datahandler
 * @param request
 * @param user
 */
public void buildMainLayout(DataHandler datahandler, VaadinRequest request, String user) {
    State state = (State) UI.getCurrent().getSession().getAttribute("state");
    MultiscaleController multiscaleController = new MultiscaleController(datahandler.getOpenBisClient(), user);

    final HomeView homeView = new HomeView(datahandler, "Your Projects", user, state, resUrl,
            manager.getTmpFolder());
    DatasetView datasetView = new DatasetView(datahandler, state, resUrl);
    final SampleView sampleView = new SampleView(datahandler, state, resUrl, multiscaleController);
    // BarcodeView barcodeView =
    // new BarcodeView(datahandler.getOpenBisClient(), manager.getBarcodeScriptsFolder(),
    // manager.getBarcodePathVariable());
    final ExperimentView experimentView = new ExperimentView(datahandler, state, resUrl, multiscaleController);
    // ChangePropertiesView changepropertiesView = new ChangePropertiesView(datahandler);

    final AddPatientView addPatientView = new AddPatientView(datahandler, state, resUrl);

    final SearchResultsView searchResultsView = new SearchResultsView(datahandler, "Search results", user,
            state, resUrl);

    Submitter submitter = null;
    try {
        submitter = WorkflowSubmitterFactory.getSubmitter(Type.guseSubmitter, manager);
    } catch (Exception e1) {
        e1.printStackTrace();
    }

    WorkflowViewController controller = new WorkflowViewController(submitter, datahandler, user);

    final ProjectView projectView = new ProjectView(datahandler, state, resUrl, controller, manager);
    final PatientView patientView = new PatientView(datahandler, state, resUrl, controller, manager);

    VerticalLayout navigatorContent = new VerticalLayout();
    // navigatorContent.setResponsive(true);

    final Navigator navigator = new Navigator(UI.getCurrent(), navigatorContent);

    navigator.addView(DatasetView.navigateToLabel, datasetView);
    navigator.addView(SampleView.navigateToLabel, sampleView);
    navigator.addView("", homeView);
    navigator.addView(ProjectView.navigateToLabel, projectView);
    // navigator.addView(BarcodeView.navigateToLabel, barcodeView);
    navigator.addView(ExperimentView.navigateToLabel, experimentView);
    navigator.addView(PatientView.navigateToLabel, patientView);
    navigator.addView(AddPatientView.navigateToLabel, addPatientView);
    navigator.addView(SearchResultsView.navigateToLabel, searchResultsView);

    setNavigator(navigator);

    // Production
    // mainLayout = new VerticalLayout();
    for (Window w : getWindows()) {
        w.setSizeFull();
    }

    mainLayout = new GridLayout(3, 3);
    mainLayout.setResponsive(true);
    mainLayout.setWidth(100, Unit.PERCENTAGE);

    mainLayout.addComponent(navigatorContent, 0, 1, 2, 1);
    mainLayout.setColumnExpandRatio(0, 0.2f);
    mainLayout.setColumnExpandRatio(1, 0.3f);
    mainLayout.setColumnExpandRatio(2, 0.5f);

    // Production
    // HorizontalLayout treeViewAndLevelView = new HorizontalLayout();
    // HorizontalLayout headerView = new HorizontalLayout();
    // headerView.setSpacing(false);
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    // final HorizontalLayout labelLayout = new HorizontalLayout();
    // headerView.addComponent(buttonLayout);
    // headerView.addComponent(labelLayout);

    Button homeButton = new Button("Home");
    homeButton.setIcon(FontAwesome.HOME);
    homeButton.setResponsive(true);
    homeButton.setStyleName(ValoTheme.BUTTON_LARGE);
    homeButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            navigator.navigateTo("");
        }

    });

    // Production
    buttonLayout.addComponent(homeButton);
    // mainLayout.addComponent(homeButton, 0, 0);

    Boolean includePatientCreation = false;

    List<Project> projects = datahandler.getOpenBisClient().getOpenbisInfoService()
            .listProjectsOnBehalfOfUser(datahandler.getOpenBisClient().getSessionToken(), user);
    int numberOfProjects = 0;
    for (Project project : projects) {
        if (project.getSpaceCode().contains("IVAC")) {
            includePatientCreation = true;
        }
        numberOfProjects += 1;
    }

    // add patient button
    if (includePatientCreation) {
        Button addPatient = new Button("Add Patient");
        addPatient.setIcon(FontAwesome.PLUS);
        addPatient.setStyleName(ValoTheme.BUTTON_LARGE);
        addPatient.setResponsive(true);
        // addPatient.setStyleName("addpatient");

        addPatient.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                UI.getCurrent().getNavigator().navigateTo(String.format(AddPatientView.navigateToLabel));
            }
        });

        // Production
        buttonLayout.addComponent(addPatient);
        // mainLayout.addComponent(addPatient, 1, 0);
    }

    mainLayout.addComponent(buttonLayout, 0, 0);

    Button header = new Button(String.format("Total number of projects: %s", numberOfProjects));
    header.setIcon(FontAwesome.HAND_O_RIGHT);
    header.setStyleName(ValoTheme.BUTTON_LARGE);
    header.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    // Production
    // labelLayout.addComponent(header);
    // labelLayout.setWidth(null);

    SearchEngineView searchBarView = new SearchEngineView(datahandler);

    // headerView.setWidth("100%");
    // Production
    // headerView.addComponent(searchBarView);
    // headerView.setComponentAlignment(searchBarView, Alignment.TOP_RIGHT);
    // searchBarView.setSizeUndefined();
    // treeViewAndLevelView.addComponent(navigatorContent);
    // mainLayout.addComponent(headerView);
    // mainLayout.addComponent(treeViewAndLevelView);

    mainLayout.addComponent(header, 1, 0);
    mainLayout.addComponent(searchBarView, 2, 0);

    // Production
    VerticalLayout versionLayout = new VerticalLayout();
    versionLayout.setWidth(100, Unit.PERCENTAGE);
    Label versionLabel = new Label(String.format("version: %s", version));
    Label revisionLabel = new Label(String.format("rev: %s", revision));
    revisionLabel.setWidth(null);
    versionLabel.setWidth(null);

    versionLayout.addComponent(versionLabel);
    if (!isInProductionMode()) {
        versionLayout.addComponent(revisionLabel);
    }
    // versionLayout.setMargin(new MarginInfo(true, false, false, false));
    // mainLayout.addComponent(versionLayout);
    mainLayout.addComponent(versionLayout, 0, 2, 2, 2);
    mainLayout.setRowExpandRatio(2, 1.0f);
    // mainLayout.setSpacing(true);

    versionLayout.setComponentAlignment(versionLabel, Alignment.MIDDLE_RIGHT);
    versionLayout.setComponentAlignment(revisionLabel, Alignment.BOTTOM_RIGHT);

    mainLayout.setComponentAlignment(searchBarView, Alignment.BOTTOM_RIGHT);

    setContent(mainLayout);
    // getContent().setSizeFull();

    // "Responsive design"
    /*
     * getPage().addBrowserWindowResizeListener(new BrowserWindowResizeListener() {
     * 
     * @Override public void browserWindowResized(BrowserWindowResizeEvent event) { int height =
     * event.getHeight(); int width = event.getWidth(); WebBrowser browser =
     * event.getSource().getWebBrowser(); // tv.rebuildLayout(height, width, browser); if
     * (currentView instanceof HomeView) { homeView.updateView(height, width, browser); } else if
     * (currentView instanceof ProjectView) { projectView.updateView(height, width, browser); } else
     * if (currentView instanceof ExperimentView) { experimentView.updateView(height, width,
     * browser); } else if (currentView instanceof PatientView) { patientView.updateView(height,
     * width, browser); } else if (currentView instanceof AddPatientView) {
     * addPatientView.updateView(height, width, browser); } } });
     * 
     * navigator.addViewChangeListener(new ViewChangeListener() {
     * 
     * @Override public boolean beforeViewChange(ViewChangeEvent event) { int height =
     * getPage().getBrowserWindowHeight(); int width = getPage().getBrowserWindowWidth(); WebBrowser
     * browser = getPage().getWebBrowser(); // View oldView = event.getOldView(); //
     * this.setEnabled(oldView, false);
     * 
     * currentView = event.getNewView(); if (currentView instanceof HomeView) {
     * homeView.updateView(height, width, browser); } if (currentView instanceof ProjectView) {
     * projectView.updateView(height, width, browser); } if (currentView instanceof ExperimentView)
     * { experimentView.updateView(height, width, browser); } if (currentView instanceof SampleView)
     * { sampleView.updateView(height, width, browser); } else if (currentView instanceof
     * PatientView) { patientView.updateView(height, width, browser); } else if (currentView
     * instanceof AddPatientView) { addPatientView.updateView(height, width, browser); } return
     * true; }
     * 
     * private void setEnabled(View view, boolean enabled) { // tv.setEnabled(enabled); if (view
     * instanceof HomeView) { homeView.setEnabled(enabled); } if (view instanceof ProjectView) {
     * projectView.setEnabled(enabled); } if (view instanceof ExperimentView) {
     * experimentView.setEnabled(enabled); } if (view instanceof SampleView) {
     * sampleView.setEnabled(enabled); } }
     * 
     * @Override public void afterViewChange(ViewChangeEvent event) { currentView =
     * event.getNewView(); // this.setEnabled(currentView, true); Object currentBean = null; if
     * (currentView instanceof ProjectView) { // TODO refactoring currentBean = new HashMap<String,
     * AbstractMap.SimpleEntry<String, Long>>();
     * 
     * // Production // labelLayout.removeAllComponents(); Button header = new
     * Button(projectView.getHeaderLabel()); header.setStyleName(ValoTheme.BUTTON_LARGE);
     * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT);
     * 
     * // labelLayout.addComponent(header); } else if (currentView instanceof HomeView) {
     * currentBean = new HashMap<String, AbstractMap.SimpleEntry<String, Long>>();
     * 
     * // labelLayout.removeAllComponents(); Button header = new Button(homeView.getHeader());
     * header.setStyleName(ValoTheme.BUTTON_LARGE);
     * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT);
     * 
     * // labelLayout.addComponent(header); // currentBean = projectView.getCurrentBean(); } else if
     * (currentView instanceof ExperimentView) { currentBean = experimentView.getCurrentBean();
     * 
     * } else if (currentView instanceof SampleView) { // TODO refactoring currentBean = new
     * HashMap<String, AbstractMap.SimpleEntry<String, Long>>();
     * 
     * // labelLayout.removeAllComponents(); Button header = new Button(sampleView.getHeader());
     * header.setStyleName(ValoTheme.BUTTON_LARGE);
     * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT);
     * 
     * // labelLayout.addComponent(header);
     * 
     * } else if (currentView instanceof DatasetView) { currentBean = new HashMap<String,
     * AbstractMap.SimpleEntry<String, Long>>(); } else if (currentView instanceof PatientView) {
     * currentBean = new HashMap<String, AbstractMap.SimpleEntry<String, Long>>();
     * 
     * // labelLayout.removeAllComponents(); Button header = new
     * Button(patientView.getHeaderLabel()); header.setStyleName(ValoTheme.BUTTON_LARGE);
     * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT);
     * // labelLayout.addComponent(header); } else if (currentView instanceof AddPatientView) {
     * currentBean = new HashMap<String, AbstractMap.SimpleEntry<String, Long>>();
     * 
     * // labelLayout.removeAllComponents(); Button header = new Button(addPatientView.getHeader());
     * header.setStyleName(ValoTheme.BUTTON_LARGE);
     * header.addStyleName(ValoTheme.BUTTON_BORDERLESS); header.setIcon(FontAwesome.HAND_O_RIGHT);
     * // labelLayout.addComponent(header); } try { PortletSession portletSession =
     * QbicmainportletUI.getCurrent().getPortletSession(); if (portletSession != null) {
     * portletSession.setAttribute("qbic_download", currentBean, PortletSession.APPLICATION_SCOPE);
     * } } catch (NullPointerException e) { // nothing to do. during initialization that might
     * happen. Nothing to worry about }
     * 
     * 
     * }
     * 
     * });
     */

    /*
     * // go to correct page String requestParams = Page.getCurrent().getUriFragment();
     * 
     * // LOGGER.debug("used urifragement: " + requestParams); if (requestParams != null) {
     * navigator.navigateTo(requestParams.startsWith("!") ? requestParams.substring(1) :
     * requestParams); } else { navigator.navigateTo(""); }
     */
}

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

License:Apache License

/**
 * Construction du menu tudiant//ww w  .  ja v  a 2 s.co  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:lifetime.component.custom.LifetimeHomeButton.java

License:Apache License

public LifetimeHomeButton(String language) {
    super(Translator.getTranslation("Home", language), language, FontAwesome.HOME);
    setDescription(Translator.getTranslation("Home", language));
    setId(StyleClassName.HOME_BUTTON.getId());
    addClickListener(new ClickListener() {

        @Override//  w  ww.j a  va  2  s  .com
        public void buttonClick(ClickEvent event) {
            Page.getCurrent().setLocation(Location.HOME.getUri());
        }
    });
}

From source file:org.eclipse.hawkbit.ui.management.DeploymentViewMenuItem.java

License:Open Source License

@Override
public Resource getDashboardIcon() {
    return FontAwesome.HOME;
}

From source file:org.lucidj.ui.gauss.GaussUI.java

License:Apache License

private void initToolbarArea() {
    hToolbarArea.setStyleName("ui-toolbar-area");
    hToolbarArea.setSizeUndefined();// ww  w.  j  a  va 2  s  .  c o  m
    hToolbarArea.setWidth("100%");

    CssLayout home_buttons = new CssLayout();
    home_buttons.setStyleName("ui-toolbar-area-home");
    home_buttons.setWidth(get_default_left_panel_width(), Sizeable.Unit.PIXELS);
    home_buttons.setId("_home_buttons");

    final Button toggle_menu = new Button();
    toggle_menu.setWidth(3, Unit.EM);
    toggle_menu.setIcon(FontAwesome.CHEVRON_DOWN);
    toggle_menu.addStyleName("tiny");
    toggle_menu.addStyleName("link");
    toggle_menu.addStyleName("ui-toolbar-spacer");
    toggle_menu.addStyleName("ui-toggle-button");
    toggle_menu.setId("_toggle_menu");
    home_buttons.addComponent(toggle_menu);

    toggle_menu.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            if (!hsMenuContents.isLocked()) {
                default_left_panel_width_px = (int) hsMenuContents.getSplitPosition();
                acMenu.setVisible(false);
                hsMenuContents.setMinSplitPosition(0, Unit.PIXELS);
                hsMenuContents.setSplitPosition(0, Sizeable.Unit.PIXELS);
                toggle_menu.setIcon(FontAwesome.CHEVRON_RIGHT);
                hsMenuContents.setLocked(true);
            } else {
                hsMenuContents.setLocked(false);
                acMenu.setVisible(true);
                hsMenuContents.setMinSplitPosition(MIN_LEFT_PANEL_WIDTH_PX, Unit.PIXELS);
                hsMenuContents.setSplitPosition(get_default_left_panel_width(), Unit.PIXELS);
                toggle_menu.setIcon(FontAwesome.CHEVRON_DOWN);
            }
        }
    });

    final Button home = new Button("Home");
    home.setIcon(FontAwesome.HOME);
    home.addStyleName("tiny");
    home.addStyleName("ui-toolbar-spacer");
    home.addStyleName("ui-toggle-button");
    home.setId("_home");
    home_buttons.addComponent(home);

    home.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            navigator.navigateTo("home");
        }
    });

    final Button new_button = new Button("New");
    new_button.setIcon(FontAwesome.EDIT);
    new_button.addStyleName("tiny");
    new_button.addStyleName("primary");
    new_button.addStyleName("ui-toggle-button");
    new_button.setId("_new");
    home_buttons.addComponent(new_button);
    new_button.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            navigator.navigateTo("new");
        }
    });

    hToolbarArea.addComponent(home_buttons);

    hToolbarPlaceholder = new CssLayout();
    hToolbarPlaceholder.setSizeFull();
    hToolbarArea.addComponent(hToolbarPlaceholder);
    hToolbarArea.setExpandRatio(hToolbarPlaceholder, 1.0f);

    final Button eject_view = new Button();
    eject_view.setIcon(FontAwesome.EXTERNAL_LINK);
    eject_view.addStyleName("tiny");
    eject_view.addStyleName("link");
    eject_view.addStyleName("ui-toggle-button");
    eject_view.setId("_eject_view");
    hToolbarArea.addComponent(eject_view);

    eject_view.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            Notification.show("Not implemented", Notification.Type.HUMANIZED_MESSAGE);
        }
    });

    toggle_sidebar = new Button();
    toggle_sidebar.setWidth(3, Unit.EM);
    toggle_sidebar.addStyleName("tiny");
    toggle_sidebar.addStyleName("link");
    toggle_sidebar.addStyleName("ui-toolbar-spacer");
    toggle_sidebar.addStyleName("ui-toggle-button");
    toggle_sidebar.setId("_toggle_sidebar");
    hToolbarArea.addComponent(toggle_sidebar);

    toggle_sidebar.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            show_sidebar(!sidebar_visible());
        }
    });
}

From source file:ui.button.LifetimeHomeButton.java

License:Apache License

public LifetimeHomeButton(String language) {
    super(Translator.getTranslation("Vitae", language), FontAwesome.HOME);
    addClickListener(this);
    setDescription(Translator.getTranslation("Vitae", language));
}