Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~alex.sung/design into release/10.0

bugfix/10.0
alex.sung 6 years ago
parent
commit
70c998af5d
  1. 2
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 60
      designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java
  3. 26
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  4. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java
  5. 83
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  6. 4
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  7. 120
      designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java
  8. 264
      designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java
  9. 41
      designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java
  10. 16
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  11. 69
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  12. 245
      designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java
  13. 55
      designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java
  14. 45
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java
  15. 8
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  16. 4
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  17. 11
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  18. 31
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  19. 6
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  20. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java
  21. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java
  22. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  23. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java
  24. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java
  25. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java
  26. 40
      designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java
  27. 5
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java
  28. 13
      designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java
  29. 8
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  30. 29
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  31. 2
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  32. 46
      designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java
  33. 2
      designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java
  34. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  35. 2
      designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java
  36. 36
      designer-realize/src/main/java/com/fr/grid/selection/Selection.java

2
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 Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false; private boolean supportCellEditorDef = false;
private boolean isDragPermited = false; private boolean isDragPermited = false;
private Locale language = Locale.SIMPLIFIED_CHINESE; private Locale language = Locale.getDefault();
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true; private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;

60
designer-base/src/main/java/com/fr/design/bbs/BBSLoginUtils.java

@ -1,14 +1,8 @@
package com.fr.design.bbs; package com.fr.design.bbs;
import com.fr.config.BBSAttr; import com.fr.base.passport.FinePassportManager;
import com.fr.config.Configuration;
import com.fr.config.MarketConfig;
import com.fr.log.FineLoggerFactory; 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. * Created by ibm on 2017/8/21.
@ -16,62 +10,14 @@ import java.util.List;
public class BBSLoginUtils { public class BBSLoginUtils {
public static void bbsLogin(final String username, final String password) { public static void bbsLogin(final String username, final String password) {
final BBSAttr bbsAttr = new BBSAttr();
bbsAttr.setBbsUsername(username);
bbsAttr.setBbsPassword(password);
try { try {
Configurations.update(new Worker() { FinePassportManager.getInstance().login(username, password);
@Override
public void run() {
MarketConfig.getInstance().setBBsAttr(bbsAttr);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{MarketConfig.class};
}
});
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public static void bbsLogin(List<String> 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<? extends Configuration>[] targets() {
return new Class[]{MarketConfig.class};
}
});
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
public static void bbsLogout() { public static void bbsLogout() {
final BBSAttr bbsAttr = new BBSAttr(); FinePassportManager.getInstance().logout();
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);
}
} }
} }

26
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.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
private JDialog dialog; private JDialog dialog;
private UILabel uiLabel; private UILabel uiLabel;
// 编码转换. // 编码转换.
private UIComboBox newCharSetComboBox; private UIComboBox charSetComboBox;
private String oirginalCharSet = null; private String originalCharSet = null;
// Database pane // Database pane
public DatabaseConnectionPane() { public DatabaseConnectionPane() {
@ -50,7 +51,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")); okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK"));
cancelButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); cancelButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
String[] defaultEncode = new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto")}; String[] defaultEncode = new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto")};
newCharSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY)); charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
@ -72,7 +73,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
new ModLineBorder(ModLineBorder.TOP), new ModLineBorder(ModLineBorder.TOP),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Advanced")
)); ));
chartSetPane.add(GUICoreUtils.createNamedPane(newCharSetComboBox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_New_Charset") + ":")); chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
} }
protected abstract JPanel mainPanel(); protected abstract JPanel mainPanel();
@ -81,8 +82,12 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
@Override @Override
public void populateBean(com.fr.data.impl.Connection ob) { public void populateBean(com.fr.data.impl.Connection ob) {
this.oirginalCharSet = ob.getOriginalCharsetName(); this.originalCharSet = ob.getOriginalCharsetName();
this.newCharSetComboBox.setSelectedItem(ob.getNewCharsetName()); if (StringUtils.isBlank(originalCharSet)) {
this.charSetComboBox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Encode_Auto"));
} else {
this.charSetComboBox.setSelectedItem(ob.getOriginalCharsetName());
}
populateSubDatabaseConnectionBean((E) ob); populateSubDatabaseConnectionBean((E) ob);
} }
@ -93,11 +98,14 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public com.fr.data.impl.Connection updateBean() { public com.fr.data.impl.Connection updateBean() {
E ob = updateSubDatabaseConnectionBean(); E ob = updateSubDatabaseConnectionBean();
ob.setOriginalCharsetName(this.oirginalCharSet); ob.setOriginalCharsetName(this.originalCharSet);
if (this.newCharSetComboBox.getSelectedIndex() == 0) { if (this.charSetComboBox.getSelectedIndex() == 0) {
ob.setNewCharsetName(null); ob.setNewCharsetName(null);
ob.setOriginalCharsetName(null);
} else { } else {
ob.setNewCharsetName((String) this.newCharSetComboBox.getSelectedItem()); ob.setNewCharsetName(EncodeConstants.ENCODING_GBK);
ob.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem()));
} }
return ob; return ob;

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java

