/** 编辑时初始化内容 */ 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()); } }
/** 组装公告对像 */ 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 void initUIComponent() { // 公告标题 noticeTitleText = this.createControl(ID_Text_NoticeTile, Text.class, JWT.NONE); // 是否置顶 isTopCheckBox = this.createControl(ID_CheckBox_IsTop, Button.class, JWT.NONE); // 发布范围 deptNameStrText = this.createControl(ID_Text_DeptNameStr, Text.class, JWT.NONE); // 发布日期 publishingDate = this.createControl(ID_Date_Publishing, DatePicker.class, JWT.NONE); publishingDate.setDate(new Date()); // 撤消日期 cancelDate = this.createControl(ID_Date_Cancel, DatePicker.class, JWT.NONE); // 公告内容 noticeContentText = this.createControl(ID_Text_Content, HtmlEditor.class, JWT.NONE); // 保存按钮 saveButton = this.createControl(ID_Button_Save, Button.class, JWT.NONE); }