Example usage for com.vaadin.server FontAwesome PLUS

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

Introduction

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

Prototype

FontAwesome PLUS

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

Click Source Link

Usage

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

License:Open Source License

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

    createBtn = new Button(AppContext.getMessage(MilestoneI18nEnum.NEW), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from   w w  w. j a v  a2  s  .  c  o m
        public void buttonClick(final Button.ClickEvent event) {
            SimpleMilestone milestone = new SimpleMilestone();
            milestone.setSaccountid(AppContext.getAccountId());
            milestone.setProjectid(CurrentProjectVariables.getProjectId());
            UI.getCurrent().addWindow(new MilestoneAddWindow(milestone));
        }
    });
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setStyleName(UIConstants.BUTTON_ACTION);
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
    layout.with(createBtn);

    Button printBtn = new Button("", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            UI.getCurrent().addWindow(new MilestoneCustomizeReportOutputWindow(new LazyValueInjector() {
                @Override
                protected Object doEval() {
                    return baseCriteria;
                }
            }));
        }
    });
    printBtn.setIcon(FontAwesome.PRINT);
    printBtn.addStyleName(UIConstants.BUTTON_OPTION);
    printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    layout.addComponent(printBtn);

    Button kanbanBtn = new Button("Board", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            EventBusFactory.getInstance()
                    .post(new MilestoneEvent.GotoList(MilestoneRoadmapViewImpl.this, null));
        }
    });
    kanbanBtn.setDescription("Board View");
    kanbanBtn.setIcon(FontAwesome.TH);

    Button roadmapBtn = new Button("List");
    roadmapBtn.setDescription("Roadmap");
    roadmapBtn.setIcon(VaadinIcons.CUBE);

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(roadmapBtn);
    viewButtons.addButton(kanbanBtn);
    viewButtons.withDefaultButton(roadmapBtn);
    layout.with(viewButtons);

    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java

License:Open Source License

private void initHeader() {
    Label headerText = new ProjectViewHeader(ProjectTypeConstants.PAGE,
            AppContext.getMessage(Page18InEnum.VIEW_LIST_TITLE));

    headerLayout.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText);

    Label sortLbl = new Label(AppContext.getMessage(Page18InEnum.OPT_SORT_LABEL));
    sortLbl.setSizeUndefined();/*from w  w w  . ja v  a 2 s. c  o m*/
    headerLayout.with(sortLbl).withAlign(sortLbl, Alignment.MIDDLE_RIGHT);

    ToggleButtonGroup sortGroup = new ToggleButtonGroup();
    headerLayout.with(sortGroup).withAlign(sortGroup, Alignment.MIDDLE_RIGHT);

    SortButton sortDateBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_DATE),
            new Button.ClickListener() {

                private static final long serialVersionUID = -6987503077975316907L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    dateSourceAscend = !dateSourceAscend;
                    if (dateSourceAscend) {
                        Collections.sort(resources, Ordering.from(dateSort));
                    } else {
                        Collections.sort(resources, Ordering.from(dateSort).reverse());
                    }
                    displayPages(resources);

                }
            });
    sortGroup.addButton(sortDateBtn);

    SortButton sortNameBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_NAME),
            new Button.ClickListener() {

                private static final long serialVersionUID = 2847554379518387585L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    nameSortAscend = !nameSortAscend;
                    if (nameSortAscend) {
                        Collections.sort(resources, Ordering.from(nameSort));
                    } else {
                        Collections.sort(resources, Ordering.from(nameSort).reverse());
                    }
                    displayPages(resources);

                }
            });
    sortGroup.addButton(sortNameBtn);

    SortButton sortKindBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_KIND),
            new Button.ClickListener() {

                private static final long serialVersionUID = 2230933690084074590L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    kindSortAscend = !kindSortAscend;
                    if (kindSortAscend) {
                        Collections.sort(resources, Ordering.from(kindSort));
                    } else {
                        Collections.sort(resources, Ordering.from(kindSort).reverse());
                    }
                    displayPages(resources);

                }
            });
    sortGroup.addButton(sortKindBtn);

    sortGroup.setDefaultButton(sortDateBtn);

    final Button newGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    UI.getCurrent().addWindow(new PageGroupWindow());
                }
            });
    newGroupBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    newGroupBtn.setIcon(FontAwesome.PLUS);
    newGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    headerLayout.with(newGroupBtn).withAlign(newGroupBtn, Alignment.MIDDLE_RIGHT);

    final Button newPageBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_PAGE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null));
                }
            });
    newPageBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    newPageBtn.setIcon(FontAwesome.PLUS);
    newPageBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));

    headerText.setStyleName(UIConstants.HEADER_TEXT);
    headerLayout.with(newPageBtn).withAlign(newPageBtn, Alignment.MIDDLE_RIGHT);
}

