A Java/J2EE development framework for enterprise system based on Struts/Spring/JPA/Hibernate and jquery/bootstrap
GNU Lesser General Public License v3.0
321
stars
242
forks
source link
建议普通和成功提示土司添加超时,频繁操作一个一个点太麻烦 #97
Open
xiaolongyuan opened 10 years ago
我的做法: 只对普通和成功提示做超时,其他不变
global.js:
form-validation.js
表单提交回调修改:
if (response.type == "success" || response.type == "warning") { //TODO 添加设置超时,2014.11.04 longyuan Global.notify(response.type, response.message,'',response.timeout);
OperationResult .java
修改后文件:
package lab.s2jh.core.web.view;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
用于Object到JSON序列化的对象结构体定义 */ @JsonInclude(Include.NON_NULL) public class OperationResult {
/* 标识操作成功与否 / public enum OPERATION_RESULT_TYPE { success, warning, failure, confirm }
/* 返回success或failure操作标识 / private String type; /* 国际化处理的返回JSON消息正文 / private String message; /* 默认超时时间 _/ private long timeout = 60_1000L; /* 补充的数据 */ private Object userdata;
public static OperationResult buildSuccessResult(String message, Object userdata) { return new OperationResult(OPERATION_RESULT_TYPE.success, message, userdata); }
public static OperationResult buildSuccessResult(String message, Object userdata,long timeout) { return new OperationResult(OPERATION_RESULT_TYPE.success, message, userdata,timeout); }
public static OperationResult buildSuccessResult(String message) { return new OperationResult(OPERATION_RESULT_TYPE.success, message); }
public static OperationResult buildSuccessResult(String message,long timeout) { return new OperationResult(OPERATION_RESULT_TYPE.success, message, timeout); }
public static OperationResult buildWarningResult(String message, Object userdata) { return new OperationResult(OPERATION_RESULT_TYPE.warning, message, userdata); }
public static OperationResult buildWarningResult(String message, Object userdata,long timeout) { return new OperationResult(OPERATION_RESULT_TYPE.warning, message, userdata, timeout); }
public static OperationResult buildFailureResult(String message) { return new OperationResult(OPERATION_RESULT_TYPE.failure, message); }
public static OperationResult buildFailureResult(String message,long timeout) { return new OperationResult(OPERATION_RESULT_TYPE.failure, message, timeout); }
public static OperationResult buildFailureResult(String message, Object userdata) { return new OperationResult(OPERATION_RESULT_TYPE.failure, message, userdata); }
public static OperationResult buildFailureResult(String message, Object userdata,long timeout) { return new OperationResult(OPERATION_RESULT_TYPE.failure, message, userdata, timeout); }
public static OperationResult buildConfirmResult(String message, Object userdata) { return new OperationResult(OPERATION_RESULT_TYPE.confirm, message, userdata); } public static OperationResult buildConfirmResult(String message, Object userdata,long timeout) { return new OperationResult(OPERATION_RESULT_TYPE.confirm, message, userdata, timeout); }
public OperationResult(OPERATION_RESULT_TYPE type, String message) { this.type = type.name(); this.message = message; } public OperationResult(OPERATION_RESULT_TYPE type, String message,long timeout) { this.type = type.name(); this.message = message; this.timeout=timeout; }
public OperationResult(OPERATION_RESULT_TYPE type, String message, Object userdata) { this.type = type.name(); this.message = message; this.userdata = userdata; } public OperationResult(OPERATION_RESULT_TYPE type, String message, Object userdata,long timeout) { this.type = type.name(); this.message = message; this.userdata = userdata; this.timeout=timeout; }
/**
/**
/**
/**
public long getTimeout() { return timeout; }
public void setTimeout(long timeout) { this.timeout = timeout; }
public Object getUserdata() { return userdata; }
public void setUserdata(Object userdata) { this.userdata = userdata; } }