Exemplo n.º 1
0
  @Override
  protected void deleteSelectedItems() {
    if (!isSelectAll) {
      Collection<SimpleRole> currentDataList = view.getPagedBeanTable().getCurrentDataList();
      List<Role> keyList = new ArrayList<>();
      for (SimpleRole item : currentDataList) {
        if (item.isSelected()) {
          if (Boolean.TRUE.equals(item.getIssystemrole())) {
            NotificationUtil.showErrorNotification(
                String.format(
                    "Can not delete role %s because it is the system role.", item.getRolename()));
          } else {
            keyList.add(item);
          }
        }
      }

      if (keyList.size() > 0) {
        roleService.massRemoveWithSession(
            keyList, AppContext.getUsername(), AppContext.getAccountId());
        doSearch(searchCriteria);
      }
    } else {
      roleService.removeByCriteria(searchCriteria, AppContext.getAccountId());
      doSearch(searchCriteria);
    }
  }
Exemplo n.º 2
0
 public void display() {
   final CallSearchCriteria criteria = new CallSearchCriteria();
   criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
   criteria.setAssignUsers(new SetSearchField<>(AppContext.getUsername()));
   criteria.setIsClosed(BitSearchField.FALSE);
   tableItem.setSearchCriteria(criteria);
 }
Exemplo n.º 3
0
  @Override
  protected void initRelatedComponents() {
    associateCampaignList = new LeadCampaignListComp();
    noteListItems = new NoteListItems(AppContext.getMessage(CrmCommonI18nEnum.TAB_NOTE));
    associateActivityList = new ActivityRelatedItemListComp(true);

    CssLayout navigatorWrapper = previewItemContainer.getNavigatorWrapper();
    MVerticalLayout basicInfo = new MVerticalLayout().withWidth("100%").withStyleName("basic-info");

    dateInfoComp = new DateInfoComp();
    basicInfo.addComponent(dateInfoComp);

    peopleInfoComp = new PeopleInfoComp();
    basicInfo.addComponent(peopleInfoComp);

    compFollowers =
        new CrmFollowersComp<>(CrmTypeConstants.LEAD, RolePermissionCollections.CRM_LEAD);
    basicInfo.addComponent(compFollowers);

    navigatorWrapper.addComponentAsFirst(basicInfo);

    previewItemContainer.addTab(
        previewContent,
        CrmTypeConstants.DETAIL,
        AppContext.getMessage(CrmCommonI18nEnum.TAB_ABOUT));
    previewItemContainer.addTab(
        associateCampaignList,
        CrmTypeConstants.CAMPAIGN,
        AppContext.getMessage(CrmCommonI18nEnum.TAB_CAMPAIGN));
    previewItemContainer.addTab(
        associateActivityList,
        CrmTypeConstants.ACTIVITY,
        AppContext.getMessage(CrmCommonI18nEnum.TAB_ACTIVITY));
  }
Exemplo n.º 4
0
    @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;
    }
Exemplo n.º 5
0
  private void displayReport() {
    final String reportName = reportDashboard[currentReportIndex];

    final CssLayout bodyContent = (CssLayout) this.bodyContent;
    bodyContent.removeAllComponents();

    if ("BugsByPriority".equals(reportName)) {
      this.setTitle(AppContext.getMessage(BugI18nEnum.WIDGET_CHART_PRIORIY_TITLE));
      IPrioritySummaryChartWidget prioritySummaryChartWidget =
          ViewManager.getCacheComponent(IPrioritySummaryChartWidget.class);
      bodyContent.addComponent(prioritySummaryChartWidget);

      final BugSearchCriteria prioritySearchCriteria = new Cloner().deepClone(baseSearchCriteria);
      prioritySummaryChartWidget.setSearchCriteria(prioritySearchCriteria);
    } else if ("BugsByStatus".equals(reportName)) {
      this.setTitle(AppContext.getMessage(BugI18nEnum.WIDGET_CHART_STATUS_TITLE));
      IStatusSummaryChartWidget statusSummaryChartWidget =
          ViewManager.getCacheComponent(IStatusSummaryChartWidget.class);
      bodyContent.addComponent(statusSummaryChartWidget);

      final BugSearchCriteria statusSearchCriteria = new Cloner().deepClone(baseSearchCriteria);
      statusSummaryChartWidget.setSearchCriteria(statusSearchCriteria);
    } else if ("BugByResolution".equals(reportName)) {
      this.setTitle(AppContext.getMessage(BugI18nEnum.WIDGET_CHART_RESOLUTION_TITLE));
      IBugResolutionSummaryChartWidget resolutionSummaryWdiget =
          ViewManager.getCacheComponent(IBugResolutionSummaryChartWidget.class);
      bodyContent.addComponent(resolutionSummaryWdiget);

      final BugSearchCriteria statusSearchCriteria = new Cloner().deepClone(baseSearchCriteria);
      resolutionSummaryWdiget.setSearchCriteria(statusSearchCriteria);
    }
  }