From source file:com.esofthead.mycollab.module.project.view.ProjectSearchPanel.java

License:Open Source License

@Override
protected Component buildExtraControls() {
    Button createBtn = new Button(AppContext.getMessage(ProjectI18nEnum.NEW), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//ww  w.  jav  a2s . c o m
        public void buttonClick(final Button.ClickEvent event) {
            UI.getCurrent().addWindow(new ProjectAddWindow());
        }
    });
    createBtn.setStyleName(UIConstants.BUTTON_ACTION);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT));
    return createBtn;
}

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

License:Open Source License

@Override
protected Component buildExtraControls() {
    Button createBtn = new Button(AppContext.getMessage(ComponentI18nEnum.NEW), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*  w ww  .j a  va 2 s  .  c om*/
        public void buttonClick(final Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null));
        }
    });
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS));
    createBtn.setStyleName(UIConstants.BUTTON_ACTION);
    createBtn.setIcon(FontAwesome.PLUS);
    return createBtn;
}

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

License:Open Source License

public ProjectMemberListViewImpl() {
    super();// w  ww.  jav  a2  s. co m
    this.setMargin(new MarginInfo(false, true, false, true));
    MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("100%").withStyleName("hdr-view");
    viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label headerText = new ProjectViewHeader(ProjectTypeConstants.MEMBER,
            AppContext.getMessage(ProjectMemberI18nEnum.VIEW_LIST_TITLE));
    headerText.setStyleName("hdr-text");

    viewHeader.with(headerText).expand(headerText);

    Button createBtn = new Button(AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoInviteMembers(this, null));
                }
            });
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);

    viewHeader.addComponent(createBtn);

    this.addComponent(viewHeader);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    contentLayout.setStyleName("view-content");

    this.addComponent(contentLayout);
}

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

License:Open Source License

@Override
protected Component buildExtraControls() {
    Button createBtn = new Button(AppContext.getMessage(VersionI18nEnum.NEW), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*from w w  w  .jav a2  s  .co m*/
        public void buttonClick(final Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null));
        }
    });
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS));
    createBtn.setStyleName(UIConstants.BUTTON_ACTION);
    createBtn.setIcon(FontAwesome.PLUS);
    return createBtn;
}

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

License:Open Source License

public TaskDashboardViewImpl() {
    this.withMargin(new MarginInfo(false, true, true, true));
    taskSearchPanel = new TaskSearchPanel();

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

    groupWrapLayout.addComponent(new Label("Sort"));
    final ComboBox sortCombo = new ValueComboBox(false,
            AppContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING),
            AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING));
    sortCombo.addValueChangeListener(new Property.ValueChangeListener() {
        @Override/*from  w  w w . ja va  2s . com*/
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            String sortValue = (String) sortCombo.getValue();
            if (AppContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) {
                sortDirection = SearchCriteria.ASC;
            } else {
                sortDirection = SearchCriteria.DESC;
            }
            queryAndDisplayTasks();
        }
    });
    sortDirection = SearchCriteria.DESC;
    groupWrapLayout.addComponent(sortCombo);

    groupWrapLayout.addComponent(new Label("Group by"));
    final ComboBox groupCombo = new ValueComboBox(false, GROUP_DUE_DATE, GROUP_START_DATE, GROUP_CREATED_DATE,
            PLAIN_LIST, GROUP_USER);
    groupCombo.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            groupByState = (String) groupCombo.getValue();
            queryAndDisplayTasks();
        }
    });
    groupByState = GROUP_DUE_DATE;
    groupWrapLayout.addComponent(groupCombo);

    taskSearchPanel.addHeaderRight(groupWrapLayout);

    Button printBtn = new Button("", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            UI.getCurrent().addWindow(new TaskCustomizeReportOutputWindow(new LazyValueInjector() {
                @Override
                protected Object doEval() {
                    return baseCriteria;
                }
            }));
        }
    });
    printBtn.setIcon(FontAwesome.PRINT);
    printBtn.addStyleName(UIConstants.BUTTON_OPTION);
    printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    groupWrapLayout.addComponent(printBtn);

    Button newTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.NEW), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
                SimpleTask newTask = new SimpleTask();
                newTask.setProjectid(CurrentProjectVariables.getProjectId());
                newTask.setSaccountid(AppContext.getAccountId());
                newTask.setLogby(AppContext.getUsername());
                UI.getCurrent().addWindow(new TaskAddWindow(newTask));
            }
        }
    });
    newTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    newTaskBtn.setIcon(FontAwesome.PLUS);
    newTaskBtn.setStyleName(UIConstants.BUTTON_ACTION);
    groupWrapLayout.addComponent(newTaskBtn);

    Button advanceDisplayBtn = new Button("List");
    advanceDisplayBtn.setWidth("100px");
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription("Advance View");

    Button kanbanBtn = new Button("Kanban", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            displayKanbanView();
        }
    });
    kanbanBtn.setWidth("100px");
    kanbanBtn.setDescription("Kanban View");
    kanbanBtn.setIcon(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(taskSearchPanel, mainLayout);
}

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

