Example usage for com.vaadin.server FontAwesome NAVICON

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

Introduction

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

Prototype

FontAwesome NAVICON

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

Click Source Link

Usage

From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java

License:Apache License

public Menu(Navigator navigator) {
    this.navigator = navigator;
    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from  w  w w. j  av  a2s  . c  o m
    Label title = new Label("My CRUD");
    title.addStyleName(ValoTheme.LABEL_H3);
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/table-logo.png"));
    image.setStyleName("logo");
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() {

        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            VaadinSession.getCurrent().getSession().invalidate();
            Page.getCurrent().reload();
        }
    });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button("Menu", new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}

From source file:com.mycollab.module.project.view.milestone.MilestoneListViewImpl.java

License:Open Source License

private HorizontalLayout createHeaderRight() {
    MHorizontalLayout layout = new MHorizontalLayout();

    MButton createBtn = new MButton(UserUIContext.getMessage(MilestoneI18nEnum.NEW), clickEvent -> {
        SimpleMilestone milestone = new SimpleMilestone();
        milestone.setSaccountid(MyCollabUI.getAccountId());
        milestone.setProjectid(CurrentProjectVariables.getProjectId());
        UI.getCurrent().addWindow(new MilestoneAddWindow(milestone));
    }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
    layout.with(createBtn);//from www . j av  a  2 s  . c om

    MButton printBtn = new MButton("", clickEvent -> UI.getCurrent()
            .addWindow(new MilestoneCustomizeReportOutputWindow(new LazyValueInjector() {
                @Override
                protected Object doEval() {
                    return baseCriteria;
                }
            }))).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    layout.addComponent(printBtn);

    MButton boardBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_BOARD))
            .withIcon(FontAwesome.SERVER).withWidth("100px");

    MButton roadmapBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new MilestoneEvent.GotoRoadmap(MilestoneListViewImpl.this)))
                            .withIcon(FontAwesome.NAVICON).withWidth("100px");

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(roadmapBtn);
    viewButtons.addButton(boardBtn);
    if (!SiteConfiguration.isCommunityEdition()) {
        MButton kanbanBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_KANBAN),
                clickEvent -> EventBusFactory.getInstance()
                        .post(new MilestoneEvent.GotoKanban(MilestoneListViewImpl.this)))
                                .withIcon(FontAwesome.TH).withWidth("100px");
        viewButtons.addButton(kanbanBtn);
    }
    viewButtons.withDefaultButton(boardBtn);
    layout.with(viewButtons);

    return layout;
}

From source file:com.mycollab.module.project.view.milestone.MilestoneRoadmapViewImpl.java

License:Open Source License

private HorizontalLayout createHeaderRight() {
    MButton createBtn = new MButton(UserUIContext.getMessage(MilestoneI18nEnum.NEW), clickEvent -> {
        SimpleMilestone milestone = new SimpleMilestone();
        milestone.setSaccountid(MyCollabUI.getAccountId());
        milestone.setProjectid(CurrentProjectVariables.getProjectId());
        UI.getCurrent().addWindow(new MilestoneAddWindow(milestone));
    }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));

    MButton printBtn = new MButton("", clickEvent -> UI.getCurrent()
            .addWindow(new MilestoneCustomizeReportOutputWindow(new LazyValueInjector() {
                @Override/*from   w w  w .j a v a2  s .  c  o m*/
                protected Object doEval() {
                    return baseCriteria;
                }
            }))).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));

    MButton boardBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_BOARD),
            clickEvent -> EventBusFactory.getInstance().post(new MilestoneEvent.GotoList(this, null)))
                    .withIcon(FontAwesome.SERVER).withWidth("100px");

    MButton roadmapBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST))
            .withIcon(FontAwesome.NAVICON).withWidth("100px");

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(roadmapBtn);
    viewButtons.addButton(boardBtn);
    if (!SiteConfiguration.isCommunityEdition()) {
        MButton kanbanBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_KANBAN),
                clickEvent -> EventBusFactory.getInstance()
                        .post(new MilestoneEvent.GotoKanban(MilestoneRoadmapViewImpl.this)))
                                .withIcon(FontAwesome.TH).withWidth("100px");
        viewButtons.addButton(kanbanBtn);
    }

    viewButtons.withDefaultButton(roadmapBtn);
    return new MHorizontalLayout(createBtn, printBtn, viewButtons);
}

From source file:com.mycollab.module.project.view.task.TaskKanbanBoardViewImpl.java

License:Open Source License

