package nc.ui.hzctr.sellctr.action;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pub.beans.UIButton;
import nc.ui.pub.beans.UIDialog;
import nc.ui.pub.beans.UILabel;
import nc.ui.pub.beans.UIRefPane;
import nc.ui.pub.beans.UITextArea; /**
* 批量输入日期窗口
*
* @author Yaolz
*/
public class BatchInputDateDialog extends UIDialog implements ActionListener { // 交房通知书生效等待期(天)标签
private UILabel day;
// 天数输入框
private UITextArea dayField;
// 竣备实际获取时间标签
private UILabel time;
// 时间参照
private UIRefPane sjref = null;
// 确定
private UIButton ok_btn;
// 取消
private UIButton cancel_btn;
private boolean isCancle;
private int bat = 0; @Override
public int showModal() {
super.show();
int bat = this.bat;
return bat;
} public BatchInputDateDialog() {
setLayout(new BorderLayout());
// 标题
setTitle("批量输入日期框");
this.setCancle(true);
initUI();
} public void setCancle(boolean isCancle) {
this.isCancle = isCancle;
} private void initUI() {
// 窗体长宽
setSize(350, 200);
getContentPane().setLayout(null);
// 交房标签
getContentPane().add(getJfDay());
// 交房文本框
getContentPane().add(getJfText());
// 竣备标签
getContentPane().add(getJfTime());
// 竣备参照
getContentPane().add(getRqsj());
// 确定按钮
getContentPane().add(getbuttonOk());
// 取消按钮
getContentPane().add(getbuttonCancel());
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int screenWidth = screenSize.width / 2;
int screenHeight = screenSize.height / 2;
int height = getHeight();
int width = getWidth();
setLocation(screenWidth - width / 2, screenHeight - height / 2);
} @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().getClass().getName()
.equals("nc.ui.pub.beans.UIButton")) {
nc.ui.pub.beans.UIButton btn = (nc.ui.pub.beans.UIButton) e
.getSource();
if (this.ok_btn.getName().equals(btn.getName())) {
onOk();
} else if (this.cancel_btn.getName().equals(btn.getName())) {
onCancel();
}
}
} private void onOk() {
if ((getJfText().getText() == null || getJfText().getText().length() <= 0)
&& (getRqsj().getText() == null || getRqsj().getText().length() <= 0)) {
MessageDialog.showErrorDlg(null, "提示", "必须填写天数与时间!");
return;
}
this.bat = 1;
this.setCancle(false);
closeOK();
} private UIButton getbuttonOk() {
this.ok_btn = new UIButton("确认");
this.ok_btn.setName("btn_ok");
this.ok_btn.setLocation(90, 140);
this.ok_btn.addActionListener(this);
return this.ok_btn;
} private UIButton getbuttonCancel() {
this.cancel_btn = new UIButton("取消");
this.cancel_btn.setName("btn_cance");
this.cancel_btn.setLocation(190, getbuttonOk().getY());
this.cancel_btn.addActionListener(this);
return this.cancel_btn;
} private UILabel getJfDay() {
if (this.day == null) {
this.day = new UILabel("交房通知书生效等待期(天):");
this.day.setFont(getFont());
this.day.setBackground(getBackground());
this.day.setForeground(getForeground());
this.day.setSize(200, 35);
this.day.setLocation(30, 30);
}
return this.day;
} private UITextArea getJfText() {
if (this.dayField == null) {
this.dayField = new UITextArea();
this.dayField.setSize(100, 25);
this.dayField.setLocation(205, 35);
}
return this.dayField;
} private UILabel getJfTime() {
if (this.time == null) {
this.time = new UILabel("竣备实际获取时间:");
this.time.setFont(getFont());
this.time.setBackground(getBackground());
this.time.setForeground(getForeground());
this.time.setSize(200, 35);
this.time.setLocation(30, 75);
}
return this.time;
} private UIRefPane getRqsj() {
if (this.sjref == null) {
this.sjref = new UIRefPane();
this.sjref.setSize(165, 25);
this.sjref.setRefNodeName("日期");
this.sjref.setLocation(140, 80);
}
return this.sjref;
} public HashMap<String, String> getData() {
HashMap rtnMap = new HashMap<String, String>();
rtnMap.put("day", getJfText().getFieldText());
rtnMap.put("time", getRqsj().getRefShowName());
return rtnMap;
} private void onCancel() {
this.setCancle(true);
this.bat = 0;
closeCancel();
} }

  

