nc 画界面,触发效果(第一种)
- 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 画界面,触发效果(第一种)的更多相关文章
- 今天我们要说的画一个三角形,恩,画一个三角形,第一种呢是利用我们的html标签结合css来实现;而第二种方法就就是我们的html5新增的一个标签canves,这个canves就是网页画幕,那么顾名思义就是在网页里建造一个画板,用来画画,好,那接下来就和我一起去看看吧!
第一种方法:利用我们的html标签结合css来实现 span{ width:0px; height:0px; border-width:7px; border-style:solid; border- ...
- 模拟QQ侧滑控件 实现三种界面切换效果(知识点:回调机制,解析网络json数据,fragment用法等)。
需要用到的lib包 :解析json gson包,从网络地址解析json数据成String字符串的异步网络解析工具AsyncHttpClient等 下载地址:点击下载 Xlistview 下拉上拉第三 ...
- 像画笔一样慢慢画出Path的三种方法(补充第四种)
今天大家在群里大家非常热闹的讨论像画笔一样慢慢画出Path的这种效果该如何实现. 北京-LGL 博客号@ligl007发起了这个话题.然后各路高手踊跃发表意见.最后雷叔 上海-雷蒙 博客号@雷蒙之星 ...
- Qt5.9一个简单的多线程实例(类QThread)(第一种方法)
Qt开启多线程,主要用到类QThread.有两种方法,第一种用一个类继承QThread,然后重新改写虚函数run().当要开启新线程时,只需要实例该类,然后调用函数start(),就可以开启一条多线程 ...
- zabbix之自动发现Tomcat多实例(第一种:已经部署完成,后续不再添加;第二种:后续或根据需要添加Tomcat实例)
单一实例手动部署:https://www.cnblogs.com/huangyanqi/p/8522526.html 注释:参考的一位博主的博客后续做的修改,那个博主的网址找不到了!!!! 背景: 1 ...
- 在android中画圆形图片的几种办法
在开发中常常会有一些需求,比方显示头像,显示一些特殊的需求,将图片显示成圆角或者圆形或者其它的一些形状. 可是往往我们手上的图片或者从server获取到的图片都是方形的.这时候就须要我们自己进行处理, ...
- 使用Typescript重构axios(二十)——请求取消功能:实现第一种使用方式
0. 系列文章 1.使用Typescript重构axios(一)--写在最前面 2.使用Typescript重构axios(二)--项目起手,跑通流程 3.使用Typescript重构axios(三) ...
- iOS 清理缓存功能实现第一种方法
添加一个提示框效果导入第三方MBProgressHUD #import "MBProgressHUD+MJ.h" /** * 清理缓存第一种方法 */ -(void)clearCa ...
- 十四、Android学习笔记_Android回调函数触发的几种方式 广播 静态对象
一.通过广播方式: 1.比如登录.假如下面这个方法是外界调用的,那么怎样在LoginActivity里面执行登录操作,成功之后在回调listener接口呢?如果是平常的类,可以通过构造函数将监听类对象 ...
随机推荐
- redis 双写一致性 看一篇成高手系列1
首先,缓存由于其高并发和高性能的特性,已经在项目中被广泛使用.在读取缓存方面,大家没啥疑问,都是按照下图的流程来进行业务操作. 但是在更新缓存方面,对于更新完数据库,是更新缓存呢,还是删除缓存.又或者 ...
- mongodb与mysql命令详细对比
传统的关系数据库一般由数据库(database).表(table).记录(record)三个层次概念组成,MongoDB是由数据库(database).集合(collection).文档对象(docu ...
- JAVA 集合操作总结
1.Collection 1.基本操作 对集合的基础操作 1.boolean add(Object o) //添加对象到集合 2.boolean remove(Object o) //删除指定的对象 ...
- Python模块 os和sys
os模块是与操作系统交互的一个接口 os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname") 改变当前脚本工作目录:相 ...
- 第三章 FFmpeg转封装
3.1 音视频文件转MP4格式 在互联网常见的格式中,跨平台最好的应该是MP4文件. 3.1.1 MP4格式标准介绍 MP4文件由多个Box与FullBox组成 每个Box由Header和Data两部 ...
- for...in的改进版for...of
for...in 用起来似乎还不错,为什么又弄个 for...of 呢? 来看个例子: 'user strict' var arr = [12,13,14,15,16]; for(var i in a ...
- python3:实现字符串的全排列(有重复字符)
抛出问题 求任意一个字符串的全排列组合,例如a='123',输出 123,132,213,231,312,321. 解决方案 #字符串任意两个位置字符交换 def str_replace(str, x ...
- 性能监控工具以及java堆分析OOM
一.性能监控工具 1.系统性能监控 Linux -确定系统运行的整体状态,基本定位问题所在 -uptime: ------系统时间 ------运行时间(例子中为127天) ------连接数(每 ...
- ubuntu vsftp
转自:https://www.cnblogs.com/java-synchronized/p/6935711.html 12点多了,擦!做个码农真不容易呀! 系统:Ubuntu16.04 安装:FTP ...
- servlet cdi注入
@WebServlet("/cdiservlet")//url映射,即@WebServlet告诉容器,如果请求的URL是"/cdiservlet",则由NewS ...