License:Open Source License

private void showTaskGroupInfo() {
    if (this.isDisplayTaskListInfo) {
        AdvancedPreviewBeanForm<SimpleTaskList> previewForm = new AdvancedPreviewBeanForm<>();
        previewForm.setWidth("100%");
        previewForm.setFormLayoutFactory(new IFormLayoutFactory() {
            private static final long serialVersionUID = 1L;

            private GridFormLayoutHelper layoutHelper;

            @Override//from w w  w  .j  av a 2  s  .c o m
            public ComponentContainer getLayout() {
                this.layoutHelper = new GridFormLayoutHelper(2, 3, "100%", "180px", Alignment.TOP_LEFT);
                this.layoutHelper.getLayout().setWidth("100%");
                this.layoutHelper.getLayout().addStyleName("colored-gridlayout");
                this.layoutHelper.getLayout().setMargin(false);
                return this.layoutHelper.getLayout();
            }

            @Override
            public void attachField(Object propertyId, Field<?> field) {
                if ("description".equals(propertyId)) {
                    layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0,
                            0, 2, "100%");
                } else if ("owner".equals(propertyId)) {
                    layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 1);
                } else if ("milestoneid".equals(propertyId)) {
                    layoutHelper.addComponent(field, AppContext.getMessage(TaskGroupI18nEnum.FORM_PHASE_FIELD),
                            1, 1);
                }
            }
        });
        previewForm.setBeanFormFieldFactory(
                new AbstractBeanFieldGroupViewFieldFactory<SimpleTaskList>(previewForm) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected Field<?> onCreateField(Object propertyId) {
                        if ("description".equals(propertyId)) {
                            return new DefaultViewField(taskList.getDescription(), ContentMode.HTML);
                        } else if ("owner".equals(propertyId)) {
                            return new ProjectUserFormLinkField(taskList.getOwner(),
                                    taskList.getOwnerAvatarId(), taskList.getOwnerFullName());
                        } else if ("milestoneid".equals(propertyId)) {
                            return new LinkViewField(taskList.getMilestoneName(),
                                    ProjectLinkBuilder.generateMilestonePreviewFullLink(taskList.getProjectid(),
                                            taskList.getMilestoneid()),
                                    ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE));
                        }

                        return null;
                    }

                });
        this.addComponent(previewForm);

        previewForm.setBean(this.taskList);
    }

    this.taskDisplay = new TaskTableDisplay(TaskTableFieldDef.id,
            Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate,
                    TaskTableFieldDef.assignee, TaskTableFieldDef.percentagecomplete));
    this.addComponent(this.taskDisplay);

    this.taskDisplay.addTableListener(new TableClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(final TableClickEvent event) {
            final SimpleTask task = (SimpleTask) event.getData();
            if ("taskname".equals(event.getFieldName())) {
                EventBusFactory.getInstance()
                        .post(new TaskEvent.GotoRead(TaskDisplayComponent.this, task.getId()));
            } else if ("closeTask".equals(event.getFieldName()) || "reopenTask".equals(event.getFieldName())
                    || "pendingTask".equals(event.getFieldName())
                    || "deleteTask".equals(event.getFieldName())) {
                TaskDisplayComponent.this.removeAllComponents();
                final ProjectTaskListService taskListService = ApplicationContextUtil
                        .getSpringBean(ProjectTaskListService.class);
                TaskDisplayComponent.this.taskList = taskListService
                        .findById(TaskDisplayComponent.this.taskList.getId(), AppContext.getAccountId());
                TaskDisplayComponent.this.showTaskGroupInfo();
            }
        }
    });

    this.createTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    TaskDisplayComponent.this
                            .removeComponent(TaskDisplayComponent.this.createTaskBtn.getParent());

                    TaskAddPopup taskAddView = new TaskAddPopup(TaskDisplayComponent.this,
                            TaskDisplayComponent.this.taskList);
                    TaskDisplayComponent.this.addComponent(taskAddView);
                }
            });
    this.createTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    this.createTaskBtn.setIcon(FontAwesome.PLUS);
    this.createTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    final VerticalLayout taskGroupFooter = new VerticalLayout();
    taskGroupFooter.setMargin(true);
    taskGroupFooter.addStyleName("task-list-footer");
    taskGroupFooter.addComponent(this.createTaskBtn);
    taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT);
    this.addComponent(taskGroupFooter);

    if (CollectionUtils.isNotEmpty(taskList.getSubTasks())) {
        taskDisplay.setCurrentDataList(taskList.getSubTasks());
    } else {
        taskDisplay.setCurrentDataList(new ArrayList<SimpleTask>());
    }
}

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