Exemplo n.º 6
0
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    if (AppContext.canWrite(RolePermissionCollections.CRM_TASK)) {
      Task task;
      if (data.getParams() instanceof Task) {
        task = (Task) data.getParams();
      } else if (data.getParams() instanceof Integer) {
        TaskService taskService = ApplicationContextUtil.getSpringBean(TaskService.class);
        task = taskService.findByPrimaryKey((Integer) data.getParams(), AppContext.getAccountId());
        if (task == null) {
          NotificationUtil.showRecordNotExistNotification();
          return;
        }
      } else {
        throw new MyCollabException("Do not support param data: " + data);
      }

      super.onGo(container, data);
      view.editItem(task);

      if (task.getId() == null) {
        AppContext.addFragment("crm/activity/task/add/", "Add Activity Task");
      } else {
        AppContext.addFragment(
            "crm/activity/task/edit/" + UrlEncodeDecoder.encode(task.getId()),
            "Edit Activity Task: " + task.getSubject());
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
Exemplo n.º 7
0
  private boolean checkPermissionAccessIfAny() {
    ViewPermission viewPermission = this.getClass().getAnnotation(ViewPermission.class);
    if (viewPermission != null) {
      String permissionId = viewPermission.permissionId();
      int impliedPermissionVal = viewPermission.impliedPermissionVal();

      if (AppContext.isAdmin()) {
        return true;
      } else {
        PermissionMap permissionMap = AppContext.getPermissionMap();
        if (permissionMap == null) {
          return false;
        } else {
          Integer value = permissionMap.get(permissionId);
          if (value == null) {
            return false;
          } else {
            return PermissionChecker.isImplied(value, impliedPermissionVal);
          }
        }
      }
    } else {
      return true;
    }
  }
Exemplo n.º 8
0
    @Override
    public ComponentContainer constructBody() {
      MHorizontalLayout layout = new MHorizontalLayout().withMargin(true);

      nameField =
          ShortcutExtension.installShortcutAction(
              new TextField(),
              new ShortcutListener("OpportunitySearchRequest", ShortcutAction.KeyCode.ENTER, null) {
                @Override
                public void handleAction(Object o, Object o1) {
                  callSearchAction();
                }
              });
      nameField.setInputPrompt("Query by opportunity name");
      nameField.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
      layout.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER);

      this.myItemCheckbox =
          new CheckBox(AppContext.getMessage(GenericI18Enum.SEARCH_MYITEMS_CHECKBOX));
      layout.with(myItemCheckbox).withAlign(myItemCheckbox, Alignment.MIDDLE_CENTER);

      Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH));
      searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
      searchBtn.setIcon(FontAwesome.SEARCH);

      searchBtn.addClickListener(
          new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
              OpportunityBasicSearchLayout.this.callSearchAction();
            }
          });
      layout.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT);

      Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR));
      cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
      cancelBtn.addClickListener(
          new Button.ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
              OpportunityBasicSearchLayout.this.nameField.setValue("");
            }
          });
      layout.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER);

      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) {
                  OpportunitySearchPanel.this.moveToAdvancedSearchLayout();
                }
              });
      advancedSearchBtn.setStyleName(UIConstants.BUTTON_LINK);
      layout.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER);
      return layout;
    }
