@Override
    public ComponentContainer getLayout() {
      String title =
          (user.getUsername() == null)
              ? AppContext.getMessage(UserI18nEnum.VIEW_NEW_USER)
              : user.getDisplayName();
      final AddViewLayout formAddLayout = new AddViewLayout(title, FontAwesome.USER);

      final VerticalLayout layout = new VerticalLayout();
      final Label organizationHeader =
          new Label(AppContext.getMessage(UserI18nEnum.SECTION_BASIC_INFORMATION));
      organizationHeader.setStyleName("h2");
      layout.addComponent(organizationHeader);

      this.basicInformationLayout =
          new GridFormLayoutHelper(2, 1, "100%", "167px", Alignment.TOP_LEFT);
      this.basicInformationLayout.getLayout().setWidth("100%");
      this.basicInformationLayout.getLayout().setMargin(false);
      this.basicInformationLayout.getLayout().addStyleName(UIConstants.COLORED_GRIDLAYOUT);

      layout.addComponent(this.basicInformationLayout.getLayout());

      formAddLayout.addHeaderRight(createButtonControls());
      formAddLayout.addBody(layout);
      formAddLayout.addBottomControls(createBottomPanel());
      return formAddLayout;
    }
  private void displayTaskStatistic() {
    rightColumn.removeAllComponents();
    UnresolvedTaskByAssigneeWidget unresolvedTaskByAssigneeWidget =
        new UnresolvedTaskByAssigneeWidget();
    unresolvedTaskByAssigneeWidget.setSearchCriteria(statisticSearchCriteria);
    rightColumn.addComponent(unresolvedTaskByAssigneeWidget);

    UnresolvedTaskByPriorityWidget unresolvedTaskByPriorityWidget =
        new UnresolvedTaskByPriorityWidget();
    unresolvedTaskByPriorityWidget.setSearchCriteria(statisticSearchCriteria);
    rightColumn.addComponent(unresolvedTaskByPriorityWidget);

    UnresolvedTaskByStatusWidget unresolvedTaskByStatusWidget = new UnresolvedTaskByStatusWidget();
    unresolvedTaskByStatusWidget.setSearchCriteria(statisticSearchCriteria);
    rightColumn.addComponent(unresolvedTaskByStatusWidget);
  }
  @Override
  protected Component generateTopControls() {
    VerticalLayout controlsBtnWrap = new VerticalLayout();
    controlsBtnWrap.setWidth("100%");
    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY));
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(
        new SplitButton.SplitButtonClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void splitButtonClick(SplitButton.SplitButtonClickEvent event) {
            fireNewRelatedItem("");
          }
        });
    controlsBtn.setSizeUndefined();
    Button selectBtn =
        new Button(
            "Select from existing opportunities",
            new Button.ClickListener() {
              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(Button.ClickEvent event) {
                ContactOpportunitySelectionWindow opportunitiesWindow =
                    new ContactOpportunitySelectionWindow(ContactOpportunityListComp.this);
                OpportunitySearchCriteria criteria = new OpportunitySearchCriteria();
                criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
                UI.getCurrent().addWindow(opportunitiesWindow);
                opportunitiesWindow.setSearchCriteria(criteria);
                controlsBtn.setPopupVisible(false);
              }
            });
    selectBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
    OptionPopupContent buttonControlsLayout = new OptionPopupContent();
    buttonControlsLayout.addOption(selectBtn);
    controlsBtn.setContent(buttonControlsLayout);

    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY));

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
  }
    @Override
    public ComponentContainer getLayout() {
      VerticalLayout formLayout = new VerticalLayout();
      formLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

      Label organizationHeader =
          new Label(AppContext.getMessage(ContactI18nEnum.SECTION_DESCRIPTION));
      organizationHeader.setStyleName(UIConstants.H2_STYLE2);
      formLayout.addComponent(organizationHeader);

      informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6);
      formLayout.addComponent(informationLayout.getLayout());

      addressLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6);
      Label addressHeader = new Label(AppContext.getMessage(ContactI18nEnum.SECTION_ADDRESS));
      addressHeader.setStyleName(UIConstants.H2_STYLE2);
      formLayout.addComponent(addressHeader);
      formLayout.addComponent(addressLayout.getLayout());
      formLayout.addComponent(buildButtonControls());
      return formLayout;
    }
      @Override
      public ComponentContainer getLayout() {
        final VerticalLayout layout = new VerticalLayout();
        this.informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(2, 6);

        layout.addComponent(this.informationLayout.getLayout());

        final MHorizontalLayout controlsBtn =
            new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false));
        layout.addComponent(controlsBtn);

        final Button approveBtn =
            new Button(
                "Approve & Close",
                new Button.ClickListener() {
                  private static final long serialVersionUID = 1L;

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

                    if (EditForm.this.validateForm()) {
                      // Save bug status and assignee
                      bug.setStatus(BugStatus.Verified.name());

                      BugService bugService =
                          ApplicationContextUtil.getSpringBean(BugService.class);
                      bugService.updateSelectiveWithSession(bug, AppContext.getUsername());

                      // Save comment
                      String commentValue = commentArea.getValue();
                      if (StringUtils.isNotBlank(commentValue)) {
                        CommentWithBLOBs comment = new CommentWithBLOBs();
                        comment.setComment(
                            Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
                        comment.setCreatedtime(new GregorianCalendar().getTime());
                        comment.setCreateduser(AppContext.getUsername());
                        comment.setSaccountid(AppContext.getAccountId());
                        comment.setType(ProjectTypeConstants.BUG);
                        comment.setTypeid("" + bug.getId());
                        comment.setExtratypeid(CurrentProjectVariables.getProjectId());

                        CommentService commentService =
                            ApplicationContextUtil.getSpringBean(CommentService.class);
                        commentService.saveWithSession(comment, AppContext.getUsername());
                      }

                      ApproveInputWindow.this.close();
                      callbackForm.refreshBugItem();
                    }
                  }
                });
        approveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        approveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);
        controlsBtn.with(approveBtn).withAlign(approveBtn, Alignment.MIDDLE_LEFT);

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

                  @Override
                  public void buttonClick(Button.ClickEvent event) {
                    ApproveInputWindow.this.close();
                  }
                });
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        controlsBtn.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_LEFT);

        layout.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
        return layout;
      }
    @Override
    public Component generateBlock(final SimpleOpportunity opportunity, int blockIndex) {
      CssLayout beanBlock = new CssLayout();
      beanBlock.addStyleName("bean-block");
      beanBlock.setWidth("350px");

      VerticalLayout blockContent = new VerticalLayout();
      MHorizontalLayout blockTop = new MHorizontalLayout().withWidth("100%");
      CssLayout iconWrap = new CssLayout();
      iconWrap.setStyleName("icon-wrap");
      FontIconLabel opportunityIcon =
          new FontIconLabel(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
      iconWrap.addComponent(opportunityIcon);
      blockTop.addComponent(iconWrap);

      VerticalLayout opportunityInfo = new VerticalLayout();
      opportunityInfo.setSpacing(true);

      MButton btnDelete = new MButton(FontAwesome.TRASH_O);
      btnDelete.addClickListener(
          new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
              ConfirmDialogExt.show(
                  UI.getCurrent(),
                  AppContext.getMessage(
                      GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.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()) {
                        ContactService contactService =
                            ApplicationContextUtil.getSpringBean(ContactService.class);
                        ContactOpportunity associateOpportunity = new ContactOpportunity();
                        associateOpportunity.setContactid(contact.getId());
                        associateOpportunity.setOpportunityid(opportunity.getId());
                        contactService.removeContactOpportunityRelationship(
                            associateOpportunity, AppContext.getAccountId());
                        ContactOpportunityListComp.this.refresh();
                      }
                    }
                  });
            }
          });

      btnDelete.addStyleName(UIConstants.BUTTON_ICON_ONLY);

      blockContent.addComponent(btnDelete);
      blockContent.setComponentAlignment(btnDelete, Alignment.TOP_RIGHT);

      Label opportunityName =
          new Label(
              String.format(
                  "Name: <a href='%s%s'>%s</a>",
                  SiteConfiguration.getSiteUrl(AppContext.getUser().getSubdomain()),
                  CrmLinkGenerator.generateCrmItemLink(
                      CrmTypeConstants.OPPORTUNITY, opportunity.getId()),
                  opportunity.getOpportunityname()),
              ContentMode.HTML);

      opportunityInfo.addComponent(opportunityName);

      Label opportunityAmount =
          new Label("Amount: " + (opportunity.getAmount() != null ? opportunity.getAmount() : ""));
      if (opportunity.getCurrency() != null && opportunity.getAmount() != null) {
        opportunityAmount.setValue(
            opportunityAmount.getValue() + opportunity.getCurrency().getSymbol());
      }
      opportunityInfo.addComponent(opportunityAmount);

      Label opportunitySaleStage =
          new Label(
              "Sale Stage: "
                  + (opportunity.getSalesstage() != null ? opportunity.getSalesstage() : ""));
      opportunityInfo.addComponent(opportunitySaleStage);

      ELabel opportunityExpectedCloseDate =
          new ELabel(
                  "Expected Closed Date: "
                      + AppContext.formatPrettyTime(opportunity.getExpectedcloseddate()))
              .withDescription(AppContext.formatDate(opportunity.getExpectedcloseddate()));
      opportunityInfo.addComponent(opportunityExpectedCloseDate);

      blockTop.with(opportunityInfo).expand(opportunityInfo);
      blockContent.addComponent(blockTop);

      blockContent.setWidth("100%");

      beanBlock.addComponent(blockContent);
      return beanBlock;
    }