package nc.ui.hzctr.sellctr.action;

import java.awt.event.ActionEvent;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap; import nc.bs.framework.common.NCLocator;
import nc.itf.uif.pub.IUifService;
import nc.ui.pub.beans.MessageDialog;
import nc.ui.pubapp.uif2app.view.ShowUpableBillForm;
import nc.ui.uif2.NCAction;
import nc.ui.uif2.model.AbstractAppModel;
import nc.uif2.annoations.MethodType;
import nc.uif2.annoations.ModelMethod;
import nc.uif2.annoations.ModelType;
import nc.vo.hzctr.sellctr.AggSellctrVO;
import nc.vo.pub.lang.UFDate; /**
* 批量输入日期按钮
*
* @author Yaolz
*/
public class BatchInputDateAction extends NCAction { private AbstractAppModel model;
private ShowUpableBillForm editor; public BatchInputDateAction() {
this.setBtnName("批量输入日期");
this.setCode("batInputAction");
} @Override
public void doAction(ActionEvent e) throws Exception {
// 获取界面选择行数
Integer[] num = ((nc.ui.uif2.model.BillManageModel) model)
.getSelectedOperaRows();
// 获取选择的每行数据
Object[] headRow = ((nc.ui.uif2.model.BillManageModel) model)
.getSelectedOperaDatas();
if (num == null || num.length < 1) {
MessageDialog.showHintDlg(null, "提示", "请选择要批量输入日期的数据");
return;
}
int a = 0;
for (Object object : headRow) {
AggSellctrVO head = (AggSellctrVO) object;
if (head.getParentVO().getDbillstatus() != -1) {
a++;
}
}
if (a > 0) {
MessageDialog
.showHintDlg(null, "更新失败", "当前选择的数据中存在非自由态单据,请重新选择!!!");
return;
}
BatchInputDateDialog bat = new BatchInputDateDialog();
if (bat.showModal() == 0) {
return;
}
HashMap<String, String> data = bat.getData();
// 获取输入天数
String day = data.get("day");
// 获取输入日期
String time = data.get("time");
Date date = StrToDate(time);
int idate = Integer.parseInt(day);
UFDate ddate = new UFDate(date);
int b = 0;
for (Object object : headRow) {
// 遍历取出表头数据
AggSellctrVO head = (AggSellctrVO) object;
// 不是自由态的跳过单次循环
if (head.getParentVO().getDbillstatus() != -1) {
continue;
}
// 交房通知日期 delivernoticedate
UFDate delivernoticedate = (head.getParentVO()
.getDelivernoticedate()) != null ? head.getParentVO()
.getDelivernoticedate() : new UFDate("1900-01-01");
// 交房通知书生效天 effectwait_date
int effectwait_date = (head.getParentVO().getEffectwait_date()) != null ? head
.getParentVO().getEffectwait_date() : 0;
// 输入交房通知日期与交房通知书生效天,得到新日期
Date newDate = addDate(delivernoticedate.toDate(), effectwait_date);
// 转换成UFDate类型
UFDate newDates = new UFDate(newDate);
// 设置实际峻备完成时间
head.getParentVO().setCompleteddate(ddate);
// 实际峻备完成时间
UFDate completeddate = head.getParentVO().getCompleteddate();
// 新日期与实际峻备完成时间做比较,如果新日期大于实际峻备完成时间。则 设置实际峻备完成时间 为 新日期
if (newDates.compareTo(completeddate) > 0 && newDates.getDay() > 0){
head.getParentVO().setConfirmdate(newDates.toString().substring(0,7));
}else{
head.getParentVO().setConfirmdate(completeddate.toString().substring(0,7));
}
// 设置交房通知书生效等待期(天)
head.getParentVO().setEffectwait_date(idate);
// 设置Dr属性为0
head.getParentVO().setAttributeValue("dr", new Integer(0));
getUpdate().update(head.getParentVO());
b++;
}
MessageDialog.showHintDlg(null, "更新成功", "已成功更新" + b + "条记录,请刷新当前界面!!!");
} /**
* 输入日期与天数,得到新日期
*/
public static Date addDate(Date date, long day) throws ParseException {
long time = date.getTime(); // 得到指定日期的毫秒数
day = day * 24 * 60 * 60 * 1000; // 要加上的天数转换成毫秒数
time += day; // 相加得到新的毫秒数
return new Date(time); // 将毫秒数转换成日期
} private IUifService getUpdate() {
IUifService service = (IUifService) NCLocator.getInstance().lookup(
IUifService.class.getName());
return service;
} /**
* 字符串转换成日期
*
* @param str
* @return date
*/
public static Date StrToDate(String str) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
date = (Date) format.parseObject(str);
} catch (Exception e) {
e.printStackTrace();
}
return date;
} public ShowUpableBillForm getEditor() {
return editor;
} public void setEditor(ShowUpableBillForm editor) {
this.editor = editor;
} @ModelMethod(modelType = ModelType.AbstractAppModel, methodType = MethodType.GETTER)
public AbstractAppModel getModel() {
return this.model;
} @ModelMethod(modelType = ModelType.AbstractAppModel, methodType = MethodType.SETTER)
public void setModel(AbstractAppModel model) {
this.model = model;
model.addAppEventListener(this);
} }

  

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. 手把手教你实现 Google 拓展插件(转自实验楼)

    一.课程简介 1.1 实验介绍 本课程的实验环境由实验楼提供,Google 浏览器拓展的运行环境为 Google 浏览器.在本实验中,你将了解如何制作一个属于你自己的 Google 拓展插件. 课程实 ...

  2. PAT 甲级 1027 Colors in Mars (20 分)

    1027 Colors in Mars (20 分) People in Mars represent the colors in their computers in a similar way a ...

  3. 使用 JavaScript 将 XML 转成 JSON

    function xmlToJson(xml) { // Create the return object var obj = {}; if (xml.nodeType == 1) { // elem ...

  4. wordpress评论回复自动发邮件的功能

    A.插件流,可以说WP强大的插件功能的确能省事不少. 插件的办法一般是两步:第一实现成功发邮件,第二时间评论自动回复,这就需要用到两个插件,一个是Configure SMTP,一个是Mail To C ...

  5. 系统变量之System.getenv()和System.getProperty()

    Java提供了System类的静态方法getenv()和getProperty()用于返回系统相关的变量与属性,getenv方法返回的变量大多于系统相关,getProperty方法返回的变量大多与ja ...

  6. [UnityShader基础]05.模板测试

    参考链接: https://blog.csdn.net/u011047171/article/details/46928463 https://blog.csdn.net/JohnBlu/articl ...

  7. html: 仿制soundmanager2右上角面板

    仿制 http://schillmania.com/projects/soundmanager2/#volume 右上角面板 <style type="text/css"&g ...

  8. java List<Map<String,Object>

    xml <select id="selectShopList" resultType="java.util.HashMap"> SELECT p.P ...

  9. 深度学习VS机器学习——到底什么区别

    转自:https://baijiahao.baidu.com/s?id=1595509949786067084&wfr=spider&for=pc 最近在听深度学习的课,老师提了一个基 ...

  10. SQL Server 磁盘请求超时的833错误原因分析以及解决

    本文出处:http://www.cnblogs.com/wy123/p/6984885.html 最近遇到一个SQL Server服务器响应极度缓慢,并且出现客户端请求报错的情况,在数据库中的erro ...