License:Open Source License

private void constructUI() {
    this.removeAllComponents();
    this.withMargin(new MarginInfo(false, true, true, true));

    header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withStyleName("hdr-view").withWidth("100%");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    this.taskGroupSelection = new PopupButton(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE));
    this.taskGroupSelection.setEnabled(CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS));
    this.taskGroupSelection.addStyleName("link");
    this.taskGroupSelection.addStyleName("hdr-text");
    taskGroupSelection.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK_LIST));
    header.with(taskGroupSelection).withAlign(taskGroupSelection, Alignment.MIDDLE_LEFT)
            .expand(taskGroupSelection);

    final MVerticalLayout filterBtnLayout = new MVerticalLayout().withMargin(true).withSpacing(true)
            .withWidth("200px");

    final Button allTasksFilterBtn = new Button(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE), new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override//from w ww  .j ava2s  .  com
                public void buttonClick(final ClickEvent event) {
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false);
                    TaskGroupDisplayViewImpl.this.taskGroupSelection
                            .setCaption(AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE));
                    TaskGroupDisplayViewImpl.this.displayAllTaskGroups();
                }
            });
    allTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(allTasksFilterBtn);

    final Button activeTasksFilterBtn = new Button(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false);
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption(
                            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE));
                    TaskGroupDisplayViewImpl.this.displayActiveTaskGroups();
                }
            });
    activeTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(activeTasksFilterBtn);

    final Button archivedTasksFilterBtn = new Button(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption(
                            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE));
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false);
                    TaskGroupDisplayViewImpl.this.displayInActiveTaskGroups();
                }
            });
    archivedTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(archivedTasksFilterBtn);

    this.taskGroupSelection.setContent(filterBtnLayout);

    final Button newTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow(
                            TaskGroupDisplayViewImpl.this);
                    UI.getCurrent().addWindow(taskListWindow);
                }
            });
    newTaskListBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    newTaskListBtn.setIcon(FontAwesome.PLUS);
    newTaskListBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP));
    newTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(newTaskListBtn);
    header.setComponentAlignment(newTaskListBtn, Alignment.MIDDLE_RIGHT);

    Button reOrderBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.ReoderTaskList(this, null));
        }
    });
    reOrderBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    reOrderBtn.setIcon(FontAwesome.SORT);
    reOrderBtn.setStyleName(UIConstants.THEME_BLUE_LINK);
    reOrderBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_REODER_TASKGROUP));
    header.addComponent(reOrderBtn);
    header.setComponentAlignment(reOrderBtn, Alignment.MIDDLE_RIGHT);

    PopupButton exportButtonControl = new PopupButton();
    exportButtonControl.addStyleName(UIConstants.THEME_BLUE_LINK);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);
    exportButtonControl.setDescription("Export to file");

    VerticalLayout popupButtonsControl = new VerticalLayout();
    exportButtonControl.setContent(popupButtonsControl);
    exportButtonControl.setWidthUndefined();

    Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF));
    FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
    pdfDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    exportPdfBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportPdfBtn);

    Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL));
    FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    exportExcelBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportExcelBtn);

    header.with(exportButtonControl).withAlign(exportButtonControl, Alignment.MIDDLE_LEFT);

    Button advanceDisplayBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            displayAdvancedView();
        }
    });
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP));

    Button simpleDisplayBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            TaskSearchCriteria searchCriteria = new TaskSearchCriteria();
            searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
            searchCriteria.setStatuses(new SetSearchField<>(new String[] { StatusI18nEnum.Open.name() }));
            TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search");
            taskFilter.setAdvanceSearch(true);
            moveToTaskSearch(taskFilter);
        }
    });
    simpleDisplayBtn.setIcon(FontAwesome.LIST_UL);
    simpleDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.LIST_VIEW_TOOLTIP));

    Button chartDisplayBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = -5707546605789537298L;

        @Override
        public void buttonClick(ClickEvent event) {
            displayGanttChartView();
        }
    });
    chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O);

    viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(simpleDisplayBtn);
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(chartDisplayBtn);
    viewButtons.setDefaultButton(advanceDisplayBtn);

    mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth().withSpacing(true);
    this.taskListsWidget = new TaskGroupDisplayWidget();

    MVerticalLayout leftColumn = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, false))
            .with(taskListsWidget);

    this.rightColumn = new MVerticalLayout().withWidth("300px")
            .withMargin(new MarginInfo(true, false, false, false));

    mainLayout.with(leftColumn, rightColumn).expand(leftColumn);

    FloatingComponent floatSidebar = FloatingComponent.floatThis(this.rightColumn);
    floatSidebar.setContainerId("main-body");

    implementTaskFilterButton();
    basicSearchView = new TaskSearchViewImpl();
    basicSearchView.getSearchHandlers().addSearchHandler(new SearchHandler<TaskSearchCriteria>() {
        @Override
        public void onSearch(TaskSearchCriteria criteria) {
            doSearch(criteria);
        }
    });
    basicSearchView.removeComponent(basicSearchView.getComponent(0));

    displayAdvancedView();
}

