Example usage for com.vaadin.ui Button setStyleName

List of usage examples for com.vaadin.ui Button setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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

License:Open Source License

public FilterTaskViewImpl() {
    this.setMargin(new MarginInfo(false, true, true, true));
    final HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);/*from w w w.  jav  a 2  s  .c o  m*/
    header.setMargin(new MarginInfo(true, false, true, false));
    header.setStyleName(UIConstants.HEADER_VIEW);
    header.setWidth("100%");
    Image titleIcon = new Image(null, MyCollabResource.newResource("icons/24/project/task.png"));

    headerText = new Label();
    headerText.setSizeUndefined();
    headerText.setStyleName(UIConstants.HEADER_TEXT);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null));

                }
            });
    backtoTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    UiUtils.addComponent(header, titleIcon, Alignment.TOP_LEFT);
    UiUtils.addComponent(header, headerText, Alignment.MIDDLE_LEFT);
    UiUtils.addComponent(header, backtoTaskListBtn, Alignment.MIDDLE_RIGHT);
    header.setExpandRatio(headerText, 1.0f);

    this.addComponent(header);

    HorizontalLayout contentLayout = new HorizontalLayout();
    contentLayout.setWidth("100%");
    contentLayout.setSpacing(true);
    this.addComponent(contentLayout);

    this.taskTableDisplay = new TaskTableDisplay(Arrays.asList(TaskTableFieldDef.taskname,
            TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.percentagecomplete));

    this.taskTableDisplay.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(FilterTaskViewImpl.this, task.getId()));
            }
        }
    });
    taskTableDisplay.setWidth("100%");
    taskTableDisplay.setStyleName("filter-task-table");

    leftColumn = new VerticalLayout();
    leftColumn.addComponent(taskTableDisplay);
    leftColumn.setStyleName("depotComp");
    leftColumn.setMargin(new MarginInfo(true, true, false, false));

    rightColumn = new VerticalLayout();
    rightColumn.setWidth("300px");
    contentLayout.addComponent(leftColumn);
    contentLayout.addComponent(rightColumn);
    contentLayout.setExpandRatio(leftColumn, 1.0f);
    unresolvedTaskByAssigneeWidget = new UnresolvedTaskByAssigneeWidget();
    rightColumn.addComponent(unresolvedTaskByAssigneeWidget);

    unresolvedTaskByPriorityWidget = new UnresolvedTaskByPriorityWidget();
    rightColumn.addComponent(unresolvedTaskByPriorityWidget);
}

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

License:Open Source License

public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) {

    final VerticalLayout taskLayout = new VerticalLayout();
    taskLayout.addStyleName("taskadd-popup");

    final VerticalLayout popupHeader = new VerticalLayout();
    popupHeader.setWidth("100%");
    popupHeader.setMargin(true);/*from ww  w.  j a  v  a2s .c om*/
    popupHeader.addStyleName("popup-header");

    final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE));
    titleLbl.addStyleName("bold");
    popupHeader.addComponent(titleLbl);
    taskLayout.addComponent(popupHeader);

    this.task = new SimpleTask();
    TabSheet taskContainer = new TabSheet();
    final TaskInputForm taskInputForm = new TaskInputForm();
    taskInputForm.setWidth("100%");
    taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE));

    this.taskNoteComponent = new TaskNoteLayout();
    taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT));

    taskLayout.addComponent(taskContainer);

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true);
    controlsLayout.addStyleName("popup-footer");

    final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskDisplayComp.closeTaskAdd();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    if (taskInputForm.validateForm()) {
                        final ProjectTaskService taskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);

                        task.setTasklistid(taskList.getId());
                        task.setProjectid(CurrentProjectVariables.getProjectId());
                        task.setSaccountid(AppContext.getAccountId());
                        task.setNotes(taskNoteComponent.getNote());

                        taskService.saveWithSession(task, AppContext.getUsername());
                        taskNoteComponent.saveContentsToRepo(task.getId());
                        taskDisplayComp.saveTaskSuccess(task);
                        taskDisplayComp.closeTaskAdd();
                    }
                }
            });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    taskLayout.addComponent(controlsLayout);
    taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT);

    this.setCompositionRoot(taskLayout);
}

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   ww  w  . jav  a2 s  . co  m*/
        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.TaskGroupDisplayViewImpl.java

License:Open Source License