@ -125,7 +125,7 @@ public class JNDIDefPane extends JPanel {
} }
// Properties. // Properties.
Hashtable<String, String> contextHashtable = jndiDatabase.getContextHashtable(); Map<String, String> contextHashtable = jndiDatabase.getContextHashtable();
Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY); Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY);
this.JNDIFactoryComboBox.setSelectedItem(INITIAL_CONTEXT_FACTORY == null ? "" : 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); populateContextAttributes(contextHashtable, this.APPLET_TF, Context.APPLET);
} }
private void populateContextAttributes(Hashtable<String, String> properties, UITextField textField, String contextAttr) { private void populateContextAttributes(Map<String, String> properties, UITextField textField, String contextAttr) {
String PROVIDER_URL = properties.get(contextAttr); String PROVIDER_URL = properties.get(contextAttr);
if (PROVIDER_URL != null) { if (PROVIDER_URL != null) {
textField.setText(PROVIDER_URL); textField.setText(PROVIDER_URL);
@ -160,7 +160,7 @@ public class JNDIDefPane extends JPanel {
jndiDatabase.setJNDIName(this.jndiNameTextField.getText()); jndiDatabase.setJNDIName(this.jndiNameTextField.getText());
Hashtable<String, String> contextHashtable = jndiDatabase.getContextHashtable(); Map<String, String> contextHashtable = jndiDatabase.getContextHashtable();
String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem(); String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem();
if (factoryString != null && factoryString.trim().length() > 0) { if (factoryString != null && factoryString.trim().length() > 0) {
@ -186,7 +186,7 @@ public class JNDIDefPane extends JPanel {
return jndiDatabase; return jndiDatabase;
} }
private void updateContextAttributes(Hashtable<String, String> contextHashtable, UITextField textField, String contextAttr) { private void updateContextAttributes(Map<String, String> contextHashtable, UITextField textField, String contextAttr) {
String tValue = textField.getText(); String tValue = textField.getText();
if (tValue != null && tValue.trim().length() > 0) { if (tValue != null && tValue.trim().length() > 0) {
contextHashtable.put(contextAttr, tValue); contextHashtable.put(contextAttr, tValue);

83
designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java

@ -1,23 +1,18 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor; 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.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; 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.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Color; import java.awt.Color;
@ -25,8 +20,6 @@ import java.awt.Desktop;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.LinkedList;
import java.util.List;
/** /**
* @author vito * @author vito
@ -150,7 +143,7 @@ public class LoginWebBridge {
try { try {
Thread.sleep(millis); Thread.sleep(millis);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -161,7 +154,7 @@ public class LoginWebBridge {
try { try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.register")));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -172,7 +165,7 @@ public class LoginWebBridge {
try { try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -202,35 +195,16 @@ public class LoginWebBridge {
if (!testConnection()) { if (!testConnection()) {
return NET_FAILED; return NET_FAILED;
} }
List<String> loginResult = frPassport(userInfo, password); int uid = 0;
String uid = loginResult.get(0);
String username = loginResult.get(1);
if (Integer.parseInt(uid) > 0) {
loginSuccess(username);
}
return uid;
}
private List<String> frPassport(String username, String password) {
LinkedList<String> list = new LinkedList<>();
try { try {
Client uc = new Client(); uid = FinePassportManager.getInstance().login(userInfo, password);
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);
}
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage(), e);
list.push(UNKNOWN_ERROR); }
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<String> 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) { public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (url.indexOf("qqLogin.html") > 0) { if (url.indexOf("qqLogin.html") > 0) {

4
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -1,8 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
@ -554,7 +554,7 @@ public class PluginWebBridge {
*/ */
public void clearUserInfo() { public void clearUserInfo() {
MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY);
BBSLoginUtils.bbsLogout(); FinePassportManager.getInstance().logout();
uiLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn")); uiLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn"));
} }

120
designer-base/src/main/java/com/fr/design/extra/ucenter/AbstractClient.java

@ -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<String, Object> 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<String, Object> 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 "";
}
}

264
designer-base/src/main/java/com/fr/design/extra/ucenter/Client.java

@ -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<String, Object> 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<String, Object> 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<String, Object>) v).keySet()) {
Object v2 = ((Map<String, Object>) 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();
}
}

41
designer-base/src/main/java/com/fr/design/extra/ucenter/XMLHelper.java

@ -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<String> ucUnserialize(String input) {
LinkedList<String> result = new LinkedList<String>();
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;
}
}

16
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -206,8 +206,7 @@ public class MutilTempalteTabPane extends JComponent {
openedTemplate.remove(jTemplate); openedTemplate.remove(jTemplate);
closeFormat(jTemplate); closeFormat(jTemplate);
HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate);
// release lock closeAndFreeLock(jTemplate);
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath());
} }
} }
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
@ -221,7 +220,6 @@ public class MutilTempalteTabPane extends JComponent {
if (openedTemplate.size() == 1) { if (openedTemplate.size() == 1) {
closeOther.setEnabled(false); closeOther.setEnabled(false);
} }
return closeOther; return closeOther;
} }
@ -698,11 +696,19 @@ public class MutilTempalteTabPane extends JComponent {
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate, @Nonnull String fileName) { private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate, @Nonnull String fileName) {
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate);
// release lock closeAndFreeLock(specifiedTemplate);
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath());
activeTemplate(fileName); 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(file.getPath());
}
}
/** /**
* 关闭模板 * 关闭模板
* *

69
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -63,19 +63,19 @@ import java.util.Locale;
*/ */
public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea;
protected RSyntaxTextArea formulaTextArea; private RSyntaxTextArea formulaTextArea;
protected UITextField keyWordTextField = new UITextField(18); private UITextField keyWordTextField = new UITextField(18);
protected int currentPosition = 0; private int currentPosition = 0;
protected int beginPosition = 0; private int beginPosition = 0;
protected int insertPosition = 0; private int insertPosition = 0;
protected JList tipsList; private JList tipsList;
protected DefaultListModel listModel = new DefaultListModel(); protected DefaultListModel listModel = new DefaultListModel();
protected int ifHasBeenWriten = 0; private int ifHasBeenWriten = 0;
protected DefaultListModel functionTypeListModel = new DefaultListModel(); private DefaultListModel functionTypeListModel = new DefaultListModel();
protected QuickList functionTypeList; private QuickList functionTypeList;
protected DefaultListModel functionNameModel; private DefaultListModel functionNameModel;
protected JList functionNameList; private JList functionNameList;
public FormulaPane() { public FormulaPane() {
initComponents(); initComponents();
@ -184,6 +184,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected void initComponents() { protected void initComponents() {
this.setLayout(new BorderLayout(4, 4)); this.setLayout(new BorderLayout(4, 4));
initTextPane();
initTipsPane();
initVariableTreeAndDescriptionArea();
}
private void initVariableTreeAndDescriptionArea() {
variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea();
this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH);
}
private void initTextPane() {
// text // text
JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(textPane, BorderLayout.CENTER); this.add(textPane, BorderLayout.CENTER);
@ -199,7 +211,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER);
textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH);
initTipsPane();
UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid"));
checkValidButton.addActionListener(checkValidActionListener); checkValidButton.addActionListener(checkValidActionListener);
@ -209,8 +220,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST);
checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST);
extendCheckBoxPane(checkBoxPane); 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.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_FORMULA);
formulaTextArea.setAnimateBracketMatching(true); formulaTextArea.setAnimateBracketMatching(true);
formulaTextArea.setAntiAliasingEnabled(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) { if (tipsList.getSelectedValue() != null) {
int signOfContinue = 1; int signOfContinue = 1;
int indexOfFunction = 0; int indexOfFunction = 0;
@ -346,7 +355,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
protected int getBeginPosition() { private int getBeginPosition() {
int i = currentPosition; int i = currentPosition;
String textArea = formulaTextArea.getText(); String textArea = formulaTextArea.getText();
for (; i > 0; i--) { for (; i > 0; i--) {
@ -361,7 +370,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
return i; return i;
} }
protected void firstStepToFindTips(int theBeginPosition) { private void firstStepToFindTips(int theBeginPosition) {
String textArea = formulaTextArea.getText(); String textArea = formulaTextArea.getText();
if (currentPosition > 0 && theBeginPosition < currentPosition) { if (currentPosition > 0 && theBeginPosition < currentPosition) {
@ -443,7 +452,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
/** /**
* Apply text. * Apply text.
*/ */
public void applyText(String text) { private void applyText(String text) {
if (text == null || text.length() <= 0) { if (text == null || text.length() <= 0) {
return; return;
} }
@ -541,7 +550,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
// check valid // check valid
protected ActionListener checkValidActionListener = new ActionListener() { private ActionListener checkValidActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
// Execute Formula default cell element. // Execute Formula default cell element.
@ -579,7 +588,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private JTree variablesTree; private JTree variablesTree;
private UITextArea descriptionTextArea; private UITextArea descriptionTextArea;
public VariableTreeAndDescriptionArea() { VariableTreeAndDescriptionArea() {
this.initComponents(); this.initComponents();
} }
@ -802,13 +811,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initComponents() { private void initComponents() {
this.setLayout(new BorderLayout(4, 4)); this.setLayout(new BorderLayout(4, 4));
// Function initVariablesTree();
initFunctionPane();
}
private void initFunctionPane() {
JPanel functionPane = new JPanel(new BorderLayout(4, 4)); JPanel functionPane = new JPanel(new BorderLayout(4, 4));
this.add(functionPane, BorderLayout.WEST); this.add(functionPane, BorderLayout.WEST);
initFunctionTypeList(functionPane); initFunctionTypeList(functionPane);
initFunctionNameList(functionPane); initFunctionNameList(functionPane);
initVariablesTree();
// 选择:
functionTypeList.setSelectedIndex(0); functionTypeList.setSelectedIndex(0);
} }
@ -959,7 +970,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private Icon icon; private Icon icon;
private String[] subNodes = new String[0]; 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.text = text;
this.icon = icon; this.icon = icon;
this.subNodes = subNodes; this.subNodes = subNodes;
@ -986,11 +997,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
public static class TextUserObject { public static class TextUserObject {
public TextUserObject(String text) { TextUserObject(String text) {
this(text, text); this(text, text);
} }
public TextUserObject(String text, String displayText) { TextUserObject(String text, String displayText) {
this.text = text; this.text = text;
this.displayText = displayText; this.displayText = displayText;
} }
@ -999,7 +1010,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
return this.text; return this.text;
} }
public String getDisplayText() { String getDisplayText() {
return this.displayText; return this.displayText;
} }

245
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.function.TIME;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.ExtraClassManager; import com.fr.plugin.ExtraClassManager;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
@ -34,13 +35,75 @@ import java.util.zip.ZipFile;
import javax.swing.DefaultListModel; 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<Function> iface = Function.class;
ClassLoader classloader = iface.getClassLoader();
Enumeration<URL> 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 * @param listModel
*/ */
public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ static void addFunctionGroupFromPlugins(DefaultListModel listModel){
//hugh:自定义函数分组 //hugh:自定义函数分组
Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); Set<Mutable> containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING);
if(!containers.isEmpty()){ if(!containers.isEmpty()){
@ -75,7 +138,63 @@ public abstract class FunctionConstants {
}; };
} }
public static FunctionGroup PLUGIN = new FunctionGroup() {
private static String[] findClassNamesUnderFilePath(String filePath) {
java.util.List<String> classNameList = new ArrayList<String>();
/*
* 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("!/")) {
String[] arr = filePath.split("!/");
String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符
String classPath = arr[1];
if(classPath.endsWith("/")){
classPath = classPath.substring(0, classPath.length() - 1);
}
if (!OperatingSystem.isWindows()){
//windows里substring后是d:\123\456, mac下substring后是Application/123/456
jarPath = StringUtils.perfectStart(jarPath, "/");
}
ZipFile zip;
try {
zip = new ZipFile(jarPath);
Enumeration entries = zip.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if (entry.isDirectory()) {
continue;
}
String entryName = entry.getName();
if (!entryName.contains(classPath) || !entryName.endsWith(".class")) {
continue;
}
classNameList.add(entryName.substring(classPath.length() + 1));
}
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} else {
File dir = new File(filePath);
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[0]);
}
private static FunctionGroup getPluginFunctionGroup() {
return new FunctionGroup() {
@Override @Override
public String getGroupName() { public String getGroupName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin");
@ -92,8 +211,10 @@ public abstract class FunctionConstants {
return nads; return nads;
} }
}; };
}
public static FunctionGroup CUSTOM = new FunctionGroup() { private static FunctionGroup getCustomFunctionGroup() {
return new FunctionGroup() {
@Override @Override
public String getGroupName() { public String getGroupName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function");
@ -116,12 +237,16 @@ public abstract class FunctionConstants {
return new NameAndDescription[0]; 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[] { 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() new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE()
}); });
}
public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = new NameAndTypeAndFunctionList[] { 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_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_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_Date_&_Time"), Function.DATETIME),
@ -131,8 +256,10 @@ public abstract class FunctionConstants {
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_FormulaD_Other"), Function.OTHER),
new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA)
}; };
}
public static FunctionGroup ALL = new FunctionGroup() { private static FunctionGroup getAllFunctionGroup() {
return new FunctionGroup() {
@Override @Override
public String getGroupName() { public String getGroupName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All");
@ -153,112 +280,16 @@ public abstract class FunctionConstants {
Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions());
} }
} }
java.util.Collections.sort(all, NameAndDescriptionComparator);
return all.toArray(new NameAndDescription[all.size()]); Collections.sort(all, new Comparator<NameAndDescription>() {
}
};
private static Comparator<NameAndDescription> NameAndDescriptionComparator = new Comparator<NameAndDescription>() {
@Override @Override
public int compare(NameAndDescription o1, NameAndDescription o2) { public int compare(NameAndDescription o1, NameAndDescription o2) {
return ComparatorUtils.compare(o1.getName(), o2.getName()); return ComparatorUtils.compare(o1.getName(), o2.getName());
} }
}; });
private static String[] findClassNamesUnderFilePath(String filePath) {
java.util.List<String> classNameList = new ArrayList<String>();
/*
* 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) {
String[] arr = filePath.split("!/");
String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符
String classPath = arr[1];
if(classPath.endsWith("/")){
classPath = classPath.substring(0, classPath.length() - 1);
}
if (!OperatingSystem.isWindows()){
//windows里substring后是d:\123\456, mac下substring后是Application/123/456
jarPath = StringUtils.perfectStart(jarPath, "/");
}
ZipFile zip;
try {
zip = new ZipFile(jarPath);
Enumeration entries = zip.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
if (entry.isDirectory()) {
continue;
}
String entryName = entry.getName();
if (entryName.indexOf(classPath) < 0 || !entryName.endsWith(".class")) {
continue;
}
classNameList.add(entryName.substring(classPath.length() + 1));
}
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
} else {
File dir = new File(filePath);
for (File f : dir.listFiles()) {
String fileName = f.getName();
if (fileName.endsWith(".class")) {
classNameList.add(fileName);
}
}
}
return classNameList.toArray(new String[classNameList.size()]);
}
// alex:读取com.fr.script.function包下面所有的Function类
static {
String pkgName = "com.fr.function";
Class<Function> 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处理
*/
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 (int fi = 0; fi < EMBFUNCTIONS.length; fi++) {
if (EMBFUNCTIONS[fi].test(inst)) {
break;
}
}
return all.toArray(new NameAndDescription[0]);
} }
} catch (ClassNotFoundException e) { };
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
} }
} }

55
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<UpdateAction> actions);
/**
* 当前实现是否可以作用于当前元素
*
* @param formDesigner 当前选中元素分为表单编辑器和参数面板(表单组件元素以及各种控件)
* @return
*/
boolean accept(BaseFormDesigner formDesigner);
}

45
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<UpdateAction> 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;
}
}

