Example usage for com.vaadin.server FontAwesome CHEVRON_RIGHT

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

Introduction

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

Prototype

FontAwesome CHEVRON_RIGHT

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

Click Source Link

Usage

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

License:Apache License

private void initToolbarArea() {
    hToolbarArea.setStyleName("ui-toolbar-area");
    hToolbarArea.setSizeUndefined();//w  ww  .j av  a  2 s .com
    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());
        }
    });
}