Exemplo n.º 9
0
  @Override
  protected void onGo(final ComponentContainer container, final ScreenData<?> data) {
    if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) {

      InsideProjectNavigationMenu projectModuleMenu =
          (InsideProjectNavigationMenu)
              ((MobileNavigationManager) UI.getCurrent().getContent()).getNavigationMenu();
      projectModuleMenu.selectButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK));

      if (data.getParams() instanceof Integer) {
        ProjectTaskService taskService =
            ApplicationContextUtil.getSpringBean(ProjectTaskService.class);
        SimpleTask task =
            taskService.findById((Integer) data.getParams(), AppContext.getAccountId());

        if (task != null) {
          this.view.previewItem(task);
          super.onGo(container, data);

          AppContext.addFragment(
              ProjectLinkGenerator.generateTaskPreviewLink(
                  task.getTaskkey(), task.getProjectShortname()),
              task.getTaskname());
        } else {
          NotificationUtil.showRecordNotExistNotification();
          return;
        }
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }
Exemplo n.º 10
0
 @Override
 public void attachField(Object propertyId, Field<?> field) {
   if (propertyId.equals("email")) {
     basicInformationLayout.addComponent(
         field, AppContext.getMessage(UserI18nEnum.FORM_EMAIL), 0, 0);
   } else if (propertyId.equals("roleid")) {
     basicInformationLayout.addComponent(
         field, AppContext.getMessage(UserI18nEnum.FORM_ROLE), 1, 0);
   }
 }
Exemplo n.º 11
0
  public void save(Task item) {
    TaskService taskService = ApplicationContextUtil.getSpringBean(TaskService.class);

    item.setSaccountid(AppContext.getAccountId());
    if (item.getId() == null) {
      taskService.saveWithSession(item, AppContext.getUsername());
    } else {
      taskService.updateWithSession(item, AppContext.getUsername());
    }
  }
Exemplo n.º 12
0
  public void save(MeetingWithBLOBs item) {
    MeetingService meetingService = ApplicationContextUtil.getSpringBean(MeetingService.class);

    item.setSaccountid(AppContext.getAccountId());
    if (item.getId() == null) {
      meetingService.saveWithSession(item, AppContext.getUsername());
    } else {
      meetingService.updateWithSession(item, AppContext.getUsername());
    }
  }
Exemplo n.º 13
0
 private void save(Version item) {
   VersionService versionService = ApplicationContextUtil.getSpringBean(VersionService.class);
   item.setSaccountid(AppContext.getAccountId());
   item.setProjectid(CurrentProjectVariables.getProjectId());
   item.setStatus(StatusI18nEnum.Open.name());
   if (item.getId() == null) {
     versionService.saveWithSession(item, AppContext.getUsername());
   } else {
     versionService.updateWithSession(item, AppContext.getUsername());
   }
 }
Exemplo n.º 14
0
 @Override
 protected void onGo(ComponentContainer container, ScreenData<?> data) {
   if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.MILESTONES)) {
     super.onGo(container, data);
     view.displayStatus(OptionI18nEnum.MilestoneStatus.InProgress);
     AppContext.addFragment(
         "project/milestone/list/"
             + GenericLinkUtils.encodeParam(CurrentProjectVariables.getProjectId()),
         AppContext.getMessage(MilestoneI18nEnum.VIEW_LIST_TITLE));
   } else {
     NotificationUtil.showMessagePermissionAlert();
   }
 }
Exemplo n.º 15
0
  private int saveMilestone(Milestone milestone) {
    MilestoneService milestoneService =
        ApplicationContextUtil.getSpringBean(MilestoneService.class);
    milestone.setProjectid(CurrentProjectVariables.getProjectId());
    milestone.setSaccountid(AppContext.getAccountId());

    if (milestone.getId() == null) {
      milestone.setCreateduser(AppContext.getUsername());
      milestoneService.saveWithSession(milestone, AppContext.getUsername());
    } else {
      milestoneService.updateWithSession(milestone, AppContext.getUsername());
    }
    return milestone.getId();
  }