private void implementTaskFilterButton() {
    this.taskSelection = new PopupButton(AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASKS));

    this.taskSelection.setEnabled(CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS));
    this.taskSelection.addStyleName("link");
    this.taskSelection.addStyleName("hdr-text");

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

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

                @Override/*from  w w w .  j  ava  2s  . c om*/
                public void buttonClick(final ClickEvent event) {
                    taskSelection.setPopupVisible(false);
                    taskSelection.setCaption(event.getButton().getCaption());
                    displayAllTasks();
                }
            });
    allTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(allTasksFilterBtn);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskSelection.setPopupVisible(false);
                    taskSelection.setCaption(event.getButton().getCaption());
                    displayActiveTasksOnly();
                }
            });
    activeTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(activeTasksFilterBtn);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskSelection.setPopupVisible(false);
                    taskSelection.setCaption(event.getButton().getCaption());
                    displayPendingTasksOnly();
                }
            });
    pendingTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(pendingTasksFilterBtn);

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

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskSelection.setPopupVisible(false);
                    taskSelection.setCaption(event.getButton().getCaption());
                    displayInActiveTasks();
                }
            });
    archievedTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(archievedTasksFilterBtn);
    taskSelection.setContent(filterBtnLayout);
}

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/*w  w  w  .  java2s  . c  om*/
                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.TaskGroupDisplayViewImpl.java

License:Open Source License

private VerticalLayout createSearchPanel() {
    MVerticalLayout basicSearchBody = new MVerticalLayout()
            .withMargin(new MarginInfo(true, false, true, false));
    basicSearchBody.addStyleName(UIConstants.BORDER_BOX_2);

    nameField = new TextField();

    nameField.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
    basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER);

    MHorizontalLayout control = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false));

    final Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
    searchBtn.setIcon(FontAwesome.SEARCH);
    searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    searchBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override// w w w  . j a  v a  2 s.c  o  m
        public void buttonClick(final ClickEvent event) {
            TaskSearchCriteria searchCriteria = new TaskSearchCriteria();
            searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
            searchCriteria.setTaskName(new StringSearchField(nameField.getValue().trim()));
            TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search");
            moveToTaskSearch(taskFilter);
        }
    });
    control.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_CENTER);

    final Button advancedSearchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    TaskSearchCriteria searchCriteria = new TaskSearchCriteria();
                    searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
                    searchCriteria.setTaskName(new StringSearchField(nameField.getValue().trim()));
                    TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search");
                    taskFilter.setAdvanceSearch(true);
                    moveToTaskSearch(taskFilter);
                }
            });
    advancedSearchBtn.setStyleName(UIConstants.THEME_BLUE_LINK);
    control.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER);
    basicSearchBody.with(control).withAlign(control, Alignment.MIDDLE_CENTER);

    return basicSearchBody;
}

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

License:Open Source License

private void constructHeader() {
    CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.addStyleName("taskgroup-header");

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);/* w  ww.  j av a 2s.  c o m*/
    header.setWidth("100%");
    Label headerLbl = new Label("All Tasks");
    headerLbl.setStyleName("h2");
    header.addComponent(headerLbl);
    header.setComponentAlignment(headerLbl, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(headerLbl, 1.0f);

    Button backToListBtn = new Button("Back to dashboard", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null));
        }
    });
    backToListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(backToListBtn);
    header.setComponentAlignment(backToListBtn, Alignment.MIDDLE_RIGHT);

    saveOrderBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.SaveReoderTaskList(event, changeSet));
        }
    });
    saveOrderBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(saveOrderBtn);
    header.setComponentAlignment(saveOrderBtn, Alignment.MIDDLE_RIGHT);

    headerWrapper.addComponent(header);

    this.addComponent(headerWrapper);

    final DDVerticalLayout ddLayout = new DDVerticalLayout();
    ddLayout.addStyleName("taskgroup-reorder");
    ddLayout.setComponentVerticalDropRatio(0.3f);
    ddLayout.setDragMode(LayoutDragMode.CLONE);
    ddLayout.setDropHandler(new DropHandler() {
        private static final long serialVersionUID = 1L;

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

        @Override
        public void drop(DragAndDropEvent event) {
            LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();

            DDVerticalLayout.VerticalLayoutTargetDetails details = (DDVerticalLayout.VerticalLayoutTargetDetails) event
                    .getTargetDetails();

            TaskListComponent comp = (TaskListComponent) transferable.getComponent();

            int currentIndex = ddLayout.getComponentIndex(comp);
            int newIndex = details.getOverIndex();

            ddLayout.removeComponent(comp);

            if (currentIndex > newIndex && details.getDropLocation() == VerticalDropLocation.BOTTOM) {
                newIndex++;
            }

            SimpleTaskList dropTaskList = comp.getTaskList();
            dropTaskList.setGroupindex(newIndex);
            changeSet.add(dropTaskList);
            ddLayout.addComponent(comp, newIndex);

            // change affected task list items
            for (int i = 0; i < ddLayout.getComponentCount(); i++) {
                TaskListComponent affectedComp = (TaskListComponent) ddLayout.getComponent(i);
                SimpleTaskList affectedTaskList = affectedComp.getTaskList();
                affectedTaskList.setGroupindex(i);
                changeSet.add(affectedTaskList);
            }
        }
    });

    taskLists = new BeanList<ProjectTaskListService, TaskListSearchCriteria, SimpleTaskList>(null,
            ApplicationContextUtil.getSpringBean(ProjectTaskListService.class), TaskListRowDisplayHandler.class,
            ddLayout);
    this.addComponent(taskLists);
}

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  .  ja  v a2  s. c  o m
        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);
}

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

