public void createBasicLayout() {
      this.messagePanelBody.removeAllComponents();
      this.messagePanelBody.addComponent(this.messageSearchPanel);

      final Button createMessageBtn =
          new Button(
              LocalizationHelper.getMessage(MessageI18nEnum.NEW_MESSAGE_ACTION),
              new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                  TopMessagePanel.this.createAddMessageLayout();
                }
              });
      createMessageBtn.setEnabled(
          CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MESSAGES));
      createMessageBtn.setStyleName(UIConstants.THEME_BLUE_LINK);
      createMessageBtn.setIcon(MyCollabResource.newResource("icons/16/addRecord.png"));
      createMessageBtn.setEnabled(
          CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MESSAGES));

      this.messagePanelBody.addComponent(createMessageBtn);
      this.messagePanelBody.setComponentAlignment(createMessageBtn, Alignment.MIDDLE_RIGHT);
    }
  public ToogleTaskSummaryField(final SimpleTask task, int maxLength) {
    this.setWidth("100%");
    this.maxLength = maxLength;
    this.task = task;
    taskLinkLbl = new Label(buildTaskLink(), ContentMode.HTML);
    taskLinkLbl.setWidthUndefined();
    taskLinkLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);

    this.addComponent(taskLinkLbl);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
      this.addStyleName("editable-field");
      this.addLayoutClickListener(
          new LayoutEvents.LayoutClickListener() {
            @Override
            public void layoutClick(LayoutEvents.LayoutClickEvent event) {
              if (event.getClickedComponent() == taskLinkLbl) {
                return;
              }
              if (isRead) {
                ToogleTaskSummaryField.this.removeComponent(taskLinkLbl);
                final TextField editField = new TextField();
                editField.setValue(task.getTaskname());
                editField.setWidth("100%");
                editField.focus();
                ToogleTaskSummaryField.this.addComponent(editField);
                ToogleTaskSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(
                    new Property.ValueChangeListener() {
                      @Override
                      public void valueChange(Property.ValueChangeEvent event) {
                        updateFieldValue(editField);
                      }
                    });
                editField.addBlurListener(
                    new FieldEvents.BlurListener() {
                      @Override
                      public void blur(FieldEvents.BlurEvent event) {
                        updateFieldValue(editField);
                      }
                    });
                isRead = !isRead;
              }
            }
          });
    }
  }
  @Override
  protected void buildExtraControls() {
    Button createBtn =
        new Button(
            AppContext.getMessage(BugI18nEnum.BUTTON_NEW_VERSION),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              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);
    this.addHeaderRight(createBtn);
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)) {
      VersionContainer versionContainer = (VersionContainer) container;
      versionContainer.addComponent(view.getWidget());

      Version version = (Version) data.getParams();
      view.editItem(version);

      ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
      if (version.getId() == null) {
        breadcrumb.gotoVersionAdd();
      } else {
        breadcrumb.gotoVersionEdit(version);
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
      MilestoneContainer milestoneContainer = (MilestoneContainer) container;
      milestoneContainer.navigateToContainer(ProjectTypeConstants.MILESTONE);
      milestoneContainer.removeAllComponents();
      milestoneContainer.addComponent(view.getWidget());

      Milestone milestone = (Milestone) data.getParams();
      view.editItem(milestone);

      ProjectBreadcrumb breadcrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
      if (milestone.getId() == null) {
        breadcrumb.gotoMilestoneAdd();
      } else {
        breadcrumb.gotoMilestoneEdit(milestone);
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
  private HorizontalLayout createSearchTopPanel() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.setSpacing(true);
    layout.setMargin(true);

    final Image titleIcon =
        new Image(null, MyCollabResource.newResource("icons/24/project/component.png"));
    layout.addComponent(titleIcon);
    layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_LEFT);

    final Label componenttitle = new Label("Components");
    componenttitle.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(componenttitle);
    layout.setExpandRatio(componenttitle, 1.0f);
    layout.setComponentAlignment(componenttitle, Alignment.MIDDLE_LEFT);

    final Button createBtn =
        new Button(
            LocalizationHelper.getMessage(BugI18nEnum.NEW_COMPONENT_ACTION),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(final Button.ClickEvent event) {
                EventBus.getInstance().fireEvent(new BugComponentEvent.GotoAdd(this, null));
              }
            });
    createBtn.setEnabled(
        CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS));
    createBtn.setStyleName(UIConstants.THEME_BLUE_LINK);
    createBtn.setIcon(MyCollabResource.newResource("icons/16/addRecord.png"));

    UiUtils.addComponent(layout, createBtn, Alignment.MIDDLE_RIGHT);

    return layout;
  }
  private void showTaskGroupInfo() {
    if (this.isDisplayTaskListInfo) {
      this.layoutHelper = new GridFormLayoutHelper(2, 3, "100%", "180px", Alignment.MIDDLE_LEFT);
      this.layoutHelper.getLayout().setWidth("100%");
      this.layoutHelper.getLayout().addStyleName("colored-gridlayout");
      this.layoutHelper.getLayout().setMargin(false);
      this.addComponent(this.layoutHelper.getLayout());

      final Label descLbl =
          (Label)
              this.layoutHelper.addComponent(
                  new Label(), "Description", 0, 0, 2, "100%", Alignment.TOP_RIGHT);
      descLbl.setContentMode(ContentMode.HTML);
      descLbl.setValue(StringUtils.preStringFormat(this.taskList.getDescription()));

      this.layoutHelper.addComponent(
          new ProjectUserFormLinkField(
              this.taskList.getOwner(),
              this.taskList.getOwnerAvatarId(),
              this.taskList.getOwnerFullName()),
          LocalizationHelper.getMessage(GenericI18Enum.FORM_ASSIGNEE_FIELD),
          0,
          1,
          Alignment.TOP_RIGHT);

      final DefaultFormViewFieldFactory.FormLinkViewField milestoneLink =
          new DefaultFormViewFieldFactory.FormLinkViewField(
              this.taskList.getMilestoneName(),
              new Button.ClickListener() {

                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                  EventBus.getInstance()
                      .fireEvent(
                          new MilestoneEvent.GotoRead(
                              this, TaskDisplayComponent.this.taskList.getMilestoneid()));
                }
              },
              MyCollabResource.newResource("icons/16/project/milestone.png"));
      this.layoutHelper.addComponent(
          milestoneLink,
          LocalizationHelper.getMessage(TaskI18nEnum.FORM_PHASE_FIELD),
          1,
          1,
          Alignment.TOP_RIGHT);

      this.taskListProgress =
          (ProgressPercentageIndicator)
              this.layoutHelper.addComponent(
                  new ProgressPercentageIndicator(this.taskList.getPercentageComplete()),
                  "Progress",
                  0,
                  2);
      this.taskListProgress.setWidth("100px");

      HorizontalLayout taskNumberProgress = new HorizontalLayout();
      taskNumberProgress.setSpacing(true);
      taskNumberProgress =
          (HorizontalLayout)
              this.layoutHelper.addComponent(taskNumberProgress, "Number of open tasks", 1, 2);

      this.taskNumberLbl =
          new Label(
              "(" + this.taskList.getNumOpenTasks() + "/" + this.taskList.getNumAllTasks() + ")");
      taskNumberProgress.addComponent(this.taskNumberLbl);
    }

    this.taskDisplay =
        new TaskTableDisplay(
            new String[] {
              "id", "taskname", "startdate", "deadline", "percentagecomplete", "assignUserFullName"
            },
            new String[] {
              "",
              LocalizationHelper.getMessage(TaskI18nEnum.TABLE_TASK_NAME_HEADER),
              LocalizationHelper.getMessage(TaskI18nEnum.TABLE_START_DATE_HEADER),
              LocalizationHelper.getMessage(TaskI18nEnum.TABLE_DUE_DATE_HEADER),
              LocalizationHelper.getMessage(TaskI18nEnum.TABLE_PER_COMPLETE_HEADER),
              LocalizationHelper.getMessage(TaskI18nEnum.TABLE_ASSIGNEE_HEADER)
            });
    this.addComponent(this.taskDisplay);

    this.taskDisplay.addTableListener(
        new ApplicationEventListener<TableClickEvent>() {
          private static final long serialVersionUID = 1L;

          @Override
          public Class<? extends ApplicationEvent> getEventType() {
            return TableClickEvent.class;
          }

          @Override
          public void handle(final TableClickEvent event) {
            final SimpleTask task = (SimpleTask) event.getData();
            if ("taskname".equals(event.getFieldName())) {
              EventBus.getInstance()
                  .fireEvent(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(
            LocalizationHelper.getMessage(TaskI18nEnum.NEW_TASK_ACTION),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(final Button.ClickEvent event) {

                TaskDisplayComponent.this.removeAllComponents();

                final TaskAddPopup taskAddView =
                    new TaskAddPopup(TaskDisplayComponent.this, TaskDisplayComponent.this.taskList);
                if (TaskDisplayComponent.this.layoutHelper != null) {
                  TaskDisplayComponent.this.addComponent(
                      TaskDisplayComponent.this.layoutHelper.getLayout(), 0);
                  TaskDisplayComponent.this.addComponent(TaskDisplayComponent.this.taskDisplay, 1);
                  TaskDisplayComponent.this.addComponent(taskAddView, 2);
                } else {
                  TaskDisplayComponent.this.addComponent(TaskDisplayComponent.this.taskDisplay, 0);
                  TaskDisplayComponent.this.addComponent(taskAddView, 1);
                }
                TaskDisplayComponent.this.removeComponent(TaskDisplayComponent.this.createTaskBtn);
              }
            });
    this.createTaskBtn.setEnabled(
        CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    this.createTaskBtn.setIcon(MyCollabResource.newResource("icons/16/addRecord.png"));
    this.createTaskBtn.setStyleName(UIConstants.THEME_BLUE_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);

    this.taskDisplay.setItems(this.taskList.getSubTasks());
  }
  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("Filter:"));
    final TaskSavedFilterComboBox savedFilterComboBox = new TaskSavedFilterComboBox();
    savedFilterComboBox.addQuerySelectListener(
        new SavedFilterComboBox.QuerySelectListener() {
          @Override
          public void querySelect(SavedFilterComboBox.QuerySelectEvent querySelectEvent) {
            List<SearchFieldInfo> fieldInfos = querySelectEvent.getSearchFieldInfos();
            TaskSearchCriteria criteria =
                SearchFieldInfo.buildSearchCriteria(TaskSearchCriteria.class, fieldInfos);
            criteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
            EventBusFactory.getInstance()
                .post(new TaskEvent.SearchRequest(TaskDashboardViewImpl.this, criteria));
          }
        });
    groupWrapLayout.addComponent(savedFilterComboBox);

    groupWrapLayout.addComponent(new Label("Sort:"));
    final ComboBox sortCombo = new ValueComboBox(false, DESCENDING, ASCENDING);
    sortCombo.setWidth("100px");
    sortCombo.addValueChangeListener(
        new Property.ValueChangeListener() {
          @Override
          public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            String sortValue = (String) sortCombo.getValue();
            if (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, PLAIN_LIST);
    groupCombo.setWidth("100px");
    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 exportBtn = new Button("Export");
    final SplitButton exportSplitBtn = new SplitButton(exportBtn);
    exportBtn.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            exportSplitBtn.setPopupVisible(true);
          }
        });
    exportSplitBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    OptionPopupContent popupButtonsControl = new OptionPopupContent();

    Button exportPdfBtn = new Button("PDF");
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    FileDownloader pdfFileDownloder = new FileDownloader(buildStreamSource(ReportExportType.PDF));
    pdfFileDownloder.extend(exportPdfBtn);
    popupButtonsControl.addOption(exportPdfBtn);

    Button exportExcelBtn = new Button("Excel");
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    FileDownloader excelFileDownloader =
        new FileDownloader(buildStreamSource(ReportExportType.EXCEL));
    excelFileDownloader.extend(exportExcelBtn);
    popupButtonsControl.addOption(exportExcelBtn);

    exportSplitBtn.setContent(popupButtonsControl);
    groupWrapLayout.with(exportSplitBtn);

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

              @Override
              public void buttonClick(final ClickEvent event) {
                SimpleTask newTask = new SimpleTask();
                newTask.setProjectid(CurrentProjectVariables.getProjectId());
                UI.getCurrent().addWindow(new TaskAddWindow(newTask));
              }
            });
    newTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    newTaskBtn.setIcon(FontAwesome.PLUS);
    newTaskBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP));
    newTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    groupWrapLayout.addComponent(newTaskBtn);

    Button advanceDisplayBtn = new Button();
    advanceDisplayBtn.setWidth("50px");
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription(
        AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP));

    Button calendarBtn =
        new Button(
            null,
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent clickEvent) {
                EventBusFactory.getInstance()
                    .post(new TaskEvent.GotoCalendarView(TaskDashboardViewImpl.this));
              }
            });
    calendarBtn.setWidth("50px");
    calendarBtn.setDescription("Calendar View");
    calendarBtn.setIcon(FontAwesome.CALENDAR);

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

              @Override
              public void buttonClick(ClickEvent event) {
                displayGanttChartView();
              }
            });
    chartDisplayBtn.setWidth("50px");
    chartDisplayBtn.setDescription("Display Gantt chart");
    chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O);

    Button kanbanBtn =
        new Button(
            null,
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent clickEvent) {
                displayKanbanView();
              }
            });
    kanbanBtn.setWidth("50px");
    kanbanBtn.setDescription("Kanban View");
    kanbanBtn.setIcon(FontAwesome.TH);

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(calendarBtn);
    viewButtons.addButton(kanbanBtn);
    viewButtons.addButton(chartDisplayBtn);
    viewButtons.setDefaultButton(advanceDisplayBtn);
    groupWrapLayout.addComponent(viewButtons);

    mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth();
    wrapBody = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, false));
    rightColumn =
        new MVerticalLayout()
            .withWidth("350px")
            .withMargin(new MarginInfo(true, false, false, false));
    mainLayout.with(wrapBody, rightColumn).expand(wrapBody);
  }
  public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    Button optionParentBtn =
        new Button(
            AppContext.getMessage(GenericI18Enum.BUTTON_OPTION),
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                optionBtn.setPopupVisible(true);
              }
            });

    optionBtn = new SplitButton(optionParentBtn);
    optionBtn.setWidthUndefined();
    optionBtn.addStyleName(UIConstants.THEME_GRAY_LINK);

    if (permissionItem != null) {
      boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
      boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
      boolean canRead = CurrentProjectVariables.canRead(permissionItem);

      if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        addBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    optionBtn.setPopupVisible(false);
                    T item = previewForm.getBean();
                    previewForm.fireAddForm(item);
                  }
                });
        addBtn.setIcon(FontAwesome.PLUS);
        addBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        addBtn.setEnabled(canWrite);
        editButtons.addComponent(addBtn);
      }

      if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        editBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    optionBtn.setPopupVisible(false);
                    T item = previewForm.getBean();
                    previewForm.fireEditForm(item);
                  }
                });
        editBtn.setIcon(FontAwesome.EDIT);
        editBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editBtn.setEnabled(canWrite);
        editButtons.addComponent(editBtn);
      }

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

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireDeleteForm(item);
                  }
                });
        deleteBtn.setIcon(FontAwesome.TRASH_O);
        deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
        deleteBtn.setEnabled(canAccess);
        editButtons.addComponent(deleteBtn);
      }

      if ((buttonEnableFlags & ASSIGN_BTN_PRESENTED) == ASSIGN_BTN_PRESENTED) {
        assignBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireAssignForm(item);
                  }
                });
        assignBtn.setIcon(FontAwesome.SHARE);
        assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editButtons.addComponent(assignBtn, 0);
        assignBtn.setEnabled(canWrite);
      }

      if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        cloneBtn =
            new Button(
                AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    optionBtn.setPopupVisible(false);
                    T item = previewForm.getBean();
                    previewForm.fireCloneForm(item);
                  }
                });
        cloneBtn.setIcon(FontAwesome.ROAD);
        cloneBtn.setStyleName("link");
        cloneBtn.setEnabled(canWrite);
        popupButtonsControl.addOption(cloneBtn);
      }

      if (popupButtonsControl.getComponentCount() > 0) {
        optionBtn.setContent(popupButtonsControl);
        editButtons.addComponent(optionBtn);
      }

      layout.with(editButtons).withAlign(editButtons, Alignment.MIDDLE_RIGHT);

      if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
        ButtonGroup navigationBtns = new ButtonGroup();
        navigationBtns.setStyleName("navigation-btns");
        Button previousItem =
            new Button(
                "<",
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoPrevious(item);
                  }
                });

        previousItem.setStyleName(UIConstants.THEME_GREEN_LINK);
        previousItem.setDescription(
            AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
        previousItem.setEnabled(canRead);
        navigationBtns.addButton(previousItem);

        Button nextItemBtn =
            new Button(
                ">",
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    T item = previewForm.getBean();
                    previewForm.fireGotoNextItem(item);
                  }
                });

        nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
        nextItemBtn.setEnabled(canRead);

        navigationBtns.addButton(nextItemBtn);
        layout.addComponent(navigationBtns);
        layout.setComponentAlignment(navigationBtns, Alignment.MIDDLE_RIGHT);
      }
    }

    return layout;
  }
Exemple #10
0
 @Override
 protected boolean hasEditPermission() {
   return CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS);
 }