Exemplo n.º 16
0
    @Override
    protected void saveTimeInvest(double spentHours, boolean isBillable, Date forDate) {
      ItemTimeLogging item = new ItemTimeLogging();
      item.setLoguser(AppContext.getUsername());
      item.setLogvalue(spentHours);
      item.setTypeid(bean.getId());
      item.setType(ProjectTypeConstants.TASK);
      item.setSaccountid(AppContext.getAccountId());
      item.setProjectid(CurrentProjectVariables.getProjectId());
      item.setLogforday(forDate);
      item.setIsbillable(isBillable);

      itemTimeLoggingService.saveWithSession(item, AppContext.getUsername());
    }
Exemplo n.º 17
0
    void displayPageInfo(Page beanItem) {
      MVerticalLayout header = new MVerticalLayout().withMargin(false);
      Label titleLbl = new Label(beanItem.getSubject());
      titleLbl.setStyleName("headerName");
      header.with(titleLbl);
      Div footer = new Div().setStyle("width:100%").setCSSClass("footer2");
      Span lastUpdatedTimeTxt =
          new Span()
              .appendText(
                  AppContext.getMessage(
                      DayI18nEnum.LAST_UPDATED_ON,
                      AppContext.formatPrettyTime(beanItem.getLastUpdatedTime().getTime())))
              .setTitle(AppContext.formatDateTime(beanItem.getLastUpdatedTime().getTime()));
      String uid = UUID.randomUUID().toString();
      ProjectMemberService projectMemberService =
          ApplicationContextUtil.getSpringBean(ProjectMemberService.class);
      SimpleProjectMember member =
          projectMemberService.findMemberByUsername(
              beanItem.getCreatedUser(),
              CurrentProjectVariables.getProjectId(),
              AppContext.getAccountId());
      if (member != null) {
        Img userAvatar =
            new Img("", StorageFactory.getInstance().getAvatarPath(member.getMemberAvatarId(), 16));
        A userLink =
            new A()
                .setId("tag" + uid)
                .setHref(
                    ProjectLinkBuilder.generateProjectMemberFullLink(
                        member.getProjectid(), member.getUsername()))
                .appendText(StringUtils.trim(member.getMemberFullName(), 30, true));
        userLink.setAttribute(
            "onmouseover", TooltipHelper.userHoverJsFunction(uid, member.getUsername()));
        userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid));
        footer.appendChild(
            lastUpdatedTimeTxt,
            new Text("&nbsp;-&nbsp;Created by: "),
            userAvatar,
            DivLessFormatter.EMPTY_SPACE(),
            userLink,
            DivLessFormatter.EMPTY_SPACE(),
            TooltipHelper.buildDivTooltipEnable(uid));
      } else {
        footer.appendChild(lastUpdatedTimeTxt);
      }

      header.addComponent(new Label(footer.write(), ContentMode.HTML));
      this.addHeader(header);
    }
Exemplo n.º 18
0
 protected void displayActivities() {
   ActivitySearchCriteria criteria = new ActivitySearchCriteria();
   criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
   criteria.setType(new StringSearchField(SearchField.AND, CrmTypeConstants.LEAD));
   criteria.setTypeid(new NumberSearchField(beanItem.getId()));
   associateActivityList.setSearchCriteria(criteria);
 }
Exemplo n.º 19
0
 protected void handlePage(String... params) {
   String username = new UrlTokenizer(params[0]).getString();
   UserService userService = ApplicationContextUtil.getSpringBean(UserService.class);
   SimpleUser user =
       userService.findUserByUserNameInAccount(username, AppContext.getAccountId());
   EventBusFactory.getInstance().post(new UserEvent.GotoEdit(EditUrlResolver.this, user));
 }