public TaskKanbanBoardViewImpl() {
    this.setSizeFull();
    this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true));
    searchPanel = new TaskSearchPanel();
    MHorizontalLayout groupWrapLayout = new MHorizontalLayout();
    groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    searchPanel.addHeaderRight(groupWrapLayout);

    toggleShowColumnsBtn = new MButton("", clickEvent -> {
        displayHiddenColumns = !displayHiddenColumns;
        reload();/* www  .j a v a  2 s. co  m*/
        toggleShowButton();
    }).withStyleName(WebThemes.BUTTON_LINK);
    groupWrapLayout.addComponent(toggleShowColumnsBtn);
    toggleShowButton();

    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) {
        MButton addNewColumnBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN),
                clickEvent -> UI.getCurrent()
                        .addWindow(new AddNewColumnWindow(this, ProjectTypeConstants.TASK, "status")))
                                .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
        groupWrapLayout.addComponent(addNewColumnBtn);
    }

    MButton deleteColumnBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.ACTION_DELETE_COLUMNS),
            clickEvent -> UI.getCurrent().addWindow(new DeleteColumnWindow(this, ProjectTypeConstants.TASK)))
                    .withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER);
    deleteColumnBtn.setVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));

    MButton advanceDisplayBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST),
            clickEvent -> EventBusFactory.getInstance().post(new TicketEvent.GotoDashboard(this, null)))
                    .withIcon(FontAwesome.NAVICON).withWidth("100px");

    MButton kanbanBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_KANBAN))
            .withIcon(FontAwesome.TH).withWidth("100px");

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(kanbanBtn);
    viewButtons.withDefaultButton(kanbanBtn);
    groupWrapLayout.addComponent(viewButtons);

    kanbanLayout = new DDHorizontalLayout();
    kanbanLayout.setHeight("100%");
    kanbanLayout.addStyleName("kanban-layout");
    kanbanLayout.setSpacing(true);
    kanbanLayout.setMargin(new MarginInfo(true, false, true, false));
    kanbanLayout.setComponentHorizontalDropRatio(0.3f);
    kanbanLayout.setDragMode(LayoutDragMode.CLONE_OTHER);

    // Enable dropping components
    kanbanLayout.setDropHandler(new DropHandler() {
        @Override
        public void drop(DragAndDropEvent event) {
            LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();

            DDHorizontalLayout.HorizontalLayoutTargetDetails details = (DDHorizontalLayout.HorizontalLayoutTargetDetails) event
                    .getTargetDetails();
            Component dragComponent = transferable.getComponent();
            if (dragComponent instanceof KanbanBlock) {
                KanbanBlock kanbanItem = (KanbanBlock) dragComponent;
                int newIndex = details.getOverIndex();
                if (details.getDropLocation() == HorizontalDropLocation.RIGHT) {
                    kanbanLayout.addComponent(kanbanItem);
                } else if (newIndex == -1) {
                    kanbanLayout.addComponent(kanbanItem, 0);
                } else {
                    kanbanLayout.addComponent(kanbanItem, newIndex);
                }

                //Update options index for this project
                List<Map<String, Integer>> indexMap = new ArrayList<>();
                for (int i = 0; i < kanbanLayout.getComponentCount(); i++) {
                    KanbanBlock blockItem = (KanbanBlock) kanbanLayout.getComponent(i);
                    Map<String, Integer> map = new HashMap<>(2);
                    map.put("id", blockItem.optionVal.getId());
                    map.put("index", i);
                    indexMap.add(map);
                }
                if (indexMap.size() > 0) {
                    optionValService.massUpdateOptionIndexes(indexMap, MyCollabUI.getAccountId());
                }
            }
        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return new Not(VerticalLocationIs.MIDDLE);
        }
    });

    this.with(searchPanel, kanbanLayout).expand(kanbanLayout);
}

From source file:com.mycollab.module.project.view.ticket.TicketDashboardViewImpl.java

License:Open Source License