8
designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -667,19 +667,11 @@ public class UIBasicMenuItemUI extends MenuItemUI {
} }
private void installFont(final String prefix, final JComponent menuItem) { private void installFont(final String prefix, final JComponent menuItem) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (menuItem == null) { if (menuItem == null) {
return; return;
} }
LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font");
} }
});
thread.setName("UIBasicMenuItemUI");
thread.setDaemon(true);
thread.start();
}
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,
Icon arrowIcon, int defaultTextIconGap) { Icon arrowIcon, int defaultTextIconGap) {

4
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 (treeNode.hasFullAuthority()) {
if (lock != null && !node.getUserID().equals(lock)) { if (lock != null && !node.getUserID().equals(lock)) {
name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")"); 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 { } else {
this.setIcon(FileTreeIcon.getFolderHalfImageIcon()); this.setIcon(FileTreeIcon.getFolderHalfImageIcon());
} }

11
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.base.BaseUtils;
import com.fr.design.icon.LockIcon; import com.fr.design.icon.LockIcon;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -125,8 +126,16 @@ public class FileTreeIcon {
return FOLDER_HALF_IMAGE_ICON; return FOLDER_HALF_IMAGE_ICON;
} }
/**
* 获取文件节点对应的图标
*
* @param node 文件节点
* @return 文件节点的图标
*/
public static Icon getIcon(FileNode node) { 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) { public static Icon getIcon(FileNode node, boolean isShowLock) {

31
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.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; 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.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID; 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.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -419,7 +422,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
fireSuperTargetModified(); fireSuperTargetModified();
} }
protected boolean accept(Object o) { public boolean accept(Object o) {
return true; return true;
} }
@ -587,6 +590,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (isCancelOperation(chooseResult)) { if (isCancelOperation(chooseResult)) {
return false; return false;
} }
// 源文件
FILE sourceFile = editingFILE;
if (isOkOperation(chooseResult)) { if (isOkOperation(chooseResult)) {
boolean access = false; boolean access = false;
@ -596,13 +601,33 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
if (!access) { 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; return false;
} }
// 目标文件
editingFILE = fileChooser.getSelectedFILE(); 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) { protected boolean saveNewFile(FILE editingFILE, String oldName) {

6
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -68,4 +68,10 @@ public class LogMessageBar extends JPanel {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(width, 24); return new Dimension(width, 24);
} }
public void disposeLogDialog() {
if (dlg != null) {
dlg.dispose();
}
}
} }

