From 82c1c501287dc8d6a815c2ad1526ce9f85d5fce0 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 6 Dec 2018 15:41:47 +0800 Subject: [PATCH 01/60] =?UTF-8?q?REPORT-13276=20release=E4=BC=A0=E4=B8=80?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/bbs/BBSLoginUtils.java | 60 +--- .../com/fr/design/extra/LoginWebBridge.java | 83 +----- .../com/fr/design/extra/PluginWebBridge.java | 4 +- .../design/extra/ucenter/AbstractClient.java | 120 -------- .../com/fr/design/extra/ucenter/Client.java | 264 ------------------ .../fr/design/extra/ucenter/XMLHelper.java | 41 --- 6 files changed, 17 insertions(+), 555 deletions(-) delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java delete mode 100644 designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java diff --git a/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java b/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java index ea24c49da0..9e2ba9a733 100644 --- a/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java +++ b/designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java @@ -1,14 +1,8 @@ package com.fr.design.bbs; -import com.fr.config.BBSAttr; -import com.fr.config.Configuration; -import com.fr.config.MarketConfig; +import com.fr.base.passport.FinePassportManager; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; -import com.fr.transaction.Configurations; -import com.fr.transaction.Worker; -import java.util.List; /** * Created by ibm on 2017/8/21. @@ -16,62 +10,14 @@ import java.util.List; public class BBSLoginUtils { public static void bbsLogin(final String username, final String password) { - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(username); - bbsAttr.setBbsPassword(password); try { - Configurations.update(new Worker() { - @Override - public void run() { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } - @Override - public Class[] targets() { - return new Class[]{MarketConfig.class}; - } - }); - - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - - public static void bbsLogin(List list) { - try { - String uid = list.get(0); - String username = list.get(1); - String password = list.get(2); - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(username); - bbsAttr.setBbsPassword(password); - bbsAttr.setBbsUid(Integer.parseInt(uid)); - bbsAttr.setInShowBBsName(username); - Configurations.update(new Worker() { - @Override - public void run() { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } - @Override - public Class[] targets() { - return new Class[]{MarketConfig.class}; - } - }); - + FinePassportManager.getInstance().login(username, password); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } public static void bbsLogout() { - final BBSAttr bbsAttr = new BBSAttr(); - bbsAttr.setBbsUsername(StringUtils.EMPTY); - bbsAttr.setBbsPassword(StringUtils.EMPTY); - bbsAttr.setBbsUid(0); - bbsAttr.setInShowBBsName(StringUtils.EMPTY); - try { - MarketConfig.getInstance().setBBsAttr(bbsAttr); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + FinePassportManager.getInstance().logout(); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java index a89a4df031..43bb8131a4 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java @@ -1,23 +1,18 @@ package com.fr.design.extra; -import com.fr.base.FRContext; +import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; -import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.PluginLoginExecutor; -import com.fr.design.extra.ucenter.Client; -import com.fr.design.extra.ucenter.XMLHelper; import com.fr.design.gui.ilable.UILabel; import com.fr.general.CloudCenter; -import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; -import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; import javafx.concurrent.Task; import javafx.scene.web.WebEngine; import netscape.javascript.JSObject; - import javax.swing.JDialog; import javax.swing.SwingUtilities; import java.awt.Color; @@ -25,8 +20,6 @@ import java.awt.Desktop; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLEncoder; -import java.util.LinkedList; -import java.util.List; /** * @author vito @@ -150,7 +143,7 @@ public class LoginWebBridge { try { Thread.sleep(millis); } catch (InterruptedException e) { - FRContext.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -161,7 +154,7 @@ public class LoginWebBridge { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -172,7 +165,7 @@ public class LoginWebBridge { try { Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } } @@ -202,35 +195,16 @@ public class LoginWebBridge { if (!testConnection()) { return NET_FAILED; } - List loginResult = frPassport(userInfo, password); - String uid = loginResult.get(0); - String username = loginResult.get(1); - if (Integer.parseInt(uid) > 0) { - loginSuccess(username); - } - return uid; - } - - private List frPassport(String username, String password) { - LinkedList list = new LinkedList<>(); + int uid = 0; try { - Client uc = new Client(); - String result = uc.ucUserLogin(username, password); - result = new String(result.getBytes("iso-8859-1"), "gbk"); - list = XMLHelper.ucUnserialize(result); - if (list.size() > 0) { - int uid = Integer.parseInt(list.get(0)); - if (uid > 0) { - BBSLoginUtils.bbsLogin(list); - } - } else { - list.push(NET_FAILED); - } + uid = FinePassportManager.getInstance().login(userInfo, password); } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - list.push(UNKNOWN_ERROR); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (uid > 0) { + loginSuccess(MarketConfig.getInstance().getBbsUsername()); } - return list; + return String.valueOf(uid); } /** @@ -276,39 +250,6 @@ public class LoginWebBridge { } } - /** - * 获取用户信息 - * - * @param userInfo - */ - public void getLoginInfo(String userInfo) { - try { - JSONObject jo = new JSONObject(userInfo); - String status = jo.get("status").toString(); - if (ComparatorUtils.equals(status, LOGIN_SUCCESS)) { - String username = jo.get("username").toString(); - int uid = Integer.parseInt(jo.get("uid") == null ? StringUtils.EMPTY : jo.get("uid").toString()); - closeQQWindow(); - loginSuccess(username); - - LinkedList list = new LinkedList<>(); - list.add(String.valueOf(uid)); - list.add(username); - list.add(StringUtils.EMPTY); - BBSLoginUtils.bbsLogin(list); - } else if (ComparatorUtils.equals(status, LOGIN_FAILED)) { - //账号没有QQ授权 - closeQQWindow(); - try { - Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("QQ_binding"))); - } catch (Exception ignored) { - // ignored - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - } public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { if (url.indexOf("qqLogin.html") > 0) { diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java index 33d5276453..903418ec93 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java @@ -1,8 +1,8 @@ package com.fr.design.extra; +import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; import com.fr.design.RestartHelper; -import com.fr.design.bbs.BBSLoginUtils; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor; @@ -554,7 +554,7 @@ public class PluginWebBridge { */ public void clearUserInfo() { MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); - BBSLoginUtils.bbsLogout(); + FinePassportManager.getInstance().logout(); uiLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn")); } diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java deleted file mode 100644 index 855e5a96e6..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.Base64; -import com.fr.base.FRContext; -import com.fr.stable.StringUtils; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Map; - -/** - * @author lp - * @date 2016/9/9 - */ -public abstract class AbstractClient { - - static final String UC_API_MYSQL = "ucApiMysql"; - static final String UC_API_POST = "ucApiPost"; - - protected String urlEncode(String value) { - return URLEncoder.encode(value); - } - - protected String md5(String input) { - MessageDigest md; - try { - md = MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - return byte2hex(md.digest(input.getBytes())); - } - - protected String md5(long input) { - return md5(String.valueOf(input)); - } - - protected String base64Decode(String input) { - try { - return new String(Base64.decode(input)); - } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - } - - protected String base64Encode(String input) { - try { - return Base64.encode(input.getBytes("iso-8859-1")); - } catch (Exception e) { - FRContext.getLogger().info(e.getMessage()); - return ""; - } - } - - protected String byte2hex(byte[] b) { - StringBuilder hs = new StringBuilder(); - String stmp = ""; - for (byte aB : b) { - stmp = (Integer.toHexString(aB & 0XFF)); - if (stmp.length() == 1) { - hs.append("0").append(stmp); - } else { - hs.append(stmp); - } - } - return hs.toString(); - } - - protected String subStr(String input, int begin, int length) { - return input.substring(begin, begin + length); - } - - protected String subStr(String input, int begin) { - if (begin > 0) { - return input.substring(begin); - } else { - return input.substring(input.length() + begin); - } - } - - protected long microTime() { - return System.currentTimeMillis(); - } - - protected long time() { - return System.currentTimeMillis() / 1000; - } - - protected String sprintf(String format, long input) { - String temp = "0000000000" + input; - return temp.substring(temp.length() - 10); - } - - protected String callUserFunc(String function, String model, String action, Map args) { - if (UC_API_MYSQL.equals(function)) { - return this.ucApiMysql(model, action, args); - } - if (UC_API_POST.equals(function)) { - return this.ucApiPost(model, action, args); - } - return StringUtils.EMPTY; - } - - public abstract String ucApiPost(String module, String action, Map arg); - - public abstract String ucApiMysql(String model, String action, Map args); - - protected String urlEncode(String value, String code) { - try { - return URLEncoder.encode(value, code); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().info(e.getMessage()); - } - return ""; - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java deleted file mode 100644 index 903286476e..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.FRContext; -import com.fr.general.CloudCenter; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.Socket; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * - * @author lp - * @date 2016/9/9 - */ -public class Client extends AbstractClient { - - private static String UC_IP = ""; - private static String UC_API = ""; - private static String UC_CONNECT = ""; - private static String UC_KEY = "Rc85U37411p4zdvcedm8D4t4D3l9Sa42H0kd98Gbd82aA99a61S2Z5LbQ9u430M0"; - private static String UC_APPID = "4"; - private static String UC_CLIENT_RELEASE = "20090212"; - public static String UC_ROOT = ""; - private static String UC_API_FUNC = "mysql".equals(UC_CONNECT) ? UC_API_MYSQL : UC_API_POST; - - public String ucUserLogin(String username, String password) { - return ucUserLogin(username, password, 0, 0); - } - - public String ucUserLogin(String username, String password, int isUid, int checkQues) { - return ucUserLogin(username, password, isUid, checkQues, "", ""); - } - - /** - * 用户登录 - * - * @param username 用户名 - * @param password 密码 - * @param isUid 是否为uid - * @param checkQues 是否使用安全问题 - * @param questionId 安全提问 - * @param answer 安全提问答案 - * @return array (uid/status, username, password, email) - */ - public String ucUserLogin(String username, String password, int isUid, int checkQues, String questionId, String answer) { - Map args = new HashMap<>(6); - args.put("username", username); - args.put("password", password); - args.put("isUid", isUid); - args.put("checkQues", checkQues); - args.put("questionId", questionId); - args.put("answer", answer); - String res = callUserFunc(UC_API_FUNC, "user", "login", args); - return "mysql".equals(UC_CONNECT) ? res : res; - } - - /** - * 拼接发送的post请求 - * - * @param module 模块 - * @param action 操作模式 - * @param arg 参数 - * @return 发送的请求加密内容 - */ - @Override - public String ucApiPost(String module, String action, Map arg) { - StringBuilder str = new StringBuilder(); - String sep = ""; - for (String k : arg.keySet()) { - Object v = arg.get(k); - k = urlEncode(k); - if (v.getClass().isAssignableFrom(Map.class)) { - StringBuilder s2 = new StringBuilder(); - String sep2 = ""; - for (String k2 : ((Map) v).keySet()) { - Object v2 = ((Map) v).get(k2); - k2 = urlEncode(k2); - s2.append(sep2).append("{").append(k).append("}[").append(k2).append("]=").append(urlEncode(String.valueOf(v2))); - sep2 = "&"; - } - str.append(sep).append(s2); - } else { - str.append(sep).append(k).append("=").append(urlEncode(String.valueOf(v), "GBK")); - } - sep = "&"; - } - String postData = ucApiRequestdata(module, action, str.toString(), ""); - UC_API = CloudCenter.getInstance().acquireUrlByKind("bbs.ucapi"); - UC_IP = CloudCenter.getInstance().acquireUrlByKind("bbs.ip"); - return ucFopen2(UC_API + "/index.php", 500000, postData, "", true, UC_IP, 20, true); - } - - @Override - public String ucApiMysql(String model, String action, Map args) { - return ""; - } - - public String ucApiInput(String data) { - return urlEncode(ucAuthCode(data + "&agent=" + md5("") + "&time=" + time(), "ENCODE", UC_KEY), "GBK"); - } - - protected String ucApiRequestdata(String module, String action, String arg, String extra) { - String input = ucApiInput(arg); - return "m=" + module + "&a=" + action + "&inajax=2&release=" + UC_CLIENT_RELEASE + "&input=" + input + "&appid=" + UC_APPID + extra; - } - - public String ucAuthCode(String string, String operation, String key) { - return ucAuthCode(string, operation, key, 0); - } - - /** - * 内容加密 - * - * @param string 原文 - * @param operation decode或者encode - * @param key 密钥 - * @param expiry 密文有效时限 - * @return 加密之后的原文 - */ - public String ucAuthCode(String string, String operation, String key, int expiry) { - int ckeyLength = 4; - key = md5(key != null ? key : UC_KEY); - String keya = md5(subStr(key, 0, 16)); - String keyb = md5(subStr(key, 16, 16)); - String keyc = "DECODE".equals(operation) ? subStr(string, 0, ckeyLength) : subStr(md5(microTime()), -ckeyLength); - String cryptkey = keya + md5(keya + keyc); - int keyLength = cryptkey.length(); - string = "DECODE".equals(operation) ? base64Decode(subStr(string, ckeyLength)) : sprintf("%010d", expiry > 0 ? expiry + time() : 0) + subStr(md5(string + keyb), 0, 16) + string; - int stringLength = string.length(); - StringBuilder result1 = new StringBuilder(); - int[] box = new int[256]; - for (int i = 0; i < 256; i++) { - box[i] = i; - } - int[] rndkey = new int[256]; - for (int i = 0; i <= 255; i++) { - rndkey[i] = (int) cryptkey.charAt(i % keyLength); - } - int j = 0; - for (int i = 0; i < 256; i++) { - j = (j + box[i] + rndkey[i]) % 256; - int tmp = box[i]; - box[i] = box[j]; - box[j] = tmp; - } - j = 0; - int a = 0; - for (int i = 0; i < stringLength; i++) { - a = (a + 1) % 256; - j = (j + box[a]) % 256; - int tmp = box[a]; - box[a] = box[j]; - box[j] = tmp; - result1.append((char) (((int) string.charAt(i)) ^ (box[(box[a] + box[j]) % 256]))); - } - if ("DECODE".equals(operation)) { - String result = result1.toString(); - try { - result = new String(result.getBytes("iso-8859-1"), "gbk"); - } catch (Exception e) { - result = result1.substring(0, result1.length()); - } - if ((Integer.parseInt(subStr(result, 0, 10)) == 0 || Long.parseLong(subStr(result, 0, 10)) - time() > 0) && subStr(result, 10, 16).equals(subStr(md5(subStr(result, 26) + keyb), 0, 16))) { - return subStr(result, 26); - } else { - return ""; - } - } else { - return keyc + base64Encode(result1.toString()).replaceAll("=", ""); - } - } - - protected String ucFopen2(String url, int limit, String post, String cookie, boolean bysocket, String ip, int timeout, boolean block) { - url += url.indexOf("?") > 0 ? "&" : "?" + "__times__=1"; - return ucFopen(url, limit, post, cookie, bysocket, ip, timeout, block); - } - - /** - * 本地模网络请求取数据 - * - * @param url 打开的url - * @param limit 取返回的数据的长度 - * @param post 要发送的 POST 数据,如uid=1&password=1234 - * @param cookie 要模拟的 COOKIE 数据,如uid=123&auth=a2323sd2323 - * @param bysocket TRUE/FALSE 是否通过SOCKET打开 - * @param ip IP地址 - * @param timeout 连接超时时间 - * @param block 是否为阻塞模式 defaul valuet:true - * @return 取到的字符串 - */ - private String ucFopen(String url, int limit, String post, String cookie, boolean bysocket, String ip, int timeout, boolean block) { - StringBuilder result = new StringBuilder(); - URL matches; - String host = ""; - String path = ""; - int port = 80; - try { - matches = new URL(url); - host = matches.getHost(); - path = matches.getPath() != null ? matches.getPath() + (matches.getQuery() != null ? "?" + matches.getQuery() : "") : "/"; - if (matches.getPort() > 0) port = matches.getPort(); - } catch (Exception e1) { - FRContext.getLogger().info(e1.getMessage()); - } - StringBuilder out = new StringBuilder(); - if (post != null && post.length() > 0) { - out.append("POST ").append(path).append(" HTTP/1.0\r\n"); - out.append("Accept: */*\r\n"); - out.append("Accept-Language: zh-cn\r\n"); - out.append("Content-Type: application/x-www-form-urlencoded\r\n"); - out.append("User-Agent: \r\n"); - out.append("Host: ").append(host).append("\r\n"); - out.append("Content-Length: ").append(post.length()).append("\r\n"); - out.append("Connection: Close\r\n"); - out.append("Cache-Control: no-cache\r\n"); - out.append("Cookie: \r\n\r\n"); - out.append(post); - } else { - out.append("GET $path HTTP/1.0\r\n"); - out.append("Accept: */*\r\n"); - out.append("Accept-Language: zh-cn\r\n"); - out.append("User-Agent: Java/1.5.0_01\r\n"); - out.append("Host: $host\r\n"); - out.append("Connection: Close\r\n"); - out.append("Cookie: $cookie\r\n\r\n"); - } - try { - Socket fp = new Socket(ip != null && ip.length() > 10 ? ip : host, port); - if (!fp.isConnected()) { - return ""; - } else { - OutputStream os = fp.getOutputStream(); - os.write(out.toString().getBytes()); - InputStream ins = fp.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(ins, "iso-8859-1")); - while (true) { - String header = reader.readLine(); - if (header == null || "".equals(header) || Objects.equals(header, "\r\n") || Objects.equals(header, "\n")) { - break; - } - } - while (true) { - String data = reader.readLine(); - if (data == null || "".equals(data)) { - break; - } else { - result.append(data); - } - } - fp.close(); - } - } catch (IOException e) { - FRContext.getLogger().info(e.getMessage()); - } - return result.toString(); - } -} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java b/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java deleted file mode 100644 index 697da6c56c..0000000000 --- a/designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.fr.design.extra.ucenter; - -import com.fr.base.FRContext; -import com.sun.org.apache.xerces.internal.parsers.DOMParser; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.io.StringReader; -import java.util.LinkedList; - -/** - * @author lp - * @date 2016/9/9 - */ -public class XMLHelper { - - public static LinkedList ucUnserialize(String input) { - - LinkedList result = new LinkedList(); - DOMParser parser = new DOMParser(); - try { - parser.parse(new InputSource(new StringReader(input))); - Document doc = parser.getDocument(); - NodeList nl = doc.getChildNodes().item(0).getChildNodes(); - int length = nl.getLength(); - for (int i = 0; i < length; i++) { - if (nl.item(i).getNodeType() == Document.ELEMENT_NODE) { - result.add(nl.item(i).getTextContent()); - } - } - } catch (SAXException e) { - FRContext.getLogger().info(e.getMessage()); - } catch (IOException e1) { - FRContext.getLogger().info(e1.getLocalizedMessage()); - } - return result; - } -} \ No newline at end of file From 3f7908f36ddc0e70e5f087567c9a700a9f39b53e Mon Sep 17 00:00:00 2001 From: qinghuiliu Date: Thu, 6 Dec 2018 17:53:42 +0800 Subject: [PATCH 02/60] =?UTF-8?q?CHART-3252=20=E8=B0=83=E8=8A=82=E8=BD=AE?= =?UTF-8?q?=E6=92=ADGis=E5=9C=B0=E5=9B=BE=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=8E=A7=E4=BB=B6=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/extended/chart/ExtendedCustomFieldComboBoxPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java index ff1c9db411..ceeea71c2d 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.itable.UITableEditor; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.stable.StringUtils; @@ -49,7 +50,7 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane Date: Thu, 6 Dec 2018 18:58:00 +0800 Subject: [PATCH 03/60] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/loghandler/LogMessageBar.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 73f9ce9bdf..6209152433 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -68,4 +68,10 @@ public class LogMessageBar extends JPanel { public Dimension getPreferredSize() { return new Dimension(width, 24); } + + public void disposeLogDialog() { + if (dlg != null) { + dlg.dispose(); + } + } } \ No newline at end of file From b5a7103d22ddb908582bbb8c353faeebe506d846 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:10:24 +0800 Subject: [PATCH 04/60] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E5=85=AC=E5=BC=8F=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=AE=80=E5=8D=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 71 +++++++++++-------- .../FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index c2c69299d1..e994bc1053 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -63,21 +63,21 @@ import java.util.Locale; */ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { - protected VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; - protected RSyntaxTextArea formulaTextArea; - protected UITextField keyWordTextField = new UITextField(18); - protected int currentPosition = 0; - protected int beginPosition = 0; - protected int insertPosition = 0; - protected JList tipsList; + private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; + private RSyntaxTextArea formulaTextArea; + private UITextField keyWordTextField = new UITextField(18); + private int currentPosition = 0; + private int beginPosition = 0; + private int insertPosition = 0; + private JList tipsList; protected DefaultListModel listModel = new DefaultListModel(); - protected int ifHasBeenWriten = 0; - protected DefaultListModel functionTypeListModel = new DefaultListModel(); - protected QuickList functionTypeList; - protected DefaultListModel functionNameModel; - protected JList functionNameList; + private int ifHasBeenWriten = 0; + private DefaultListModel functionTypeListModel = new DefaultListModel(); + private QuickList functionTypeList; + private DefaultListModel functionNameModel; + private JList functionNameList; - public FormulaPane() { + FormulaPane() { initComponents(); } @@ -184,6 +184,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected void initComponents() { this.setLayout(new BorderLayout(4, 4)); + + initTextPane(); + initTipsPane(); + initVariableTreeAndDescriptionArea(); + } + + private void initVariableTreeAndDescriptionArea() { + variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); + this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); + } + + private void initTextPane() { // text JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(textPane, BorderLayout.CENTER); @@ -199,7 +211,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); - initTipsPane(); UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); checkValidButton.addActionListener(checkValidActionListener); @@ -209,8 +220,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); extendCheckBoxPane(checkBoxPane); - variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); - this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); } @@ -218,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected void configFormulaArea() { + private void configFormulaArea() { formulaTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_FORMULA); formulaTextArea.setAnimateBracketMatching(true); formulaTextArea.setAntiAliasingEnabled(true); @@ -313,7 +322,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } - protected void fixFunctionNameList() { + private void fixFunctionNameList() { if (tipsList.getSelectedValue() != null) { int signOfContinue = 1; int indexOfFunction = 0; @@ -346,7 +355,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected int getBeginPosition() { + private int getBeginPosition() { int i = currentPosition; String textArea = formulaTextArea.getText(); for (; i > 0; i--) { @@ -361,7 +370,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return i; } - protected void firstStepToFindTips(int theBeginPosition) { + private void firstStepToFindTips(int theBeginPosition) { String textArea = formulaTextArea.getText(); if (currentPosition > 0 && theBeginPosition < currentPosition) { @@ -443,7 +452,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { /** * Apply text. */ - public void applyText(String text) { + private void applyText(String text) { if (text == null || text.length() <= 0) { return; } @@ -541,7 +550,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } // check valid - protected ActionListener checkValidActionListener = new ActionListener() { + private ActionListener checkValidActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { // Execute Formula default cell element. @@ -579,7 +588,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JTree variablesTree; private UITextArea descriptionTextArea; - public VariableTreeAndDescriptionArea() { + VariableTreeAndDescriptionArea() { this.initComponents(); } @@ -802,13 +811,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initComponents() { this.setLayout(new BorderLayout(4, 4)); - // Function + initVariablesTree(); + initFunctionPane(); + } + + private void initFunctionPane() { JPanel functionPane = new JPanel(new BorderLayout(4, 4)); this.add(functionPane, BorderLayout.WEST); initFunctionTypeList(functionPane); initFunctionNameList(functionPane); - initVariablesTree(); - // 选择: functionTypeList.setSelectedIndex(0); } @@ -959,7 +970,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private Icon icon; private String[] subNodes = new String[0]; - public TextFolderUserObject(String text, Icon icon, String[] subNodes) { + TextFolderUserObject(String text, Icon icon, String[] subNodes) { this.text = text; this.icon = icon; this.subNodes = subNodes; @@ -986,11 +997,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static class TextUserObject { - public TextUserObject(String text) { + TextUserObject(String text) { this(text, text); } - public TextUserObject(String text, String displayText) { + TextUserObject(String text, String displayText) { this.text = text; this.displayText = displayText; } @@ -999,7 +1010,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return this.text; } - public String getDisplayText() { + String getDisplayText() { return this.displayText; } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index e08f7e3b40..d689c54df9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - public FormulaPaneWhenReserveFormula() { + FormulaPaneWhenReserveFormula() { super(); } From b9b04e753d832a343f4dfe5bde559997cb30118e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:11:14 +0800 Subject: [PATCH 05/60] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 4595b04ac0..0abc2f46e7 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; import com.fr.stable.OperatingSystem; @@ -225,39 +226,48 @@ public abstract class FunctionConstants { String pkgName = "com.fr.function"; Class iface = Function.class; ClassLoader classloader = iface.getClassLoader(); - URL url = classloader.getResource(pkgName.replace('.', '/')); - String classFilePath = url.getFile(); - - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ + Enumeration urlEnumeration = null; try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { + if (EMBFUNCTIONS[fi].test(inst)) { + break; + } } + } - + } catch (ClassNotFoundException e) { + } catch (InstantiationException e) { + } catch (IllegalAccessException e) { } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } } } From 4dccaabbbfc8a8c55cb996358a04c4d2b036d783 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 7 Dec 2018 11:13:53 +0800 Subject: [PATCH 06/60] =?UTF-8?q?REPORT-13280=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E3=80=91=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/CellElementPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java index 42d4f1d397..7324300eba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java @@ -67,7 +67,7 @@ public class CellElementPropertyPane extends DockingView { } - public synchronized static CellElementPropertyPane getInstance() { + public static CellElementPropertyPane getInstance() { if (singleton == null) { synchronized (CellElementPropertyPane.class) { if (singleton == null) { From b8455e82a40a05e5030fc9f165ae0954ccc50f0d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 13:53:04 +0800 Subject: [PATCH 07/60] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>FunctionConstants=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 315 ++++++++++-------- .../design/formula/FunctionConstantsTest.java | 40 +++ 2 files changed, 208 insertions(+), 147 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0abc2f46e7..750df1bad1 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -35,13 +35,75 @@ import java.util.zip.ZipFile; import javax.swing.DefaultListModel; -public abstract class FunctionConstants { - +public final class FunctionConstants { + + public static FunctionGroup PLUGIN = getPluginFunctionGroup(); + public static FunctionGroup CUSTOM = getCustomFunctionGroup(); + static NameAndFunctionList COMMON = getCommonFunctionList(); + static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); + public static FunctionGroup ALL = getAllFunctionGroup(); + + static { + loadEmbededFunctions(); + } + + /** + * Don't let anyone instantiate this class. + */ + private FunctionConstants() {} + + private static void loadEmbededFunctions() { + String pkgName = "com.fr.function"; + Class iface = Function.class; + ClassLoader classloader = iface.getClassLoader(); + Enumeration urlEnumeration = null; + try { + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + return; + } + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ + try { + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { + if (EMBFUNCTION.test(inst)) { + break; + } + } + } + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } + } + } + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ - public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ + static void addFunctionGroupFromPlugins(DefaultListModel listModel){ //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); if(!containers.isEmpty()){ @@ -75,107 +137,15 @@ public abstract class FunctionConstants { } }; } - - public static FunctionGroup PLUGIN = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); - int count = fs.length; - FunctionDefNAD[] nads = new FunctionDefNAD[count]; - for (int i = 0; i < count; i ++) { - nads[i] = new FunctionDefNAD(fs[i]); - } - return nads; - } - }; - - public static FunctionGroup CUSTOM = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionConfig funtionManager = FunctionConfig.getInstance(); - if (funtionManager != null) { - int functionDefCount = funtionManager.getFunctionDefCount(); - - FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; - for (int i = 0; i < functionDefCount; i++) { - nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); - } - - return nads; - } - - return new NameAndDescription[0]; - } - }; - - public static NameAndFunctionList COMMON = new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { - new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() - }); - - public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = new NameAndTypeAndFunctionList[] { - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) - }; - - public static FunctionGroup ALL = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); - } - - @Override - public NameAndDescription[] getDescriptions() { - List all = new ArrayList(); - for (int i = 0; i < EMBFUNCTIONS.length; i++) { - all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); - } - Collections.addAll(all, PLUGIN.getDescriptions()); - Collections.addAll(all, CUSTOM.getDescriptions()); - //hugh:自定义函数分组 - Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); - if(!containers.isEmpty()){ - for(Mutable container : containers){ - Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); - } - } - java.util.Collections.sort(all, NameAndDescriptionComparator); - - return all.toArray(new NameAndDescription[all.size()]); - } - }; - - private static Comparator NameAndDescriptionComparator = new Comparator() { - @Override - public int compare(NameAndDescription o1, NameAndDescription o2) { - return ComparatorUtils.compare(o1.getName(), o2.getName()); - } - }; - private static String[] findClassNamesUnderFilePath(String filePath) { java.util.List classNameList = new ArrayList(); /* * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.indexOf("!/") >= 0) { + if (filePath.contains("!/")) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; @@ -198,7 +168,7 @@ public abstract class FunctionConstants { } String entryName = entry.getName(); - if (entryName.indexOf(classPath) < 0 || !entryName.endsWith(".class")) { + if (!entryName.contains(classPath) || !entryName.endsWith(".class")) { continue; } @@ -209,66 +179,117 @@ public abstract class FunctionConstants { } } else { File dir = new File(filePath); - - for (File f : dir.listFiles()) { - String fileName = f.getName(); - if (fileName.endsWith(".class")) { - classNameList.add(fileName); + File[] files = dir.listFiles(); + if (files != null) { + for (File f : files) { + String fileName = f.getName(); + if (fileName.endsWith(".class")) { + classNameList.add(fileName); + } } } } - return classNameList.toArray(new String[classNameList.size()]); + return classNameList.toArray(new String[0]); } - - // alex:读取com.fr.script.function包下面所有的Function类 - static { - String pkgName = "com.fr.function"; - Class iface = Function.class; - ClassLoader classloader = iface.getClassLoader(); - Enumeration urlEnumeration = null; - try { - urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } - while (urlEnumeration.hasMoreElements()) { - URL url = urlEnumeration.nextElement(); - String classFilePath = url.getFile(); - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ - try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + private static FunctionGroup getPluginFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { - try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; - } - } + @Override + public NameAndDescription[] getDescriptions() { + FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); + int count = fs.length; + FunctionDefNAD[] nads = new FunctionDefNAD[count]; + for (int i = 0; i < count; i ++) { + nads[i] = new FunctionDefNAD(fs[i]); + } + return nads; + } + }; + } + + private static FunctionGroup getCustomFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); + } + + @Override + public NameAndDescription[] getDescriptions() { + FunctionConfig funtionManager = FunctionConfig.getInstance(); + if (funtionManager != null) { + int functionDefCount = funtionManager.getFunctionDefCount(); + + FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; + for (int i = 0; i < functionDefCount; i++) { + nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); + } + + return nads; + } + + return new NameAndDescription[0]; + } + }; + } + + private static NameAndFunctionList getCommonFunctionList() { + return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { + new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() + }); + } + + private static NameAndTypeAndFunctionList[] getEmbededFunctionListArray() { + return new NameAndTypeAndFunctionList[] { + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) + }; + } + + private static FunctionGroup getAllFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); + } + + @Override + public NameAndDescription[] getDescriptions() { + List all = new ArrayList(); + for (int i = 0; i < EMBFUNCTIONS.length; i++) { + all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); + } + Collections.addAll(all, PLUGIN.getDescriptions()); + Collections.addAll(all, CUSTOM.getDescriptions()); + //hugh:自定义函数分组 + Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); + if(!containers.isEmpty()){ + for(Mutable container : containers){ + Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } + + Collections.sort(all, new Comparator() { + @Override + public int compare(NameAndDescription o1, NameAndDescription o2) { + return ComparatorUtils.compare(o1.getName(), o2.getName()); + } + }); + + return all.toArray(new NameAndDescription[0]); } - } + }; } } diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java new file mode 100644 index 0000000000..33cfd577da --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -0,0 +1,40 @@ +package com.fr.design.formula; + +import org.junit.Test; + +import static junit.framework.Assert.fail; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; + +/** + * Created by plough on 2018/12/7. + */ +public class FunctionConstantsTest { + @Test + public void testNewInstanceFail() throws Exception { + try { + FunctionConstants.class.newInstance(); + fail("Not allowed to instantiate FunctionConstants!"); + } catch (IllegalAccessException e) { + assertTrue(true); + } + } + + @Test + public void testEmbedFuntionsAfterStaticInit() { + NameAndTypeAndFunctionList[] embFunctionLists = FunctionConstants.EMBFUNCTIONS; + // 一共有 8 个分类 + assertEquals(8, embFunctionLists.length); + for (NameAndTypeAndFunctionList embFunctionsList : embFunctionLists) { + // 每个分类下都有函数 + NameAndDescription[] nameAndDescriptions = embFunctionsList.getDescriptions(); + assertTrue(nameAndDescriptions.length > 0); + } + } + + @Test + public void testCommonFuntionsAfterStaticInit() { + NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; + assertEquals(9, commonFunctionList.getDescriptions().length); + } +} From 8559c8ee12f8d9b86963d53b124899f4792512d4 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:14:19 +0800 Subject: [PATCH 08/60] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20,=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=8C=E6=AD=A510.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/RightSelectionHandlerProvider.java | 55 +++++++++++++++++++ ...AbstractRightSelectionHandlerProvider.java | 45 +++++++++++++++ .../com/fr/design/mainframe/JTemplate.java | 2 +- .../form/parameter/FormParaDesigner.java | 8 ++- .../com/fr/design/mainframe/FormDesigner.java | 29 ++++++++-- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../cell/clipboard/CellElementsClip.java | 48 ++++++++++++++-- .../fr/design/mainframe/ElementCasePane.java | 2 +- .../java/com/fr/grid/selection/Selection.java | 27 +++++++-- 9 files changed, 199 insertions(+), 19 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java new file mode 100644 index 0000000000..5e7d414236 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java @@ -0,0 +1,55 @@ +package com.fr.design.fun; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.mark.Mutable; + +import java.util.List; + +/** + * 设计器右键菜单接口 + */ +public interface RightSelectionHandlerProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "RightSelectionHandlerProvider"; + + + /** + * 对单元格或者悬浮元素的右键菜单项进行增删改 + * + * @param ePane 选择的元素 + * @param popupMenu 右键主菜单 + */ + void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu); + + + /** + * 当前实现是否可以作用于当前元素 + * + * @param selectableElement 当前选中元素分为CellSelection和FloatSelection(单元格和悬浮元素) + * @return + */ + boolean accept(SelectableElement selectableElement); + + + /** + * 对表单,参数面板内置的右键选项进行增删改处理 + * + * @param actions 默认的action集合 注意:主体代码要求这边的action必须是UndoableAction 的子类而非updateAction + */ + void dmlUpdateActions(BaseFormDesigner formDesigner, List actions); + + /** + * 当前实现是否可以作用于当前元素 + * + * @param formDesigner 当前选中元素分为表单编辑器和参数面板(表单组件元素以及各种控件) + * @return + */ + boolean accept(BaseFormDesigner formDesigner); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java new file mode 100644 index 0000000000..6ec8282ed8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java @@ -0,0 +1,45 @@ +package com.fr.design.fun.impl; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import java.util.List; + +@API(level = RightSelectionHandlerProvider.CURRENT_LEVEL) +public abstract class AbstractRightSelectionHandlerProvider extends AbstractProvider implements RightSelectionHandlerProvider { + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public void dmlUpdateActions(BaseFormDesigner formDesigner, List actions) { + + } + + @Override + public boolean accept(BaseFormDesigner formDesigner) { + return false; + } + + @Override + public void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu) { + + } + + @Override + public boolean accept(SelectableElement selectableElement) { + return false; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index c2557a5b9c..fa9b181a57 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -419,7 +419,7 @@ public abstract class JTemplate> fireSuperTargetModified(); } - protected boolean accept(Object o) { + public boolean accept(Object o) { return true; } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 0895d4c1dc..62cea356d6 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -11,6 +11,7 @@ import java.awt.Image; import java.awt.Insets; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.swing.BorderFactory; @@ -324,10 +325,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), - new FormDeleteAction(this)}; + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + new FormDeleteAction(this)})); + dmlActions(designerActions); } - return designerActions; + return designerActions.toArray(new UpdateAction[designerActions.size()]); } private boolean searchQueryCreators(XLayoutContainer rootContainer) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index b313bc1433..fd0de4b257 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,9 +1,11 @@ package com.fr.design.mainframe; +import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; @@ -39,6 +41,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; @@ -89,6 +92,7 @@ import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; /** * 设计界面组件。该组件是界面设计工具的核心,主要负责的是被设计界面的显示,界面设计操作状态的 显示,编辑状态的显示等等。 @@ -132,7 +136,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection private int resolution = ScreenResolution.getScreenResolution(); // 编辑状态的事件表 private CreatorEventListenerTable edit; - protected UpdateAction[] designerActions; + protected List designerActions; private FormDesignerModeForSpecial desigerMode; private Action switchAction; private FormElementCaseContainerProvider elementCaseContainer; @@ -1180,11 +1184,28 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this), - new MoveUpAction(this), new MoveDownAction(this)}; + new MoveUpAction(this), new MoveDownAction(this)})); + dmlActions(designerActions); + } + return designerActions.toArray(new UpdateAction[designerActions.size()]); + } + /** + * 扩展菜单项 + * @param actions + */ + public void dmlActions(List actions) { + try { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlUpdateActions(this,actions); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); } - return designerActions; } // 当前选中控件可以上移一层吗? diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ec8020fd21..cc3ba96f5c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -160,7 +160,7 @@ public class JForm extends JTemplate implements BaseJForm { } @Override - protected boolean accept(Object o) { + public boolean accept(Object o) { return !(o instanceof FloatElementsProvider); } diff --git a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java index 2579e37c2e..84edad71fb 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java +++ b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java @@ -3,9 +3,6 @@ */ package com.fr.design.cell.clipboard; -import java.util.Arrays; -import java.util.Iterator; - import com.fr.base.FRContext; import com.fr.grid.selection.CellSelection; import com.fr.report.cell.CellElement; @@ -15,6 +12,9 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.StringUtils; import com.fr.stable.unit.FU; +import java.util.Arrays; +import java.util.Iterator; + /** * The clip of CellElement. */ @@ -39,7 +39,47 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { this.clips = clips; } - public String compateExcelPaste() { + public int getColumnSpan() { + return columnSpan; + } + + public void setColumnSpan(int columnSpan) { + this.columnSpan = columnSpan; + } + + public int getRowSpan() { + return rowSpan; + } + + public void setRowSpan(int rowSpan) { + this.rowSpan = rowSpan; + } + + public FU[] getColumnWidth() { + return columnWidth; + } + + public void setColumnWidth(FU[] columnWidth) { + this.columnWidth = columnWidth; + } + + public FU[] getRowHeight() { + return rowHeight; + } + + public void setRowHeight(FU[] rowHeight) { + this.rowHeight = rowHeight; + } + + public TemplateCellElement[] getClips() { + return clips; + } + + public void setClips(TemplateCellElement[] clips) { + this.clips = clips; + } + + public String compateExcelPaste() { Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator()); // 排序 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index c47b142c1c..4112ac6c44 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -663,7 +663,7 @@ public abstract class ElementCasePane extends Tar } } - private Object getClipObject() { + public Object getClipObject() { // 需要检查是否可以编辑。 Clipboard clipboard = DesignerContext.getClipboard(this.getGrid()); Transferable clipData = clipboard.getContents(this); diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 6787e36a5c..1d7a8b3fcf 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -1,19 +1,22 @@ package com.fr.grid.selection; -import java.io.Serializable; - -import javax.swing.JPopupMenu; - import com.fr.base.FRContext; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; -import com.fr.report.elementcase.TemplateElementCase; import com.fr.design.selection.SelectableElement; +import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; import com.fr.stable.FCloneable; +import javax.swing.JPopupMenu; +import java.io.Serializable; +import java.util.Set; + /* * TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢? * @@ -65,6 +68,20 @@ public abstract class Selection implements FCloneable, Serializable , Selectable // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); + /** + * 添加插件菜单(增删改都可以) + * @param ePane + * @param popupMenu + */ + public void addExtraMenu(ElementCasePane ePane, UIPopupMenu popupMenu) { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlMenu(ePane, popupMenu); + } + } + } + // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); From 350665eab47b8b6e853aef73c270e36cae2f29da Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:16:49 +0800 Subject: [PATCH 09/60] rt --- .../src/main/java/com/fr/grid/selection/Selection.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 1d7a8b3fcf..6adcd49643 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -27,10 +27,8 @@ import java.util.Set; public abstract class Selection implements FCloneable, Serializable , SelectableElement { public abstract boolean isSelectedOneCell(ElementCasePane ePane); - // ///////////////////////////////copy///////////////////////////////// public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane); - // ///////////////////////////////paste//////////////////////////////// public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) { FloatElementsClip floatElementClip; try { @@ -56,7 +54,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane); - // ///////////////////////////////merge//////////////////////////////// public abstract boolean canMergeCells(ElementCasePane ePane); public abstract boolean mergeCells(ElementCasePane ePane); @@ -65,7 +62,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean unMergeCells(ElementCasePane ePane); - // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); /** @@ -82,15 +78,12 @@ public abstract class Selection implements FCloneable, Serializable , Selectable } } - // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); - // //////////////////////////////////////////////////////////////////// public abstract int[] getSelectedRows(); public abstract int[] getSelectedColumns(); - // //////////////////////////////move////////////////////////////////// public abstract void moveLeft(ElementCasePane ePane); public abstract void moveRight(ElementCasePane ePane); @@ -99,10 +92,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract void moveDown(ElementCasePane ePane); - // //////////////////////////DeleteAction/////////////////////////////// public abstract boolean triggerDeleteAction(ElementCasePane ePane); - // //////////////////////////Just4CellSelection/////////////////////////////// public abstract boolean containsColumnRow(ColumnRow cr); public abstract void populatePropertyPane(ElementCasePane ePane); From 474aafec64d445e69dcfe5b4e46efae2a3c6042d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 16:46:04 +0800 Subject: [PATCH 10/60] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 2 +- .../com/fr/design/formula/FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index e994bc1053..bff2080e46 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -77,7 +77,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private DefaultListModel functionNameModel; private JList functionNameList; - FormulaPane() { + public FormulaPane() { initComponents(); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index d689c54df9..e08f7e3b40 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - FormulaPaneWhenReserveFormula() { + public FormulaPaneWhenReserveFormula() { super(); } From 3c0a90601d03b25ae3819c7ffee9514b5c830698 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 7 Dec 2018 16:47:20 +0800 Subject: [PATCH 11/60] =?UTF-8?q?MOBILE-18551=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E3=80=8B?= =?UTF-8?q?tab=E6=A0=B7=E5=BC=8F=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEtab=E7=9A=84=E5=AD=97=E7=AC=A6=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E3=80=81=E6=96=9C=E4=BD=93=E9=A2=9C=E8=89=B2=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/MobileTemplateStyleDefinePane.java | 4 +++- .../mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index b499e18d78..feb19463da 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -208,8 +208,10 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Fri, 7 Dec 2018 17:49:45 +0800 Subject: [PATCH 12/60] =?UTF-8?q?REPORT-13176=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E9=BB=98=E8=AE=A4=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E3=80=8B=E9=A2=84=E8=A7=88=E5=A4=84=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=A4=AA=E5=B0=8F=EF=BC=8C=E5=A6=82=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 6b2ecec669..2a14bea078 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -12,6 +12,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { @@ -84,6 +85,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 1a0472cbb5..70499f3028 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; @@ -151,6 +152,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java index a4cf4e3339..a3c1382130 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java @@ -24,6 +24,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { private NewColorSelectBox initDotColor; @@ -131,6 +132,7 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { Dimension dimension = this.getSize(); int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); g2d.setFont(frFont); g2d.setColor(frFont.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ea0dba6590..003dd04bf7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @@ -171,6 +172,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); From 4e40e10c53650cdaedbb01d2eab453e0b6055b22 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 8 Dec 2018 10:45:38 +0800 Subject: [PATCH 13/60] =?UTF-8?q?REPORT-13340=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E6=BB=91=E5=8A=A8=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F=20=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=8C=BA=E5=9F=9F=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 +- .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 2a14bea078..7ffd0abe21 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -86,7 +86,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index 003dd04bf7..ddd4c202d0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -173,7 +173,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); From e5d23733bacfea9711f85d80deb170830c4eea4f Mon Sep 17 00:00:00 2001 From: abel Date: Sat, 8 Dec 2018 11:00:15 +0800 Subject: [PATCH 14/60] =?UTF-8?q?REPORT-13029=20JNDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/connect/JNDIDefPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java index 32bc4d4b71..e99d99ca4d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java @@ -125,7 +125,7 @@ public class JNDIDefPane extends JPanel { } // Properties. - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY); this.JNDIFactoryComboBox.setSelectedItem(INITIAL_CONTEXT_FACTORY == null ? "" : INITIAL_CONTEXT_FACTORY); @@ -148,7 +148,7 @@ public class JNDIDefPane extends JPanel { populateContextAttributes(contextHashtable, this.APPLET_TF, Context.APPLET); } - private void populateContextAttributes(Hashtable properties, UITextField textField, String contextAttr) { + private void populateContextAttributes(Map properties, UITextField textField, String contextAttr) { String PROVIDER_URL = properties.get(contextAttr); if (PROVIDER_URL != null) { textField.setText(PROVIDER_URL); @@ -160,7 +160,7 @@ public class JNDIDefPane extends JPanel { jndiDatabase.setJNDIName(this.jndiNameTextField.getText()); - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem(); if (factoryString != null && factoryString.trim().length() > 0) { @@ -186,7 +186,7 @@ public class JNDIDefPane extends JPanel { return jndiDatabase; } - private void updateContextAttributes(Hashtable contextHashtable, UITextField textField, String contextAttr) { + private void updateContextAttributes(Map contextHashtable, UITextField textField, String contextAttr) { String tValue = textField.getText(); if (tValue != null && tValue.trim().length() > 0) { contextHashtable.put(contextAttr, tValue); From 30de22f58db92499d5be7c30ea44511a0d74d32a Mon Sep 17 00:00:00 2001 From: Hades Date: Sat, 8 Dec 2018 15:30:29 +0800 Subject: [PATCH 15/60] =?UTF-8?q?REPORT-13310=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=9D=A5=E5=9B=9E=E5=88=87=E6=8D=A2=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?,=20=E9=9D=9E=E5=B8=B8=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/imenu/UIBasicMenuItemUI.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 74c65e8eed..61587beef2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -667,18 +667,10 @@ public class UIBasicMenuItemUI extends MenuItemUI { } private void installFont(final String prefix, final JComponent menuItem) { - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - if (menuItem == null) { - return; - } - LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); - } - }); - thread.setName("UIBasicMenuItemUI"); - thread.setDaemon(true); - thread.start(); + if (menuItem == null) { + return; + } + LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); } protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, From de75ef5d1f0ad1acfad68e88897a2c12cfa5584b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 8 Dec 2018 15:43:19 +0800 Subject: [PATCH 16/60] =?UTF-8?q?REPORT-12854=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20=E4=BA=A4=E4=BA=92=E4=BF=AE=E6=94=B9=20bug?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0f52a4c5c7..0b37855c92 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:00:43 +0800 Subject: [PATCH 17/60] rt --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0b37855c92..fc2045161c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -73,7 +73,7 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:29:56 +0800 Subject: [PATCH 18/60] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index fc2045161c..fc666f15fd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -85,7 +85,6 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:44:40 +0800 Subject: [PATCH 19/60] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=AF=B9=E8=AF=9D=E6=A1=86?= =?UTF-8?q?=E8=A2=AB=E5=8F=A6=E5=AD=98=E6=96=87=E4=BB=B6icon=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=81=E5=AE=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itree/filetree/EnvFileTree.java | 4 +--- .../fr/design/gui/itree/filetree/FileTreeIcon.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 550ba715e5..d5a9044d5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -69,10 +69,8 @@ public class EnvFileTree extends RefreshableJTree { if (treeNode.hasFullAuthority()) { if (lock != null && !node.getUserID().equals(lock)) { name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")"); - this.setIcon(FileTreeIcon.getIcon(node)); - } else { - this.setIcon(FileTreeIcon.getIcon(node, false)); } + this.setIcon(FileTreeIcon.getIcon(node)); } else { this.setIcon(FileTreeIcon.getFolderHalfImageIcon()); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 130240aead..b0e26cc80e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -3,6 +3,7 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.BaseUtils; import com.fr.design.icon.LockIcon; import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; @@ -125,8 +126,16 @@ public class FileTreeIcon { return FOLDER_HALF_IMAGE_ICON; } + /** + * 获取文件节点对应的图标 + * + * @param node 文件节点 + * @return 文件节点的图标 + */ public static Icon getIcon(FileNode node) { - return getIcon(node, node.getLock() != null); + // 如果文件节点锁不为空且不是当前用户锁定的该模板,那么模板ICON 提示用户当前文件节点被锁 + boolean showLock = node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock()); + return getIcon(node, showLock); } public static Icon getIcon(FileNode node, boolean isShowLock) { From 3f3bb397cc785c97acc079dccce95d3d789bafc4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 20:10:18 +0800 Subject: [PATCH 20/60] =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=86=85=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=A7=A3=E9=94=81=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index b6f18a1882..2a00df0720 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -206,8 +206,7 @@ public class MutilTempalteTabPane extends JComponent { openedTemplate.remove(jTemplate); closeFormat(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath()); + closeAndFreeLock(jTemplate); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -221,7 +220,6 @@ public class MutilTempalteTabPane extends JComponent { if (openedTemplate.size() == 1) { closeOther.setEnabled(false); } - return closeOther; } @@ -698,11 +696,19 @@ public class MutilTempalteTabPane extends JComponent { private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath()); + closeAndFreeLock(specifiedTemplate); activeTemplate(fileName); } + private void closeAndFreeLock(@Nonnull JTemplate template) { + FILE file = template.getEditingFILE(); + // 只有是环境内的文件,才执行释放锁 + if (file != null && file.isEnvFile()) { + // release lock + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + } + } + /** * 关闭模板 * From fa38f5327954c87da6e0d1a73a76864de0b9fb2f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 21:11:42 +0800 Subject: [PATCH 21/60] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=E6=97=B6=E7=9A=84=E6=96=87=E4=BB=B6=E9=94=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MutilTempalteTabPane.java | 2 +- .../com/fr/design/mainframe/JTemplate.java | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 2a00df0720..ab4f2aae32 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -705,7 +705,7 @@ public class MutilTempalteTabPane extends JComponent { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index fa9b181a57..7b80c3fd74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -32,6 +32,7 @@ import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.itree.filetree.TemplateFileTree; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; @@ -56,6 +57,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -587,6 +590,8 @@ public abstract class JTemplate> if (isCancelOperation(chooseResult)) { return false; } + // 源文件 + FILE sourceFile = editingFILE; if (isOkOperation(chooseResult)) { boolean access = false; @@ -596,13 +601,33 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (!access) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); return false; } + // 目标文件 editingFILE = fileChooser.getSelectedFILE(); } - return saveNewFile(editingFILE, oldName); + boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + if (lockedTarget) { + boolean saved = saveNewFile(editingFILE, oldName); + // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 + if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + } + return saved; + } else { + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); + return false; + } } protected boolean saveNewFile(FILE editingFILE, String oldName) { From c6679a32832db047bafdd06b58df77f70f2238e1 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 10 Dec 2018 11:39:50 +0800 Subject: [PATCH 22/60] =?UTF-8?q?REPORT-13418=2010.0=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E9=BB=98=E8=AE=A4=E8=AF=AD=E8=A8=80=E6=94=B9=E6=88=90?= =?UTF-8?q?=E8=B7=9F9=E4=B8=80=E6=A0=B7,=20=E5=8F=96=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=BB=98=E8=AE=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index d054ab959f..73da53d4b8 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -112,7 +112,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private Color paginationLineColor = Color.black; // line color of paper private boolean supportCellEditorDef = false; private boolean isDragPermited = false; - private Locale language = Locale.SIMPLIFIED_CHINESE; + private Locale language = Locale.getDefault(); //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 private boolean useOracleSystemSpace = true; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; From 17031ef1b2d2026ccd20e6e2d417fbad7ddf3926 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 10 Dec 2018 12:43:48 +0800 Subject: [PATCH 23/60] =?UTF-8?q?REPORT-12698=20=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=9B=BE?= =?UTF-8?q?=E6=A1=88,=20=E5=85=B3=E9=97=AD=E6=A8=A1=E6=9D=BF=E5=90=8E?= =?UTF-8?q?=E5=86=8D=E6=89=93=E5=BC=80,=20=E4=BC=9A=E5=8F=98=E6=88=90?= =?UTF-8?q?=E7=BA=AF=E9=BB=91=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backgroundpane/PatternBackgroundQuickPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index d965151cb8..bb8038ac4a 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -52,7 +52,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { } foregroundColorPane = new ColorSelectBox(60); backgroundColorPane = new ColorSelectBox(60); - + foregroundColorPane.setSelectObject(Color.lightGray); + foregroundColorPane.setSelectObject(Color.black); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -219,7 +220,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { @Override public void reset() { patternButtonArray[0].setSelected(true); - foregroundColorPane.setSelectObject(null); - backgroundColorPane.setSelectObject(null); + foregroundColorPane.setSelectObject(Color.lightGray); + backgroundColorPane.setSelectObject(Color.black); } } From 8456349de848306cf1dfed55a3fa6fcfcd852689 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 10 Dec 2018 13:36:16 +0800 Subject: [PATCH 24/60] =?UTF-8?q?=E5=8A=A0=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backgroundpane/PatternBackgroundQuickPane.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index bb8038ac4a..5e69d9f829 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -30,6 +30,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { private int patternIndex = 0; // pattern setIndex. private final static int DEFAULT_DIM_HEIGHT = 210; + private final static Color DEFAULT_FOREGROUND = Color.lightGray; + private final static Color DEFAULT_BACKGROUND = Color.black; private ColorSelectBox foregroundColorPane; private ColorSelectBox backgroundColorPane; private PatternButton[] patternButtonArray; @@ -52,8 +54,8 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { } foregroundColorPane = new ColorSelectBox(60); backgroundColorPane = new ColorSelectBox(60); - foregroundColorPane.setSelectObject(Color.lightGray); - foregroundColorPane.setSelectObject(Color.black); + foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); + foregroundColorPane.setSelectObject(DEFAULT_BACKGROUND); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; Component[][] components = new Component[][]{ @@ -220,7 +222,7 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { @Override public void reset() { patternButtonArray[0].setSelected(true); - foregroundColorPane.setSelectObject(Color.lightGray); - backgroundColorPane.setSelectObject(Color.black); + foregroundColorPane.setSelectObject(DEFAULT_FOREGROUND); + backgroundColorPane.setSelectObject(DEFAULT_BACKGROUND); } } From d88f4f9dd8c9388f06db45c37e9cc4bf2e08b012 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 10 Dec 2018 16:41:28 +0800 Subject: [PATCH 25/60] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=20=E6=8D=A2=E7=94=A8multiple?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=90=88=E5=B9=B6=E5=A4=9A=E6=9D=A1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 6f3c9bdea7..4dafbeccd6 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -104,6 +104,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_TITLE = "title"; private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; + private static final String ATTR_FUNCTION_ARRAY = "functionArray"; private static InformationCollector collector; @@ -232,21 +233,23 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - ArrayList> content = null; - content = getFunctionsContent(current, new Date(lastTime)); + JSONArray content = null; + try { + content = getFunctionsContent(current, new Date(lastTime)); + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.size() > 0){ - for(int i=0; i 0){ + success = sendFunctionRecord(url, content); //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 if (success) { this.lastTime = dateToString(); + FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); } } - FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); // //先将发送压缩文件这段代码注释,之后提任务 //大数据量下发送压缩zip数据不容易丢失 // try { @@ -265,12 +268,14 @@ public class InformationCollector implements XMLReadable, XMLWriter { // } } - private boolean sendFunctionRecord(String url, Map record) { + private boolean sendFunctionRecord(String url, JSONArray record) { boolean success = false; try { - String recordUrl = url+"?token=" + SiteCenterToken.generateToken() + "&content="+URLEncoder.encode(new JSONObject(record).toString(), EncodeConstants.ENCODING_UTF_8); - String res = HttpToolbox.get(recordUrl); - success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", record); + String res = HttpToolbox.post(url, para); + success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -437,33 +442,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static ArrayList getFunctionsContent(Date current, Date last){ - ArrayList> records = new ArrayList>(); + public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + JSONArray functionArray = new JSONArray(); QueryCondition condition = QueryFactory.create() .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); - String bbsUserName = MarketConfig.getInstance().getBbsUsername(); - String uuid = envManager.getUUID(); + if(!focusPoints.isEmpty()){ for(FocusPoint focusPoint : focusPoints.getList()){ - Map record = new HashMap<>(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); record.put(ATTR_ID, focusPoint.getId()); record.put(ATTR_TEXT, focusPoint.getText()); record.put(ATTR_SOURCE, focusPoint.getSource()); record.put(ATTR_TIME, focusPoint.getTime().getTime()); record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, bbsUserName); - record.put(ATTR_UUID, uuid); - records.add(record); + record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); + record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); + record.put(ATTR_FUNCTION_ARRAY, functionArray); + functionArray.put(record); } } + } catch (MetricException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } - return records; + return functionArray; } private class StartStopTime implements XMLReadable, XMLWriter { From 560b0fb626b90e7d46fe23b08d9709f6bd0e59e8 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 10 Dec 2018 19:02:52 +0800 Subject: [PATCH 26/60] =?UTF-8?q?=E6=AF=8F=E8=BE=BE=E5=88=B0200=E6=9D=A1?= =?UTF-8?q?=E6=97=B6=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 57 ++++++++++++++----- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 4dafbeccd6..047ffc6717 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -105,6 +105,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { private static final String ATTR_USER_NAME = "username"; private static final String ATTR_UUID = "uuid"; private static final String ATTR_FUNCTION_ARRAY = "functionArray"; + private static final int MAX_EACH_REQUEST_RECORD_COUNT = 200; private static InformationCollector collector; @@ -242,14 +243,22 @@ public class InformationCollector implements XMLReadable, XMLWriter { boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); - if(content.length() > 0){ - success = sendFunctionRecord(url, content); + try { + for(int i=0;i 0){ + success = sendFunctionRecord(url, functionArray); + } + } //服务器返回true, 说明已经获取成功, 更新最后一次发送时间 if (success) { this.lastTime = dateToString(); FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); } + }catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } + // //先将发送压缩文件这段代码注释,之后提任务 //大数据量下发送压缩zip数据不容易丢失 // try { @@ -443,34 +452,52 @@ public class InformationCollector implements XMLReadable, XMLWriter { } public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + //记录当前条数,达到200条合并成一个请求 + int count = 0; JSONArray functionArray = new JSONArray(); QueryCondition condition = QueryFactory.create() .addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - + JSONArray temp = new JSONArray(); if(!focusPoints.isEmpty()){ - for(FocusPoint focusPoint : focusPoints.getList()){ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - record.put(ATTR_FUNCTION_ARRAY, functionArray); - functionArray.put(record); + for(int i=0;i< focusPoints.getList().size();i++){ + FocusPoint focusPoint = focusPoints.getList().get(i); + if(focusPoint != null){ + if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ + temp.put(getOneRecord(focusPoint)); + } else { + count = 0; + functionArray.put(temp); + temp = new JSONArray(); + temp.put(getOneRecord(focusPoint)); + } + if(i == (focusPoints.getList().size() -1)){ + functionArray.put(temp); + } + } } } - } catch (MetricException e) { + } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return functionArray; } + private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, focusPoint.getId()); + record.put(ATTR_TEXT, focusPoint.getText()); + record.put(ATTR_SOURCE, focusPoint.getSource()); + record.put(ATTR_TIME, focusPoint.getTime().getTime()); + record.put(ATTR_TITLE, focusPoint.getTitle()); + record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); + record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); + return record; + } + private class StartStopTime implements XMLReadable, XMLWriter { private String startDate; From a6bab815bcca3db158fb53aeab3e023f968d7893 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 10 Dec 2018 20:02:11 +0800 Subject: [PATCH 27/60] REPORT-13441 & REPORT-13442 --- .../design/condition/LiteConditionPane.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index 36fa874ccf..b14c8cde12 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -121,7 +121,7 @@ public abstract class LiteConditionPane extends BasicBeanPa JoinCondition newJoinCondition = new JoinCondition(andRadioButton.isSelected() ? DataConstants.AND : DataConstants.OR, liteCondition); ExpandMutableTreeNode parentTreeNode = getParentTreeNode(); - boolean result = isExistedInParentTreeNode(parentTreeNode, newJoinCondition); + boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false); if (result) { JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); @@ -162,7 +162,7 @@ public abstract class LiteConditionPane extends BasicBeanPa @Override public void mouseExited(MouseEvent evt) { - GUICoreUtils.setEnabled(conditionCardPane, conditionCardPane.isEnabled()); + GUICoreUtils.setEnabled(conditionCardPane, conditionCardPane.isEnabled()); } }; @@ -596,6 +596,8 @@ public abstract class LiteConditionPane extends BasicBeanPa oldJoinCondition.setJoin(andRadioButton.isSelected() ? DataConstants.AND : DataConstants.OR); Condition oldLiteCondition = oldJoinCondition.getCondition(); + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); + ExpandMutableTreeNode parentTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); // peter:如果当前选中的是ListCondition,只要改变Join为AND或者OR,直接返回. if (oldLiteCondition != null && !(oldLiteCondition instanceof ListCondition)) { // peter:先获得当前的LiteCondition. @@ -605,13 +607,18 @@ public abstract class LiteConditionPane extends BasicBeanPa } else { liteCondition = new FormulaCondition(formulaTextArea.getText()); } + //修改的时候加入判断条件类型 REPORT-13441 + boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); + if (result) { + JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); + return; + } oldJoinCondition.setCondition(liteCondition); } // peter:需要reload parent - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); - ExpandMutableTreeNode parentTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); defaultTreeModel.reload(parentTreeNode); parentTreeNode.expandCurrentTreeNode(conditionsTree); conditionsTree.setSelectionPath(GUICoreUtils.getTreePath(selectedTreeNode)); @@ -745,22 +752,31 @@ public abstract class LiteConditionPane extends BasicBeanPa return parentTreeNode; } - private boolean isExistedInParentTreeNode(ExpandMutableTreeNode parentTreeNode, JoinCondition newJoinCondition) { + private boolean isExistedInParentTreeNode(ExpandMutableTreeNode parentTreeNode, Condition liteCondition, boolean isModify) { if (parentTreeNode == null) { return false; } JoinCondition parentJoinCondition = (JoinCondition) parentTreeNode.getUserObject(); Condition parentLiteCondition = parentJoinCondition.getCondition(); + Object oldJoinCondition = null; + //获取当前选中的条件用于修改判断 + TreePath selectedTreePath = conditionsTree.getSelectionPath(); + if (selectedTreePath != null) { + ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); + oldJoinCondition = selectedTreeNode.getUserObject(); + } if (parentLiteCondition instanceof ListCondition) { // peter:在添加UserObject的节点. for (int i = 0; i < parentTreeNode.getChildCount(); i++) { ExpandMutableTreeNode tempTreeNode = (ExpandMutableTreeNode) parentTreeNode.getChildAt(i); Object tempObject = tempTreeNode.getUserObject(); - if (tempObject instanceof JoinCondition) { + //修改的时候需要排除所选条件,和其他条件比较。增加的时候全盘比较 + if (tempObject instanceof JoinCondition && isModify ? (!tempObject.equals(oldJoinCondition)) : true) { JoinCondition tempJoinCondition = (JoinCondition) tempObject; - if (ComparatorUtils.equals(tempJoinCondition, newJoinCondition)) { + //条件内容一样就视为相同条件,join类型无关 + if (ComparatorUtils.equals(tempJoinCondition.getCondition(), liteCondition)) { return true; } } @@ -941,7 +957,7 @@ public abstract class LiteConditionPane extends BasicBeanPa @Override public Condition updateBean() { // Samuel:先按modifybutton - modify(); + //modify(); REPORT-13442 需要点修改按钮才能修改 // peter: 先删除所有的节点 DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.conditionsTree.getModel(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); @@ -963,9 +979,9 @@ public abstract class LiteConditionPane extends BasicBeanPa JoinCondition joinCondition = (JoinCondition) rootTreeNode.getUserObject(); Condition newCondition = joinCondition.getCondition(); //clone(),防止多个条件分组使用同一个condition对象 - try{ - newCondition = (Condition)joinCondition.getCondition().clone(); - }catch (CloneNotSupportedException e){ + try { + newCondition = (Condition) joinCondition.getCondition().clone(); + } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } return newCondition; From aabedeaa0b495c352b1891f2e50676ded9e98466 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 10 Dec 2018 20:04:07 +0800 Subject: [PATCH 28/60] REPORT-13441 & REPORT-13442 --- .../main/java/com/fr/design/condition/LiteConditionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index b14c8cde12..193c35775a 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -607,7 +607,7 @@ public abstract class LiteConditionPane extends BasicBeanPa } else { liteCondition = new FormulaCondition(formulaTextArea.getText()); } - //修改的时候加入判断条件类型 REPORT-13441 + //修改的时候加入判断条件重复 REPORT-13441 boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); if (result) { JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), From cee61dfe26bab4fd5168fdb9b9077983a3226c75 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 10:34:57 +0800 Subject: [PATCH 29/60] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 750df1bad1..9df15fd8f9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; @@ -66,7 +67,6 @@ public final class FunctionConstants { while (urlEnumeration.hasMoreElements()) { URL url = urlEnumeration.nextElement(); String classFilePath = url.getFile(); - /* * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 @@ -77,10 +77,9 @@ public final class FunctionConstants { FRContext.getLogger().error(e1.getMessage(), e1); } FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ + if (isCustomFormulaPath(classFilePath)) { + continue; + } for (String fileName : findClassNamesUnderFilePath(classFilePath)) { try { Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); @@ -94,11 +93,19 @@ public final class FunctionConstants { } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } catch (Throwable e) { + // 不要因为个别公式加载失败,而导致整个函数面板无法启动 + FineLoggerFactory.getLogger().error(e.getMessage()); } } } } + private static boolean isCustomFormulaPath(String classFilePath) { + // 除非是代码启动,否则不读取 WEB-INF/classes/com/fr/function 目录下的类 + return !classFilePath.contains("!/") && GeneralUtils.readBuildNO().contains("-"); + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel From 8ec239644ff9ef04cb7fc01277b9f79d7fb0aa8d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 10:42:31 +0800 Subject: [PATCH 30/60] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FunctionConstants.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 9df15fd8f9..0166c269be 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -102,11 +102,18 @@ public final class FunctionConstants { } private static boolean isCustomFormulaPath(String classFilePath) { - // 除非是代码启动,否则不读取 WEB-INF/classes/com/fr/function 目录下的类 - return !classFilePath.contains("!/") && GeneralUtils.readBuildNO().contains("-"); + return !isJarPath(classFilePath) && isDebugMode(); } - /** + private static boolean isDebugMode() { + return !GeneralUtils.readBuildNO().contains("-"); + } + + private static boolean isJarPath(String classFilePath) { + return classFilePath.contains("!/"); + } + + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ @@ -152,7 +159,7 @@ public final class FunctionConstants { * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.contains("!/")) { + if (isJarPath(filePath)) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; From 40f367e1d2b3fff16568dd4cdaa18dffb7edc9a8 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 11:22:49 +0800 Subject: [PATCH 31/60] =?UTF-8?q?REPORT-13402=20=E3=80=90=E9=98=BB?= =?UTF-8?q?=E5=A1=9E=E3=80=91=E3=80=9010.0.2=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E9=9D=A2=E6=9D=BF=E7=82=B9=E4=B8=8D=E5=BC=80?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 6 ++-- .../design/formula/FunctionConstantsTest.java | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0166c269be..eee75a2220 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -102,11 +102,11 @@ public final class FunctionConstants { } private static boolean isCustomFormulaPath(String classFilePath) { - return !isJarPath(classFilePath) && isDebugMode(); + return !isJarPath(classFilePath) && isNotDebugMode(); } - private static boolean isDebugMode() { - return !GeneralUtils.readBuildNO().contains("-"); + private static boolean isNotDebugMode() { + return GeneralUtils.readBuildNO().contains("-"); } private static boolean isJarPath(String classFilePath) { diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java index 33cfd577da..75c9c9e5ba 100644 --- a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -1,14 +1,24 @@ package com.fr.design.formula; +import com.fr.general.GeneralUtils; +import com.fr.invoke.Reflect; +import org.easymock.EasyMock; import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; import static junit.framework.Assert.fail; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertFalse; /** * Created by plough on 2018/12/7. */ +@RunWith(PowerMockRunner.class) +@PrepareForTest(GeneralUtils.class) public class FunctionConstantsTest { @Test public void testNewInstanceFail() throws Exception { @@ -37,4 +47,30 @@ public class FunctionConstantsTest { NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; assertEquals(9, commonFunctionList.getDescriptions().length); } + + @Test + public void testIsCustomFormulaPathRunWithCode() { + PowerMock.mockStatic(GeneralUtils.class); + EasyMock.expect(GeneralUtils.readBuildNO()).andReturn("不是安装版本").anyTimes(); + PowerMock.replayAll(); + + String classFilePath = "/Users/plough/.m2/repository/com/fr/core/fine-core/10.0-RELEASE-SNAPSHOT/fine-core-10.0-RELEASE-20181211.024527-499.jar!/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + + classFilePath = "/Users/plough/work/new_10_release_finereport/engine-settings/env/webroot/WEB-INF/classes/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + } + + @Test + public void testIsCustomFormulaPathRunWithJar() { + PowerMock.mockStatic(GeneralUtils.class); + EasyMock.expect(GeneralUtils.readBuildNO()).andReturn("Build#release-2018.12.10.12.11.09.95").anyTimes(); + PowerMock.replayAll(); + + String classFilePath = "file:/Applications/FineReport_10.0_12_10/webapps/webroot/WEB-INF/lib/fine-report-engine-10.0.jar!/com/fr/function"; + assertFalse(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + + classFilePath = "/Applications/FineReport_10.0_12_10/webapps/webroot/WEB-INF/classes/com/fr/function"; + assertTrue(Reflect.on(FunctionConstants.class).call("isCustomFormulaPath", classFilePath).get()); + } } From 1537cf742b7498f1f073e91d61546a2f3a4372d7 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 11 Dec 2018 17:08:09 +0800 Subject: [PATCH 32/60] =?UTF-8?q?REPORT-13363=20=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 756cd12623..ca32ff565d 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -59,6 +59,7 @@ import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import javax.swing.JComponent; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.MatteBorder; import java.awt.Component; @@ -121,6 +122,9 @@ public class Designer extends BaseDesigner { try { designerRoot.start(); } catch (LifecycleFatalError fatal) { + SplashContext.getInstance().hide(); + JOptionPane.showMessageDialog(null, fatal.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().error(fatal.getMessage(), fatal); System.exit(0); } From a5a4dc4db6e501187ac58340735969589815c6d2 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 12 Dec 2018 10:10:29 +0800 Subject: [PATCH 33/60] =?UTF-8?q?REPORT-13477=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E3=80=8Btab=E6=A0=B7=E5=BC=8F=E3=80=8Btab=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E8=BF=87=E9=95=BF=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F/=E4=B8=8B=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=BC=8F=E7=9A=84=E9=A2=84=E8=A7=88=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/DefaultMobileStyleDefinePane.java | 6 +++--- .../mobile/ui/DownMenuStyleDefinePane.java | 6 +++--- .../mobile/ui/UpMenuStyleDefinePane.java | 6 +++--- .../preview/MobileTemplatePreviewPane.java | 21 ++++++++++++++++--- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 7ffd0abe21..10fc42e8f1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -95,9 +95,9 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 70499f3028..ff76e5fed5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -163,8 +163,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); if(i == 0){ Color oldColor = g2d.getColor(); g2d.setColor(this.getSelectColor()); @@ -173,7 +173,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { } Icon icon = new Icon(PAINT_ICON, ICON_PATH); g2d.drawImage(IconManager.getIconManager().getDefaultIconImage(icon), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null); - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent); Stroke oldStroke = g2d.getStroke(); if (splitLine.getLineStyle() != 0) { g2d.setColor(splitLine.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ddd4c202d0..be8ff823a9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -188,15 +188,15 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); - String widgetName = cardSwitchButton.getText(); - int width = fm.stringWidth(widgetName); + String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); + int width = fm.stringWidth(displayName); if(i == 0){ Color oldColor = g2d.getColor(); g2d.setColor(this.getSelectColor()); g2d.fillRect(0, 0 ,eachWidth, panelHeight - 2); g2d.setColor(oldColor); } - g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); + g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); Stroke oldStroke = g2d.getStroke(); if (i == 0) { g2d.setColor(this.underLine.getColor()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java index d5ddbb6b9f..73f09f04e0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/preview/MobileTemplatePreviewPane.java @@ -5,6 +5,7 @@ import com.fr.general.cardtag.mobile.TabFontConfig; import javax.swing.JPanel; import java.awt.Color; +import java.awt.FontMetrics; public abstract class MobileTemplatePreviewPane extends JPanel { private Color initialColor; @@ -35,18 +36,32 @@ public abstract class MobileTemplatePreviewPane extends JPanel { this.tabFontConfig = tabFontConfig; } - public MobileTemplatePreviewPane(){ + public MobileTemplatePreviewPane() { } - public void populateConfig(MobileTemplateStyle templateStyle){ + public void populateConfig(MobileTemplateStyle templateStyle) { this.setInitialColor(templateStyle.getInitialColor()); this.setBackground(templateStyle.getInitialColor()); this.setSelectColor(templateStyle.getSelectColor()); this.setTabFontConfig(templateStyle.getTabFontConfig()); } - public void repaint (){ + protected String calculateDisplayName(String widgetName, FontMetrics fm, int eachWidth) { + StringBuffer buffer = new StringBuffer(); + String result; + for (int i = 0; i < widgetName.length(); i++) { + result = buffer.toString(); + buffer.append(widgetName.charAt(i)); + if (fm.stringWidth(buffer.toString()) > eachWidth) { + return result; + } + } + return buffer.toString(); + + } + + public void repaint() { super.repaint(); } From b749d6115ef64057b211900d6510dfb5f44aa3b8 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 12 Dec 2018 11:58:04 +0800 Subject: [PATCH 34/60] =?UTF-8?q?REPORT-13457=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98=20&=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=8B=96=E6=8B=BD=E5=9C=BA=E6=99=AF=E7=9A=84=E7=A9=BA?= =?UTF-8?q?=E6=8C=87=E9=92=88=E5=92=8C=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E6=B3=9B=E5=9E=8B=E6=94=B9=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignModelAdapter.java | 170 +++++++++--- .../fr/design/designer/TargetComponent.java | 5 +- .../design/file/HistoryTemplateListCache.java | 5 + .../design/file/HistoryTemplateListPane.java | 5 + .../com/fr/design/mainframe/BaseJForm.java | 11 +- .../com/fr/design/mainframe/JTemplate.java | 2 +- .../design/mainframe/JTemplateProvider.java | 6 +- .../designer/beans/models/StateModel.java | 66 +++-- .../designer/creator/XCreatorUtils.java | 8 +- .../fr/design/mainframe/ComponentTree.java | 30 ++- .../com/fr/design/mainframe/FormDesigner.java | 8 +- .../fr/design/mainframe/FormModelAdapter.java | 187 +++++++------- .../java/com/fr/design/mainframe/JForm.java | 4 +- .../actions/report/ReportParameterAction.java | 22 +- .../fr/design/mainframe/ElementCasePane.java | 1 + .../com/fr/design/mainframe/JWorkBook.java | 11 +- .../mainframe/WorkBookModelAdapter.java | 244 +++++++++--------- 17 files changed, 480 insertions(+), 305 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 251ee7af86..4ebc64103d 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -3,6 +3,8 @@ package com.fr.design; import com.fr.base.Parameter; import com.fr.base.io.BaseBook; import com.fr.data.TableDataSource; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateProvider; import com.fr.form.ui.Widget; @@ -14,68 +16,159 @@ import java.util.List; import java.util.Map; /** - * 当前的设计器模式 + * 设计器模式 FormModel or WorkBookModel + *

+ * 指的是编辑的模板是普通报表还是决策报表 * * @author zhou * @since 2012-7-26上午11:24:54 */ -public abstract class DesignModelAdapter { +public abstract class DesignModelAdapter> { + /** + * 当前的设计模式 FormModel or WorkBookModel + */ private static DesignModelAdapter currentModelAdapter; + /** + * 模板 + */ protected S jTemplate; + /** + * 全部的参数,包括全局参数,模板参数和数据集参数 + */ + private Parameter[] parameters; + + /** + * 数据集参数 + */ + private Parameter[] tableDataParameters; + + /** + * 模板参数 + */ + private Parameter[] templateParameters; + + public DesignModelAdapter(S jTemplate) { this.jTemplate = jTemplate; - setCurrentModelAdapter(this); + updateCachedParameter(); + setCurrentModelAdapter(this); + } + + public static void setCurrentModelAdapter(DesignModelAdapter model) { + currentModelAdapter = model; + } + + public static DesignModelAdapter getCurrentModelAdapter() { + return currentModelAdapter; } + /** + * 获取当前编辑的模板 + * + * @return template + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + * @see HistoryTemplateListCache#getCurrentEditingTemplate() + * @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead + */ + @Deprecated public S getjTemplate() { return jTemplate; } + /** + * 设置当前编辑的模板 + * 不要脱离上下文直接调用 + * + * @param jTemplate jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + * @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead + */ + @Deprecated public void setjTemplate(S jTemplate) { this.jTemplate = jTemplate; } public T getBook() { - return (T) ((JTemplate) jTemplate).getTarget(); + return jTemplate.getTarget(); } - public static void setCurrentModelAdapter(DesignModelAdapter model) { - currentModelAdapter = model; - } - - public static DesignModelAdapter getCurrentModelAdapter() { - return currentModelAdapter; - } /** - * 响应目标改变事件. + * 响应正在编辑的模板改变事件. */ public void fireTargetModified() { - ((JTemplate) this.jTemplate).fireTargetModified(); + this.jTemplate.fireTargetModified(); } + /** + * 获取悬浮元素名称数组 + * + * @return String[] 悬浮元素名称数组 + */ public String[] getFloatNames() { return new String[0]; } + /** + * 获取编辑模板的所有参数 + *

+ * 由于在参数面板拖动过程中频繁获取 + * 远程设计时数据集参数rpc 调用需要考虑网络等因素,因此会比较缓慢,引起参数面板拖动卡顿, + * 所以缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板的所有参数 + */ public Parameter[] getParameters() { - return new Parameter[0]; + return parameters == null ? new Parameter[0] : parameters; } - // 报表参数 + /** + * 模板参数(报表参数) + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板参数 + * @deprecated use {@link DesignModelAdapter#getTemplateParameters()} instead + */ + @Deprecated public Parameter[] getReportParameters() { - return new Parameter[0]; + return getTableDataParameters(); + } + + /** + * 模板参数(报表参数) + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 + * + * @return Parameter[] 模板参数 + */ + public Parameter[] getTemplateParameters() { + return templateParameters == null ? new Parameter[0] : templateParameters; } /** * 数据源参数 + *

+ * 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 * - * @return + * @return Parameter[] 数据源参数 */ public Parameter[] getTableDataParameters() { - return new Parameter[0]; + return tableDataParameters == null ? new Parameter[0] : tableDataParameters; + } + + + /** + * 重命名TableData后的一些操作 + * + * @param oldName 旧名字 + * @param newName 新名字. + * @return 返回是否名字一样. + */ + public boolean renameTableData(String oldName, String newName) { + return renameTableData(oldName, newName, true); } /** @@ -101,17 +194,6 @@ public abstract class DesignModelAdapter getWidgetsName(); + /** + * 更新缓存的参数 + */ + public void updateCachedParameter() { + // 全部参数 + this.parameters = getLatestParameters(); + // 数据及参数 + this.tableDataParameters = getLatestTableDataParameters(); + // 模板参数 + this.templateParameters = getLatestTemplateParameters(); + + } + /** * 环境改变. */ @@ -146,4 +241,19 @@ public abstract class DesignModelAdapter extends JComponent { +public abstract class TargetComponent extends JComponent implements JTemplateProvider { private T target; public TargetComponent(T t) { @@ -34,6 +35,7 @@ public abstract class TargetComponent extends JComponent { public abstract void stopEditing(); + @Override public T getTarget() { return target; } @@ -82,6 +84,7 @@ public abstract class TargetComponent extends JComponent { /** * Fire template modified listeners. */ + @Override public void fireTargetModified() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index b73805ee66..e4bd1db952 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -5,6 +5,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; @@ -99,6 +100,10 @@ public class HistoryTemplateListCache implements CallbackEvent { return this.editingTemplate; } + /** + * @param jt jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + */ public void setCurrentEditingTemplate(JTemplate jt) { this.editingTemplate = jt; //如果当前历史面板中没有 diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index a51735f641..2dc56cc9da 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -1,6 +1,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILE; import com.fr.file.FileNodeFILE; @@ -60,6 +61,10 @@ public class HistoryTemplateListPane implements CallbackEvent { return instead().getCurrentEditingTemplate(); } + /** + * @param jt jt + * @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) + */ public void setCurrentEditingTemplate(JTemplate jt) { instead().setCurrentEditingTemplate(jt); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java index 559387b208..d3cff1ff95 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/BaseJForm.java @@ -1,16 +1,16 @@ package com.fr.design.mainframe; -import javax.swing.JComponent; - import com.fr.form.FormElementCaseContainerProvider; +import javax.swing.JComponent; + /** * Author : Shockway * Date: 13-7-15 * Time: 上午10:28 */ -public interface BaseJForm extends JTemplateProvider { +public interface BaseJForm extends JTemplateProvider { String XML_TAG = "JForm"; int FORM_TAB = 0; @@ -32,11 +32,6 @@ public interface BaseJForm extends JTemplateProvider { */ void refreshSelectedWidget(); - /** - * 获取当前的Target - */ - Object getTarget(); - /** * 执行撤销 * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 7b80c3fd74..7f5cab7448 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -75,7 +75,7 @@ import java.util.regex.Pattern; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ -public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, JTemplateProvider, DesignerProxy { +public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null private static final int PREFIX_NUM = 3000; private FILE editingFILE = null; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java index 7df132d6e9..fb87f7f049 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateProvider.java @@ -1,6 +1,8 @@ package com.fr.design.mainframe; -public interface JTemplateProvider { +public interface JTemplateProvider { - public void fireTargetModified(); + void fireTargetModified(); + + T getTarget(); } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java index 5eee1aca8d..1e7badb8a3 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/StateModel.java @@ -7,12 +7,22 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.location.Location; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XConnector; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.utils.ComponentUtils; -import java.awt.*; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -94,8 +104,11 @@ public class StateModel { return; } - XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); - XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); + XLayoutContainer container = getMouseLocationContainer(e); + if (container == null) { + return; + } + XCreator creator = selectionModel.getSelection().getSelectedCreator(); Component creatorContainer = XCreatorUtils.getParentXLayoutContainer(creator); if (creatorContainer != null && creatorContainer != container @@ -141,11 +154,8 @@ public class StateModel { * @param mouseReleasedY 鼠标释放位置Y */ private void adding(int mouseReleasedX, int mouseReleasedY) { - // 当前鼠标所在的组件 - XCreator hoveredComponent = designer.getComponentAt(mouseReleasedX, mouseReleasedY, selectionModel.getSelection().getSelectedCreators()); - - // 获取该组件所在的焦点容器 - XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); + // 当前鼠标所在组件的容器 + XLayoutContainer container = getMouseLocationContainer(mouseReleasedX, mouseReleasedY); boolean success = false; @@ -166,6 +176,33 @@ public class StateModel { designer.setPainter(null); } + /** + * 获取鼠标所在位置组件的容器 + * + * @param e MouseEvent + * @return 鼠标所在位置的组件的容器 + */ + private XLayoutContainer getMouseLocationContainer(MouseEvent e) { + return getMouseLocationContainer(e.getX(), e.getY()); + } + + /** + * 获取鼠标所在位置组件的容器 + * + * @param x x 鼠标所在位置x + * @param y y 鼠标所在位置y + * @return 鼠标所在位置的组件的容器 + */ + private XLayoutContainer getMouseLocationContainer(int x, int y) { + // 当前鼠标所在的组件 + XCreator hoveredComponent = designer.getComponentAt(x, y, selectionModel.getSelection().getSelectedCreators()); + if (hoveredComponent == null) { + return null; + } + // 获取该组件所在的焦点容器 + return XCreatorUtils.getHotspotContainer(hoveredComponent); + } + /** * 是否拖拽 * @@ -246,7 +283,7 @@ public class StateModel { if (p != null) { try { designer.setCursor(XConnector.connectorCursor); - } catch (Exception e) { + } catch (Exception ignored) { } } else { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); @@ -433,11 +470,11 @@ public class StateModel { // 拖拽时画依附线用到的painter private void setDependLinePainter(MouseEvent e) { - XCreator comp = designer.getComponentAt(e.getX(), e.getY(), selectionModel.getSelection().getSelectedCreators()); - if (comp == null) { + XLayoutContainer container = getMouseLocationContainer(e); + if (container == null) { return; } - XLayoutContainer container = XCreatorUtils.getHotspotContainer(comp); + XCreator creator = selectionModel.getSelection().getSelectedCreator(); HoverPainter painter = AdapterBus.getContainerPainter(designer, container); designer.setPainter(painter); @@ -479,9 +516,8 @@ public class StateModel { * @return xy值 */ public Point getMouseXY(MouseEvent e) { - Point p1 = new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + return new Point(e.getX() + designer.getArea().getHorizontalValue(), e.getY() + designer.getArea().getVerticalValue()); - return p1; } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java index 748c377836..774010136c 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java @@ -66,9 +66,11 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.StringUtils; +import com.fr.third.javax.annotation.Nonnull; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import java.awt.Container; +import java.awt.Dimension; /** * XCreator的相关处理 @@ -284,7 +286,7 @@ public class XCreatorUtils { * @param creator 组件 * @return 返回顶层容器 */ - public static XLayoutContainer getHotspotContainer(XCreator creator) { + public static XLayoutContainer getHotspotContainer(@Nonnull XCreator creator) { if (creator.isDedicateContainer()) { return (XLayoutContainer) creator.getParent(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 02abef0105..a2f295f87d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -3,19 +3,28 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteBodyLayout; -import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.design.gui.itree.UITreeUI; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.DropMode; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JTree; +import javax.swing.SwingUtilities; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; @@ -118,7 +127,9 @@ public class ComponentTree extends JTree { public void setAndScrollSelectionPath(TreePath[] treepath) { setSelectionPaths(treepath); - scrollPathToVisible(treepath[0]); + if (treepath.length > 0) { + scrollPathToVisible(treepath[0]); + } } @Override @@ -330,8 +341,7 @@ public class ComponentTree extends JTree { return contentPane; } - private BufferedImage componentToImage(Component comp) throws IOException - { + private BufferedImage componentToImage(Component comp) throws IOException { BufferedImage im = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_ARGB); comp.paint(im.getGraphics()); return im; @@ -341,14 +351,14 @@ public class ComponentTree extends JTree { private void updateSize() { int width = compImage.getWidth(); int height = compImage.getHeight(); - double aspectRatio = (double)width / height; + double aspectRatio = (double) width / height; if (width > MAX_WIDTH) { width = MAX_WIDTH; - height = (int)(width / aspectRatio); + height = (int) (width / aspectRatio); } if (height > MAX_HEIGHT) { height = MAX_HEIGHT; - width = (int)(height * aspectRatio); + width = (int) (height * aspectRatio); } this.setPreferredSize(new Dimension(width, height)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index fd0de4b257..5dd42de8d9 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -65,6 +65,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.stable.ArrayUtils; import com.fr.stable.bridge.StableFactory; +import com.fr.third.javax.annotation.Nullable; import javax.swing.Action; import javax.swing.JComponent; @@ -918,7 +919,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection * @return 是则返回true */ public boolean isRoot(XCreator comp) { - return comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class); + return comp != null && (comp == rootComponent || comp.acceptType(XWAbsoluteBodyLayout.class)); } // 计算鼠标事件e所发生的位置相对根组件的位置关系 @@ -980,6 +981,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection return getComponentAt(x, y, null); } + @Nullable public XCreator getComponentAt(int x, int y, XCreator[] except) { XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent; XCreator comp = xCreatorAt(x + formArea.getHorizontalValue(), y + formArea.getVerticalValue(), container, @@ -1191,8 +1193,10 @@ public class FormDesigner extends TargetComponent implements TreeSelection } return designerActions.toArray(new UpdateAction[designerActions.size()]); } + /** * 扩展菜单项 + * * @param actions */ public void dmlActions(List actions) { @@ -1200,7 +1204,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { if (handler.accept(this)) { - handler.dmlUpdateActions(this,actions); + handler.dmlUpdateActions(this, actions); } } } catch (Exception e) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index 3c1233fab0..670c2fa489 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -12,7 +12,6 @@ import com.fr.form.ui.DataControl; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; -import com.fr.main.parameter.ReportParameterAttr; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; import com.fr.stable.js.WidgetName; @@ -20,35 +19,38 @@ import com.fr.stable.js.WidgetName; import java.util.ArrayList; import java.util.List; -public class FormModelAdapter extends DesignModelAdapter { +public class FormModelAdapter extends DesignModelAdapter> { - public FormModelAdapter(BaseJForm jForm) { - super(jForm); - } + public FormModelAdapter(BaseJForm jForm) { + super(jForm); + } /** * 环境改变. */ - public void envChanged() { - WidgetToolBarPane.refresh(); - jTemplate.refreshAllNameWidgets(); - } + public void envChanged() { + WidgetToolBarPane.refresh(); + jTemplate.refreshAllNameWidgets(); + + } /** * 参数改变. */ - public void parameterChanged() { - //实时更新参数 - jTemplate.populateParameter(); - } + public void parameterChanged() { + //实时更新参数 + jTemplate.populateParameter(); + // 更新缓存的参数 + updateCachedParameter(); + } /** * 控件配置改变. */ - public void widgetConfigChanged() { - WidgetToolBarPane.refresh(); - jTemplate.refreshAllNameWidgets(); - } + public void widgetConfigChanged() { + WidgetToolBarPane.refresh(); + jTemplate.refreshAllNameWidgets(); + } /** * 重命名TableData后的一些操作 @@ -57,81 +59,80 @@ public class FormModelAdapter extends DesignModelAdapter { * @param newName 新名字. * @return 返回是否名字一样. */ - public boolean renameTableData(String oldName, String newName) { - if (super.renameTableData(oldName, newName)) { - jTemplate.refreshSelectedWidget(); - return true; - } - return false; - } - - @Override - public List getWidgetsName() { - final List list = new ArrayList(); - Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { - - @Override - public void dealWith(Widget widget) { - if (widget instanceof DataControl || widget instanceof MultiFileEditor) { - list.add(new WidgetName(widget.getWidgetName())); - } - } - }); - return list; - } - - /** - * 获取可以被超链的对象,表单主体中的所有控件 - */ - public Widget[] getLinkableWidgets() { - final ArrayList linkAbleList = new ArrayList(); + public boolean renameTableData(String oldName, String newName) { + if (super.renameTableData(oldName, newName)) { + jTemplate.refreshSelectedWidget(); + return true; + } + return false; + } + + @Override + public List getWidgetsName() { + final List list = new ArrayList(); + Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { + + @Override + public void dealWith(Widget widget) { + if (widget instanceof DataControl || widget instanceof MultiFileEditor) { + list.add(new WidgetName(widget.getWidgetName())); + } + } + }); + return list; + } + + /** + * 获取可以被超链的对象,表单主体中的所有控件 + */ + public Widget[] getLinkableWidgets() { + final ArrayList linkAbleList = new ArrayList(); final JForm currentJForm = ((JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { - - @Override - public boolean dealWithAllCards() { - return true; - } - - public void dealWith(Widget widget) { - boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); - //可以超链的对象不包含本身; 目前只有图表和报表块可以 - // bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己 - if (isSupportAsHypelink) { - linkAbleList.add(widget); - } - } - }, Widget.class); - - return linkAbleList.toArray(new Widget[linkAbleList.size()]); - } - - // 报表参数 - @Override - public Parameter[] getReportParameters() { - Parameter[] rpa = this.getBook().getTemplateParameters(); - return rpa == null ? new Parameter[0] : rpa; - } - - // 数据源参数 - @Override - public Parameter[] getTableDataParameters() { - TableDataSource source = this.getBook(); - Calculator c = Calculator.createCalculator(); - c.setAttribute(TableDataSource.KEY, source); - java.util.List list = new java.util.ArrayList(); - java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); - while (nameIt.hasNext()) { - TableData td = source.getTableData(nameIt.next()); - if (td.getParameters(c) != null) { - list.addAll(java.util.Arrays.asList(td.getParameters(c))); - } - } - return list.toArray(new Parameter[list.size()]); - } - - @Override - public Parameter[] getParameters() { - return this.getBook().getParameters(); - } + Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { + + @Override + public boolean dealWithAllCards() { + return true; + } + + public void dealWith(Widget widget) { + boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); + //可以超链的对象不包含本身; 目前只有图表和报表块可以 + // bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己 + if (isSupportAsHypelink) { + linkAbleList.add(widget); + } + } + }, Widget.class); + + return linkAbleList.toArray(new Widget[linkAbleList.size()]); + } + + + @Override + protected Parameter[] getLatestTemplateParameters() { + Parameter[] rpa = this.getBook().getTemplateParameters(); + return rpa == null ? new Parameter[0] : rpa; + } + + @Override + protected Parameter[] getLatestTableDataParameters() { + TableDataSource source = this.getBook(); + Calculator c = Calculator.createCalculator(); + c.setAttribute(TableDataSource.KEY, source); + java.util.List list = new java.util.ArrayList(); + java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); + while (nameIt.hasNext()) { + TableData td = source.getTableData(nameIt.next()); + if (td.getParameters(c) != null) { + list.addAll(java.util.Arrays.asList(td.getParameters(c))); + } + } + return list.toArray(new Parameter[list.size()]); + } + + @Override + protected Parameter[] getLatestParameters() { + return this.getBook().getParameters(); + } } \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index cc3ba96f5c..06f7632265 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -86,7 +86,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -public class JForm extends JTemplate implements BaseJForm { +public class JForm extends JTemplate implements BaseJForm { private static final String FORM_CARD = "FORM"; private static final String ELEMENTCASE_CARD = "ELEMENTCASE"; @@ -139,7 +139,7 @@ public class JForm extends JTemplate implements BaseJForm { return DesignState.JFORM; } - public TemplateProcessInfo getProcessInfo() { + public TemplateProcessInfo getProcessInfo() { if (processInfo == null) { processInfo = new JFormProcessInfo(template); } diff --git a/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java b/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java index 5a72fd13c8..1d044909cb 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/report/ReportParameterAction.java @@ -3,25 +3,25 @@ */ package com.fr.design.actions.report; -import java.awt.event.ActionEvent; - -import javax.swing.SwingUtilities; - import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.design.DesignModelAdapter; import com.fr.design.actions.JWorkBookAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.JWorkBook; import com.fr.design.menu.KeySetUtils; import com.fr.design.parameter.ParameterArrayPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.main.TemplateWorkBook; import com.fr.main.parameter.ReportParameterAttr; +import javax.swing.SwingUtilities; +import java.awt.event.ActionEvent; + /** * Report Parameter */ -public class ReportParameterAction extends JWorkBookAction{ +public class ReportParameterAction extends JWorkBookAction { public ReportParameterAction(JWorkBook jwb) { super(jwb); @@ -37,7 +37,7 @@ public class ReportParameterAction extends JWorkBookAction{ * @return 是否执行成功 */ public void actionPerformed(ActionEvent evt) { - final JWorkBook jwb = getEditingComponent(); + JWorkBook jwb = getEditingComponent(); if (jwb == null) { return; } @@ -59,10 +59,8 @@ public class ReportParameterAction extends JWorkBookAction{ for (int i = 0; i < parameters.length; i++) { copyReportParameterAttr.addParameter(parameters[i]); } - jwb.fireTargetModified(); - jwb.updateReportParameterAttr(); - jwb.populateReportParameterAttr(); - + DesignModelAdapter.getCurrentModelAdapter().fireTargetModified(); + DesignModelAdapter.getCurrentModelAdapter().parameterChanged(); } }); parameterArrayDialog.setVisible(true); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index 4112ac6c44..5bc5cd791d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -862,6 +862,7 @@ public abstract class ElementCasePane extends Tar /** * 响应目标变动. */ + @Override public void fireTargetModified() { // marks:自动计算 TemplateElementCase report = this.getEditingElementCase(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 569f02bb6f..58ecb1ea85 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -204,7 +204,7 @@ public class JWorkBook extends JTemplate { } @Override - public TemplateProcessInfo getProcessInfo() { + public TemplateProcessInfo getProcessInfo() { if (processInfo == null) { processInfo = new JWorkBookProcessInfo(template); } @@ -309,10 +309,10 @@ public class JWorkBook extends JTemplate { centerPane.setUpPaneHeight(hasParameterPane() ? parameterPane.getPreferredSize().height : 0); } - @Override /** * */ + @Override public void setComposite() { super.setComposite(); reportComposite.setComponents(); @@ -544,10 +544,11 @@ public class JWorkBook extends JTemplate { // //////////////////////OLD BELOW///////////////////////// // //////////////////////////////////////////////////////// - @Override + /** * set target */ + @Override public void setTarget(WorkBook book) { if (book == null) { return; @@ -1098,7 +1099,7 @@ public class JWorkBook extends JTemplate { FILE newFile = createNewEmptyFile(); //如果文件已经打开, 那么就覆盖关闭掉他 MutilTempalteTabPane.getInstance().closeFileTemplate(newFile); - final TemplateWorkBook tpl = this.getTarget(); + final WorkBook tpl = this.getTarget(); // 弹出输入参数 java.util.Map parameterMap = inputParameters(tpl); @@ -1106,7 +1107,7 @@ public class JWorkBook extends JTemplate { String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath()); FileOutputStream fileOutputStream = new FileOutputStream(fullPath); EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter(); - exporter.export(fileOutputStream, (WorkBook) tpl, parameterMap); + exporter.export(fileOutputStream, tpl, parameterMap); } catch (Exception e1) { FRContext.getLogger().error(e1.getMessage()); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index d84090b181..1e55d3c9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -25,132 +25,134 @@ import java.util.Iterator; import java.util.List; /** - * * @author zhou * @since 2012-7-26下午2:03:12 */ public class WorkBookModelAdapter extends DesignModelAdapter { - public WorkBookModelAdapter(JWorkBook jworkbook) { - super(jworkbook); - } - - @Override - public Parameter[] getParameters() { - return this.getBook().getParameters(); - } - - // 报表参数 - @Override - public Parameter[] getReportParameters() { - ReportParameterAttr rpa = this.getBook().getReportParameterAttr(); - return rpa == null ? new Parameter[0] : rpa.getParameters(); - } - - // 数据源参数 - @Override - public Parameter[] getTableDataParameters() { - TableDataSource source = this.getBook(); - Calculator c = Calculator.createCalculator(); - c.setAttribute(TableDataSource.KEY, source); - java.util.List list = new java.util.ArrayList(); - java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); - while (nameIt.hasNext()) { - TableData td = source.getTableData(nameIt.next()); - if (td.getParameters(c) != null) { - list.addAll(java.util.Arrays.asList(td.getParameters(c))); - } - } - return list.toArray(new Parameter[list.size()]); - } - - /** - * 重命名TableData后的一些操作 - * @param oldName 旧名字 - * @param newName 新名字 - * @return 返回是否刷新. - */ - public boolean renameTableData(String oldName, String newName) { - if (super.renameTableData(oldName, newName)) { - if (this.getBook().getTableData(oldName) == null) { - jTemplate.refreshParameterPane4TableData(oldName,newName); - } - return true; - } - return false; - } - - /** - * 环境改变. - */ - public void envChanged() { - DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); - if (provider != null) { - provider.refreshToolbar(); - } - jTemplate.refreshAllNameWidgets(); - } - - /** - * 参数改变. - */ - public void parameterChanged() { - jTemplate.updateReportParameterAttr(); - jTemplate.populateReportParameterAttr(); - } - - /** - * 控件改变. - */ - public void widgetConfigChanged() { - DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); - if (provider != null) { - provider.refreshToolbar(); - } - jTemplate.refreshAllNameWidgets(); - } - - /** - * 返回控件的名字 - * @return widgetName 控件列表. - */ - public List getWidgetsName() { - List list = new ArrayList(); - WorkBook wb = this.getBook(); - for (int i = 0, len = wb.getReportCount(); i < len; i++) { - Report report = wb.getReport(i); - Iterator it = report.iteratorOfElementCase(); - while (it.hasNext()) { - ElementCase ec = (ElementCase)it.next(); - Iterator cs = ec.cellIterator(); - while (cs.hasNext()) { - CellElement ce = (CellElement)cs.next(); - if (ce instanceof DefaultTemplateCellElement) { - Widget widget = ((DefaultTemplateCellElement)ce).getWidget(); - if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { - list.add(new WidgetName(widget.getWidgetName())); - } - } - } - } - } - return list; - } - - /** - * 返回悬浮元素的名字数组 - * @return 返回数组. - */ - public String[] getFloatNames() { - TemplateElementCase elementCase = jTemplate.getEditingElementCase(); - - List nameList = new ArrayList(); - Iterator it = elementCase.floatIterator(); - while (it.hasNext()) { - nameList.add(it.next().getName()); - } - return nameList.toArray(new String[nameList.size()]); - } + public WorkBookModelAdapter(JWorkBook jworkbook) { + super(jworkbook); + } + + + /** + * 重命名TableData后的一些操作 + * + * @param oldName 旧名字 + * @param newName 新名字 + * @return 返回是否刷新. + */ + public boolean renameTableData(String oldName, String newName) { + if (super.renameTableData(oldName, newName)) { + if (this.getBook().getTableData(oldName) == null) { + jTemplate.refreshParameterPane4TableData(oldName, newName); + } + return true; + } + return false; + } + + /** + * 环境改变. + */ + public void envChanged() { + DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); + if (provider != null) { + provider.refreshToolbar(); + } + jTemplate.refreshAllNameWidgets(); + } + + /** + * 参数改变. + */ + public void parameterChanged() { + jTemplate.updateReportParameterAttr(); + jTemplate.populateReportParameterAttr(); + updateCachedParameter(); + } + + /** + * 控件改变. + */ + public void widgetConfigChanged() { + DesignToolbarProvider provider = StableFactory.getMarkedObject(DesignToolbarProvider.STRING_MARKED, DesignToolbarProvider.class); + if (provider != null) { + provider.refreshToolbar(); + } + jTemplate.refreshAllNameWidgets(); + } + + @Override + protected Parameter[] getLatestTemplateParameters() { + ReportParameterAttr rpa = this.getBook().getReportParameterAttr(); + return rpa == null ? new Parameter[0] : rpa.getParameters(); + } + + @Override + protected Parameter[] getLatestTableDataParameters() { + TableDataSource source = this.getBook(); + Calculator c = Calculator.createCalculator(); + c.setAttribute(TableDataSource.KEY, source); + java.util.List list = new java.util.ArrayList(); + java.util.Iterator nameIt = this.getBook().getTableDataNameIterator(); + while (nameIt.hasNext()) { + TableData td = source.getTableData(nameIt.next()); + if (td.getParameters(c) != null) { + list.addAll(java.util.Arrays.asList(td.getParameters(c))); + } + } + return list.toArray(new Parameter[list.size()]); + } + + @Override + protected Parameter[] getLatestParameters() { + return this.getBook().getParameters(); + } + + /** + * 返回控件的名字 + * + * @return widgetName 控件列表. + */ + public List getWidgetsName() { + List list = new ArrayList(); + WorkBook wb = this.getBook(); + for (int i = 0, len = wb.getReportCount(); i < len; i++) { + Report report = wb.getReport(i); + Iterator it = report.iteratorOfElementCase(); + while (it.hasNext()) { + ElementCase ec = (ElementCase) it.next(); + Iterator cs = ec.cellIterator(); + while (cs.hasNext()) { + CellElement ce = (CellElement) cs.next(); + if (ce instanceof DefaultTemplateCellElement) { + Widget widget = ((DefaultTemplateCellElement) ce).getWidget(); + if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { + list.add(new WidgetName(widget.getWidgetName())); + } + } + } + } + } + return list; + } + + /** + * 返回悬浮元素的名字数组 + * + * @return 返回数组. + */ + public String[] getFloatNames() { + TemplateElementCase elementCase = jTemplate.getEditingElementCase(); + + List nameList = new ArrayList(); + Iterator it = elementCase.floatIterator(); + while (it.hasNext()) { + nameList.add(it.next().getName()); + } + return nameList.toArray(new String[nameList.size()]); + } public Widget[] getLinkableWidgets() { From a515a01364cc684cba27e8814b8ee977214f5488 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 13 Dec 2018 09:42:04 +0800 Subject: [PATCH 35/60] =?UTF-8?q?REPORT-12885=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=94=B5=E8=84=91=E5=9C=A8=E7=BD=91=E7=BB=9C=E7=95=85=E9=80=9A?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B3=E7=A7=92=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/SplashContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 2e5467557c..a8a542a581 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,7 +24,7 @@ public class SplashContext { public static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; public static final String SPLASH_CACHE_NAME = "splash_10.gif"; - private static final int FETCH_ONLINE_MAX_TIMES = 10; + private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); From 2c50f3d1dd33482648882b64543c3c4b895d9531 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 14 Dec 2018 15:52:34 +0800 Subject: [PATCH 36/60] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=8E=9F=E5=85=88=E6=94=B6=E9=9B=86=E5=9C=A8feedback?= =?UTF-8?q?=EF=BC=8C10.0=E9=9C=80=E8=A6=81=E9=80=82=E9=85=8D=202.=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=82=B9=E4=BB=8Emetric=E5=8F=96=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=BC=A0=E5=85=A5Date=E4=BB=8E12=E6=9C=8810?= =?UTF-8?q?=E5=8F=B7=E5=BC=80=E5=A7=8B=E5=B0=B1=E6=8B=BF=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BA=86=EF=BC=8C=E6=8D=A2=E7=94=A8long?= =?UTF-8?q?=E6=98=AF=E5=8F=AF=E4=BB=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 047ffc6717..0398189d9c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -170,7 +170,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } - private byte[] getJSONContentAsByte(){ + private JSONObject getJSONContentAsByte(){ JSONObject content = new JSONObject(); JSONArray startStopArray = new JSONArray(); @@ -192,13 +192,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { FRContext.getLogger().error(e.getMessage(), e); } } - - try { - return content.toString().getBytes(EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e) { - FRContext.getLogger().error(e.getMessage(), e); - return ArrayUtils.EMPTY_BYTE_ARRAY; - } + return content; } private void sendUserInfo(){ @@ -208,19 +202,17 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - byte[] content = getJSONContentAsByte(); - HttpClient hc = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("user.info")); - hc.setContent(content); - if (!hc.isServerAlive()) { - return; - } - String res = hc.getResponseText(); - //服务器返回true,说明已经取得成功,清空当前记录的信息 + JSONObject content = getJSONContentAsByte(); + String url = CloudCenter.getInstance().acquireUrlByKind("user.info.v10"); boolean success = false; try { + HashMap para = new HashMap<>(); + para.put("token", SiteCenterToken.generateToken()); + para.put("content", content); + String res = HttpToolbox.post(url, para); success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage(), e); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (success){ this.reset(); @@ -236,7 +228,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { } JSONArray content = null; try { - content = getFunctionsContent(current, new Date(lastTime)); + content = getFunctionsContent(currentTime, lastTime); } catch (JSONException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -451,7 +443,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(Date current, Date last) throws JSONException{ + public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); From 9d2d79d44c3e250131c7c8f63fbd3cde43ed4033 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 17 Dec 2018 09:38:46 +0800 Subject: [PATCH 37/60] =?UTF-8?q?REPORT-13548=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91tab=E5=9D=97=E5=A4=8D=E5=88=B6=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E5=90=8E=E7=82=B9=E5=87=BB=E4=BC=9A=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XWCardLayout.java | 10 ++++ .../design/mainframe/FormSelectionUtils.java | 58 ++++++++++++------- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 53a72e9112..107e31ed12 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -106,6 +106,16 @@ public class XWCardLayout extends XLayoutContainer { return new Dimension(500, 300); } + /** + * 重置组件的名称 + * @param name 名称 + */ + public void resetCreatorName(String name) { + super.resetCreatorName(name); + changeRelateSwitchCardName(name); + } + + @Override protected void initLayoutManager() { cardLayout = new FRCardLayout(toData().getHgap(), toData().getVgap()); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java index 9a6a5d546e..f88b9e5400 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java @@ -14,12 +14,11 @@ import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.utils.ComponentUtils; +import com.fr.form.main.Form; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - - import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; @@ -97,8 +96,7 @@ public class FormSelectionUtils { Rectangle rec = clipboard.getSelctionBounds(); for (XCreator creator : clipboard.getSelectedCreators()) { try { - Widget copied = copyWidget(designer, creator); - XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); + XCreator copiedCreator = copyXcreator(designer.getTarget(), creator); // 获取位置 Point point = getPasteLocation((AbstractLayoutAdapter) adapter, copiedCreator, @@ -181,8 +179,7 @@ public class FormSelectionUtils { private static void relativePasteXCreator(FormDesigner designer, XCreator creator, LayoutAdapter adapter, Rectangle tabContainerRect, int x, int y) { try { - Widget copied = copyWidget(designer, creator); - XCreator copiedXCreator = XCreatorUtils.createXCreator(copied, creator.getSize()); + XCreator copiedXCreator = copyXcreator(designer.getTarget(), creator); if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) { if (!adapter.accept(copiedXCreator, x - tabContainerRect.x, y - tabContainerRect.y)) { designer.showMessageDialog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Too_Small_To_Paste")); @@ -235,33 +232,52 @@ public class FormSelectionUtils { return new Point(x, y); } - /** * 拷贝组件 + * @param form 当前表单 + * @param xCreator 待拷贝的组件 + * @return XCreator 拷贝的组件 */ - private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws - CloneNotSupportedException { - ArrayList nameSpace = new ArrayList<>(); + public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{ Widget copied = (Widget) xCreator.toData().clone(); - //重命名拷贝的组件 - String name = getCopiedName(formDesigner, copied, nameSpace); - if (copied instanceof WTitleLayout) { - XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize()); - xwTitleLayout.resetCreatorName(name); - } else { - copied.setWidgetName(name); + XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize()); + ArrayList nameSpace = new ArrayList<>(); + copyWidgetName(form, nameSpace, copiedCreator); + return copiedCreator; + } + + /** + * 拷贝组件 + * @param form 当前表单 + * @param nameSpace 命名空间 + * @param xCreator 拷贝的组件 + */ + private static void copyWidgetName(Form form, ArrayList nameSpace, XCreator xCreator){ + String copyName = FormSelectionUtils.getCopiedName(form, xCreator.toData(), nameSpace); + if (xCreator.toData() instanceof WTitleLayout) { + XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) xCreator.toData(), xCreator.getSize()); + xwTitleLayout.resetCreatorName(copyName); + return; + } + xCreator.resetCreatorName(copyName); + int count = xCreator.getComponentCount(); + for(int a = 0; a nameSpace) { + private static String getCopiedName(Form form, Widget copied, ArrayList nameSpace) { StringBuilder name = new StringBuilder(copied.getWidgetName()); do { name.append(POSTFIX); - } while (formDesigner.getTarget().isNameExist(name.toString()) || nameSpace.contains(name.toString())); + } while (form.isNameExist(name.toString()) || nameSpace.contains(name.toString())); nameSpace.add(name.toString()); return name.toString(); } @@ -308,4 +324,4 @@ public class FormSelectionUtils { } } } -} +} \ No newline at end of file From 0b837ebfb2ef0f8523b5db9655abccc2024b9409 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 17 Dec 2018 11:38:40 +0800 Subject: [PATCH 38/60] =?UTF-8?q?REPORT-13626=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E4=BF=9D=E5=AD=98=E6=A8=A1=E7=89=88-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/itextfield/UIAutoCompletionField.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java index de6bccd865..5672a8502d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UIAutoCompletionField.java @@ -1,11 +1,9 @@ package com.fr.design.gui.itextfield; import com.fr.design.gui.imenu.UIListPopup; -import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; -import com.fr.stable.OperatingSystem; - -import javax.swing.*; +import javax.swing.JList; +import javax.swing.UIManager; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.ListSelectionEvent; @@ -13,10 +11,12 @@ import javax.swing.event.ListSelectionListener; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.Document; - -import java.awt.Dimension; -import java.awt.LayoutManager; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.util.ArrayList; public class UIAutoCompletionField extends UITextField implements DocumentListener, MouseListener, ListSelectionListener, ActionListener, KeyListener { @@ -82,9 +82,6 @@ public class UIAutoCompletionField extends UITextField implements DocumentListen } private void textChanged() { - if (OperatingSystem.isMacOS()) { - return; - } if (!popup.isVisible()) { showPopup(); requestFocus(); From 62c14cfe072e138ee0874d651b7b1520f78d6f6d Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Mon, 17 Dec 2018 14:51:11 +0800 Subject: [PATCH 39/60] REPORT-13629 & REPORT-13572 --- .../src/main/java/com/fr/design/mainframe/JForm.java | 5 +++-- .../main/java/com/fr/design/mainframe/SheetNameTabPane.java | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index cc3ba96f5c..fb58e21eff 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -5,6 +5,7 @@ import com.fr.base.PaperSize; import com.fr.base.Parameter; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.actions.FormMobileAttrAction; import com.fr.design.actions.TemplateParameterAction; import com.fr.design.actions.core.WorkBookSupportable; import com.fr.design.actions.file.export.EmbeddedFormExportExportAction; @@ -496,9 +497,9 @@ public class JForm extends JTemplate implements BaseJForm { @Override public ShortCut[] shortcut4TemplateMenu() { if (this.index == FORM_TAB) { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, new ShortCut[0]); } else { - return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); + return ArrayUtils.addAll(new ShortCut[]{new TemplateParameterAction(this), new FormMobileAttrAction(this), new ReportFitAttrAction(this)}, this.elementCaseDesign.shortcut4TemplateMenu()); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 3ecd2caf42..09f1ff9e1b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -335,7 +335,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse checkButton(showCount < widthArray.length); // richie:当linearray不为空时,说明有了鼠标拖动,下面画由于鼠标拖动产生的效果. - if (!lineArray.isEmpty()) { + //REPORT-13572 点击切换会出现重影,保证:此时鼠标点击是没有放开的,才会绘制轨迹 + if (!lineArray.isEmpty() && !isReleased) { paintDragTab(g2d, textHeight, charWidth, textAscent); } @@ -568,6 +569,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse * @param evt 鼠标事件 */ public void mousePressed(MouseEvent evt) { + isReleased = false; int reportcount = reportComposite.getEditingWorkBook().getReportCount(); if (scrollIndex < 0 || scrollIndex >= reportcount) { return; @@ -749,7 +751,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse /** * exchange workSheet * - * @param workBook + * @param * @param index1 * @param index2 * @return workBook From e10d3b580abbda023f6dd149e5e55299eacf7da8 Mon Sep 17 00:00:00 2001 From: zheng Date: Mon, 17 Dec 2018 14:53:21 +0800 Subject: [PATCH 40/60] =?UTF-8?q?CHART-2554=20=E6=BC=8F=E6=96=97=E5=9B=BE?= =?UTF-8?q?=20=E7=95=8C=E9=9D=A2=20=E9=A3=8E=E6=A0=BC=2010.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/funnel/designer/style/VanChartFunnelSeriesPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java index a6a8dcb9a9..8a02cd5f44 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java @@ -44,7 +44,7 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane { //设置色彩面板内容 protected void setColorPaneContent (JPanel panel) { if (stylePane != null) { - panel.add(createStylePane(), BorderLayout.CENTER); + panel.add(stylePane, BorderLayout.CENTER); } panel.add(createAlphaPane(), BorderLayout.SOUTH); } From 31088893d87d2830e25a9a3e543bdd37159e1c58 Mon Sep 17 00:00:00 2001 From: Hades Date: Mon, 17 Dec 2018 16:18:03 +0800 Subject: [PATCH 41/60] =?UTF-8?q?REPORT-13614=20=E3=80=9010.0.2=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E9=A2=84=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 +++++++-- .../main/java/com/fr/design/mainframe/FormParaPane.java | 5 ++++- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index 40490702de..d57875e38c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,14 +9,19 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; + private Widget widget; - public UserDefinedWidgetOption(String name) { + public UserDefinedWidgetOption(String name, Widget widget) { this.widgetConfigName = name; + this.widget = widget; } @Override public Widget createWidget() { - return new NameWidget(widgetConfigName); + Widget widget = new NameWidget(widgetConfigName); + widget.setEnabled(this.widget.isEnabled()); + widget.setVisible(this.widget.isVisible()); + return widget; } @Override diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 647a0dd8a5..1d990aeb69 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -1,10 +1,12 @@ package com.fr.design.mainframe; +import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; +import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; @@ -25,6 +27,7 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; /** @@ -154,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 1958056b35..76cf264397 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); } } } From 84d6fdb7ec249916cec6038941e095526feac668 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:56:27 +0800 Subject: [PATCH 42/60] =?UTF-8?q?=E7=9C=9F=E6=AD=A3=E6=88=90=E5=9B=A0:=20X?= =?UTF-8?q?NameWidegt=E6=BC=8F=E5=8A=A0setEnable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/core/UserDefinedWidgetOption.java | 9 ++------- .../java/com/fr/design/designer/creator/XNameWidget.java | 4 +++- .../main/java/com/fr/design/mainframe/FormParaPane.java | 2 +- .../java/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java index d57875e38c..40490702de 100644 --- a/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java +++ b/designer-base/src/main/java/com/fr/design/gui/core/UserDefinedWidgetOption.java @@ -9,19 +9,14 @@ import com.fr.form.ui.Widget; public class UserDefinedWidgetOption extends WidgetOption { private String widgetConfigName; - private Widget widget; - public UserDefinedWidgetOption(String name, Widget widget) { + public UserDefinedWidgetOption(String name) { this.widgetConfigName = name; - this.widget = widget; } @Override public Widget createWidget() { - Widget widget = new NameWidget(widgetConfigName); - widget.setEnabled(this.widget.isEnabled()); - widget.setVisible(this.widget.isVisible()); - return widget; + return new NameWidget(widgetConfigName); } @Override diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java index b886ad6c49..2671017878 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XNameWidget.java @@ -68,7 +68,9 @@ public class XNameWidget extends XWidgetCreator { Widget widget; if (wc != null && (widget= wc.toWidget()) != null) { editor = XCreatorUtils.createXCreator(widget); - toData().setVisible(widget.isVisible()); + Widget currentWidget = toData(); + currentWidget.setVisible(widget.isVisible()); + currentWidget.setEnabled(widget.isEnabled()); this.setBorder(null); } else { this.setBorder(DEFALUTBORDER); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 1d990aeb69..9de2484202 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -157,7 +157,7 @@ public class FormParaPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java index 76cf264397..1958056b35 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java @@ -256,7 +256,7 @@ public class FormParaWidgetPane extends JPanel { //预定义控件工具栏这儿不显示工具栏中没有的预定义控件 continue; } - predifinedwidgeList.add(new UserDefinedWidgetOption(name, widget)); + predifinedwidgeList.add(new UserDefinedWidgetOption(name)); } } } From 582c2890c99f42745d0a6ff4358f1a30a2d2e96f Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 18 Dec 2018 21:58:58 +0800 Subject: [PATCH 43/60] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormParaPane.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java index 9de2484202..647a0dd8a5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormParaPane.java @@ -1,12 +1,10 @@ package com.fr.design.mainframe; -import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.core.UserDefinedWidgetOption; import com.fr.design.gui.core.WidgetOption; -import com.fr.design.gui.core.WidgetOptionFactory; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.LayoutUtils; @@ -27,7 +25,6 @@ import java.awt.event.ComponentEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; /** From 82517ab7436bddd1277b62dd8f3cff16ceb22c17 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 19 Dec 2018 10:27:04 +0800 Subject: [PATCH 44/60] =?UTF-8?q?REPORT-13528=20=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84jar=EF=BC=8C=E5=9B=BE=E7=89=87=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=8F=96=E5=88=B0=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SeriesCondition/impl/FormHyperlinkNorthPane.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java index 63d94bbb2a..5159e318cf 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkNorthPane.java @@ -110,12 +110,14 @@ public class FormHyperlinkNorthPane extends BasicBeanPane } String editorName = formHyperlink.getRelateEditorName(); //防止初始的时候有空白选项 - if (editorName == null) { - return; + String[] formHyperlinkEditNames = getFormHyperlinkEditNames(); + if (editorName == null && formHyperlinkEditNames.length > 0) { + editorName = formHyperlinkEditNames[0]; + formHyperlink.setRelateEditorName(editorName); } if (targetFrameComboBox != null) { //noinspection unchecked - targetFrameComboBox.setModel(new DefaultComboBoxModel(getFormHyperlinkEditNames())); + targetFrameComboBox.setModel(new DefaultComboBoxModel(formHyperlinkEditNames)); targetFrameComboBox.setSelectedItem(editorName); } } From 630ad3cf0c223ffa29132528d2baf177b4a39b86 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 19 Dec 2018 14:56:48 +0800 Subject: [PATCH 45/60] =?UTF-8?q?MOBILE-18837=E3=80=90RN=E3=80=91=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E3=80=8Btabpane=E3=80=8B=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=A8=A1=E6=9D=BF=E8=AE=BE=E4=B8=BA=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=EF=BC=8Ctabpane=E4=B8=80=E4=BA=9B=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ui/DefaultMobileStyleDefinePane.java | 15 ++++++++++++--- .../mobile/ui/TemplateStyleDefinePaneFactory.java | 5 +++-- .../designer/layout/WCardTagLayoutDefinePane.java | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 10fc42e8f1..860a0c9fb9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -7,7 +7,10 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.FRFont; import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle; +import com.fr.general.cardtag.mobile.TabFontConfig; + import java.awt.BasicStroke; +import java.awt.Color; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; @@ -41,17 +44,17 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane @Override public MobileTemplateStyle updateBean() { - return new DefaultMobileTemplateStyle(); + return getDefaultTemplateStyle(); } public MobileTemplateStyle updateConfig(){ - return new DefaultMobileTemplateStyle(); + return getDefaultTemplateStyle(); } @Override protected MobileTemplateStyle getDefaultTemplateStyle() { - return new DefaultMobileTemplateStyle(); + return new DefaultMobileTemplateStyle(new TabFontConfig(getTagLayout().getTitleFont())); } @Override @@ -74,6 +77,10 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR); } + public Color getInitialColor() { + return DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR; + } + public void repaint() { super.repaint(); } @@ -94,11 +101,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int fontHeight = fm.getHeight(); int ascentHeight = fm.getAscent(); for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { + g2d.setColor(frFont.getForeground()); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); int width = fm.stringWidth(displayName); g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); if (i == 0) { + g2d.setColor(Color.BLACK); g2d.setStroke(new BasicStroke(2.0f)); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java index 9b287de07f..dab5a03ba7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java @@ -24,9 +24,10 @@ public class TemplateStyleDefinePaneFactory { public static BasicBeanPane createDefinePane(String style, WCardTagLayout tagLayout) { StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style); - Class> clazz = styleDefinePaneUI.getaClass(); - if (clazz == null) { + if(styleDefinePaneUI == null){ + styleDefinePaneUI = defineMap.get(DefaultMobileTemplateStyle.STYLE_NAME); } + Class> clazz = styleDefinePaneUI.getaClass(); BasicBeanPane quickPane = null; try { quickPane = Reflect.on(clazz).create(tagLayout).get(); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java index d1e68baf39..41ea1c1c7d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java @@ -115,6 +115,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify templateStyleEditor.setValue(ob.getTemplateStyle()); FRFont frFont = layoutBorderStyle.getTitle().getFrFont(); if (frFont != null) { + ob.setTitleFont(frFont); frFontPane.populateBean(frFont); } } @@ -126,8 +127,10 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart(); LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); - layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont)); + FRFont titleFont = frFontPane.update(frFont); + layoutBorderStyle.getTitle().setFrFont(titleFont); WCardTagLayout layout = (WCardTagLayout) creator.toData(); + layout.setTitleFont(titleFont); boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType(); if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"))) { layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex())); From 42f0405e0c6f27667820027e9bf24f837612a442 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 19 Dec 2018 16:04:10 +0800 Subject: [PATCH 46/60] =?UTF-8?q?REPORT-13654=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8D=A2=E4=B8=8A12=E5=8F=B7=E7=9A=84release?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=B0=83=E8=89=B2=E6=9D=BF=E5=87=BA=E4=B8=8D?= =?UTF-8?q?=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/color/NewColorSelectPane.java | 21 +++++++++++----- .../style/color/PickColorButtonFactory.java | 24 ++++++++++++------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 0f5e629e28..d532324165 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; - -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) + customButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!customButton.isEnabled()) { + return; + } customButtonPressed(); } }); diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 67d99819d7..f394801c89 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -4,11 +4,15 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIBasicButtonUI; -import javax.swing.*; -import javax.swing.plaf.ButtonUI; -import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; -import java.awt.event.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; /** * Created by plough on 2016/12/22. @@ -28,7 +32,7 @@ class PickColorButtonFactory { * @return SpecialUIButton 屏幕取色按钮 */ static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { - SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); + final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; if (iconType == IconType.ICON16) { @@ -42,9 +46,13 @@ class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654) + pickColorButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!pickColorButton.isEnabled()) { + return; + } new ColorPicker(colorSelectable, setColorRealTime); } }); From 6b7bb5b6c3fc4c1e58a41da6fae0ad629e11ab7d Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 09:47:40 +0800 Subject: [PATCH 47/60] =?UTF-8?q?REPORT-10829=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=80=85=E5=A4=A7=E8=B5=9B=E6=94=AF=E6=92=91,=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=90=8C=E6=AD=A510.0=20,=E6=9C=89=E9=81=97=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/grid/selection/CellSelection.java | 4 ++++ .../src/main/java/com/fr/grid/selection/FloatSelection.java | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java index e6eb983c6b..ee80f22a24 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java @@ -508,6 +508,10 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getInsertMenu(ePane)); popup.add(DeprecatedActionManager.getDeleteMenu(ePane)); popup.add(DeprecatedActionManager.getClearMenu(ePane)); + + popup.addSeparator(); + + addExtraMenu(ePane, popup); return popup; } diff --git a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java index c982934a03..6ce0d736fc 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/FloatSelection.java @@ -1,6 +1,5 @@ package com.fr.grid.selection; -import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.cell.CleanAuthorityAction; @@ -27,7 +26,6 @@ import com.fr.design.mainframe.ElementCasePane.Clear; import com.fr.design.selection.QuickEditor; import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; - import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; @@ -149,6 +147,10 @@ public class FloatSelection extends Selection { popup.add(new EditFloatElementNameAction(ePane).createMenuItem()); + popup.addSeparator(); + + addExtraMenu(ePane, popup); + return popup; } From 553f5172645e30f3f58d1f0d887d1be01e624168 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Thu, 20 Dec 2018 14:07:10 +0800 Subject: [PATCH 48/60] =?UTF-8?q?REPORT-13717=20=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=90=8C=E5=90=8D=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 3 ++ .../fr/design/file/MutilTempalteTabPane.java | 47 ++++++++----------- .../fr/design/mainframe/DesignerFrame.java | 31 ++++++------ 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..6d069eba81 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -183,10 +183,13 @@ public class HistoryTemplateListCache implements CallbackEvent { /** * 判断是否打开过该模板 + * 由于切换环境不会关闭模板,可能存在同名的模板,所以该方法不能准确找到所选的模板, * * @param filename 文件名 * @return 文件位置 + * @deprecated use HistoryTemplateListCache#contains(com.fr.design.mainframe.JTemplate) instead */ + @Deprecated public int contains(String filename) { for (int i = 0; i < historyList.size(); i++) { String historyPath = historyList.get(i).getPath(); diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index ab4f2aae32..65989dfccf 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -18,7 +18,6 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.third.javax.annotation.Nonnull; -import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.lock.TplOperator; @@ -674,9 +673,6 @@ public class MutilTempalteTabPane extends JComponent { return; } - //当前激活的模板 - String filename = openedTemplate.get(selectedIndex).getPath(); - filename = FilenameUtils.standard(filename); if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", @@ -684,20 +680,20 @@ public class MutilTempalteTabPane extends JComponent { if (returnVal == JOptionPane.YES_OPTION) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } else if (returnVal == JOptionPane.NO_OPTION) { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } else { - closeTpl(specifiedTemplate, filename); + closeTpl(specifiedTemplate); } } - private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { + private void closeTpl(@Nonnull JTemplate specifiedTemplate) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); closeAndFreeLock(specifiedTemplate); - activeTemplate(fileName); + activePrevTemplateAfterClose(); } private void closeAndFreeLock(@Nonnull JTemplate template) { @@ -729,11 +725,9 @@ public class MutilTempalteTabPane extends JComponent { } /** - * 关闭掉一个模板之后该激活的Tab - * - * @param fileName 关闭掉一个模板之后该激活的Tab的文件名,绝对路径 + * 关闭掉一个模板之后激活新的待显示模板 */ - private void activeTemplate(String fileName) { + private void activePrevTemplateAfterClose() { if (openedTemplate.isEmpty()) { //新建并激活模板 DesignerContext.getDesignerFrame().addAndActivateJTemplate(); @@ -742,23 +736,20 @@ public class MutilTempalteTabPane extends JComponent { temTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); } else { - //如果关闭的模板是当前选中的模板,则重新激活 - if (closeIconIndex == selectedIndex) { - if (closeIconIndex == maxPaintIndex) { + // 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板; + // selectIndex 没有变化,但是对应的模板已经变成了前一张模板 + if (closeIconIndex == selectedIndex || isCloseCurrent) { + // 如果 closeIconIndex 是最后一个被渲染画出的,那么预览上一个,防止数组越界 + if (closeIconIndex >= maxPaintIndex) { + // selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true selectedIndex--; } - } else if (isCloseCurrent) { - //不是通过关闭按钮,而是通过文件关闭菜单关闭的当前模板的,也重新激活 - if (selectedIndex > openedTemplate.size() - 1) { - selectedIndex -= 1; - if (selectedIndex < 0) { - selectedIndex = 0; - } - isCloseCurrent = false; - } - } else { - //如果关闭的模板不是当前选中的模板,则激活的模板不变 - selectedIndex = HistoryTemplateListCache.getInstance().contains(fileName); + isCloseCurrent = false; + } + // 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index + else { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + selectedIndex = HistoryTemplateListCache.getInstance().contains(template); } //如果是已后台关闭的模板,则重新打开文件 openedTemplate.get(selectedIndex).activeOldJTemplate(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 5c262da9de..72994fca77 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -29,6 +29,7 @@ import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.iprogressbar.ProgressDialog; import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.toolbar.ToolBarMenuDock; @@ -76,7 +77,6 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; -import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -160,9 +160,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta //用于判断设计器是否打开了 private boolean designerOpened = false; - private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); + private int contentWidth = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth()); - private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + private int contentHeight = (int) (java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight()); private WindowAdapter windowAdapter = new WindowAdapter() { @@ -849,18 +849,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } else { if (editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); - FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", + FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", editingTemplate.getEditingFILE().getName())); } } @@ -957,8 +957,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog( + this, + Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), + ProductConstants.PRODUCT_NAME, + JOptionPane.INFORMATION_MESSAGE + ); DesignerFrameFileDealerPane.getInstance().refresh(); return; } @@ -968,7 +972,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } catch (DecryptTemplateException e) { JOptionPane.showMessageDialog( this, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), + Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.WARNING_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") @@ -1027,7 +1031,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta MutilTempalteTabPane.getInstance().setTemTemplate( HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); } else { - activeTemplate(tplFile, jt); + activeTemplate(jt); } opened = true; break; @@ -1042,13 +1046,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta /** * 激活指定的模板 * - * @param tplFile 模板文件 - * @param jt 当前报表 + * @param jt 当前报表 * @date 2014-10-14-下午6:31:23 */ - private void activeTemplate(FILE tplFile, JTemplate jt) { + private void activeTemplate(JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 - int index = HistoryTemplateListPane.getInstance().contains(tplFile.getPath()); + int index = HistoryTemplateListPane.getInstance().contains(jt); List> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); if (index != -1) { historyList.get(index).activeJTemplate(index, jt); From fcb58a3448c87d95554f99c2dfada0eeda64a693 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 20 Dec 2018 15:26:44 +0800 Subject: [PATCH 49/60] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/loghandler/LogMessageBar.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 6209152433..bf815e1d74 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -73,5 +73,6 @@ public class LogMessageBar extends JPanel { if (dlg != null) { dlg.dispose(); } + THIS = null; } } \ No newline at end of file From ef2d65581066c301ae265f881e778a63a59a26b9 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Thu, 20 Dec 2018 16:30:52 +0800 Subject: [PATCH 50/60] REPORT-13689 & REPORT-13733 & REPORT-13716 & REPORT-13720 --- .../design/file/HistoryTemplateListCache.java | 5 ++ .../fr/design/mainframe/DesignerFrame.java | 26 ++++--- .../mainframe/EastRegionContainerPane.java | 2 + .../actions/server/StyleListAction.java | 77 ++++++++++--------- .../com/fr/design/present/StyleArrayPane.java | 16 ++-- 5 files changed, 72 insertions(+), 54 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index e4bd1db952..b41e15e80c 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -2,6 +2,7 @@ package com.fr.design.file; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.design.DesignerEnvManager; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -59,6 +60,10 @@ public class HistoryTemplateListCache implements CallbackEvent { public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); + //直接关闭模板的时候退出权限编辑 + if (DesignModeContext.isAuthorityEditing()) { + DesignerContext.getDesignerFrame().closeAuthorityEditing(); + } if (contains(selected) == -1) { return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 5c262da9de..d7c40e6bdd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -10,6 +10,7 @@ import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -17,6 +18,7 @@ import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; @@ -224,16 +226,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } public void mouseReleased(MouseEvent e) { - if (DesignerMode.isAuthorityEditing()) { - DesignerMode.setMode(DesignerMode.NORMAL); - WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); - DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); - needToAddAuhtorityPaint(); - refreshDottedLine(); - fireAuthorityStateToNomal(); + if (DesignModeContext.isAuthorityEditing()) { + closeAuthorityEditing(); } } @@ -332,6 +326,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta this.progressDialog = new ProgressDialog(this); } + public void closeAuthorityEditing(){ + DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL); + WestRegionContainerPane.getInstance().replaceDownPane( + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); + DesignerContext.getDesignerFrame().resetToolkitByPlus( + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + needToAddAuhtorityPaint(); + refreshDottedLine(); + fireAuthorityStateToNomal(); + } + /** * 注册app. * diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index a49d66791f..97ce22814d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -412,6 +412,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { if (propertyItem.isVisible() && propertyItem.isEnabled() && !propertyItem.isPoppedOut()) { propertyCard.show(rightPane, tabName); propertyItem.setTabButtonSelected(); + //从单元格菜单过来也要关闭弹出窗 + hideCurrentPopupPane(); } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java index 61276163d5..4f57bdc2ac 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java @@ -10,8 +10,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; import com.fr.general.IOUtils; +import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.Worker; +import com.fr.transaction.WorkerCallBack; +import com.fr.transaction.WorkerFacade; import javax.swing.*; import java.awt.event.ActionEvent; @@ -21,16 +24,17 @@ import java.awt.event.ActionEvent; * StyleList Action */ public class StyleListAction extends UpdateAction { - public StyleListAction() { + public StyleListAction() { this.setMenuKeySet(PREDEFINED_STYLES); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName() + "..."); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); - this.generateAndSetSearchText(StyleManagerPane.class.getName()); - } + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png")); + this.generateAndSetSearchText(StyleManagerPane.class.getName()); + } /** * 动作 + * * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { @@ -40,45 +44,44 @@ public class StyleListAction extends UpdateAction { styleListDialog.addDialogActionListener(new DialogActionAdapter() { @Override public void doOk() { - Configurations.update(new Worker() { + Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) { @Override public void run() { styleListPane.update(ServerPreferenceConfig.getInstance()); } + }.addCallBack(new CallBackAdaptor(){ + @Override + public void afterCommit() { + DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); + } + })); - @Override - public Class[] targets() { - return new Class[]{ServerPreferenceConfig.class}; - } - }); - - } + } }); - ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); - styleListPane.populate(mirror); - styleListDialog.setVisible(true); - - } - - @Override - public void update() { - this.setEnabled(true); - } + ServerPreferenceConfig mirror = ServerPreferenceConfig.getInstance().mirror(); + styleListPane.populate(mirror); + styleListDialog.setVisible(true); + } + + @Override + public void update() { + this.setEnabled(true); + } - public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { - @Override - public char getMnemonic() { - return 'K'; - } + public static final MenuKeySet PREDEFINED_STYLES = new MenuKeySet() { + @Override + public char getMnemonic() { + return 'K'; + } - @Override - public String getMenuName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); - } + @Override + public String getMenuName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles"); + } - @Override - public KeyStroke getKeyStroke() { - return null; - } - }; + @Override + public KeyStroke getKeyStroke() { + return null; + } + }; } diff --git a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java index bd7602ee79..76c1e72617 100644 --- a/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/StyleArrayPane.java @@ -2,6 +2,7 @@ package com.fr.design.present; import com.fr.base.Style; import com.fr.config.ServerPreferenceConfig; +import com.fr.config.StyleMap; import com.fr.design.gui.controlpane.AbstractNameableCreator; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; @@ -13,6 +14,8 @@ import com.fr.design.style.StylePane; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.transaction.Configurations; +import com.fr.transaction.WorkerAdaptor; import java.util.ArrayList; import java.util.Iterator; @@ -90,17 +93,16 @@ public class StyleArrayPane extends JListControlPane { /** * Update. */ - public void update(ServerPreferenceConfig configManager) { - configManager.clearAllStyle(); + public void update(final ServerPreferenceConfig configManager) { + //configManager.clearAllStyle(); // Nameable[]居然不能强转成Parameter[],一定要这么写... Nameable[] nameables = this.update(); - + final StyleMap styleMap = new StyleMap(); for (int i = 0; i < nameables.length; i++) { - configManager.putStyle(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); + styleMap.put(((NameObject)nameables[i]).getName(), (Style)((NameObject)nameables[i]).getObject()); } - DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement(); - } - + configManager.setStyleMap(styleMap); + } } From 3ed78faa5143aacd59c59cd984c1a7492fddf72b Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:11:33 +0800 Subject: [PATCH 51/60] =?UTF-8?q?CHART-3169=20=E6=96=B0=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=20=E6=A0=B7=E5=BC=8F=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E9=A3=8E=E6=A0=BC=20=E6=94=B9=E4=B8=BA'?= =?UTF-8?q?=E6=B8=90=E5=8F=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../van/chart/designer/component/VanChartBeautyPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java index 44c0e1a551..f6642bd710 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -28,7 +29,7 @@ public class VanChartBeautyPane extends BasicBeanPane { double[] columnSize = {f, e}; double[] rowSize = {p}; Component[][] components = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style")), styleBox}, } ; JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); @@ -36,8 +37,8 @@ public class VanChartBeautyPane extends BasicBeanPane { } protected String[] getNameArray(){ - return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Default_Name"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Top_Down_Shade") + return new String[]{Toolkit.i18nText("Fine-Design_Chart_Default_Name"), + Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade") }; } @Override From 67ab9101f53ef4b1ae9091623dcdd2c0c39bf3c4 Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 19:15:31 +0800 Subject: [PATCH 52/60] =?UTF-8?q?CHART-3573=20=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E7=9A=84key=E6=9D=A5=E5=8C=BA=E5=88=AB=E5=BC=80'=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E6=96=AD=E5=BC=80'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/style/series/CustomDefaultSeriesPane.java | 2 +- .../chart/gui/style/series/CustomTypeConditionSeriesPane.java | 2 +- .../design/mainframe/chart/gui/style/series/LineSeriesPane.java | 2 +- .../mainframe/chart/gui/style/series/RadarSeriesPane.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java index d31aad3b38..d0507acc02 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomDefaultSeriesPane.java @@ -240,7 +240,7 @@ public class CustomDefaultSeriesPane extends BasicPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java index 7b6bb36571..3c2f52349f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/CustomTypeConditionSeriesPane.java @@ -449,7 +449,7 @@ public class CustomTypeConditionSeriesPane extends BasicBeanPane{ lineStyle.setPreferredSize(new Dimension(150,20)); markerPane.setPreferredSize(new Dimension(150,20)); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java index 9fbbb11970..612e89b481 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/LineSeriesPane.java @@ -49,7 +49,7 @@ public class LineSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Curve_Smooth")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); double p = TableLayout.PREFERRED; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java index 8943473270..a5a3fb4d61 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/RadarSeriesPane.java @@ -45,7 +45,7 @@ public class RadarSeriesPane extends AbstractPlotSeriesPane{ isCurve = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fill")); lineStyle = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); markerPane = new MarkerComboBox(MarkerFactory.getMarkerArray()); - String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; + String[] nameArray = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Break"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Null_Value_Continue")}; Boolean[] valueArray = {true, false}; isNullValueBreak = new UIButtonGroup(nameArray, valueArray); From 2dcaaef7ed49bffdd039ffbd5c4daea63aaab0fe Mon Sep 17 00:00:00 2001 From: "Wim.Zhai" Date: Thu, 20 Dec 2018 20:11:23 +0800 Subject: [PATCH 53/60] =?UTF-8?q?CHART-3575=20=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84'=E5=88=86=E7=B1=BB=E5=90=8D'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/style/ChartDatapointLabelPane.java | 2 +- .../component/format/CategoryNameFormatPaneWithCheckBox.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java index 48585ae5b1..8e198ea6c5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartDatapointLabelPane.java @@ -96,7 +96,7 @@ public class ChartDatapointLabelPane extends BasicPane{ boolean isGuidline = plot.isSupportLeadLine(); if(plot.isSupportCategoryFilter()) { - isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name")); + isCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name")); } isSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")); isValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java index 2e0d55a41f..575143a625 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/format/CategoryNameFormatPaneWithCheckBox.java @@ -1,6 +1,7 @@ package com.fr.van.chart.designer.component.format; +import com.fr.design.i18n.Toolkit; import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; @@ -18,6 +19,7 @@ public class CategoryNameFormatPaneWithCheckBox extends VanChartFormatPaneWithCh @Override protected String getCheckBoxText() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); + //"分类名" 图表(新特性)标签、提示时有用到 + return Toolkit.i18nText("Fine-Design_Chart_Category_Use_Name"); } } From f2d684e167b360eeb42abded516b511611d5eef5 Mon Sep 17 00:00:00 2001 From: "Mata.Li" Date: Fri, 21 Dec 2018 10:37:25 +0800 Subject: [PATCH 54/60] MOBILE-18801 --- .../fr/design/actions/FormMobileAttrAction.java | 16 ++++++++++++++++ .../designer/layout/FRFitLayoutDefinePane.java | 11 +++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index 033ba5ea57..d77078fad6 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -3,11 +3,15 @@ package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.base.iofile.attr.MobileOnlyTemplateAttrMark; import com.fr.design.actions.JTemplateAction; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.form.mobile.FormMobileAttrPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.menu.MenuKeySet; @@ -73,6 +77,9 @@ public class FormMobileAttrAction extends JTemplateAction { formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); + //改变布局为自适应布局,只在移动端属性设置保存后改变一次 + doChangeBodyLayout(); + WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); } @@ -80,6 +87,15 @@ public class FormMobileAttrAction extends JTemplateAction { dialog.setVisible(true); } + private void doChangeBodyLayout(){ + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XLayoutContainer rootLayout = formDesigner.getRootComponent(); + if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)) { + rootLayout = (XWAbsoluteBodyLayout) rootLayout.getXCreator(0); + } + ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); + } + @Focus(id = "com.fr.mobile.mobile_template_frm", text = "Fine-Design_Function_Mobile_Template_Frm", source = Original.EMBED) private void recordFunction() { // do nothing diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index 0f3e0aba0a..dd19d7c812 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -137,14 +137,9 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { XLayoutContainer rootLayout = selectedBodyLayout(formDesigner); if (rootLayout != formDesigner.getRootComponent() && formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) { - //原单例面板populate根据当前样式populate属性面板,现加入移动端逻辑:可能需要根据面板属性改变样式 - Form form = formDesigner.getTarget(); - if (form.getFormMobileAttr().isMobileOnly() && form.getFormMobileAttr().isAdaptivePropertyAutoMatch()) { - ((XWFitLayout)formDesigner.getRootComponent()).switch2FitBodyLayout(rootLayout); - } else { - formDesigner.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); - } + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xWFitLayout, new Widget[]{selectedBodyLayout(formDesigner).toData()})); + } paddingBound.populate(ob); layoutComboBox.setSelectedIndex(ob.getBodyLayoutType().getTypeValue()); From ba5b8fe1674e6edb30affd980001ab9254972092 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:43:05 +0800 Subject: [PATCH 55/60] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BA=8F=E5=88=97=E5=8C=96=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=20SerilizationException=20,=20WorkspaceNoteHitException=202.?= =?UTF-8?q?=20=E5=8A=A0=E5=85=A5=E5=88=87=E6=8D=A2=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=9A=84=E6=A3=80=E6=B5=8B=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=B5=8B=E8=AF=95=E8=BF=9C=E7=A8=8B=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E9=86=92=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 46 ++++++++++++++++ .../main/java/com/fr/env/RemoteEnvPane.java | 37 ++++++++----- .../java/com/fr/env/TestConnectionResult.java | 55 +++++++++++++++++++ 3 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/env/TestConnectionResult.java diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 76ae528949..725272a153 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; +import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.i18n.Toolkit; @@ -15,19 +16,25 @@ import com.fr.env.EnvListPane; import com.fr.general.GeneralContext; import com.fr.license.exception.RegistEditionException; import com.fr.log.FineLoggerFactory; +import com.fr.stable.AssistUtils; import com.fr.stable.EnvChangedListener; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import static javax.swing.JOptionPane.ERROR_MESSAGE; +import static javax.swing.JOptionPane.QUESTION_MESSAGE; public class EnvChangeEntrance { @@ -90,6 +97,11 @@ public class EnvChangeEntrance { }); return false; } + + if (versionCheck(selectedEnv)) { + return false; + } + WorkContext.switchTo(workspace, new WorkContextCallback() { @Override public void done() { @@ -138,6 +150,40 @@ public class EnvChangeEntrance { return true; } + /** + * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当选择 ok 时,才继续。 + * + * @param selectedEnv 选择的环境 + * @return 是否一致 + * @throws Exception 异常 + */ + private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + + if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { + + WorkspaceConnectionInfo info = selectedEnv.getConnection(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); + + return result.size() != 0 && result.get(0) == 1; + } + } + return false; + } + /** * 编辑items * diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 769c843cc5..21b5d2b2ca 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -511,14 +511,14 @@ public class RemoteEnvPane extends BasicBeanPane { } private void tryConnectRemoteEnv() { + final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); + final WorkspaceConnectionInfo connection = remoteEnv.getConnection(); + final SwingWorker worker = new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { - final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); - - WorkspaceConnectionInfo connection = remoteEnv.getConnection(); DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); try { @@ -532,23 +532,33 @@ public class RemoteEnvPane extends BasicBeanPane { protected void done() { okButton.setEnabled(true); try { - Boolean result = get(); - if (result == null) { + + TestConnectionResult result = TestConnectionResult.parse(get(), connection); + if (result == TestConnectionResult.Fully_Success) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Partly_Sucess) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + } + + if (result == TestConnectionResult.Fully_Failed) { + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } + + if (result == TestConnectionResult.Auth_Failed) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } else { - if (result) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Successful")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); - } else { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } } } catch (InterruptedException | ExecutionException e) { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); @@ -596,6 +606,7 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); + //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java new file mode 100644 index 0000000000..3aaf594ecb --- /dev/null +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -0,0 +1,55 @@ +package com.fr.env; + +import com.fr.stable.AssistUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.connect.WorkspaceConnectionInfo; +import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; + +/** + * created by Harrison on 2018/12/20 + **/ +public enum TestConnectionResult { + /** + * 完全成功, 版本匹配,测试连接成功。 + */ + Fully_Success(0), + + /** + * 不完全成功,版本不匹配,但测试连接成功。 + */ + Partly_Sucess(1), + + /** + * 完全失败,直接没连上 + */ + Fully_Failed(2), + + /** + * 验证 Token 失败 + */ + Auth_Failed(3); + + private int sign; + + TestConnectionResult(int i) { + this.sign = i; + } + + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + if (value == null) { + return Auth_Failed; + } + + if (!value) { + return Fully_Failed; + } + + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } + + return Partly_Sucess; + } +} From 1380b31b6467f8f0c400e4af279227416df9de12 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 10:58:13 +0800 Subject: [PATCH 56/60] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/env/RemoteEnvPane.java | 4 +- .../java/com/fr/env/TestConnectionResult.java | 37 +++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 21b5d2b2ca..742b6cc16b 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -541,7 +541,7 @@ public class RemoteEnvPane extends BasicBeanPane { if (result == TestConnectionResult.Partly_Sucess) { message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); - uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); + uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); } if (result == TestConnectionResult.Fully_Failed) { @@ -557,8 +557,6 @@ public class RemoteEnvPane extends BasicBeanPane { FineLoggerFactory.getLogger().error(e, e.getMessage()); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage()); } dialogDownPane.remove(cancelButton); dialogDownPane.revalidate(); diff --git a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java index 3aaf594ecb..357d4f38cb 100644 --- a/designer-base/src/main/java/com/fr/env/TestConnectionResult.java +++ b/designer-base/src/main/java/com/fr/env/TestConnectionResult.java @@ -1,41 +1,40 @@ package com.fr.env; +import com.fr.log.FineLoggerFactory; import com.fr.stable.AssistUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; /** + * 测试连接的结果。 + * 不改变原有逻辑的情况下,加入一层转化。 + * 根据这里的转化结果,判断需要提示哪些内容。 + * * created by Harrison on 2018/12/20 **/ public enum TestConnectionResult { /** * 完全成功, 版本匹配,测试连接成功。 */ - Fully_Success(0), + Fully_Success, /** * 不完全成功,版本不匹配,但测试连接成功。 */ - Partly_Sucess(1), + Partly_Sucess, /** * 完全失败,直接没连上 */ - Fully_Failed(2), + Fully_Failed, /** * 验证 Token 失败 */ - Auth_Failed(3); + Auth_Failed; - private int sign; - - TestConnectionResult(int i) { - this.sign = i; - } - - public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) throws Exception { + public static TestConnectionResult parse(Boolean value, WorkspaceConnectionInfo info) { if (value == null) { return Auth_Failed; } @@ -43,13 +42,21 @@ public enum TestConnectionResult { if (!value) { return Fully_Failed; } + try { - String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return Fully_Success; + } - if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { - return Fully_Success; + return Partly_Sucess; + } catch (Exception e) { + + // 发生异常,说明没连接上。返回完全失败。 + FineLoggerFactory.getLogger().error(e.getMessage()); + return Fully_Failed; } - return Partly_Sucess; + } } From fcdb68c2fcedd59e37749bef190d8341f640497e Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:24:24 +0800 Subject: [PATCH 57/60] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=8B=E9=80=BB=E8=BE=91=E3=80=82?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B9=E4=BE=BF=E7=90=86=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 47 ++++++++++++------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 725272a153..58f22d1b64 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -98,7 +98,8 @@ public class EnvChangeEntrance { return false; } - if (versionCheck(selectedEnv)) { + // 如果版本不一致,且确认 不继续 连接,这里返回 false. + if (!versionCheckAndConfirm(selectedEnv)) { return false; } @@ -151,37 +152,47 @@ public class EnvChangeEntrance { } /** - * 切换环境之前,进行版本检测,当版本不一致的时候,提示。 - * 当选择 ok 时,才继续。 + * 切换远程环境之前,进行版本检测,当版本不一致的时候,提示。 + * 当用户确认选择 ok 时,才继续。 * * @param selectedEnv 选择的环境 * @return 是否一致 + * 1. 非远程环境 , 返回 true + * 2. 远程环境 + * 2.1 不匹配, + * 2.1.1 当选择 ok , 返回 true + * 2.1.2 当选择 no, 返回 false + * 2.2 匹配, 返回 true * @throws Exception 异常 */ - private boolean versionCheck(DesignerWorkspaceInfo selectedEnv) throws Exception { + private boolean versionCheckAndConfirm(DesignerWorkspaceInfo selectedEnv) throws Exception { if (selectedEnv.getType() == DesignerWorkspaceType.Remote) { WorkspaceConnectionInfo info = selectedEnv.getConnection(); String serverVersion = new FunctionalHttpRequest(info).getServerVersion(); - if (!AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + if (AssistUtils.equals(serverVersion, WorkContext.getVersion())) { + return true; + } - final List result = new ArrayList<>(1); - PopTipStrategy.NOW.showTip(new PopTip() { - @Override - public void show() { - String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; - int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), - UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); - result.add(choice); - } - }); + final List result = new ArrayList<>(1); + PopTipStrategy.NOW.showTip(new PopTip() { + @Override + public void show() { + String[] option = {Toolkit.i18nText("Fine-Design_Report_Yes"), Toolkit.i18nText("Fine-Design_Report_No")}; + int choice = JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency"), + UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.YES_NO_OPTION, QUESTION_MESSAGE, UIManager.getIcon("OptionPane.warningIcon"), option, 1); + result.add(choice); + } + }); - return result.size() != 0 && result.get(0) == 1; - } + // 只有选择 yes , 这里的值才为 0, 返回 true + // 否着返回 false, 将不进行下面的连接操作。 + return result.size() != 0 && result.get(0) == 0; } - return false; + + return true; } /** From 02dd1b00793e08c381d26f541d47f7ce2e94aac8 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 11:43:14 +0800 Subject: [PATCH 58/60] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=BF=98=E4=BA=86=E6=B3=A8=E9=87=8A=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index 742b6cc16b..dc764153ca 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -604,7 +604,6 @@ public class RemoteEnvPane extends BasicBeanPane { dialogDownPane = new JPanel(); uiLabel = new UILabel(UIManager.getIcon("OptionPane.informationIcon")); upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); - //upPane.setLayout(new BorderLayout()); upPane.add(uiLabel); upPane.add(message); dialogDownPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0)); From b912d85688410664c67e612bb6ca13762dbc5d39 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Fri, 21 Dec 2018 14:02:44 +0800 Subject: [PATCH 59/60] =?UTF-8?q?REPORT-13431=20=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E8=AE=B0=E5=BD=95,=20=E9=9C=80=E8=A6=81=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=80=81=201.=E5=8F=91=E9=80=81=E5=89=8D?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=202.SEND=5FDELAY=E5=8E=9F=E5=85=88=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=9C=89=E8=AF=AF=EF=BC=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/InformationCollector.java | 157 +++++++++++++----- 1 file changed, 118 insertions(+), 39 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 0398189d9c..61b583c615 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -5,11 +5,6 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; import com.fr.config.MarketConfig; -import com.fr.data.core.db.DBUtils; -import com.fr.data.core.db.dialect.DialectFactory; -import com.fr.data.core.db.dml.Delete; -import com.fr.data.core.db.dml.Select; -import com.fr.data.core.db.dml.Table; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.errorinfo.ErrorInfoUploader; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; @@ -19,18 +14,13 @@ import com.fr.general.DateUtils; import com.fr.general.DesUtils; import com.fr.general.GeneralUtils; import com.fr.general.IOUtils; -import com.fr.general.http.HttpClient; import com.fr.general.http.HttpToolbox; import com.fr.intelli.record.FocusPoint; -import com.fr.intelli.record.MetricException; import com.fr.intelli.record.MetricRegistry; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.log.message.ParameterMessage; -import com.fr.record.DBRecordXManager; -import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -58,17 +48,15 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; /** * @author neil @@ -79,7 +67,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { // 24小时上传一次 private static final long DELTA = 24 * 3600 * 1000L; - private static final long SEND_DELAY = 30 * 1000L; + private static final long SEND_DELAY = 300 * 1000L; private static final String FILE_NAME = "fr.info"; private static final String XML_START_STOP_LIST = "StartStopList"; private static final String XML_START_STOP = "StartStop"; @@ -226,12 +214,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { if (currentTime - lastTime <= DELTA) { return; } - JSONArray content = null; - try { - content = getFunctionsContent(currentTime, lastTime); - } catch (JSONException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + JSONArray content = getFunctionsContent(currentTime, lastTime); boolean success = false; FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); @@ -443,7 +426,7 @@ public class InformationCollector implements XMLReadable, XMLWriter { }); } - public static JSONArray getFunctionsContent(long current, long last) throws JSONException{ + public JSONArray getFunctionsContent(long current, long last) { //记录当前条数,达到200条合并成一个请求 int count = 0; JSONArray functionArray = new JSONArray(); @@ -452,21 +435,20 @@ public class InformationCollector implements XMLReadable, XMLWriter { .addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); try { DataList focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); - JSONArray temp = new JSONArray(); + TreeSet focusPointsList = new TreeSet<>(); if(!focusPoints.isEmpty()){ for(int i=0;i< focusPoints.getList().size();i++){ FocusPoint focusPoint = focusPoints.getList().get(i); if(focusPoint != null){ if((++count <= MAX_EACH_REQUEST_RECORD_COUNT)){ - temp.put(getOneRecord(focusPoint)); + focusPointsList.add(getOneRecord(focusPoint)); } else { count = 0; - functionArray.put(temp); - temp = new JSONArray(); - temp.put(getOneRecord(focusPoint)); + functionArray.put(setToJSONArray(focusPointsList)); + focusPointsList.add(getOneRecord(focusPoint)); } if(i == (focusPoints.getList().size() -1)){ - functionArray.put(temp); + functionArray.put(setToJSONArray(focusPointsList)); } } } @@ -478,16 +460,33 @@ public class InformationCollector implements XMLReadable, XMLWriter { return functionArray; } - private static JSONObject getOneRecord(FocusPoint focusPoint) throws JSONException{ - com.fr.json.JSONObject record = new com.fr.json.JSONObject(); - record.put(ATTR_ID, focusPoint.getId()); - record.put(ATTR_TEXT, focusPoint.getText()); - record.put(ATTR_SOURCE, focusPoint.getSource()); - record.put(ATTR_TIME, focusPoint.getTime().getTime()); - record.put(ATTR_TITLE, focusPoint.getTitle()); - record.put(ATTR_USER_NAME, MarketConfig.getInstance().getBbsUsername()); - record.put(ATTR_UUID, DesignerEnvManager.getEnvManager().getUUID()); - return record; + private FunctionRecord getOneRecord(FocusPoint focusPoint) { + FunctionRecord functionRecord = new FunctionRecord(); + functionRecord.setId(focusPoint.getId() == null?StringUtils.EMPTY : focusPoint.getId()); + functionRecord.setText(focusPoint.getText() == null?StringUtils.EMPTY : focusPoint.getText()); + functionRecord.setSource(focusPoint.getSource()); + functionRecord.setTime(focusPoint.getTime().getTime()); + functionRecord.setTitle(focusPoint.getTitle() == null?StringUtils.EMPTY : focusPoint.getTitle()); + functionRecord.setUsername(MarketConfig.getInstance().getBbsUsername() == null?StringUtils.EMPTY : MarketConfig.getInstance().getBbsUsername()); + functionRecord.setUuid(DesignerEnvManager.getEnvManager().getUUID() == null?StringUtils.EMPTY : DesignerEnvManager.getEnvManager().getUUID()); + return functionRecord; + } + + private JSONArray setToJSONArray(Set set) throws JSONException { + JSONArray jsonArray = new JSONArray(); + for(Iterator iter = set.iterator(); iter.hasNext(); ) { + FunctionRecord functionRecord = (FunctionRecord)iter.next(); + com.fr.json.JSONObject record = new com.fr.json.JSONObject(); + record.put(ATTR_ID, functionRecord.getId()); + record.put(ATTR_TEXT, functionRecord.getText()); + record.put(ATTR_SOURCE, functionRecord.getSource()); + record.put(ATTR_TIME, functionRecord.getTime()); + record.put(ATTR_TITLE, functionRecord.getTitle()); + record.put(ATTR_USER_NAME, functionRecord.getUsername()); + record.put(ATTR_UUID, functionRecord.getUuid()); + jsonArray.put(record); + } + return jsonArray; } private class StartStopTime implements XMLReadable, XMLWriter { @@ -529,4 +528,84 @@ public class InformationCollector implements XMLReadable, XMLWriter { } + private class FunctionRecord implements Comparable{ + private String id; + private String text; + private int source; + private long time; + private String title; + private String username; + private String uuid; + + public FunctionRecord(){ + + } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getSource() { + return source; + } + + public void setSource(int source) { + this.source = source; + } + + public long getTime() { + return time; + } + + public void setTime(long time) { + this.time = time; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public int compareTo(Object o) { + FunctionRecord functionRecord = (FunctionRecord) o; + if(this.getId().equals((functionRecord.getId())) && this.getText().equals(functionRecord.getText()) + && this.getSource() == functionRecord.getSource() && this.getTime() == functionRecord.getTime() + && this.getTitle().equals(functionRecord.getTitle()) && this.getUsername().equals(functionRecord.getUsername()) + && this.getUuid().equals(functionRecord.getUuid())){ + return 0; + } + return 1; + } + } } \ No newline at end of file From 0fcdd85bdb2801154a85c4f1c6452df57663bedb Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 21 Dec 2018 16:26:57 +0800 Subject: [PATCH 60/60] =?UTF-8?q?REPORT-13074=20=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=90=91=E4=B8=8B=E5=85=BC=E5=AE=B9=201.=20?= =?UTF-8?q?=E5=B0=86=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5=E5=92=8C=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E8=BF=9E=E6=8E=A5=E6=8F=90=E7=A4=BA=E5=88=86=E5=BC=80?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/main/java/com/fr/env/RemoteEnvPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java index dc764153ca..d2953eeb6a 100644 --- a/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java +++ b/designer-base/src/main/java/com/fr/env/RemoteEnvPane.java @@ -540,7 +540,7 @@ public class RemoteEnvPane extends BasicBeanPane { } if (result == TestConnectionResult.Partly_Sucess) { - message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistency")); + message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Version_Inconsistence_Test")); uiLabel.setIcon(UIManager.getIcon("OptionPane.warningIcon")); }