Example usage for com.vaadin.server FontAwesome SORT_ALPHA_DESC

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

Introduction

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

Prototype

FontAwesome SORT_ALPHA_DESC

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

Click Source Link

Usage

From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java

License:Open Source License

public ProjectMemberListViewImpl() {
    super();// ww w  . j  ava2 s . c o m
    this.setMargin(new MarginInfo(false, true, true, true));
    MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();
    viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    headerText = ComponentUtils.headerH2(ProjectTypeConstants.MEMBER,
            UserUIContext.getMessage(ProjectMemberI18nEnum.LIST));
    viewHeader.with(headerText).expand(headerText);

    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            displayMembers();
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            displayMembers();
        }
    });
    viewHeader.addComponent(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setMemberFullName(StringSearchField.and(value));
            displayMembers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setMemberFullName(null);
            displayMembers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    viewHeader.addComponent(searchTextField);

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

    MButton createBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new ProjectMemberEvent.GotoInviteMembers(this, null)))
                            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SEND);
    createBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    viewHeader.addComponent(createBtn);

    addComponent(viewHeader);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    addComponent(contentLayout);
}

From source file:com.mycollab.module.project.view.user.MyProjectListComponent.java

License:Open Source License

public MyProjectListComponent() {
    withSpacing(false).withMargin(new MarginInfo(true, false, true, false));
    this.addStyleName("myprojectlist");

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withStyleName(WebThemes.PANEL_HEADER);
    titleLbl = new Label(UserUIContext.getMessage(ProjectCommonI18nEnum.WIDGET_ACTIVE_PROJECTS_TITLE, 0));

    final MButton sortBtn = new MButton("").withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        isSortAsc = !isSortAsc;// w ww.jav a 2 s .  co m
        if (searchCriteria != null) {
            if (isSortAsc) {
                sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
                searchCriteria.setOrderFields(
                        Collections.singletonList(new SearchCriteria.OrderField("name", SearchCriteria.ASC)));
            } else {
                sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
                searchCriteria.setOrderFields(
                        Collections.singletonList(new SearchCriteria.OrderField("name", SearchCriteria.DESC)));
            }
            displayResults();
        }
    });

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria = getAllProjectsSearchCriteria();
            searchCriteria.setProjectName(StringSearchField.and(value));
            displayResults();
        }

        @Override
        public void emptySearch() {
            searchCriteria = getAllProjectsSearchCriteria();
            searchCriteria.setProjectName(null);
            displayResults();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);

    final PopupButton projectsPopup = new PopupButton("");
    projectsPopup.setIcon(FontAwesome.CARET_SQUARE_O_DOWN);
    projectsPopup.addStyleName(WebThemes.BUTTON_ICON_ONLY);

    OptionPopupContent filterBtnLayout = new OptionPopupContent();

    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
    int allProjectCount = projectService.getTotalCount(getAllProjectsSearchCriteria());
    Button allProjectsBtn = new Button(
            UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ALL_PROJECTS, allProjectCount),
            clickEvent -> {
                displayAllProjects();
                projectsPopup.setPopupVisible(false);
            });
    filterBtnLayout.addOption(allProjectsBtn);

    int activeProjectsCount = projectService.getTotalCount(getActiveProjectsSearchCriteria());
    Button activeProjectsBtn = new Button(
            UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECTS, activeProjectsCount),
            clickEvent -> {
                displayActiveProjects();
                projectsPopup.setPopupVisible(false);
            });
    filterBtnLayout.addOption(activeProjectsBtn);

    int archiveProjectsCount = projectService.getTotalCount(getArchivedProjectsSearchCriteria());
    Button archiveProjectsBtn = new Button(
            UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECTS, archiveProjectsCount),
            clickEvent -> {
                displayArchiveProjects();
                projectsPopup.setPopupVisible(false);
            });
    filterBtnLayout.addOption(archiveProjectsBtn);
    projectsPopup.setContent(filterBtnLayout);

    header.with(titleLbl, sortBtn, searchTextField, projectsPopup).expand(titleLbl)
            .alignAll(Alignment.MIDDLE_LEFT);

    this.projectList = new ProjectPagedList();
    this.with(header, projectList);
}

From source file:com.mycollab.module.project.view.user.ProjectMembersWidget.java

License:Open Source License

public ProjectMembersWidget() {
    super("", new CssLayout());
    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;//from  w  ww .j a  v a2 s  .  c o  m
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            searchCriteria.setOrderFields(Collections
                    .singletonList(new SearchCriteria.OrderField("memberFullName", SearchCriteria.ASC)));
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            searchCriteria.setOrderFields(Collections
                    .singletonList(new SearchCriteria.OrderField("memberFullName", SearchCriteria.DESC)));
        }
        memberList.setSearchCriteria(searchCriteria);
        setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.WIDGET_MEMBERS_TITLE,
                memberList.getTotalCount()));
    });
    addHeaderElement(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setMemberFullName(StringSearchField.and(value));
            showMembers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setMemberFullName(null);
            showMembers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    addHeaderElement(searchTextField);

    MButton inviteMemberBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEE),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new ProjectMemberEvent.GotoInviteMembers(this, null))).withIcon(FontAwesome.PLUS)
                            .withStyleName(WebThemes.BUTTON_ACTION).withVisible(
                                    CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    addHeaderElement(inviteMemberBtn);

    memberList = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectMemberService.class),
            new MemberRowDisplayHandler(), 7);
    bodyContent.addComponent(memberList);
}

From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java

License:Open Source License

public UserListViewImpl() {
    super();/*from  w  w  w. ja v  a  2 s.  c  o m*/
    this.setMargin(new MarginInfo(false, true, false, true));
    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();
    MButton createBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.NEW),
            clickEvent -> EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null)))
                    .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
                    .withVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER));

    headerText = HeaderWithFontAwesome.h2(FontAwesome.USERS, UserUIContext.getMessage(UserI18nEnum.LIST) + " "
            + UserUIContext.getMessage(GenericI18Enum.OPT_TOTAL_VALUE, 0));

    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            displayUsers();
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            displayUsers();
        }
    });
    header.addComponent(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setDisplayName(StringSearchField.and(value));
            displayUsers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setDisplayName(null);
            displayUsers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);

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

    header.with(headerText, sortBtn, searchTextField, printBtn, createBtn).alignAll(Alignment.MIDDLE_LEFT)
            .expand(headerText);
    this.addComponent(header);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    this.addComponent(contentLayout);
}