@Override
 public String[] getTableActionIds() {
   LoginInfo login = getContext().find(LoginInfo.class);
   if (login.hasAuth(Auth.SubFunction_GoodsSplitManage_Approval))
     return new String[] {Action.Approval.name()};
   else return null;
 }
 @Override
 public String[] getTableActionIds() {
   List<String> list = new ArrayList<String>();
   LoginInfo login = getContext().find(LoginInfo.class);
   if (login.hasAuth(Auth.SubFunction_CustomerMange_BusPerson)) {
     list.add(Action.Allocate.name());
   }
   list.add(Action.Delete.name());
   return list.toArray(new String[0]);
 }
 /** 查询未布布公告 */
 private List<NoticeItem> findNoticeItemList(Context context, STableStatus tablestatus) {
   FindNoticeItemListKey key = new FindNoticeItemListKey();
   // 查询未发布公告
   key.setType(FindNoticeItemListKey.NOT_RELEASE);
   // 搜索字符串
   if (StringHelper.isNotEmpty(searchNoticeText.getText())
       && !searchNoticeText.getText().trim().equals("输入搜索内容")) {
     key.setSearchText(searchNoticeText.getText().trim());
   }
   LoginInfo loginInfo = context.get(LoginInfo.class);
   // 非Boss只查询自已的公告,设置创建人GUID
   if (!loginInfo.hasAuth(Auth.Boss)) {
     key.setCreateGuid(loginInfo.getEmployeeInfo().getId());
   }
   // 排序
   key.setSortCloumName(tablestatus.getSortColumn());
   key.setSortType(
       SSortDirection.ASC == tablestatus.getSortDirection() ? SortType.Asc : SortType.Desc);
   List<NoticeItem> noticeItemList = context.getList(NoticeItem.class, key);
   return noticeItemList;
 }
 /** 获取列 */
 public STableColumn[] getColumns() {
   ArrayList<STableColumn> columnList = new ArrayList<STableColumn>();
   LoginInfo loginInfo = getContext().find(LoginInfo.class);
   // 是否总经理或经理
   boolean isManager =
       loginInfo.hasAuth(Auth.Boss)
           || loginInfo.hasAuth(Auth.AccountManager)
           || loginInfo.hasAuth(Auth.SalesManager)
           || loginInfo.hasAuth(Auth.PurchaseManager)
           || loginInfo.hasAuth(Auth.StoreKeeperManager);
   //
   STableColumn titleColumn = new STableColumn("noticeTitle", 200, JWT.LEFT, "公告标题");
   titleColumn.setGrab(true);
   titleColumn.setSortable(true);
   columnList.add(titleColumn);
   // 发布日期
   STableColumn publishTimeColumn = new STableColumn("publishTime", 150, JWT.CENTER, "发布日期");
   publishTimeColumn.setSortable(true);
   columnList.add(publishTimeColumn);
   //		//只有总经理或经理显示该列
   //		if(isManager){
   //			//撤消日期
   //			STableColumn cancelTimeColumn = new STableColumn("cancelTime", 150, JWT.CENTER, "撤消日期");
   //			cancelTimeColumn.setSortable(true);
   //			columnList.add(cancelTimeColumn);
   //		}
   STableColumn createPersonColumn = new STableColumn("createPerson", 150, JWT.CENTER, "创建人");
   createPersonColumn.setSortable(true);
   columnList.add(createPersonColumn);
   // 只有总经理或经理显示该列
   if (isManager) {
     //			//发布范围
     //			STableColumn deptNameStrColumn = new STableColumn("deptNameStr", 300, JWT.CENTER,
     // "发布范围");
     //			deptNameStrColumn.setSortable(true);
     //			deptNameStrColumn.setGrab(true);
     //			columnList.add(deptNameStrColumn);
     // 置顶
     STableColumn isTopColumn = new STableColumn("isTop", 50, JWT.CENTER, "置顶");
     isTopColumn.setSortable(true);
     columnList.add(isTopColumn);
   }
   return columnList.toArray(new STableColumn[columnList.size()]);
 }
  @Override
  public void process(Situation situation) {

    super.process(situation);
    LoginInfo login = situation.find(LoginInfo.class);

    final LWComboList cmb_scope = this.createControl(ID_COMBO_CUSTOMERSCOPE, LWComboList.class);
    // final ComboList cmb_term = this.createControl(ID_COMBO_TIME,
    // ComboList.class);
    final QueryScopeSource source =
        PSIProcessorUtils.initQueryScopeSource(cmb_scope, "我的客户", "全部客户", Auth.Sales);
    // getContext().getList(QueryTerm.class);
    // cmb_term.addItem("当前");
    // cmb_term.setData("当前", "");
    // cmb_term.addItem("本月新增");
    // cmb_term.setData("本月新增", QueryTerm.ID_MONTH);
    // cmb_term.addItem("本季新增");
    // cmb_term.setData("本季新增", QueryTerm.ID_QUARTER);
    // cmb_term.addItem("本周新增");
    // cmb_term.setData("本周新增", QueryTerm.ID_WEEK);
    // cmb_term.setSelection(0);
    // cmb_term.addSelectionListener(new SelectionListener() {
    //
    // public void widgetSelected(SelectionEvent e) {
    // key.setQueryTerm(getContext().find(QueryTerm.class,
    // cmb_term.getData(cmb_term.getText())));
    // table.render();
    // }
    // });

    cmb_scope.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent e) {
            key.setQueryScope((QueryScope) source.getElementById(cmb_scope.getText()));
            key.setSearchText(null);
            table.render();
          }
        });

    countLabel = this.createControl(ID_LABEL_COUNT, Label.class);

    this.createControl(ID_BUTTON_NEW, Button.class)
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                PageControllerInstance pci = new PageControllerInstance("NewCustomerPage");
                MsgRequest request = new MsgRequest(pci);
                getContext().bubbleMessage(request);
              }
            });
    Button but_allocate = this.createControl(ID_BUTTON_ALLOCATE, Button.class, JWT.NONE);
    but_allocate.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            allocate(table.getSelections());
          }
        });
    if (!login.hasAuth(Auth.SubFunction_CustomerMange_BusPerson)) {
      but_allocate.getNext().dispose();
      but_allocate.dispose();
    }
    Button but_share = this.createControl(ID_BUTTON_SHARE, Button.class, JWT.NONE);
    but_share.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            share(table.getSelections());
          }
        });
    if (!login.hasAuth(Auth.SubFunction_CustomerMange_Share)) {
      but_share.getNext().dispose();
      but_share.dispose();
    }

    this.createControl(ID_BUTTON_DELETE, Button.class)
        .addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                delete(table.getSelections());
              }
            });
    final Text searchText = this.createControl(ID_TEXT_SEARCHTEXT, Text.class, JWT.NONE);
    searchText.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            key.setSearchText(searchText.getText());
            table.render();
          }
        });
  }