Exemplo n.º 20
0
  @Override
  protected void buildExtraControls() {
    MButton customizeViewBtn =
        ComponentUtils.createCustomizeViewButton()
            .withListener(
                new Button.ClickListener() {
                  @Override
                  public void buttonClick(ClickEvent clickEvent) {
                    UI.getCurrent()
                        .addWindow(
                            new CaseListCustomizeWindow(CaseListView.VIEW_DEF_ID, tableItem));
                  }
                });
    this.addExtraButton(customizeViewBtn);

    MButton importBtn =
        ComponentUtils.createImportEntitiesButton()
            .withListener(
                new Button.ClickListener() {
                  @Override
                  public void buttonClick(ClickEvent clickEvent) {
                    UI.getCurrent().addWindow(new CaseImportWindow());
                  }
                });
    importBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CASE));

    this.addExtraButton(importBtn);
  }
Exemplo n.º 21
0
  private String buildTaskLink() {
    String uid = UUID.randomUUID().toString();
    String linkName =
        String.format(
            "[#%d] - %s", task.getTaskkey(), StringUtils.trim(task.getTaskname(), maxLength, true));
    A taskLink =
        new A()
            .setId("tag" + uid)
            .setHref(
                ProjectLinkBuilder.generateTaskPreviewFullLink(
                    task.getTaskkey(), CurrentProjectVariables.getShortName()))
            .appendText(linkName)
            .setStyle("display:inline");
    Div resultDiv = new DivLessFormatter().appendChild(taskLink);
    if (task.isOverdue()) {
      taskLink.setCSSClass("overdue");
      resultDiv.appendChild(
          new Span()
              .setCSSClass(UIConstants.LABEL_META_INFO)
              .appendText(" - Due in " + AppContext.formatDuration(task.getDeadline())));
    } else if (task.isCompleted()) {
      taskLink.setCSSClass("completed");
    }

    taskLink.setAttribute(
        "onmouseover",
        TooltipHelper.projectHoverJsFunction(uid, ProjectTypeConstants.TASK, task.getId() + ""));
    taskLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid));

    resultDiv.appendChild(TooltipHelper.buildDivTooltipEnable(uid));
    return resultDiv.write();
  }
Exemplo n.º 22
0
      @Override
      protected Field<?> onCreateField(final Object propertyId) {
        String value = "";

        if (propertyId.equals("email")) {
          return new DefaultFormViewFieldFactory.FormEmailLinkViewField(
              PreviewForm.this.user.getEmail());
        } else if (propertyId.equals("dateofbirth")) {
          value = AppContext.formatDate(PreviewForm.this.user.getDateofbirth());
          return new DefaultFormViewFieldFactory.FormViewField(value);
        } else if (propertyId.equals("timezone")) {
          value = TimezoneMapper.getTimezone(PreviewForm.this.user.getTimezone()).getDisplayName();
          return new DefaultFormViewFieldFactory.FormViewField(value);
        } else if (propertyId.equals("website")) {
          value = PreviewForm.this.user.getWebsite();
          return new DefaultFormViewFieldFactory.FormUrlLinkViewField(value);
        } else if (propertyId.equals("facebookaccount")) {
          return new DefaultFormViewFieldFactory.FormUrlSocialNetworkLinkViewField(
              PreviewForm.this.user.getFacebookaccount(),
              "https://www.facebook.com/" + PreviewForm.this.user.getFacebookaccount());
        } else if (propertyId.equals("twitteraccount")) {
          return new DefaultFormViewFieldFactory.FormUrlSocialNetworkLinkViewField(
              PreviewForm.this.user.getTwitteraccount(),
              "https://www.twitter.com/" + PreviewForm.this.user.getTwitteraccount());
        } else if (propertyId.equals("skypecontact")) {
          return new DefaultFormViewFieldFactory.FormUrlSocialNetworkLinkViewField(
              PreviewForm.this.user.getSkypecontact(),
              "skype:" + PreviewForm.this.user.getSkypecontact() + "?chat");
        }
        return null;
      }