4
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.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints;
public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane {
@ -84,7 +85,8 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
int panelWidth = dimension.width; int panelWidth = dimension.width;
int panelHeight = dimension.height; int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont); FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount();

2
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.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Stroke; import java.awt.Stroke;
import java.util.ArrayList; import java.util.ArrayList;
@ -151,6 +152,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
int panelWidth = dimension.width; int panelWidth = dimension.width;
int panelHeight = dimension.height; int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont(); FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont); FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout();

4
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -208,8 +208,10 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
MobileTemplateStyle ob = updateSubStyle(); MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(custom.getSelectedIndex() == 1); ob.setCustom(custom.getSelectedIndex() == 1);
ob.setInitialColor(initialColorBox.getSelectObject()); ob.setInitialColor(initialColorBox.getSelectObject());
TabFontConfig config = ob.getTabFontConfig(); TabFontConfig config = new TabFontConfig();
config.setSelectColor(ob.getTabFontConfig().getSelectColor());
config.setFont(fontConfPane.update()); config.setFont(fontConfPane.update());
ob.setTabFontConfig(config);
return ob; return ob;
} }

2
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.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints;
public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
private NewColorSelectBox initDotColor; private NewColorSelectBox initDotColor;
@ -131,6 +132,7 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
Dimension dimension = this.getSize(); Dimension dimension = this.getSize();
int panelHeight = dimension.height; int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont(); FRFont frFont = this.getTabFontConfig().getFont();
g2d.setFont(frFont); g2d.setFont(frFont);
g2d.setColor(frFont.getForeground()); g2d.setColor(frFont.getForeground());

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.widget.MobileTabFontConfPane;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -97,7 +98,10 @@ public abstract class StyleDefinePaneWithSelectConf extends MobileTemplateStyleD
public MobileTemplateStyle updateSubStyle() { public MobileTemplateStyle updateSubStyle() {
MobileTemplateStyle mobileTemplateStyle = updateStyleWithSelectConf(); MobileTemplateStyle mobileTemplateStyle = updateStyleWithSelectConf();
mobileTemplateStyle.setSelectColor(selectColorBox.getSelectObject()); mobileTemplateStyle.setSelectColor(selectColorBox.getSelectObject());
mobileTemplateStyle.getTabFontConfig().setSelectColor(selectFontColor.getColor()); TabFontConfig config = new TabFontConfig();
config.setFont(mobileTemplateStyle.getTabFontConfig().getFont());
config.setSelectColor(selectFontColor.getColor());
mobileTemplateStyle.setTabFontConfig(config);
return mobileTemplateStyle; return mobileTemplateStyle;
} }

