1. package nc.ui.hzctr.sellctr.action;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Dimension;
  5. import java.awt.Toolkit;
  6. import java.awt.event.ActionEvent;
  7. import java.awt.event.ActionListener;
  8. import java.util.HashMap;
  9. import nc.ui.pub.beans.MessageDialog;
  10. import nc.ui.pub.beans.UIButton;
  11. import nc.ui.pub.beans.UIDialog;
  12. import nc.ui.pub.beans.UILabel;
  13. import nc.ui.pub.beans.UIRefPane;
  14. import nc.ui.pub.beans.UITextArea;
  15.  
  16. /**
  17. * 批量输入日期窗口
  18. *
  19. * @author Yaolz
  20. */
  21. public class BatchInputDateDialog extends UIDialog implements ActionListener {
  22.  
  23. // 交房通知书生效等待期(天)标签
  24. private UILabel day;
  25. // 天数输入框
  26. private UITextArea dayField;
  27. // 竣备实际获取时间标签
  28. private UILabel time;
  29. // 时间参照
  30. private UIRefPane sjref = null;
  31. // 确定
  32. private UIButton ok_btn;
  33. // 取消
  34. private UIButton cancel_btn;
  35. private boolean isCancle;
  36. private int bat = 0;
  37.  
  38. @Override
  39. public int showModal() {
  40. super.show();
  41. int bat = this.bat;
  42. return bat;
  43. }
  44.  
  45. public BatchInputDateDialog() {
  46. setLayout(new BorderLayout());
  47. // 标题
  48. setTitle("批量输入日期框");
  49. this.setCancle(true);
  50. initUI();
  51. }
  52.  
  53. public void setCancle(boolean isCancle) {
  54. this.isCancle = isCancle;
  55. }
  56.  
  57. private void initUI() {
  58. // 窗体长宽
  59. setSize(350, 200);
  60. getContentPane().setLayout(null);
  61. // 交房标签
  62. getContentPane().add(getJfDay());
  63. // 交房文本框
  64. getContentPane().add(getJfText());
  65. // 竣备标签
  66. getContentPane().add(getJfTime());
  67. // 竣备参照
  68. getContentPane().add(getRqsj());
  69. // 确定按钮
  70. getContentPane().add(getbuttonOk());
  71. // 取消按钮
  72. getContentPane().add(getbuttonCancel());
  73. Toolkit kit = Toolkit.getDefaultToolkit();
  74. Dimension screenSize = kit.getScreenSize();
  75. int screenWidth = screenSize.width / 2;
  76. int screenHeight = screenSize.height / 2;
  77. int height = getHeight();
  78. int width = getWidth();
  79. setLocation(screenWidth - width / 2, screenHeight - height / 2);
  80. }
  81.  
  82. @Override
  83. public void actionPerformed(ActionEvent e) {
  84. if (e.getSource().getClass().getName()
  85. .equals("nc.ui.pub.beans.UIButton")) {
  86. nc.ui.pub.beans.UIButton btn = (nc.ui.pub.beans.UIButton) e
  87. .getSource();
  88. if (this.ok_btn.getName().equals(btn.getName())) {
  89. onOk();
  90. } else if (this.cancel_btn.getName().equals(btn.getName())) {
  91. onCancel();
  92. }
  93. }
  94. }
  95.  
  96. private void onOk() {
  97. if ((getJfText().getText() == null || getJfText().getText().length() <= 0)
  98. && (getRqsj().getText() == null || getRqsj().getText().length() <= 0)) {
  99. MessageDialog.showErrorDlg(null, "提示", "必须填写天数与时间!");
  100. return;
  101. }
  102. this.bat = 1;
  103. this.setCancle(false);
  104. closeOK();
  105. }
  106.  
  107. private UIButton getbuttonOk() {
  108. this.ok_btn = new UIButton("确认");
  109. this.ok_btn.setName("btn_ok");
  110. this.ok_btn.setLocation(90, 140);
  111. this.ok_btn.addActionListener(this);
  112. return this.ok_btn;
  113. }
  114.  
  115. private UIButton getbuttonCancel() {
  116. this.cancel_btn = new UIButton("取消");
  117. this.cancel_btn.setName("btn_cance");
  118. this.cancel_btn.setLocation(190, getbuttonOk().getY());
  119. this.cancel_btn.addActionListener(this);
  120. return this.cancel_btn;
  121. }
  122.  
  123. private UILabel getJfDay() {
  124. if (this.day == null) {
  125. this.day = new UILabel("交房通知书生效等待期(天):");
  126. this.day.setFont(getFont());
  127. this.day.setBackground(getBackground());
  128. this.day.setForeground(getForeground());
  129. this.day.setSize(200, 35);
  130. this.day.setLocation(30, 30);
  131. }
  132. return this.day;
  133. }
  134.  
  135. private UITextArea getJfText() {
  136. if (this.dayField == null) {
  137. this.dayField = new UITextArea();
  138. this.dayField.setSize(100, 25);
  139. this.dayField.setLocation(205, 35);
  140. }
  141. return this.dayField;
  142. }
  143.  
  144. private UILabel getJfTime() {
  145. if (this.time == null) {
  146. this.time = new UILabel("竣备实际获取时间:");
  147. this.time.setFont(getFont());
  148. this.time.setBackground(getBackground());
  149. this.time.setForeground(getForeground());
  150. this.time.setSize(200, 35);
  151. this.time.setLocation(30, 75);
  152. }
  153. return this.time;
  154. }
  155.  
  156. private UIRefPane getRqsj() {
  157. if (this.sjref == null) {
  158. this.sjref = new UIRefPane();
  159. this.sjref.setSize(165, 25);
  160. this.sjref.setRefNodeName("日期");
  161. this.sjref.setLocation(140, 80);
  162. }
  163. return this.sjref;
  164. }
  165.  
  166. public HashMap<String, String> getData() {
  167. HashMap rtnMap = new HashMap<String, String>();
  168. rtnMap.put("day", getJfText().getFieldText());
  169. rtnMap.put("time", getRqsj().getRefShowName());
  170. return rtnMap;
  171. }
  172.  
  173. private void onCancel() {
  174. this.setCancle(true);
  175. this.bat = 0;
  176. closeCancel();
  177. }
  178.  
  179. }

  

  1. package nc.ui.hzctr.sellctr.action;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import java.text.ParseException;
  5. import java.text.SimpleDateFormat;
  6. import java.util.Date;
  7. import java.util.HashMap;
  8.  
  9. import nc.bs.framework.common.NCLocator;
  10. import nc.itf.uif.pub.IUifService;
  11. import nc.ui.pub.beans.MessageDialog;
  12. import nc.ui.pubapp.uif2app.view.ShowUpableBillForm;
  13. import nc.ui.uif2.NCAction;
  14. import nc.ui.uif2.model.AbstractAppModel;
  15. import nc.uif2.annoations.MethodType;
  16. import nc.uif2.annoations.ModelMethod;
  17. import nc.uif2.annoations.ModelType;
  18. import nc.vo.hzctr.sellctr.AggSellctrVO;
  19. import nc.vo.pub.lang.UFDate;
  20.  
  21. /**
  22. * 批量输入日期按钮
  23. *
  24. * @author Yaolz
  25. */
  26. public class BatchInputDateAction extends NCAction {
  27.  
  28. private AbstractAppModel model;
  29. private ShowUpableBillForm editor;
  30.  
  31. public BatchInputDateAction() {
  32. this.setBtnName("批量输入日期");
  33. this.setCode("batInputAction");
  34. }
  35.  
  36. @Override
  37. public void doAction(ActionEvent e) throws Exception {
  38. // 获取界面选择行数
  39. Integer[] num = ((nc.ui.uif2.model.BillManageModel) model)
  40. .getSelectedOperaRows();
  41. // 获取选择的每行数据
  42. Object[] headRow = ((nc.ui.uif2.model.BillManageModel) model)
  43. .getSelectedOperaDatas();
  44. if (num == null || num.length < 1) {
  45. MessageDialog.showHintDlg(null, "提示", "请选择要批量输入日期的数据");
  46. return;
  47. }
  48. int a = 0;
  49. for (Object object : headRow) {
  50. AggSellctrVO head = (AggSellctrVO) object;
  51. if (head.getParentVO().getDbillstatus() != -1) {
  52. a++;
  53. }
  54. }
  55. if (a > 0) {
  56. MessageDialog
  57. .showHintDlg(null, "更新失败", "当前选择的数据中存在非自由态单据,请重新选择!!!");
  58. return;
  59. }
  60. BatchInputDateDialog bat = new BatchInputDateDialog();
  61. if (bat.showModal() == 0) {
  62. return;
  63. }
  64. HashMap<String, String> data = bat.getData();
  65. // 获取输入天数
  66. String day = data.get("day");
  67. // 获取输入日期
  68. String time = data.get("time");
  69. Date date = StrToDate(time);
  70. int idate = Integer.parseInt(day);
  71. UFDate ddate = new UFDate(date);
  72. int b = 0;
  73. for (Object object : headRow) {
  74. // 遍历取出表头数据
  75. AggSellctrVO head = (AggSellctrVO) object;
  76. // 不是自由态的跳过单次循环
  77. if (head.getParentVO().getDbillstatus() != -1) {
  78. continue;
  79. }
  80. // 交房通知日期 delivernoticedate
  81. UFDate delivernoticedate = (head.getParentVO()
  82. .getDelivernoticedate()) != null ? head.getParentVO()
  83. .getDelivernoticedate() : new UFDate("1900-01-01");
  84. // 交房通知书生效天 effectwait_date
  85. int effectwait_date = (head.getParentVO().getEffectwait_date()) != null ? head
  86. .getParentVO().getEffectwait_date() : 0;
  87. // 输入交房通知日期与交房通知书生效天,得到新日期
  88. Date newDate = addDate(delivernoticedate.toDate(), effectwait_date);
  89. // 转换成UFDate类型
  90. UFDate newDates = new UFDate(newDate);
  91. // 设置实际峻备完成时间
  92. head.getParentVO().setCompleteddate(ddate);
  93. // 实际峻备完成时间
  94. UFDate completeddate = head.getParentVO().getCompleteddate();
  95. // 新日期与实际峻备完成时间做比较,如果新日期大于实际峻备完成时间。则 设置实际峻备完成时间 为 新日期
  96. if (newDates.compareTo(completeddate) > 0 && newDates.getDay() > 0){
  97. head.getParentVO().setConfirmdate(newDates.toString().substring(0,7));
  98. }else{
  99. head.getParentVO().setConfirmdate(completeddate.toString().substring(0,7));
  100. }
  101. // 设置交房通知书生效等待期(天)
  102. head.getParentVO().setEffectwait_date(idate);
  103. // 设置Dr属性为0
  104. head.getParentVO().setAttributeValue("dr", new Integer(0));
  105. getUpdate().update(head.getParentVO());
  106. b++;
  107. }
  108. MessageDialog.showHintDlg(null, "更新成功", "已成功更新" + b + "条记录,请刷新当前界面!!!");
  109. }
  110.  
  111. /**
  112. * 输入日期与天数,得到新日期
  113. */
  114. public static Date addDate(Date date, long day) throws ParseException {
  115. long time = date.getTime(); // 得到指定日期的毫秒数
  116. day = day * 24 * 60 * 60 * 1000; // 要加上的天数转换成毫秒数
  117. time += day; // 相加得到新的毫秒数
  118. return new Date(time); // 将毫秒数转换成日期
  119. }
  120.  
  121. private IUifService getUpdate() {
  122. IUifService service = (IUifService) NCLocator.getInstance().lookup(
  123. IUifService.class.getName());
  124. return service;
  125. }
  126.  
  127. /**
  128. * 字符串转换成日期
  129. *
  130. * @param str
  131. * @return date
  132. */
  133. public static Date StrToDate(String str) {
  134. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  135. Date date = null;
  136. try {
  137. date = (Date) format.parseObject(str);
  138. } catch (Exception e) {
  139. e.printStackTrace();
  140. }
  141. return date;
  142. }
  143.  
  144. public ShowUpableBillForm getEditor() {
  145. return editor;
  146. }
  147.  
  148. public void setEditor(ShowUpableBillForm editor) {
  149. this.editor = editor;
  150. }
  151.  
  152. @ModelMethod(modelType = ModelType.AbstractAppModel, methodType = MethodType.GETTER)
  153. public AbstractAppModel getModel() {
  154. return this.model;
  155. }
  156.  
  157. @ModelMethod(modelType = ModelType.AbstractAppModel, methodType = MethodType.SETTER)
  158. public void setModel(AbstractAppModel model) {
  159. this.model = model;
  160. model.addAppEventListener(this);
  161. }
  162.  
  163. }

  