Exemplo n.º 23
0
 @Override
 protected void updateTimeRemain(double newValue) {
   ProjectTaskService taskService =
       ApplicationContextUtil.getSpringBean(ProjectTaskService.class);
   bean.setRemainestimate(newValue);
   taskService.updateWithSession(bean, AppContext.getUsername());
 }
    @Override
    public ComponentContainer constructBody() {
      MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true);
      basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

      Label nameLbl = new Label("Name:");
      basicSearchBody.with(nameLbl);

      nameField = new TextField();
      nameField.setInputPrompt("Query by version name");
      nameField.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
      nameField.addShortcutListener(
          new ShortcutListener("VersionSearchName", ShortcutAction.KeyCode.ENTER, null) {
            @Override
            public void handleAction(Object o, Object o1) {
              callSearchAction();
            }
          });
      basicSearchBody.with(nameField);

      Button searchBtn =
          new Button(
              AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH),
              new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                  callSearchAction();
                }
              });
      searchBtn.setStyleName(UIConstants.BUTTON_ACTION);
      searchBtn.setIcon(FontAwesome.SEARCH);
      basicSearchBody.with(searchBtn);

      Button cancelBtn =
          new Button(
              AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR),
              new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                  nameField.setValue("");
                }
              });
      cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
      basicSearchBody.with(cancelBtn);

      return basicSearchBody;
    }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {

    if (data instanceof ProjectScreenData.Edit) {
      // TODO: Handle edit project
    } else {
      if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.PROJECT)) {
        super.onGo(container, data);
        view.displayDashboard();
        AppContext.addFragment(
            ProjectLinkGenerator.generateProjectLink(CurrentProjectVariables.getProject().getId()),
            AppContext.getMessage(ProjectCommonI18nEnum.VIEW_DASHBOARD));
      } else {
        NotificationUtil.showMessagePermissionAlert();
      }
    }
  }
Exemplo n.º 26
0
  @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;
  }
Exemplo n.º 27
0
    @Override
    protected SearchCriteria fillUpSearchCriteria() {
      OpportunitySearchCriteria searchCriteria = new OpportunitySearchCriteria();
      searchCriteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));

      if (StringUtils.isNotBlank(this.nameField.getValue().trim())) {
        searchCriteria.setOpportunityName(StringSearchField.and(this.nameField.getValue().trim()));
      }

      if (this.myItemCheckbox.getValue()) {
        searchCriteria.setAssignUsers(new SetSearchField<>(AppContext.getUsername()));
      } else {
        searchCriteria.setAssignUsers(null);
      }

      return searchCriteria;
    }
 public TaskListComponent(SimpleTaskList taskList) {
   this.taskList = taskList;
   this.setStyleName("task-component");
   this.setWidth("100%");
   Label taskName = new Label(taskList.getName());
   taskName.addStyleName("task-name");
   if ("Closed".equals(taskList.getStatus())) {
     taskName.addStyleName(UIConstants.LINK_COMPLETED);
   }
   this.addComponent(taskName);
   Label taskCreatedTime =
       new Label(
           AppContext.getMessage(
               DayI18nEnum.LAST_UPDATED_ON,
               AppContext.formatPrettyTime(taskList.getLastupdatedtime())));
   taskCreatedTime.setStyleName("created-time");
   this.addComponent(taskCreatedTime);
 }
Exemplo n.º 29
0
 @Override
 protected ComponentContainer createBottomPanel() {
   TabSheetLazyLoadComponent tabContainer = new TabSheetLazyLoadComponent();
   tabContainer.addTab(
       this.commentListComp,
       AppContext.getMessage(GenericI18Enum.TAB_COMMENT),
       FontAwesome.COMMENTS);
   return tabContainer;
 }
  @Override
  protected void onGo(ComponentContainer container, ScreenData<?> data) {
    CrmToolbar.navigateItem(CrmTypeConstants.LEAD);
    if (AppContext.canRead(RolePermissionCollections.CRM_LEAD)) {
      if (data.getParams() instanceof SimpleLead) {
        SimpleLead lead = (SimpleLead) data.getParams();
        super.onGo(container, data);
        view.previewItem(lead);

        AppContext.addFragment(
            CrmLinkGenerator.generateLeadPreviewLink(lead.getId()),
            AppContext.getMessage(
                GenericI18Enum.BROWSER_PREVIEW_ITEM_TITLE, "Lead", lead.getLeadName()));
      }
    } else {
      NotificationUtil.showMessagePermissionAlert();
    }
  }