4
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.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Stroke; import java.awt.Stroke;
public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
@ -171,7 +172,8 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
int panelWidth = dimension.width; int panelWidth = dimension.width;
int panelHeight = dimension.height; int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FRFont frFont = this.getTabFontConfig().getFont();
FontMetrics fm = GraphHelper.getFontMetrics(frFont); FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount();

40
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);
}
}

5
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.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; 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.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -49,7 +50,7 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
JPanel northPane = new JPanel(new BorderLayout()); JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER); northPane.add(jcb, BorderLayout.CENTER);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(82, 20)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, 20));
northPane.add(label, BorderLayout.WEST); northPane.add(label, BorderLayout.WEST);
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
@ -134,7 +135,7 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
}; };
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {76, 120}; double[] columnSize = {78, 122};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);

13
designer-form/src/main/java/com/fr/design/designer/creator/XWScaleLayout.java

@ -10,6 +10,7 @@ import java.awt.event.ContainerEvent;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter;
import com.fr.design.form.layout.FRScaleLayout; import com.fr.design.form.layout.FRScaleLayout;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
@ -166,4 +167,16 @@ public class XWScaleLayout extends DedicateLayoutContainer {
XCreator child = getXCreator(INDEX); XCreator child = getXCreator(INDEX);
child.firePropertyChange(); child.firePropertyChange();
} }
/**
* 获取被包装的XCreator扩展的属性tab
* @return
*/
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
if (this.getXCreatorCount() > 0) {
return this.getXCreator(0).getWidgetPropertyUIProviders();
}
return super.getWidgetPropertyUIProviders();
}
} }

