/* * 获取对象列表 */ public Object[] getElements(Context context, STableStatus tablestatus) { GetGoodsSplitBillListKey key = new GetGoodsSplitBillListKey(tablestatus.getBeginIndex(), tablestatus.getPageSize(), false); if (CheckIsNull.isNotEmpty(tablestatus.getSortColumn())) { key.setSortField(getSortField(tablestatus.getSortColumn())); key.setSortType(getSortType(tablestatus.getSortDirection())); } key.setStatus(new GoodsSplitStatus[] {GoodsSplitStatus.Approvaling}); key.setSearchText(searchText.getText()); key.setBeginTime(context.find(QueryTerm.class, queryTermList.getText()).getStartTime()); key.setEndTime(context.find(QueryTerm.class, queryTermList.getText()).getEndTime()); ListEntity<GoodsSplitItem> entity = context.find(ListEntity.class, key); List<GoodsSplitItem> itemList = entity.getItemList(); // if (CheckIsNull.isEmpty(itemList)) { // countLabel.setText("0"); // return null; // } GoodsSplitItem[] items = new GoodsSplitItem[itemList.size()]; for (int i = 0; i < itemList.size(); i++) { items[i] = itemList.get(i); itemMap.put(items[i].getRECID().toString(), items[i]); } int size = items.length; if (tablestatus.getPageNo() != STableStatus.FIRSTPAGE) { String preSize = countLabel.getText(); if (StringHelper.isNotEmpty(preSize)) { size += Integer.parseInt(preSize); } } countLabel.setText(String.valueOf(size)); // countLabel.setText("" + items.length); countLabel.getParent().getParent().layout(); return items; }
/** 发布范围按钮侦听器 */ private void deptNameStrTextListener() { deptNameStrText.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { PageControllerInstance pageControllerInstance = new PageControllerInstance( new PageController( DepartmentSelectProcessor.class, DepartmentSelectRender.class), deptGuidStr); WindowStyle windowStyle = new WindowStyle(JWT.CLOSE, Location.Context); windowStyle.setSize(240, 360); MsgRequest request = new MsgRequest(pageControllerInstance, "部门选择", windowStyle); request.setResponseHandler( new ResponseHandler() { public void handle( Object type, Object deptNameStr, Object deptGuidStr, Object returnValue3) { if (type.equals(DepartmentSelectProcessor.FINISH_SELECTED)) { // 完成选择 NewNoticeProcessor.this.deptNameStrText.setText( getOmitDeptNameStr(deptNameStr.toString())); NewNoticeProcessor.this.deptGuidStr = null != deptGuidStr ? deptGuidStr.toString() : ""; } } }); getContext().bubbleMessage(request); } }); }
/** 编辑时初始化内容 */ private void initNoticeInfo() { NoticeInfo noticeInfo = (NoticeInfo) this.getArgument(); if (null != noticeInfo) { deptGuidStr = noticeInfo.getDeptGuidList() == null ? "" : StringUtils.join(noticeInfo.getDeptGuidList().iterator(), ","); noticeTitleText.setText(noticeInfo.getNoticeTitle()); isTopCheckBox.setSelection(noticeInfo.getIsTop()); deptNameStrText.setText(noticeInfo.getDeptNameStr()); publishingDate.setDate( noticeInfo.getPublishTime() == 0 ? null : new Date(noticeInfo.getPublishTime())); cancelDate.setDate( noticeInfo.getCancelTime() == 0 ? null : new Date(noticeInfo.getCancelTime())); noticeContentText.setContent(noticeInfo.getNoticeContent()); } }
/** 搜索按钮增加事件监听器 */ protected void searchNoticeButtonListenter() { searchNoticeText.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { table.render(); } }); }
/** 组装公告对像 */ private SaveOrUpdateNoticeTask buildSaveOrUpdateNoticeTask() { SaveOrUpdateNoticeTask saveOrUpdateNoticeTask = new SaveOrUpdateNoticeTask(); if (null == getArgument()) { // 公告GUID saveOrUpdateNoticeTask.setRECID(getContext().newRECID()); // 创建日期 saveOrUpdateNoticeTask.setCreateDate(new Date().getTime()); } else { // 公告GUID saveOrUpdateNoticeTask.setRECID(((NoticeInfo) this.getArgument()).getRECID()); // 创建日期 saveOrUpdateNoticeTask.setCreateDate(((NoticeInfo) this.getArgument()).getCreateTime()); } // 公告标题 saveOrUpdateNoticeTask.setNoticeTitle( noticeTitleText.getText() != null ? noticeTitleText.getText().trim() : ""); // 是否置顶 saveOrUpdateNoticeTask.setIsTop(isTopCheckBox.getSelection()); // 发布范围 saveOrUpdateNoticeTask.setDeptNameStr( deptNameStrText.getText() != null ? deptNameStrText.getText().trim() : ""); // 发布日期 saveOrUpdateNoticeTask.setPublishTime( publishingDate.getDate() != null ? publishingDate.getDate().getTime() : 0); // 撤消日期 saveOrUpdateNoticeTask.setCancelTime( cancelDate.getDate() != null ? DateUtil.getDayEndTime(cancelDate.getDate().getTime()) : 0); // 公告内容 saveOrUpdateNoticeTask.setNoticeContent( noticeContentText.getContent() != null ? noticeContentText.getContent().trim() : ""); // 发布范围 if (StringHelper.isNotEmpty(deptGuidStr)) { String[] deptGuids = deptGuidStr.split(","); List<GUID> deptGuidList = new ArrayList<GUID>(); if (null != deptGuids && deptGuids.length > 0) { for (Object item : deptGuids) { deptGuidList.add(GUID.valueOf(item.toString())); } } saveOrUpdateNoticeTask.setDeptGuidList(deptGuidList); } return saveOrUpdateNoticeTask; }
/** 查询未布布公告 */ 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; }
@Override public void process(Situation situation) { super.process(situation); queryTermList = this.createControl(ID_COMBOLIST_DATEITEM, LWComboList.class); PSIProcessorUtils.initQueryTermSource(queryTermList); queryTermList.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { table.render(); } }); countLabel = this.createControl(ID_LABEL_CHECKOUTGINSHEET_COUNT, Label.class); searchText = this.createControl(ID_TEXT_SEARCH, Text.class); searchText.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { table.render(); } }); }
@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(); } }); }