License:Open Source License

public TaskKanbanviewImpl() {
    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);

    Button addNewColumnBtn = new Button("New column", new Button.ClickListener() {
        @Override/*from w  w w  . ja v a2  s.com*/
        public void buttonClick(Button.ClickEvent clickEvent) {
            UI.getCurrent()
                    .addWindow(new AddNewColumnWindow(TaskKanbanviewImpl.this, ProjectTypeConstants.TASK));
        }
    });
    addNewColumnBtn.setIcon(FontAwesome.PLUS);
    addNewColumnBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));
    addNewColumnBtn.setStyleName(UIConstants.BUTTON_ACTION);
    groupWrapLayout.addComponent(addNewColumnBtn);

    Button deleteColumBtn = new Button("Delete columns", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent()
                    .addWindow(new DeleteColumnWindow(TaskKanbanviewImpl.this, ProjectTypeConstants.TASK));
        }
    });
    deleteColumBtn.setIcon(FontAwesome.TRASH_O);
    deleteColumBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));
    deleteColumBtn.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(TaskKanbanviewImpl.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.setDefaultButton(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);
}

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

License:Open Source License

public TaskSearchTableDisplay(TableViewField requiredColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(ProjectTaskService.class), SimpleTask.class, requiredColumn,
            displayColumns);/*from www.  java  2  s  . c om*/

    this.addGeneratedColumn("taskname", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId);

            CssLayout taskName = new CssLayout();

            String taskname = "[%s-%s] %s";
            taskname = String.format(taskname, CurrentProjectVariables.getProject().getShortname(),
                    task.getTaskkey(), task.getTaskname());
            LabelLink b = new LabelLink(taskname, ProjectLinkBuilder
                    .generateTaskPreviewFullLink(task.getTaskkey(), task.getProjectShortname()));
            b.setDescription(ProjectTooltipGenerator.generateToolTipTask(AppContext.getUserLocale(), task,
                    AppContext.getSiteUrl(), AppContext.getTimezone()));

            if (StringUtils.isNotBlank(task.getPriority())) {
                b.setIconLink(ProjectResources.getIconResourceLink12ByTaskPriority(task.getPriority()));

            }

            if (task.getPercentagecomplete() != null && 100d == task.getPercentagecomplete()) {
                b.addStyleName(UIConstants.LINK_COMPLETED);
            } else {
                if ("Pending".equals(task.getStatus())) {
                    b.addStyleName(UIConstants.LINK_PENDING);
                } else if ((task.getEnddate() != null
                        && (task.getEnddate().before(new GregorianCalendar().getTime())))
                        || (task.getActualenddate() != null
                                && (task.getActualenddate().before(new GregorianCalendar().getTime())))
                        || (task.getDeadline() != null
                                && (task.getDeadline().before(new GregorianCalendar().getTime())))) {
                    b.addStyleName(UIConstants.LINK_OVERDUE);
                }
            }

            taskName.addComponent(b);
            taskName.setWidth("100%");
            taskName.setHeightUndefined();
            return taskName;

        }
    });

    this.addGeneratedColumn("percentagecomplete", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId);
            Double percomp = (task.getPercentagecomplete() == null) ? new Double(0)
                    : task.getPercentagecomplete();
            ProgressPercentageIndicator progress = new ProgressPercentageIndicator(percomp);
            progress.setWidth("100px");
            return progress;
        }
    });

    this.addGeneratedColumn("startdate", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDate(task.getStartdate()));

        }
    });

    this.addGeneratedColumn("deadline", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDate(task.getDeadline()));

        }
    });

    this.addGeneratedColumn("id", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId);
            PopupButton taskSettingPopupBtn = new PopupButton();
            VerticalLayout filterBtnLayout = new VerticalLayout();
            filterBtnLayout.setMargin(true);
            filterBtnLayout.setSpacing(true);
            filterBtnLayout.setWidth("100px");

            Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            EventBusFactory.getInstance()
                                    .post(new TaskEvent.GotoEdit(TaskSearchTableDisplay.this, task));
                        }
                    });
            editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
            editButton.setStyleName("link");
            filterBtnLayout.addComponent(editButton);

            if ((task.getPercentagecomplete() != null && task.getPercentagecomplete() != 100)
                    || task.getPercentagecomplete() == null) {
                Button closeBtn = new Button("Close", new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        task.setStatus("Closed");
                        task.setPercentagecomplete(100d);

                        ProjectTaskService projectTaskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);
                        projectTaskService.updateWithSession(task, AppContext.getUsername());

                        fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "closeTask"));
                    }
                });
                closeBtn.setStyleName("link");
                closeBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
                filterBtnLayout.addComponent(closeBtn);
            } else {
                Button reOpenBtn = new Button("ReOpen", new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        task.setStatus("Open");
                        task.setPercentagecomplete(0d);

                        ProjectTaskService projectTaskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);
                        projectTaskService.updateWithSession(task, AppContext.getUsername());
                        fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "reopenTask"));
                    }
                });
                reOpenBtn.setStyleName("link");
                reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
                filterBtnLayout.addComponent(reOpenBtn);
            }

            if (!"Pending".equals(task.getStatus())) {
                if (!"Closed".equals(task.getStatus())) {
                    Button pendingBtn = new Button("Pending", new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            task.setStatus("Pending");
                            task.setPercentagecomplete(0d);

                            ProjectTaskService projectTaskService = ApplicationContextUtil
                                    .getSpringBean(ProjectTaskService.class);
                            projectTaskService.updateWithSession(task, AppContext.getUsername());
                            fireTableEvent(
                                    new TableClickEvent(TaskSearchTableDisplay.this, task, "pendingTask"));
                        }
                    });
                    pendingBtn.setStyleName("link");
                    pendingBtn.setEnabled(
                            CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
                    filterBtnLayout.addComponent(pendingBtn);
                }
            } else {
                Button reOpenBtn = new Button("ReOpen", new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        task.setStatus("Open");
                        task.setPercentagecomplete(0d);

                        ProjectTaskService projectTaskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);
                        projectTaskService.updateWithSession(task, AppContext.getUsername());

                        fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "reopenTask"));
                    }
                });
                reOpenBtn.setStyleName("link");
                reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
                filterBtnLayout.addComponent(reOpenBtn);
            }

            Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                    new Button.ClickListener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            ConfirmDialogExt.show(UI.getCurrent(),
                                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                            SiteConfiguration.getSiteName()),
                                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                                    AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                                    AppContext.getMessage(GenericI18Enum.BUTTON_NO),
                                    new ConfirmDialog.Listener() {
                                        private static final long serialVersionUID = 1L;

                                        @Override
                                        public void onClose(ConfirmDialog dialog) {
                                            if (dialog.isConfirmed()) {
                                                ProjectTaskService projectTaskService = ApplicationContextUtil
                                                        .getSpringBean(ProjectTaskService.class);
                                                projectTaskService.removeWithSession(task.getId(),
                                                        AppContext.getUsername(), AppContext.getAccountId());
                                                fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this,
                                                        task, "deleteTask"));
                                            }
                                        }
                                    });
                        }
                    });
            deleteBtn.setStyleName("link");
            deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));
            filterBtnLayout.addComponent(deleteBtn);

            taskSettingPopupBtn.setIcon(MyCollabResource.newResource("icons/16/item_settings.png"));
            taskSettingPopupBtn.setStyleName("link");
            taskSettingPopupBtn.setContent(filterBtnLayout);
            return taskSettingPopupBtn;
        }
    });

    this.addGeneratedColumn("assignUserFullName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId);
            return new ProjectUserLink(task.getAssignuser(), task.getAssignUserAvatarId(),
                    task.getAssignUserFullName());

        }
    });
    this.setWidth("100%");
}