8
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.Insets;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -324,10 +325,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/ */
public UpdateAction[] getActions() { public UpdateAction[] getActions() {
if (designerActions == null) { if (designerActions == null) {
designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), designerActions = new ArrayList<UpdateAction>(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this)}; new FormDeleteAction(this)}));
dmlActions(designerActions);
} }
return designerActions; return designerActions.toArray(new UpdateAction[designerActions.size()]);
} }
private boolean searchQueryCreators(XLayoutContainer rootContainer) { private boolean searchQueryCreators(XLayoutContainer rootContainer) {

29
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1,9 +1,11 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.FRContext;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.base.mode.DesignModeContext; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.designer.TargetComponent; 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.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.RightSelectionHandlerProvider;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
@ -89,6 +92,7 @@ import java.lang.reflect.Proxy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 设计界面组件该组件是界面设计工具的核心主要负责的是被设计界面的显示界面设计操作状态的 显示编辑状态的显示等等 * 设计界面组件该组件是界面设计工具的核心主要负责的是被设计界面的显示界面设计操作状态的 显示编辑状态的显示等等
@ -132,7 +136,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
// 编辑状态的事件表 // 编辑状态的事件表
private CreatorEventListenerTable edit; private CreatorEventListenerTable edit;
protected UpdateAction[] designerActions; protected List<UpdateAction> designerActions;
private FormDesignerModeForSpecial<?> desigerMode; private FormDesignerModeForSpecial<?> desigerMode;
private Action switchAction; private Action switchAction;
private FormElementCaseContainerProvider elementCaseContainer; private FormElementCaseContainerProvider elementCaseContainer;
@ -1180,11 +1184,28 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/ */
public UpdateAction[] getActions() { public UpdateAction[] getActions() {
if (designerActions == null) { if (designerActions == null) {
designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), designerActions = new ArrayList<UpdateAction>(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this),
new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(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<UpdateAction> actions) {
try {
Set<RightSelectionHandlerProvider> 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;
} }
// 当前选中控件可以上移一层吗? // 当前选中控件可以上移一层吗?

2
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -160,7 +160,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} }
@Override @Override
protected boolean accept(Object o) { public boolean accept(Object o) {
return !(o instanceof FloatElementsProvider); return !(o instanceof FloatElementsProvider);
} }

46
designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java

@ -3,9 +3,6 @@
*/ */
package com.fr.design.cell.clipboard; package com.fr.design.cell.clipboard;
import java.util.Arrays;
import java.util.Iterator;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.CellElement; 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.StringUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import java.util.Arrays;
import java.util.Iterator;
/** /**
* The clip of CellElement. * The clip of CellElement.
*/ */
@ -39,6 +39,46 @@ public class CellElementsClip implements Cloneable, java.io.Serializable {
this.clips = clips; this.clips = clips;
} }
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() { public String compateExcelPaste() {
Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator()); Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator());

2
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) { if (singleton == null) {
synchronized (CellElementPropertyPane.class) { synchronized (CellElementPropertyPane.class) {
if (singleton == null) { if (singleton == null) {

2
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -663,7 +663,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
} }
private Object getClipObject() { public Object getClipObject() {
// 需要检查是否可以编辑。 // 需要检查是否可以编辑。
Clipboard clipboard = DesignerContext.getClipboard(this.getGrid()); Clipboard clipboard = DesignerContext.getClipboard(this.getGrid());
Transferable clipData = clipboard.getContents(this); Transferable clipData = clipboard.getContents(this);

2
designer-realize/src/main/java/com/fr/design/webattr/printsettings/AbstractNativePrintSettingPane.java

@ -373,7 +373,7 @@ public abstract class AbstractNativePrintSettingPane extends JPanel {
{customPageRadioButton, specifiedAreaField, areaFieldTip}, {customPageRadioButton, specifiedAreaField, areaFieldTip},
{doublePrintRadioButton, doublePrintComboBox, new JPanel()} {doublePrintRadioButton, doublePrintComboBox, new JPanel()}
}; };
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 0); return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 8);
} }
private JPanel getScalePane() { private JPanel getScalePane() {

36
designer-realize/src/main/java/com/fr/grid/selection/Selection.java

@ -1,19 +1,22 @@
package com.fr.grid.selection; package com.fr.grid.selection;
import java.io.Serializable;
import javax.swing.JPopupMenu;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.CellElementsClip;
import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.ElementsTransferable;
import com.fr.design.cell.clipboard.FloatElementsClip; 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.design.mainframe.ElementCasePane;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.design.selection.SelectableElement; import com.fr.design.selection.SelectableElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.FCloneable; import com.fr.stable.FCloneable;
import javax.swing.JPopupMenu;
import java.io.Serializable;
import java.util.Set;
/* /*
* TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢? * TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢?
* *
@ -24,10 +27,8 @@ import com.fr.stable.FCloneable;
public abstract class Selection implements FCloneable, Serializable , SelectableElement { public abstract class Selection implements FCloneable, Serializable , SelectableElement {
public abstract boolean isSelectedOneCell(ElementCasePane ePane); public abstract boolean isSelectedOneCell(ElementCasePane ePane);
// ///////////////////////////////copy/////////////////////////////////
public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane); public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane);
// ///////////////////////////////paste////////////////////////////////
public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) { public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) {
FloatElementsClip floatElementClip; FloatElementsClip floatElementClip;
try { try {
@ -53,7 +54,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane); public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane);
// ///////////////////////////////merge////////////////////////////////
public abstract boolean canMergeCells(ElementCasePane ePane); public abstract boolean canMergeCells(ElementCasePane ePane);
public abstract boolean mergeCells(ElementCasePane ePane); public abstract boolean mergeCells(ElementCasePane ePane);
@ -62,18 +62,28 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract boolean unMergeCells(ElementCasePane ePane); public abstract boolean unMergeCells(ElementCasePane ePane);
// ///////////////////////////////popup////////////////////////////////
public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); public abstract JPopupMenu createPopupMenu(ElementCasePane ePane);
// ///////////////////////////////clear//////////////////////////////// /**
* 添加插件菜单(增删改都可以)
* @param ePane
* @param popupMenu
*/
public void addExtraMenu(ElementCasePane ePane, UIPopupMenu popupMenu) {
Set<RightSelectionHandlerProvider> selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG);
for (RightSelectionHandlerProvider handler : selectionHandlerProviders) {
if (handler.accept(this)) {
handler.dmlMenu(ePane, popupMenu);
}
}
}
public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane);
// ////////////////////////////////////////////////////////////////////
public abstract int[] getSelectedRows(); public abstract int[] getSelectedRows();
public abstract int[] getSelectedColumns(); public abstract int[] getSelectedColumns();
// //////////////////////////////move//////////////////////////////////
public abstract void moveLeft(ElementCasePane ePane); public abstract void moveLeft(ElementCasePane ePane);
public abstract void moveRight(ElementCasePane ePane); public abstract void moveRight(ElementCasePane ePane);
@ -82,10 +92,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable
public abstract void moveDown(ElementCasePane ePane); public abstract void moveDown(ElementCasePane ePane);
// //////////////////////////DeleteAction///////////////////////////////
public abstract boolean triggerDeleteAction(ElementCasePane ePane); public abstract boolean triggerDeleteAction(ElementCasePane ePane);
// //////////////////////////Just4CellSelection///////////////////////////////
public abstract boolean containsColumnRow(ColumnRow cr); public abstract boolean containsColumnRow(ColumnRow cr);
public abstract void populatePropertyPane(ElementCasePane ePane); public abstract void populatePropertyPane(ElementCasePane ePane);

Loading…
Cancel
Save