public TicketDashboardViewImpl() {
    this.withMargin(new MarginInfo(false, true, true, true));
    ticketSearchPanel = new TicketSearchPanel();

    MHorizontalLayout groupWrapLayout = new MHorizontalLayout();
    groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    groupWrapLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.ACTION_SORT)));
    final ComboBox sortCombo = new ValueComboBox(false,
            UserUIContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING),
            UserUIContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING));
    sortCombo.addValueChangeListener(valueChangeEvent -> {
        String sortValue = (String) sortCombo.getValue();
        if (UserUIContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) {
            sortDirection = SearchCriteria.ASC;
        } else {/*from   www .  j a va2 s . c o  m*/
            sortDirection = SearchCriteria.DESC;
        }
        queryAndDisplayTickets();
    });
    sortDirection = SearchCriteria.DESC;
    groupWrapLayout.addComponent(sortCombo);

    groupWrapLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_GROUP)));
    final ComboBox groupCombo = new ValueComboBox(false, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE),
            UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE),
            UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME),
            UserUIContext.getMessage(GenericI18Enum.OPT_PLAIN),
            UserUIContext.getMessage(GenericI18Enum.OPT_USER),
            UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
    groupByState = UserUIContext.getMessage(MilestoneI18nEnum.SINGLE);
    groupCombo.setValue(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
    groupCombo.addValueChangeListener(valueChangeEvent -> {
        groupByState = (String) groupCombo.getValue();
        queryAndDisplayTickets();
    });

    groupWrapLayout.addComponent(groupCombo);

    ticketSearchPanel.addHeaderRight(groupWrapLayout);

    MButton printBtn = new MButton("", clickEvent -> UI.getCurrent()
            .addWindow(new TicketCustomizeReportOutputWindow(new LazyValueInjector() {
                @Override
                protected Object doEval() {
                    return baseCriteria;
                }
            }))).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    groupWrapLayout.addComponent(printBtn);

    MButton newTicketBtn = new MButton(UserUIContext.getMessage(TicketI18nEnum.NEW), clickEvent -> {
        UI.getCurrent().addWindow(AppContextUtil.getSpringBean(TicketComponentFactory.class)
                .createNewTicketWindow(null, CurrentProjectVariables.getProjectId(), null, false));
    }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
            .withVisible(CurrentProjectVariables.canWriteTicket());
    groupWrapLayout.addComponent(newTicketBtn);

    MButton advanceDisplayBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST))
            .withIcon(FontAwesome.NAVICON).withWidth("100px");

    MButton kanbanBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_KANBAN),
            clickEvent -> displayKanbanView()).withWidth("100px").withIcon(FontAwesome.TH);

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(kanbanBtn);
    viewButtons.withDefaultButton(advanceDisplayBtn);
    groupWrapLayout.addComponent(viewButtons);

    MHorizontalLayout mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth();
    wrapBody = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, false));
    rightColumn = new MVerticalLayout().withWidth("370px")
            .withMargin(new MarginInfo(true, false, false, false));
    mainLayout.with(wrapBody, rightColumn).expand(wrapBody);
    this.with(ticketSearchPanel, mainLayout);
}

From source file:de.kaiserpfalzEdv.vaadin.menu.impl.MenuImpl.java

License:Apache License

@Inject
public MenuImpl(final Authenticator accessControl, final EventBus bus, final I18NHandler i18n,
        final List<View> allViews) {
    this.accessControl = accessControl;
    this.bus = bus;
    this.i18n = i18n;
    this.allViews = allViews;

    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from www .  j  a v  a 2 s.com
    Label title = new Label(translate("application.name"));
    title.addStyleName(ValoTheme.LABEL_H3);
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/table-logo.png"));
    image.setStyleName("logo");
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem(translate("button.logout.caption"), FontAwesome.valueOf(translate("button.logout.icon")),
            selectedItem -> {
                VaadinSession.getCurrent().getSession().invalidate();
                Page.getCurrent().reload();
            });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button(translate("application.name"), new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}

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

License:Open Source License

private void initNoteComponent() {

    innerNotesComponent = new VerticalLayout();

    innerNotesComponent.setIcon(FontAwesome.NAVICON);
    innerNotesComponent.setCaption("Experiment Notes");

    noteComponent = new MultiscaleComponent(controller);
    innerNotesComponent.addComponent(noteComponent);
    innerNotesComponent.setMargin(new MarginInfo(true, false, false, true));
}

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

License:Open Source License

private void initNoteComponent() {
    innerNotesComponent = new VerticalLayout();

    innerNotesComponent.setIcon(FontAwesome.NAVICON);
    innerNotesComponent.setCaption("Sample Notes");

    noteComponent = new MultiscaleComponent(controller);
    innerNotesComponent.addComponent(noteComponent);
    innerNotesComponent.setMargin(new MarginInfo(true, false, false, true));
}

From source file:ui.menu.LifetimeMenu.java

License:Apache License

private void initMoreMenuOptions() {
    menuButton = new LifetimeButtonLink("More", FontAwesome.NAVICON);
    menuButton.addClickListener(this);
    logoutButton = new LogoutButton(userId, language);
    lightsOnButton = new LightsOnOffButton(language);
    VerticalLayout options = new VerticalLayout(logoutButton, lightsOnButton);
    options.setStyleName("v-menu-options");
    menu.put(menuButton, options);//from  ww  w .j av  a 2  s.  c om
}