From source file:com.esofthead.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);

    toggleShowColumsBtn = new Button("");
    toggleShowColumsBtn.addClickListener(new Button.ClickListener() {
        @Override//from   ww  w .  j  a v  a2s .  com
        public void buttonClick(Button.ClickEvent clickEvent) {
            displayHiddenColumns = !displayHiddenColumns;
            reload();
            toggleShowButton();
        }
    });
    toggleShowColumsBtn.addStyleName(UIConstants.BUTTON_LINK);
    groupWrapLayout.addComponent(toggleShowColumsBtn);
    toggleShowButton();

    Button addNewColumnBtn = new Button(AppContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    UI.getCurrent().addWindow(new AddNewColumnWindow(TaskKanbanBoardViewImpl.this,
                            ProjectTypeConstants.TASK, "status"));
                }
            });
    addNewColumnBtn.setIcon(FontAwesome.PLUS);
    addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));
    addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION);
    groupWrapLayout.addComponent(addNewColumnBtn);

    Button deleteColumnBtn = new Button("Delete columns", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent()
                    .addWindow(new DeleteColumnWindow(TaskKanbanBoardViewImpl.this, ProjectTypeConstants.TASK));
        }
    });
    deleteColumnBtn.setIcon(FontAwesome.TRASH_O);
    deleteColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));
    deleteColumnBtn.setStyleName(UIConstants.BUTTON_DANGER);

    Button advanceDisplayBtn = new Button("List", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskEvent.GotoDashboard(TaskKanbanBoardViewImpl.this, null));
        }
    });
    advanceDisplayBtn.setWidth("100px");
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription("Advance View");

    Button kanbanBtn = new Button("Kanban");
    kanbanBtn.setWidth("100px");
    kanbanBtn.setDescription("Kanban View");
    kanbanBtn.setIcon(FontAwesome.TH);

    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 HashedMap(2);
                    map.put("id", blockItem.optionVal.getId());
                    map.put("index", i);
                    indexMap.add(map);
                }
                if (indexMap.size() > 0) {
                    optionValService.massUpdateOptionIndexes(indexMap, AppContext.getAccountId());
                }
            }
        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return new Not(VerticalLocationIs.MIDDLE);
        }
    });
    this.setWidth("100%");
    this.with(searchPanel, kanbanLayout).expand(kanbanLayout);
}