nc 画界面,触发效果(第一种)的更多相关文章

  1. 今天我们要说的画一个三角形,恩,画一个三角形,第一种呢是利用我们的html标签结合css来实现;而第二种方法就就是我们的html5新增的一个标签canves,这个canves就是网页画幕,那么顾名思义就是在网页里建造一个画板,用来画画,好,那接下来就和我一起去看看吧!

    第一种方法:利用我们的html标签结合css来实现 span{ width:0px; height:0px; border-width:7px; border-style:solid; border- ...

  2. 模拟QQ侧滑控件 实现三种界面切换效果(知识点:回调机制,解析网络json数据,fragment用法等)。

    需要用到的lib包 :解析json  gson包,从网络地址解析json数据成String字符串的异步网络解析工具AsyncHttpClient等 下载地址:点击下载 Xlistview 下拉上拉第三 ...

  3. 像画笔一样慢慢画出Path的三种方法(补充第四种)

    今天大家在群里大家非常热闹的讨论像画笔一样慢慢画出Path的这种效果该如何实现. 北京-LGL 博客号@ligl007发起了这个话题.然后各路高手踊跃发表意见.最后雷叔 上海-雷蒙 博客号@雷蒙之星 ...

  4. Qt5.9一个简单的多线程实例(类QThread)(第一种方法)

    Qt开启多线程,主要用到类QThread.有两种方法,第一种用一个类继承QThread,然后重新改写虚函数run().当要开启新线程时,只需要实例该类,然后调用函数start(),就可以开启一条多线程 ...

  5. zabbix之自动发现Tomcat多实例(第一种:已经部署完成,后续不再添加;第二种:后续或根据需要添加Tomcat实例)

    单一实例手动部署:https://www.cnblogs.com/huangyanqi/p/8522526.html 注释:参考的一位博主的博客后续做的修改,那个博主的网址找不到了!!!! 背景: 1 ...

  6. 在android中画圆形图片的几种办法

    在开发中常常会有一些需求,比方显示头像,显示一些特殊的需求,将图片显示成圆角或者圆形或者其它的一些形状. 可是往往我们手上的图片或者从server获取到的图片都是方形的.这时候就须要我们自己进行处理, ...

  7. 使用Typescript重构axios(二十)——请求取消功能:实现第一种使用方式

    0. 系列文章 1.使用Typescript重构axios(一)--写在最前面 2.使用Typescript重构axios(二)--项目起手,跑通流程 3.使用Typescript重构axios(三) ...

  8. iOS 清理缓存功能实现第一种方法

    添加一个提示框效果导入第三方MBProgressHUD #import "MBProgressHUD+MJ.h" /** * 清理缓存第一种方法 */ -(void)clearCa ...

  9. 十四、Android学习笔记_Android回调函数触发的几种方式 广播 静态对象

    一.通过广播方式: 1.比如登录.假如下面这个方法是外界调用的,那么怎样在LoginActivity里面执行登录操作,成功之后在回调listener接口呢?如果是平常的类,可以通过构造函数将监听类对象 ...

随机推荐

  1. redis 双写一致性 看一篇成高手系列1

    首先,缓存由于其高并发和高性能的特性,已经在项目中被广泛使用.在读取缓存方面,大家没啥疑问,都是按照下图的流程来进行业务操作. 但是在更新缓存方面,对于更新完数据库,是更新缓存呢,还是删除缓存.又或者 ...

  2. mongodb与mysql命令详细对比

    传统的关系数据库一般由数据库(database).表(table).记录(record)三个层次概念组成,MongoDB是由数据库(database).集合(collection).文档对象(docu ...

  3. JAVA 集合操作总结

    1.Collection 1.基本操作 对集合的基础操作 1.boolean add(Object o) //添加对象到集合 2.boolean remove(Object o) //删除指定的对象 ...

  4. Python模块 os和sys

    os模块是与操作系统交互的一个接口 os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname") 改变当前脚本工作目录:相 ...

  5. 第三章 FFmpeg转封装

    3.1 音视频文件转MP4格式 在互联网常见的格式中,跨平台最好的应该是MP4文件. 3.1.1 MP4格式标准介绍 MP4文件由多个Box与FullBox组成 每个Box由Header和Data两部 ...

  6. for...in的改进版for...of

    for...in 用起来似乎还不错,为什么又弄个 for...of 呢? 来看个例子: 'user strict' var arr = [12,13,14,15,16]; for(var i in a ...

  7. python3:实现字符串的全排列(有重复字符)

    抛出问题 求任意一个字符串的全排列组合,例如a='123',输出 123,132,213,231,312,321. 解决方案 #字符串任意两个位置字符交换 def str_replace(str, x ...

  8. 性能监控工具以及java堆分析OOM

      一.性能监控工具 1.系统性能监控 Linux -确定系统运行的整体状态,基本定位问题所在 -uptime: ------系统时间 ------运行时间(例子中为127天) ------连接数(每 ...

  9. ubuntu vsftp

    转自:https://www.cnblogs.com/java-synchronized/p/6935711.html 12点多了,擦!做个码农真不容易呀! 系统:Ubuntu16.04 安装:FTP ...

  10. servlet cdi注入

    @WebServlet("/cdiservlet")//url映射,即@WebServlet告诉容器,如果请求的URL是"/cdiservlet",则由NewS ...