Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/feature/10.0)

* commit 'bebd51531702a1ba8b915e8b1b57fde24709946c': (261 commits)
  REPORT-27647 模板组件的安装下载-模板组件复用插件 调整暴露的接口,返回合适的接口
  去掉多余接口
  REPORT-27647 模板组件的安装下载-模板组件复用插件 删掉多余的设计
  REPORT-27647 模板组件的安装下载-模板组件复用插件 1、抽出一个更通用的接口来添加面板 2、为共享加载器添加插件实现
  REPORT-27647 模板组件的安装下载-模板组件复用插件 1、空字符串 2、判空 3、接口 xml
  去掉 main 函数
  REPORT-27647 模板组件的安装下载-模板组件复用插件 ui 界面 1、 本地组件库界面 2、 小圆点设计
  方法名修改
  设计器启动后,对初始环境做一次检测
  无任务,编译失败
  REPORT-27280 程序数据集支持刷新出所需参数 支持在选中 class 后,刷新出参数
  无jira任务,import需要依赖third
  REPORT-27189 切换到单机环境,鼠标悬停在版本管理上,提示错误
  无jira任务, 冲突修复
  MOBILE-25614 && MOBILE-25605
  REPORT-27138 && REPORT-27137 && REPORT-27109 && REPORT-27140
  ct
  ct
  ct
  ct
  ...
research/11.0
richie 5 years ago
parent
commit
9a99ccdbb8
  1. 34
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 154
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 89
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  4. 3
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  5. 1
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  6. 3
      designer-base/src/main/java/com/fr/design/actions/community/UpAction.java
  7. 96
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  8. 2
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  9. 15
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  10. 2
      designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java
  11. 3
      designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java
  12. 3
      designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java
  13. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java
  14. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java
  15. 2
      designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java
  16. 7
      designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java
  17. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  18. 78
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  19. 13
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  20. 1
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java
  21. 28
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java
  22. 8
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  23. 85
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  24. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  25. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  26. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  27. 7
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  28. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  29. 9
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  30. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java
  31. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  32. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java
  33. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java
  34. 30
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  35. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  36. 14
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  37. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java
  38. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  39. 2
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  40. 1
      designer-base/src/main/java/com/fr/design/designer/EditingState.java
  41. 7
      designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java
  42. 4
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  43. 94
      designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java
  44. 290
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  45. 1
      designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java
  46. 90
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  47. 2
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  48. 5
      designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java
  49. 5
      designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java
  50. 19
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  51. 2
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  52. 15
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  53. 28
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  54. 4
      designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java
  55. 9
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  56. 7
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  57. 3
      designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java
  58. 3
      designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java
  59. 5
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  60. 17
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  61. 11
      designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java
  62. 3
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  63. 8
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  64. 8
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  65. 10
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  66. 3
      designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java
  67. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  68. 3
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  69. 1
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  70. 11
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  71. 9
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  72. 7
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  73. 5
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  74. 7
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  75. 9
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  76. 5
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  77. 7
      designer-base/src/main/java/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java
  78. 13
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  79. 35
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  80. 2
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  81. 2
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  82. 39
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  83. 57
      designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java
  84. 57
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  85. 7
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  86. 34
      designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java
  87. 23
      designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java
  88. 3
      designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java
  89. 46
      designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java
  90. 39
      designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java
  91. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java
  92. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java
  93. 10
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java
  94. 31
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java
  95. 41
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java
  96. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java
  97. 31
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  98. 8
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  99. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java
  100. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

34
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -16,9 +16,11 @@ import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
@ -153,6 +155,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* alphafine
*/
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
/**
* 阅后即焚的配置项
*/
private SnapChatConfig snapChatConfig = SnapChatConfig.getInstance();
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance();
@ -1545,11 +1552,19 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readDesignerPushUpdateAttr(reader);
} else if (name.equals(vcsConfigManager.XML_TAG)) {
readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
} else if (name.equals(SnapChatConfig.XML_TAG)) {
readSnapChatConfig(reader);
} else {
readLayout(reader, name);
}
}
}
private void readSnapChatConfig(XMLableReader reader) {
reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance());
}
private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance());
@ -1736,6 +1751,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(vcsConfigManager);
}
public void readDesignerPort(XMLableReader reader) {
reader.readXMLObject(DesignerPort.getInstance());
}
/**
* Write XML.<br>
* The method will be invoked when save data to XML file.<br>
@ -1761,9 +1780,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeOpenDebug(writer);
writeDesignerPushUpdateAttr(writer);
writeVcsAttr(writer);
writeDesignerPort(writer);
writeSnapChatConfig(writer);
writer.end();
}
private void writeSnapChatConfig(XMLPrintWriter writer) {
if (this.snapChatConfig != null) {
this.snapChatConfig.writeXML(writer);
}
}
private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer);
@ -2010,6 +2038,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.vcsConfigManager.writeXML(writer);
}
private void writeDesignerPort(XMLPrintWriter writer) {
DesignerPort.getInstance().writeXML(writer);
}
public VcsConfigManager getVcsConfigManager() {
return vcsConfigManager;

154
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -3,35 +3,51 @@ package com.fr.design;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.design.write.submit.CheckServiceDialog;
import com.fr.env.EnvListPane;
import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.invoke.Reflect;
import com.fr.json.JSONArray;
import com.fr.license.exception.RegistEditionException;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.Result;
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.base.WorkspaceAPI;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceAuthException;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
@ -83,6 +99,7 @@ public class EnvChangeEntrance {
private boolean switch2Env(final String envName, PopTipStrategy strategy) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
try {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
@ -91,18 +108,13 @@ public class EnvChangeEntrance {
strategy.showTip(new PopTip() {
@Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false;
}
// 如果版本不一致,且确认 不继续 连接,这里返回 false.
if (!versionCheckAndConfirm(selectedEnv)) {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
@ -120,15 +132,15 @@ public class EnvChangeEntrance {
if (template != null) {
template.refreshToolArea();
}
showServiceDialog(selectedEnv);
} catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
strategy.showTip(new PopTip() {
@Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
return false;
@ -137,8 +149,8 @@ public class EnvChangeEntrance {
strategy.showTip(new PopTip() {
@Override
public void show() {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
});
@ -153,6 +165,7 @@ public class EnvChangeEntrance {
}
/**
* 这个功能留着可能会加回来先做注释处理
* 切换远程环境之前进行版本检测当版本不一致的时候提示
* 当用户确认选择 ok 才继续
*
@ -196,6 +209,118 @@ public class EnvChangeEntrance {
return true;
}
/**
* 对选择的环境做服务检测
* @param selectedEnv 选择的工作环境
*/
public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception {
//是否需要做服务校验
if(needCheckBranch(selectedEnv)) {
String localBranch;
String remoteBranch;
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
localBranch = GeneralUtils.readFullBuildNO();
try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (WorkspaceConnectionException e) {
remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch);
}
//通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本)
if (localBranch.contains("#") && localBranch.equals(remoteBranch)) {
//说明版本一致,仅做日志记录
FineLoggerFactory.getLogger().info("Remote Designer version consistency");
} else {
localBranch = formatBranch(localBranch);
remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
StringBuilder textBuilder = new StringBuilder();
for (Class clazz : noExistServiceSet) {
WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class);
String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description());
textBuilder.append(descriptionOfCN).append("\n");
}
String areaText = textBuilder.toString();
CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch);
dialog.setVisible(true);
}
}
}
/**
* 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境
* 2一个月内不弹出是否勾选这里预留还未实际增加
* @param selectedEnv 选择的环境
* @return
*/
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){
return selectedEnv.getType() == DesignerWorkspaceType.Remote;
}
/**
* 获取不存在的服务列表
* @param info 环境连接信息
* @return 以Set形式返回不存在的服务
*/
public Set<Class> getNoExistServiceSet(WorkspaceConnectionInfo info){
Set<Class> noExistServiceSet = new HashSet<Class>();
Set<Class> remoteServiceSet = new HashSet<Class>();
Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet();
try {
JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList();
for(int i = 0; i < serviceArray.size(); i++){
try{
Class clazz = Class.forName((String) serviceArray.get(i));
remoteServiceSet.add(clazz);
} catch (Exception e){
continue;
}
}
noExistServiceSet.addAll(localServiceSet);
noExistServiceSet.removeAll(remoteServiceSet);
return noExistServiceSet;
} catch (WorkspaceConnectionException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
//根据本地的服务列表做逐一检测
for(Class clazz : localServiceSet) {
Method testMethod = Reflect.on(Method.class).create(clazz, "connectTest", new Class[0], String.class, new Class[0], 1025, 8, null, null, null, null).get();
WorkspaceProxyPool proxyPool = (WorkspaceProxyPool) (((RemoteWorkspace) WorkContext.getCurrent()).getClient()).getPool();
Result result = proxyPool.testInvoker(testMethod);
Exception invokeException = (Exception) result.getException();
if(invokeException != null){
Exception cause = (Exception) invokeException.getCause();
//获取被包装最底层的异常
while (cause != null) {
invokeException = cause;
cause = (Exception) invokeException.getCause();
}
//该异常表示服务不存在
if(invokeException instanceof ClassNotFoundException){
noExistServiceSet.add(clazz);
}
}
}
return noExistServiceSet;
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(),e);
return null;
}
}
/**
* 格式化分支版本号
* @param branch 初始的分支版本号
* @return 格式化后的版本号
*/
private String formatBranch(String branch){
if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13);
}
return branch;
}
/**
* 编辑items
*
@ -243,14 +368,13 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
System.exit(0);
DesignerExiter.getInstance().execute();
}
}
@Override
public void doCancel() {
System.exit(0);
}
DesignerExiter.getInstance().execute(); }
});
envListDialog.setVisible(true);
}

89
designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java

@ -7,7 +7,14 @@ package com.fr.design;
import com.fr.base.BaseUtils;
import com.fr.common.annotations.Open;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.*;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.MobileWidgetStyleProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.ServerTableDataDefineProvider;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.ToolbarItemProvider;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.core.WidgetOptionFactory;
import com.fr.design.menu.ShortCut;
@ -24,6 +31,7 @@ import com.fr.stable.Filter;
import com.fr.stable.plugin.ExtraDesignClassManagerProvider;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -127,21 +135,25 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
}
public WidgetOption[] getWebWidgetOptions(Set<ToolbarItemProvider> set, Filter<ToolbarItemProvider> filter) {
if (set == null || set.isEmpty()) {
return new WidgetOption[0];
}
List<WidgetOption> list = new ArrayList<>();
for (ToolbarItemProvider provider : set) {
if (filter != null && filter.accept(provider)) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
return new DesignExtraBridge<WidgetOption, ToolbarItemProvider>() {
@Override
WidgetOption createT(ToolbarItemProvider provider) {
return WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(),
IOUtils.readIcon(provider.iconPathForWidget()),
provider.classForWidget()
);
list.add(option);
}
}
return list.toArray(new WidgetOption[list.size()]);
@Override
WidgetOption[] toArray(Collection<?> sCollection) {
if (sCollection == null) {
return new WidgetOption[0];
}
return sCollection.toArray(new WidgetOption[sCollection.size()]);
}
}.filterSAndTransformT(set, filter);
}
@ -224,8 +236,8 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return new MobileWidgetStyleProvider[0];
}
List<MobileWidgetStyleProvider> providers = new ArrayList<>();
for (MobileWidgetStyleProvider provider: set) {
if(ComparatorUtils.equalsIgnoreCase(provider.xTypeForWidget(), xType)) {
for (MobileWidgetStyleProvider provider : set) {
if (ComparatorUtils.equalsIgnoreCase(provider.xTypeForWidget(), xType)) {
providers.add(provider);
}
}
@ -256,4 +268,55 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return Collections.unmodifiableSet(shortCuts);
}
public PreviewProvider[] getTemplatePreviews(Filter<PreviewProvider> filter) {
Set<PreviewProvider> set = ExtraDesignClassManager.getInstance().getArray(PreviewProvider.MARK_STRING);
return new DesignExtraBridge<PreviewProvider, PreviewProvider>() {
@Override
PreviewProvider createT(PreviewProvider previewProvider) {
return previewProvider;
}
@Override
PreviewProvider[] toArray(Collection<?> sCollection) {
if (sCollection == null) {
return new PreviewProvider[0];
}
return sCollection.toArray(new PreviewProvider[sCollection.size()]);
}
}.filterSAndTransformT(set, filter);
}
/**
* 抽了一个可能用到的公用逻辑出来通过filter过滤接口实现Set<s>并将对外接口实例转成内部实例S转成T,比如ToolItemProvider转成WidgetOption,当然也可以不转
*
* @param <T> 你想要得到的类型可以跟S相同
* @param <S> 待转换的目标类型
*/
abstract class DesignExtraBridge<T, S> {
T[] filterSAndTransformT(Set<S> set, Filter<S> filter) {
if (set == null || set.isEmpty()) {
return toArray(set);
}
List<T> list = new ArrayList<>();
for (S provider : set) {
if (filter == null || filter.accept(provider)) {
list.add(createT(provider));
}
}
return toArray(list);
}
/**
* S转T
* @param s
* @return
*/
abstract T createT(S s);
abstract T[] toArray(Collection<?> sCollection);
}
}

3
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -2,6 +2,7 @@ package com.fr.design;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction;
import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
@ -152,7 +153,7 @@ public class RestartHelper {
} finally {
WorkContext.getCurrent().close();
frame.dispose();
System.exit(0);
DesignerExiter.getInstance().execute();
}
}

1
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -64,6 +64,7 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
* 撤销
*/
public void prepare4Undo() {
//do nothing
}
/**

3
designer-base/src/main/java/com/fr/design/actions/community/UpAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory;
@ -38,7 +39,7 @@ public class UpAction extends UpdateAction
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);

96
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -1,7 +1,5 @@
package com.fr.design.actions.file;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
@ -47,10 +45,36 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.text.DecimalFormat;
import java.util.Locale;
@ -208,7 +232,7 @@ public class PreferencePane extends BasicPane {
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
if(SupportOSImpl.AUTOPUSHUPDATE.support()){
if (SupportOSImpl.AUTOPUSHUPDATE.support()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}
@ -486,23 +510,8 @@ public class PreferencePane extends BasicPane {
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting"));
logPane.add(logLevelPane);
logLevelComboBox = new UIComboBox(LOG);
logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal());
logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Configurations.update(new Worker() {
@Override
public void run() {
Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
}
});
}
private void createLanPane(JPanel generalPane) {
@ -530,8 +539,8 @@ public class PreferencePane extends BasicPane {
});
UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, p, p};
double[] rowSize = {p};
double[] columnSize = {p, p, p};
Component[][] components = {
{languageLabel, languageComboBox, noticeLabel},
};
@ -571,7 +580,7 @@ public class PreferencePane extends BasicPane {
private void createLengthPane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double[] rowSize = {p};
// 长度单位选择
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units"));
@ -593,8 +602,8 @@ public class PreferencePane extends BasicPane {
private void createServerPane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, p, p};
double[] rowSize = {p};
double[] columnSize = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting"));
advancePane.add(serverPortPane);
@ -633,7 +642,7 @@ public class PreferencePane extends BasicPane {
/**
* The method of populate.
*
* @param designerEnvManager
* @param designerEnvManager 设计器环境管理器
*/
public void populate(DesignerEnvManager designerEnvManager) {
if (designerEnvManager == null) {
@ -662,7 +671,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false);
}
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (FineClusterConfig.getInstance().isCluster()) {
if (WorkContext.getCurrent().isCluster()){
vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false);
}
@ -801,17 +810,24 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
}
Configurations.update(new Worker() {
@Override
public void run() {
Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem()));
}
if (WorkContext.getCurrent().isLocal()) {
Configurations.update(new Worker() {
@Override
public void run() {
Level level = (Level) logLevelComboBox.getSelectedItem();
if (level != null) {
Log4jConfig.getInstance().setRootLevel(level);
}
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
@Override
public Class<? extends Configuration>[] targets() {
@SuppressWarnings("unchecked")
Class<? extends Configuration>[] classes = new Class[]{Log4jConfig.class};
return classes;
}
});
}
Configurations.update(new Worker() {
@Override

2
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -21,7 +21,7 @@ import java.util.Map;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.showConfirmDialog;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
public final class WebPreviewUtils {

15
designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java

@ -2,6 +2,7 @@ package com.fr.design.actions.file.export;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.FRProgressBar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
@ -132,10 +133,10 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
E e = getEditingComponent();
if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) {
e.stopEditing();
int returnVal = JOptionPane.showConfirmDialog(
int returnVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + e.getEditingFILE() + "\" ?",
ProductConstants.PRODUCT_NAME,
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE
);
@ -171,7 +172,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100);
FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!");
JOptionPane.showMessageDialog(
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name);
@ -180,10 +181,10 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100);
target.closeTemplate();
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"),
UIManager.getString("OptionPane.messageDialogTitle"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);
@ -191,10 +192,10 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100);
target.closeTemplate();
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path,
UIManager.getString("OptionPane.messageDialogTitle"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.ERROR_MESSAGE,
UIManager.getIcon("OptionPane.errorIcon")
);

2
designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java

@ -51,7 +51,7 @@ public class FineUIAction extends UpdateAction {
BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
// Do nothing
}
});
dialog.setVisible(true);

3
designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java

@ -6,6 +6,7 @@ package com.fr.design.actions.help;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory;
@ -47,7 +48,7 @@ public class ForumAction extends UpdateAction {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);

3
designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java

@ -6,6 +6,7 @@ package com.fr.design.actions.help;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.menu.MenuKeySet;
import com.fr.log.FineLoggerFactory;
@ -37,7 +38,7 @@ public class SupportQQAction extends UpdateAction {
try {
Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);

2
designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java

@ -31,7 +31,7 @@ public class RemindDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// Do nothing
}
public RemindPane getRemindPane() {

2
designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java

@ -114,6 +114,7 @@ public class RemindPane extends JPanel {
@Override
public void removeLayoutComponent(Component comp) {
// Do nothing
}
@Override
@ -139,6 +140,7 @@ public class RemindPane extends JPanel {
@Override
public void addLayoutComponent(String name, Component comp) {
// Do nothing
}
};
}

2
designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java

@ -16,8 +16,6 @@ import com.fr.design.utils.gui.GUICoreUtils;
* 一个层次连续节点.
*/
public class ContinuousTreeSelectionModel extends DefaultTreeSelectionModel {
public ContinuousTreeSelectionModel() {
}
public void addSelectionPaths(TreePath[] paths) {
if (paths == null || paths.length == 0) {

7
designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java

@ -10,6 +10,7 @@ import com.fr.data.condition.ListCondition;
import com.fr.data.condition.ObjectCondition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.formula.VariableResolver;
@ -123,7 +124,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
ExpandMutableTreeNode parentTreeNode = getParentTreeNode();
boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false);
if (result) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed"));
return;
}
@ -222,7 +223,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
return;
}
int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
int returnVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"),
JOptionPane.OK_CANCEL_OPTION);
if (returnVal == JOptionPane.OK_OPTION) {
@ -610,7 +611,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
//修改的时候加入判断条件重复 REPORT-13441
boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true);
if (result) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed"));
return;
}

2
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -272,10 +272,12 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
*/
@Override
public void editingCanceled(ChangeEvent e) {
// Do nothing
}
@Override
public void editingStopped(ChangeEvent e) {
// Do nothing
}
}

78
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -20,7 +20,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataFactory;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -73,7 +73,7 @@ public abstract class DesignTableDataManager {
*/
private static java.util.Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>();
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>();
// private static List<ChangeListener> dsListeners = new ArrayList<ChangeListener>();
private static List<ChangeListener> globalDsListeners = new ArrayList<>();
private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>();
@ -83,6 +83,7 @@ public abstract class DesignTableDataManager {
//用于记录是否要弹出参数框
private static ThreadLocal<String> threadLocal = new ThreadLocal<String>();
private static Map<TableDataSource, Map<String, String[]>> columnCache = new HashMap<>();
/**
* 清除全局 数据集缓存.
@ -95,25 +96,31 @@ public abstract class DesignTableDataManager {
* 响应数据集改变.
*/
private static void fireDsChanged() {
fireDsChanged(globalDsListeners);
for (Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) {
List<ChangeListener> dsListeners = listenerEntry.getValue();
for (int i = 0; i < dsListeners.size(); i++) {
//增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener),
// 由于dsListeners是arraylist, 此时会ConcurrentModifyException
// for (ChangeListener l : dsListeners) {
ChangeEvent e = null;
dsListeners.get(i).stateChanged(e);
}
fireDsChanged(dsListeners);
}
}
private static void fireDsChanged(List<ChangeListener> dsListeners) {
for (int i = 0; i < dsListeners.size(); i++) {
//增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener),
// 由于dsListeners是arraylist, 此时会ConcurrentModifyException
ChangeEvent e = null;
dsListeners.get(i).stateChanged(e);
}
}
public static void closeTemplate(JTemplate<?, ?> template) {
if (template != null) {
columnCache.remove(getEditingTableDataSource());
dsListenersMap.remove(template.getPath());
}
}
public static void envChange() {
columnCache.clear();
dsListenersMap.clear();
dsNameChangedMap.clear();
clearGlobalDs();
@ -160,13 +167,17 @@ public abstract class DesignTableDataManager {
}
}
public static void addGlobalDsChangeListener(ChangeListener l) {
globalDsListeners.add(l);
}
/**
* 添加模板数据集改变 监听事件.
*
* @param l ChangeListener监听器
*/
public static void addDsChangeListener(ChangeListener l) {
JTemplate<?, ?> template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
String key = StringUtils.EMPTY;
if (template != null) {
key = template.getPath();
@ -178,7 +189,6 @@ public abstract class DesignTableDataManager {
}
dsListeners.add(l);
}
/**
* 获取数据源source中dsName的所有字段
*
@ -190,7 +200,51 @@ public abstract class DesignTableDataManager {
java.util.Map<String, TableDataWrapper> resMap = getAllEditingDataSet(source);
java.util.Map<String, TableDataWrapper> dsMap = getAllDataSetIncludingProcedure(resMap);
TableDataWrapper tabledataWrapper = dsMap.get(dsName);
return tabledataWrapper == null ? new String[0] : tabledataWrapper.calculateColumnNameList().toArray(new String[0]);
if (tabledataWrapper == null) {
return new String[0];
} else {
return getSelectedColumnNamesFromCache(source, dsName, tabledataWrapper);
}
}
private static String[] getSelectedColumnNamesFromCache(TableDataSource dataSource, String dsName, TableDataWrapper tableDataWrapper) {
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
map = new HashMap<>();
String[] columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]);
map.put(dsName, columnNames);
columnCache.put(dataSource, map);
return columnNames;
} else {
String[] columnNames = map.get(dsName);
if (columnNames == null) {
columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]);
map.put(dsName, columnNames);
return columnNames;
} else {
return columnNames;
}
}
}
public static void removeSelectedColumnNames(String dsName) {
Map<String, String[]> map = columnCache.get(getEditingTableDataSource());
if (map == null) {
return;
}
map.remove(dsName);
}
public static void addDsColumnNames(String dsName, String[] columnNames) {
TableDataSource dataSource = getEditingTableDataSource();
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
map = new HashMap<>();
map.put(dsName, columnNames);
columnCache.put(dataSource, map);
} else {
map.put(dsName, columnNames);
}
}
/**

13
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -17,6 +17,7 @@ import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterableComboBoxModel;
import com.fr.design.gui.icombobox.UIComboBox;
@ -103,10 +104,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
// Do nothing
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
// Do nothing
}
};
@ -114,10 +117,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private PopupMenuListener listener = new PopupMenuListener() {
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
// Do nothing
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
// Do nothing
}
@Override
@ -199,6 +204,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
protected void addFocusListener() {
// Do nothing
}
@SuppressWarnings("unchecked")
@ -332,7 +338,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DBUtils.refreshDatabase();
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem();
DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"),
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"),
JOptionPane.INFORMATION_MESSAGE);
}
@ -438,7 +444,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE);
}
}
@ -462,7 +468,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
JOptionPane.showMessageDialog(designerFrame, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
FineJOptionPane.showMessageDialog(designerFrame, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE);
failedToFindTable();
return null;
@ -492,6 +498,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
protected void failedToFindTable() {
// Do nothing
}
protected String getTableName() {

1
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java

@ -75,6 +75,7 @@ public class ChoosePaneSupportFormula extends ChoosePane {
}
protected void addFocusListener() {
// Do nothing
}
/**

28
designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java

@ -34,6 +34,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
private static final long serialVersionUID = 1L;
private boolean refresModel = false;
private String treeName; //树数据集本身的名字
private ChangeListener changeListener;
public TableDataComboBox(TableDataSource source){
this(source,StringUtils.EMPTY);
@ -136,15 +137,22 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
}
}
/**
*注册listener,相应数据集改变
*/
public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource());
}
});
}
/**
*注册listener,相应数据集改变
*/
@Override
public void registerDSChangeListener() {
changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource());
}
};
DesignTableDataManager.addDsChangeListener(changeListener);
}
public void registerGlobalDSChangeListener() {
DesignTableDataManager.addGlobalDsChangeListener(changeListener);
}
}

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

@ -5,6 +5,7 @@ import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
@ -49,7 +50,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
if (StringUtils.isEmpty(tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"));
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"));
setIllegalIndex(editingIndex);
return;
}
@ -58,12 +59,12 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName));
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName));
setIllegalIndex(editingIndex);
} else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips"));
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips"));
setIllegalIndex(editingIndex);
}
if (nameableList.getSelectedValue() instanceof ListModelElement) {
@ -255,6 +256,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
protected void checkRepeatedDSName(List<String> exsitTableDataNameList) {
// Do nothing
}
/**

85
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -16,6 +16,9 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -24,12 +27,12 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.NameObject;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
@ -38,8 +41,13 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
@ -89,23 +97,9 @@ public class TableDataTreePane extends BasicTableDataTreePane {
createAddMenuDef();
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
// 创建插件监听
createPluginListener();
return context.contain(PluginModule.ExtraDesign);
}
});
editAction = new EditAction();
removeAction = new RemoveAction();
previewTableDataAction = new PreviewTableDataAction(dataTree);
@ -145,8 +139,57 @@ public class TableDataTreePane extends BasicTableDataTreePane {
new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY);
checkButtonEnabled();
}
private void createPluginListener() {
//菜单栏监听
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
//监听数据集插件
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//REPORT-25577
//如果数据集插件禁用或启用。需要清空当前模板中的缓存
reloadCurrTemplate();
}
private void reloadCurrTemplate() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (accept(jt)) {
jt.refreshResource();
}
}
private boolean accept(JTemplate<?, ?> jt) {
return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext pluginContext) {
return pluginContext.contain(TableDataDefineProvider.XML_TAG);
}
});
}
protected void checkButtonEnabled() {
super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree);
}
@ -243,6 +286,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
if (selectedNO == null) {
return;
}
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false);
}
}
@ -263,7 +307,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
return;
}
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?",
int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.OK_OPTION) {
// richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧
@ -274,6 +318,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dataTree.setSelectionRow(dataTree.getRowCount() - 1);
fireDSChanged();
checkButtonEnabled();
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
}
}
}

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -4,6 +4,7 @@ import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
@ -43,7 +44,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Empty_Name"));
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Empty_Name"));
setIllegalIndex(editingIndex);
isNamePermitted = false;
return;
@ -53,7 +54,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
isNamePermitted = false;
nameableList.stopEditing();
String message = Toolkit.i18nText("Fine-Design_Basic_Connection_Duplicate_Name", tempName);
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setIllegalIndex(editingIndex);
}
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {

6
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -98,7 +98,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
}
protected void addKeyMonitor() {
//do nothing
}
protected JPanel createCheckBoxgroupPane() {
@ -137,7 +137,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
/**
* itemComboBox 加上 itemListener
*
*
* @param itemListener
*/
public void addItemListener(ItemListener itemListener) {
@ -214,7 +214,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
public static interface DoubleClickSelectedNodeOnTreeListener {
/**
* 处理双击事件
*
*
* @param target
*/
public void actionPerformed(TableProcedure target);

3
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -140,8 +140,6 @@ public class PreviewTableModel extends AbstractTableModel {
* 就是由于预览的JTable在不停的getRowCount来显示数据.
*/
private static class ErrorResultSet extends AbstractDataModel {
public ErrorResultSet() {
}
public int getRowCount() {
return 0;
@ -160,6 +158,7 @@ public class PreviewTableModel extends AbstractTableModel {
}
public void release() throws Exception {
// Do nothing
}
}

7
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -14,6 +14,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
@ -303,7 +304,7 @@ public class PreviewTablePane extends BasicPane {
return;
}
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
}
private void populate(TableData tableData) throws Exception {
@ -394,8 +395,8 @@ public class PreviewTablePane extends BasicPane {
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
}
dialog.setVisible(false);
} finally {

10
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java

@ -38,6 +38,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
this.setDefaultEditor(ParameterTableModel.ParameterEditor.class, new ParameterTableModel().new ParameterEditor());
this.setDefaultRenderer(StoreProcedureParameterValueEditor.class, new ProcedureParameterValueRenderer());
}
@Override
public boolean isCellEditable(int row, int col) {
if (ComparatorUtils.equals(getValueAt(row, col -1), "OUT")) {
return false;
@ -48,6 +49,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
return false;
}
@Override
public boolean shouldResponseDoubleClickAction () {
return false;
}
@ -60,7 +62,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
editor.getMenu().addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// Do nothing
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
@ -77,15 +79,16 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
}, 100);
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
//do nothing
}
@Override
@ -147,6 +150,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
editor.setCurrentEditor(0);
editor.populate(value);

9
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java

@ -57,8 +57,10 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
(Dialog) SwingUtilities.getWindowAncestor(ClassTableDataPane.this),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(bPane.getClassPath());
}
String classPath = bPane.getClassPath();
ClassTableData tableData = new ClassTableData(classPath);
populateBean(tableData);
}
});
dlg.setVisible(true);
}
@ -124,6 +126,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
java.util.List<ParameterProvider> oldParas = editorPane.update();
oldParas.add(new Parameter());
@ -132,6 +135,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}
private class RemoveParaAction extends UITableEditAction {
@ -149,6 +153,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}

25
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java

@ -1,22 +1,21 @@
package com.fr.design.data.tabledata.tabledatapane;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.gui.itextfield.UITextField;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.gui.itextfield.UITextField;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class CustomDictModel extends UITableModelAdapter<Object[]> implements ActionStyle {
/**
@ -34,11 +33,13 @@ public class CustomDictModel extends UITableModelAdapter<Object[]> implements Ac
this.setDefaultEditor(ParameterEditor.class, new ParameterEditor());
}
@Override
public Object getValueAt(int row, int column) {
Object[] os = this.getList().get(row);
return os[column];
}
@Override
public void setValueAt(Object value, int row, int column) {
Object[] os = this.getList().get(row);
os[column] = value;
@ -104,7 +105,7 @@ public class CustomDictModel extends UITableModelAdapter<Object[]> implements Ac
@Override
public void editingCanceled(ChangeEvent e) {
//do nothing
}
@Override

6
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -101,10 +101,10 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
protected void addKeyMonitor() {
searchField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
//do nothing
}
@Override
@ -117,7 +117,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
public void keyReleased(KeyEvent e) {
//do nothing
}
});
}

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java

@ -64,7 +64,7 @@ public class EmbeddedTableDataDefinedPane extends BasicPane{
// 行号显示
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(30);
tableColumn.setMaxWidth(dataJTable.getColumnCount());
// 控制按钮
add = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"));

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java

@ -220,7 +220,7 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
// 行号显示,每次dateJTable的表结构发生变化时都要调用
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(30);
tableColumn.setMaxWidth(dataJTable.getColumnCount());
}
private class DoubleRenderer extends DefaultTableCellRenderer {

30
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -14,6 +14,7 @@ import com.fr.data.impl.XMLTableData;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -222,7 +223,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
public void actionPerformed(ActionEvent arg0) {
String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params);
if (!checkURL(uri)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning"));
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning"));
return;
}
params = getEditorPaneParameter();
@ -234,10 +235,10 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (in == null) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} else {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
try {
in.close();
} catch (IOException e) {
@ -521,6 +522,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}
@ -832,7 +834,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private class XMLNodeTree extends JTree {
private DefaultTreeModel treeModel;
private DefaultTreeModel xmlTreeModel;
private DefaultTreeModel waitTreeModel = null;
@ -854,7 +856,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private MouseListener treeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (XMLNodeTree.this.getModel() != treeModel) {
if (XMLNodeTree.this.getModel() != xmlTreeModel) {
return;
}
int selRow = XMLNodeTree.this.getRowForLocation(e.getX(), e.getY());
@ -891,7 +893,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
public DefaultTreeModel getTreeModel() {
return treeModel;
return xmlTreeModel;
}
//防止界面卡死。
@ -908,7 +910,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
//wikky:为满足706设计时对不合法的xml文件(有多个根节点)的处理,把拿到的InputStream强制在最外层添加<XML></XML>作为唯一根节点而将文件转换为合法的xml。
private void initData() {
params = getEditorPaneParameter(); // 生成tree结构放哪儿呢?放这里感觉不对撒
treeModel = null;
xmlTreeModel = null;
selectedNode = null;
xmlColumnsList.clear();
DataSource dataSource = null;
@ -949,17 +951,17 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
loadedTreeModel();
}
if (treeModel == null) {
if (xmlTreeModel == null) {
FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader.");
return;
}
if (treeModel.getChildCount(treeModel.getRoot()) == 1) {
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(), 0));
if (xmlTreeModel.getChildCount(xmlTreeModel.getRoot()) == 1) {
xmlTreeModel = new DefaultTreeModel((ExpandMutableTreeNode) xmlTreeModel.getChild(xmlTreeModel.getRoot(), 0));
} else {
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
ExpandMutableTreeNode root = (ExpandMutableTreeNode) xmlTreeModel.getRoot();
root.setUserObject(StringUtils.EMPTY);
}
this.setModel(treeModel);
this.setModel(xmlTreeModel);
}
private void loadedTreeModel() {
@ -1011,7 +1013,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
currentNode = new ExpandMutableTreeNode(nodeName);
if (layer == 0) {
treeModel = new DefaultTreeModel(currentNode);
xmlTreeModel = new DefaultTreeModel(currentNode);
} else {
boolean conflict = false;
for (int i = 0; i < parentNode.getChildCount(); i++) {

5
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -144,12 +144,14 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
refresh();
}
@Override
public void checkEnabled() {
//do nothing
}
}
@ -259,14 +261,17 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
private UIButton formulaButton;
private DocumentListener documentListener = new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
updateFormula(formulaContentTextField.getText());
}
@Override
public void insertUpdate(DocumentEvent e) {
updateFormula(formulaContentTextField.getText());
}
@Override
public void removeUpdate(DocumentEvent e) {
updateFormula(formulaContentTextField.getText());
}

14
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -17,6 +17,7 @@ import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -187,6 +188,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
populateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
try {
storeProcedureContext.setText(StringUtils.EMPTY);
@ -204,6 +206,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return null;
}
@Override
public void done() {
editorPane.populate(storeprocedure.getParameters());
}
@ -218,6 +221,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
*
* @param listener 监听器
*/
@Override
public void addStoreProcedureWorkerListener(StoreProcedureWorkerListener listener) {
this.storeProcedureWorkerListener = listener;
@ -227,6 +231,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
/**
* 去除存储过程监听器
*/
@Override
public void removeStoreProcedureWorkerListener() {
this.storeProcedureWorkerListener = null;
@ -239,7 +244,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
try {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
} catch (Exception e) {
JOptionPane.showMessageDialog(ProcedureDataPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
FineJOptionPane.showMessageDialog(ProcedureDataPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
}
}
@ -264,6 +269,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
updateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(true);
@ -271,6 +277,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return null;
}
@Override
public void done() {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(false);
@ -328,6 +335,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
/**
* 响应数据集改变
*/
@Override
public void fireDSChanged() {
fireDSChanged(new HashMap<String, String>());
}
@ -337,6 +345,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
*
* @param map 改变的map
*/
@Override
public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map);
}
@ -348,6 +357,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
StoreProcedure sp = updateBeanWithOutExecute();
StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText());
@ -361,12 +371,14 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
refresh();
}
@Override
public void checkEnabled() {
//do nothing
}
}
}

1
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java

@ -65,6 +65,7 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper {
}
}
columnNameList = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
DesignTableDataManager.addDsColumnNames(name, columnNameList.toArray(new String[0]));
return columnNameList;
}

5
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -9,6 +9,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.mainframe.DesignerContext;
@ -102,7 +103,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
return columnNameList;
}
if (!createStore(false)) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData"));
return new ArrayList<String>();
}
columnNameList = Arrays.asList(procedureDataModel.getColumnName());
@ -219,7 +220,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
}
loadingBar.close();
}

2
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java

@ -27,6 +27,6 @@ public class UniversalDatabaseDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
//do nothing
}
}

1
designer-base/src/main/java/com/fr/design/designer/EditingState.java

@ -7,6 +7,7 @@ public interface EditingState {
@Override
public void revert() {
//do nothing
}
};

7
designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java

@ -4,6 +4,7 @@
package com.fr.design.designer.creator;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.core.PropertyChangeListener;
import java.beans.IntrospectionException;
@ -40,6 +41,12 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
return this;
}
@Deprecated
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
this.l = l;
return this;
}
public void firePropertyChanged() {
if (l != null) {
l.propertyChange();

4
designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java

@ -121,12 +121,12 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
@Override
public void addLayoutComponent(String name, Component comp) {
//do nothing
}
@Override
public void removeLayoutComponent(Component comp) {
//do nothing
}
@Override

94
designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java

@ -0,0 +1,94 @@
package com.fr.design.dialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/1/8
*/
public abstract class ErrorDialog extends JDialog implements ActionListener {
private UIButton okButton;
private UIButton restartButton;
public ErrorDialog(Frame parent, String message, String title, String detail) {
super(parent, true);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
UILabel boldFontLabel = new UILabel(message);
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us"));
Font font = FRFont.getInstance("Dialog", Font.BOLD, 20);
boldFontLabel.setFont(font);
messagePane.add(boldFontLabel);
messagePane.add(label);
northPane.add(messagePane);
JTextArea area = new JTextArea(detail);
area.setPreferredSize(new Dimension(400, 100));
area.setEnabled(true);
area.setEditable(false);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message"));
centerPane.add(detailLabel, BorderLayout.NORTH);
centerPane.add(area, BorderLayout.CENTER);
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Ok"));
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
okEvent();
}
});
buttonPane.add(okButton);
restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Restart"));
restartButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
restartEvent();
}
});
buttonPane.add(restartButton);
controlPane.add(buttonPane, BorderLayout.EAST);
southPane.add(controlPane);
this.setTitle(title);
this.setResizable(false);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500));
GUICoreUtils.centerWindow(this);
}
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
protected abstract void okEvent();
protected abstract void restartEvent();
}

290
designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java

@ -0,0 +1,290 @@
package com.fr.design.dialog;
import com.fr.invoke.Reflect;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import java.awt.Component;
import java.awt.HeadlessException;
import java.util.HashMap;
import java.util.Map;
/**
* @author Joe
* @version 10.0
* Created by Joe on 12/5/2019
*/
public class FineJOptionPane extends JOptionPane {
public final static String[] OPTION_DEFAULT = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK") };
public final static String[] OPTION_YES_NO = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No") };
public final static String[] OPTION_YES_NO_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") };
public final static String[] OPTION_OK_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") };
//选项类型optionType 和 选项字符串数组 一一对应
private final static Map<Integer, String[]> OPTION_MAP = new HashMap<>();
static {
OPTION_MAP.put(DEFAULT_OPTION, OPTION_DEFAULT);
OPTION_MAP.put(YES_NO_OPTION, OPTION_YES_NO);
OPTION_MAP.put(YES_NO_CANCEL_OPTION, OPTION_YES_NO_CANCEL);
OPTION_MAP.put(OK_CANCEL_OPTION, OPTION_OK_CANCEL);
}
private final static String MESSAGE_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message");
private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm");
private final static String INPUT_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips");
/**
* 使用默认 标题 消息类型 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message)
throws HeadlessException {
showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE,
INFORMATION_MESSAGE);
}
/**
* 使用默认 Icon 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType)
throws HeadlessException {
showMessageDialog(parentComponent, message, title, messageType, null);
}
/**
* 使用默认 选项类型选项 初始选项 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @param icon 图标
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType, Icon icon)
throws HeadlessException {
showMessageDialog(parentComponent, message, title, DEFAULT_OPTION,
messageType, icon, OPTION_DEFAULT, null);
}
/**
* 自定义的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message,
String title, int optionType, int messageType,
Icon icon, Object[] options, Object initialValue)
throws HeadlessException {
showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, options, initialValue);
}
/**
* 使用默认 标题 选项类型 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message)
throws HeadlessException {
return showConfirmDialog(parentComponent, message,
CONFIRM_DIALOG_TITLE,
YES_NO_CANCEL_OPTION);
}
/**
* 使用默认 消息类型 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType) throws HeadlessException {
return showConfirmDialog(parentComponent, message, title, optionType,
QUESTION_MESSAGE);
}
/**
* 使用默认 Icon 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType)
throws HeadlessException {
return showConfirmDialog(parentComponent, message, title, optionType,
messageType, null);
}
/**
* 根据 选项类型 获取对应 选项 且使用默认 初始选项 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon)
throws HeadlessException {
String[] options = OPTION_MAP.get(optionType);
return showConfirmDialog(parentComponent, message, title, optionType,
messageType, icon, options, options[0]);
}
/**
* 自定义的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon,
Object[] options, Object initialValue)
throws HeadlessException {
return showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, options, initialValue);
}
/**
* 指定消息内容的输入弹出框
* @param message 消息内容
* @return
* @throws HeadlessException
*/
public static String showInputDialog(Object message)
throws HeadlessException {
return showInputDialog(null, message);
}
/**
* 使用默认 标题 消息类型 的输入弹出框
* @param parentComponent 父容器
* @param message 消息内容
* @return
* @throws HeadlessException
*/
public static String showInputDialog(Component parentComponent,
Object message) throws HeadlessException {
return showInputDialog(parentComponent, message, INPUT_DIALOG_TITLE, QUESTION_MESSAGE);
}
/**
* 使用默认 标题消息类型Icon 选项 的输入弹出框
* @param parentComponent 父容器
* @param message 消息类型
* @param initialSelectionValue 初始选项
* @return
*/
public static String showInputDialog(Component parentComponent, Object message,
Object initialSelectionValue) {
return (String)showInputDialog(parentComponent, message,
INPUT_DIALOG_TITLE, QUESTION_MESSAGE, null, null,
initialSelectionValue);
}
/**
* 使用默认 父容器消息内容 初始选项 的输入弹出框
* @param message 消息内容
* @param initialSelectionValue 初始选项
* @return
*/
public static String showInputDialog(Object message, Object initialSelectionValue) {
return showInputDialog(null, message, initialSelectionValue);
}
/**
* 使用默认 Icon选项 初始选项 的输入弹出框
* @param parentComponent 父容器
* @param message 消息内容
* @param title 标题
* @param messageType 消息类型
* @return
* @throws HeadlessException
*/
public static String showInputDialog(Component parentComponent,
Object message, String title, int messageType)
throws HeadlessException {
return (String)showInputDialog(parentComponent, message, title,
messageType, null, null, null);
}
/**
* 自定义的输入弹出框
* @param parentComponent 父容器
* @param message 消息内容
* @param title 标题
* @param messageType 消息类型
* @param icon 图标
* @param selectionValues 选项
* @param initialSelectionValue 初始选项
* @return
* @throws HeadlessException
*/
public static Object showInputDialog(Component parentComponent,
Object message, String title, int messageType, Icon icon,
Object[] selectionValues, Object initialSelectionValue)
throws HeadlessException {
JOptionPane pane = new JOptionPane(message, messageType,
OK_CANCEL_OPTION, icon,
OPTION_OK_CANCEL, null);
pane.setWantsInput(true);
pane.setSelectionValues(selectionValues);
pane.setInitialSelectionValue(initialSelectionValue);
pane.setComponentOrientation(((parentComponent == null) ?
getRootFrame() : parentComponent).getComponentOrientation());
int style = Reflect.on(JOptionPane.class).call("styleFromMessageType", messageType).get();
JDialog dialog = Reflect.on(pane).call("createDialog", parentComponent, title, style).get();
pane.selectInitialValue();
dialog.show();
dialog.dispose();
Object value = pane.getInputValue();
if (value == UNINITIALIZED_VALUE) {
return null;
}
return value;
}
}

1
designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java

@ -363,5 +363,6 @@ public class JWizardDialog extends BasicDialog {
@Override
public void checkValid() throws Exception {
//do nothing
}
}

90
designer-base/src/main/java/com/fr/design/dialog/TipDialog.java

@ -0,0 +1,90 @@
package com.fr.design.dialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/1/8
*/
public abstract class TipDialog extends JDialog implements ActionListener {
private UIButton endButton;
private UIButton cancelButton;
public TipDialog(Frame parent, String type, String tip, String endText, String cancelText) {
super(parent, true);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel iconPane = new JPanel();
UILabel iconLabel = new UILabel();
iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error2.png"));
iconPane.add(iconLabel);
iconPane.setPreferredSize(new Dimension(50, 50));
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel tipLabel = new UILabel(tip);
tipPane.add(tipLabel);
northPane.add(iconPane, BorderLayout.WEST);
northPane.add(tipPane, BorderLayout.CENTER);
JTextArea area = new JTextArea(type);
area.setPreferredSize(new Dimension(400, 100));
area.setEnabled(true);
area.setEditable(false);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.add(area);
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
endButton = new UIButton(endText);
endButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
endEvent();
}
});
buttonPane.add(endButton);
cancelButton = new UIButton(cancelText);
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelEvent();
}
});
buttonPane.add(cancelButton);
controlPane.add(buttonPane, BorderLayout.EAST);
southPane.add(controlPane);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Error_Tittle"));
this.setResizable(false);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500));
GUICoreUtils.centerWindow(this);
}
protected abstract void endEvent();
protected abstract void cancelEvent();
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
}

2
designer-base/src/main/java/com/fr/design/dialog/UIDialog.java

@ -167,7 +167,7 @@ public abstract class UIDialog extends JDialog {
try {
checkValid();
} catch (Exception exp) {
JOptionPane.showMessageDialog(this, exp.getMessage());
FineJOptionPane.showMessageDialog(this, exp.getMessage());
return;
}

5
designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java

@ -3,6 +3,7 @@ package com.fr.design.editor;
import com.fr.base.BaseFormula;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editor.editor.ColumnIndexEditor;
import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
@ -302,8 +303,8 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver,
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
if (designerEnvManager.isSupportStringToFormula()) {
if (!designerEnvManager.isDefaultStringToFormula()) {
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula")
+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION);
int returnValue = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula")
+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j);

5
designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java

@ -3,6 +3,7 @@ package com.fr.design.editor;
import com.fr.base.BaseFormula;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editor.editor.ColumnNameEditor;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
@ -283,8 +284,8 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
if (designerEnvManager.isSupportStringToFormula()) {
if (!designerEnvManager.isDefaultStringToFormula()) {
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula")
+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION);
int returnValue = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula")
+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION);
if (returnValue == JOptionPane.OK_OPTION) {
setCurrentEditor(j);

19
designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java

@ -1,18 +1,17 @@
package com.fr.design.editor.editor;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.js.WidgetName;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* the editor to edit WidgetName
*
@ -43,12 +42,12 @@ public class WidgetNameEditor extends Editor<WidgetName> {
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
//do nothing
}
@Override

2
designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -64,7 +64,9 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
writer.attr("path", path);
}
@Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException {
LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone();

15
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -1,10 +1,12 @@
package com.fr.design.env;
import com.fr.log.FineLoggerFactory;
import com.fr.security.SecurityToolbox;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@ -79,6 +81,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
}
@Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException {
RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone();
@ -89,8 +92,14 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override
public boolean checkValid(){
return true;
public boolean checkValid() {
boolean result = false;
try {
result = WorkContext.getConnector().testConnection(connection);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return result;
}
return result;
}
}

28
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,8 @@
package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.i18n.Toolkit;
import com.fr.rpc.ExceptionHandler;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
@ -8,6 +10,8 @@ import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.authority.decision.DecisionOperator;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import com.fr.workspace.pool.WorkObjectPool;
/**
* Created by juhaoyu on 2018/6/14.
@ -66,7 +70,12 @@ public class RemoteWorkspace implements Workspace {
}
return isRoot;
}
@Override
public boolean isCluster() {
return FineClusterConfig.getInstance().isCluster();
}
@Override
public WorkspaceConnection getConnection() {
@ -78,6 +87,19 @@ public class RemoteWorkspace implements Workspace {
return client.getPool().get(type);
}
@Override
public <T> T get(Class<T> type, ExceptionHandler exceptionHandler){
if(exceptionHandler != null) {
WorkObjectPool objectPool = client.getPool();
if (objectPool instanceof WorkspaceProxyPool) {
return ((WorkspaceProxyPool) objectPool).get(type, exceptionHandler);
}else {
return client.getPool().get(type);
}
}
return client.getPool().get(type);
}
@Override
public void close() {
@ -96,4 +118,8 @@ public class RemoteWorkspace implements Workspace {
return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
}
public WorkspaceClient getClient(){
return client;
}
}

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

@ -10,10 +10,10 @@ package com.fr.design.extra;
public class AppStoreBuilder {
public void checkStoreJavaSciptVersion() {
//do nothing
}
public void updateStoreJavaScript() {
//do nothing
}
}

9
designer-base/src/main/java/com/fr/design/extra/LoginDialog.java

@ -4,12 +4,8 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import javax.swing.*;
import java.awt.*;
/**
* Created by vito on 2017/5/5.
@ -41,5 +37,6 @@ public class LoginDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// do nothing
}
}

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

@ -14,10 +14,8 @@ 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;
import java.awt.Desktop;
import javax.swing.*;
import java.awt.*;
import java.net.URI;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -221,5 +219,6 @@ public class LoginWebBridge {
}
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
// do nothing
}
}

3
designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java

@ -1,5 +1,6 @@
package com.fr.design.extra;
import com.fr.design.dialog.FineJOptionPane;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
@ -46,7 +47,7 @@ public class LoginWebPane extends JFXPanel {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(LoginWebPane.this, message);
FineJOptionPane.showMessageDialog(LoginWebPane.this, message);
}
});
}

3
designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
@ -88,7 +87,7 @@ public abstract class PluginAbstractLoadingViewPane<V, T> extends PluginAbstract
@Override
public void pressInstallButton() {
// do nothing
}
@Override

5
designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java

@ -7,7 +7,6 @@ import com.fr.design.gui.ilist.UIList;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.license.Licensed;
import com.fr.plugin.manage.PluginManager;
@ -23,7 +22,7 @@ import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -155,7 +154,7 @@ public class PluginControlPane extends BasicPane {
PluginManager.getController().uninstall(PluginMarker.create(id, version), true, new PluginTaskCallback() {
@Override
public void done(PluginTaskResult result) {
// do nothing
}
});
}

17
designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java

@ -1,6 +1,7 @@
package com.fr.design.extra;
import com.fr.config.MarketConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
@ -13,11 +14,7 @@ import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File;
import java.util.List;
@ -98,7 +95,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
@Override
public void pressInstallButton() {
// do nothing
}
@Override
@ -174,21 +171,21 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
PluginManager.getController().install(chosenFile, new ProgressCallback() {
@Override
public void updateProgress(String description, double progress) {
// do nothing
}
@Override
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
} else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
});
} catch (Exception e1) {
JOptionPane.showMessageDialog(PluginFromStorePane.this, e1.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(PluginFromStorePane.this, e1.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}

11
designer-base/src/main/java/com/fr/design/extra/PluginInstalledPane.java

@ -1,6 +1,7 @@
package com.fr.design.extra;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.plugin.context.PluginContext;
@ -67,9 +68,9 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
@Override
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
JOptionPane.showMessageDialog(null, modifyMessage);
FineJOptionPane.showMessageDialog(null, modifyMessage);
} else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
});
@ -78,9 +79,9 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
@Override
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
JOptionPane.showMessageDialog(null, modifyMessage);
FineJOptionPane.showMessageDialog(null, modifyMessage);
} else {
JOptionPane.showMessageDialog(null,PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null,PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
});
@ -135,7 +136,7 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
try {
controlPane.deletePlugin(plugin);
} catch (Exception e) {
JOptionPane.showMessageDialog(PluginInstalledPane.this, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(PluginInstalledPane.this, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
if (rv == JOptionPane.OK_OPTION) {

3
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -1,6 +1,7 @@
package com.fr.design.extra;
import com.fr.config.MarketConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.bridge.exec.JSCallback;
@ -91,7 +92,7 @@ public class PluginOperateUtils {
@Override
public void run() {
int rv = JOptionPane.showConfirmDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Confirmed"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),

8
designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java

@ -1,10 +1,10 @@
package com.fr.design.extra;
import com.fr.config.MarketConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
@ -192,16 +192,16 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
PluginManager.getController().update(chosenFile, new ProgressCallback() {
@Override
public void updateProgress(String description, double progress) {
// do nothing
}
@Override
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
} else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
});

8
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -1,6 +1,7 @@
package com.fr.design.extra;
import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
@ -12,6 +13,7 @@ import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.error.PluginBaseErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants;
@ -109,7 +111,7 @@ public class PluginUtils {
throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
}
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -193,7 +195,7 @@ public class PluginUtils {
}
}
public static String getMessageByErrorCode(PluginErrorCode errorCode) {
public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) {
if(errorCode == PluginErrorCode.None){
return "";
}
@ -201,7 +203,7 @@ public class PluginUtils {
return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode));
}
private static String getInterKeyByErrorCode(PluginErrorCode errorCode) {
private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) {
return errorCode.getDescription();
}

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

@ -55,7 +55,7 @@ public class PluginWebBridge {
private static PluginWebBridge helper;
private UIDialog uiDialog;
private ACTIONS action;
private ACTIONS actions;
private Map<String, Object> config;
private WebEngine webEngine;
@ -94,10 +94,10 @@ public class PluginWebBridge {
* @return 配置信息
*/
public String getRunConfig() {
if (action != null) {
if (actions != null) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put(ACTION, action.getContext());
jsonObject.put(ACTION, actions.getContext());
Set<String> keySet = config.keySet();
for (String key : keySet) {
jsonObject.put(key, config.get(key).toString());
@ -117,7 +117,7 @@ public class PluginWebBridge {
* @param config 参数
*/
public void setRunConfig(ACTIONS action, Map<String, Object> config) {
this.action = action;
this.actions = action;
this.config = config;
}
@ -125,7 +125,7 @@ public class PluginWebBridge {
* 清楚打开动作
*/
public void clearRunConfig() {
this.action = null;
this.actions = null;
this.config = null;
}

3
designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java

@ -1,6 +1,7 @@
package com.fr.design.extra;
import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
@ -104,7 +105,7 @@ public class PluginWebPane extends JFXPanel {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(PluginWebPane.this, message);
FineJOptionPane.showMessageDialog(PluginWebPane.this, message);
}
});
}

2
designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java

@ -3,7 +3,6 @@ package com.fr.design.extra;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
@ -27,6 +26,7 @@ public class QQLoginDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// do nothing
}
}

3
designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java

@ -1,5 +1,6 @@
package com.fr.design.extra;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
@ -138,7 +139,7 @@ public class QQLoginWebPane extends JFXPanel {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(QQLoginWebPane.this, message);
FineJOptionPane.showMessageDialog(QQLoginWebPane.this, message);
}
});
}

1
designer-base/src/main/java/com/fr/design/extra/ShopDialog.java

@ -29,5 +29,6 @@ public class ShopDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// do nothing
}
}

11
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.mainframe.DesignerContext;
@ -62,7 +63,7 @@ public class WebViewDlgHelper {
String mainJsPath = StableUtils.pathJoin(installHome, MAIN_JS_PATH);
File file = new File(mainJsPath);
if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
@ -79,7 +80,7 @@ public class WebViewDlgHelper {
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg();
} else {
int rv = JOptionPane.showConfirmDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install_Version"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
@ -199,7 +200,7 @@ public class WebViewDlgHelper {
private static void confirmDownLoadShopJS() {
int rv = JOptionPane.showConfirmDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),
@ -277,7 +278,7 @@ public class WebViewDlgHelper {
CommonUtils.deleteFile(scriptZip);
}
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
}
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -300,7 +301,7 @@ public class WebViewDlgHelper {
JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) {
int rv = JOptionPane.showConfirmDialog(
int rv = FineJOptionPane.showConfirmDialog(
null,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Update"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"),

9
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
@ -41,7 +42,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
null,
@ -50,7 +51,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -70,7 +71,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -80,7 +81,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE);
}
}
}

7
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.log.FineLoggerFactory;
@ -38,7 +39,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
FineJOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog(
null,
@ -47,7 +48,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -58,7 +59,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}

5
designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginUtils;
import com.fr.plugin.manage.control.PluginTaskCallback;
@ -24,9 +25,9 @@ public class ModifyStatusCallback implements PluginTaskCallback{
if (result.isSuccess()) {
jsCallback.execute("success");
String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate");
JOptionPane.showMessageDialog(null, modifyMessage);
FineJOptionPane.showMessageDialog(null, modifyMessage);
} else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}

7
designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginUtils;
import com.fr.log.FineLoggerFactory;
@ -27,7 +28,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) {
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Success"));
}else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) {
int rv = JOptionPane.showOptionDialog(
null,
@ -36,7 +37,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -46,7 +47,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
} else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

9
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
@ -39,7 +40,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) {
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
null,
@ -48,7 +49,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -68,7 +69,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -78,7 +79,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
}else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

5
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

@ -1,6 +1,7 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.log.FineLoggerFactory;
@ -33,11 +34,11 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
if (result.isSuccess()) {
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
JOptionPane.showMessageDialog(null,pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
FineJOptionPane.showMessageDialog(null,pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Success"));
} else {
jsCallback.execute("failed");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, pluginInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

7
designer-base/src/main/java/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java

@ -1,5 +1,6 @@
package com.fr.design.extra.tradition.callback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.PluginStatusCheckCompletePane;
import com.fr.design.extra.PluginUtils;
@ -32,7 +33,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
public void done(PluginTaskResult result){
if (result.isSuccess()) {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
null,
@ -41,7 +42,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
null,
FineJOptionPane.OPTION_YES_NO_CANCEL,
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -50,7 +51,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane));
} else {
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("FR-Designer-Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
FineJOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

13
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -386,4 +386,17 @@ public class HistoryTemplateListCache implements CallbackEvent {
}
FineLoggerFactory.getLogger().info("Env Change Template Loaded.");
}
/**
* 重新载入当前模板刷新数据/对象
*/
public void reloadCurrentTemplate() {
JTemplate<?, ?> jt = getCurrentEditingTemplate();
boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
if (access) {
closeSelectedReport(jt);
DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE());
}
}
}

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

@ -5,6 +5,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit;
@ -21,26 +22,9 @@ import com.fr.third.javax.annotation.Nonnull;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.AWTEvent;
import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -257,7 +241,7 @@ public class MutilTempalteTabPane extends JComponent {
private String tempalteShowName(JTemplate<?, ?> template) {
String name = template.getEditingFILE().getName();
String name = template.getTemplateName();
if (!template.isSaved() && !name.endsWith(" *")) {
name += " *";
}
@ -678,8 +662,8 @@ public class MutilTempalteTabPane extends JComponent {
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() + "\" ?",
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?",
Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
specifiedTemplate.saveTemplate();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
@ -854,7 +838,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseEntered(MouseEvent e) {
// do nothing
}
/**
@ -877,6 +861,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseReleased(MouseEvent e) {
// do nothing
}
/**
@ -886,6 +871,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
}
/**
@ -931,7 +917,7 @@ public class MutilTempalteTabPane extends JComponent {
//如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
JOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
FineJOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MutilTempalteTabPane.this.repaint();
return;
@ -957,6 +943,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseDragged(MouseEvent e) {
// do nothing
}
/**

2
designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java

@ -135,7 +135,7 @@ public class NodeAuthProcessor {
* @param fileNode file nodes
* @return 带权限信息的文件节点
*/
public boolean fixFileNodeAuth(FileNode fileNode) {
public boolean checkFileNodeAuth(FileNode fileNode) {
boolean isLocal = WorkContext.getCurrent().isLocal();
boolean isRoot = WorkContext.getCurrent().isRoot();

2
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

File diff suppressed because one or more lines are too long

39
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -4,6 +4,7 @@
package com.fr.design.file;
import com.fr.base.FRContext;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
@ -44,6 +45,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Objects;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static javax.swing.JOptionPane.YES_NO_OPTION;
@ -253,16 +255,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
? Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Folder")
: Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_File");
if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent,
UIManager.getString("OptionPane.messageDialogTitle"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
YES_NO_OPTION)
== JOptionPane.YES_OPTION) {
// 删除所有选中的即可
if (!deleteNodes(Arrays.asList(treeNodes))) {
JOptionPane.showConfirmDialog(null,
FineJOptionPane.showConfirmDialog(null,
Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"),
Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE);
}
@ -276,30 +278,41 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (deletableNodes.isEmpty()) {
// 提醒被锁定模板无法删除
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Unable_Delete_Locked_File"),
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE);
return;
}
if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
tipContent,
UIManager.getString("OptionPane.messageDialogTitle"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
YES_NO_OPTION)
== JOptionPane.YES_OPTION) {
// 删除其他
if (!deleteNodes(deletableNodes)) {
JOptionPane.showConfirmDialog(null,
FineJOptionPane.showConfirmDialog(null,
Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"),
UIManager.getString("OptionPane.messageDialogTitle"),
Toolkit.i18nText("Fine-Design_Basic_Error"),
JOptionPane.DEFAULT_OPTION,
JOptionPane.ERROR_MESSAGE);
}
}
}
reportletsTree.refresh();
refreshAfterDelete();
}
private void refreshAfterDelete() {
TreePath[] paths = reportletsTree.getSelectionPaths();
if (paths == null) {
reportletsTree.refresh();
} else {
for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) {
reportletsTree.refreshParent(path);
}
}
}
private boolean deleteNodes(Collection<ExpandMutableTreeNode> nodes) {
@ -403,9 +416,9 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
if (!lockedNodes.isEmpty()) {
JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Warn_Rename_Lock_File"),
UIManager.getString("OptionPane.messageDialogTitle"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);
return true;
}

57
designer-base/src/main/java/com/fr/design/formula/FormulaConstants.java

@ -0,0 +1,57 @@
package com.fr.design.formula;
import com.fr.stable.StringUtils;
/**
* @author Joe
* @version 10.0
* Created by Joe on 10/30/2019
*/
public enum FormulaConstants {
PAGE_NUMBER("$$page_number", "Page_Number"),
TOTAL_PAGE_NUMBER("$$totalPage_number", "Total_Page_Number"),
FINE_USERNAME("$fine_username", "Fine_Username"),
FINE_ROLE("$fine_role", "Fine_Role"),
FINE_POSITION("$fine_position", "Fine_Position"),
NULL("NULL", "Null"),
NOFILTER("NOFILTER", "No_Filter"),
REPORT_NAME("reportName", "Report_Name"),
FORMLET_NAME("formletName", "Formlet_Name"),
SERVLET_URL("servletURL", "Servlet_URL"),
SERVER_SCHEMA("serverSchema", "Server_Schema"),
SERVER_NAME("serverName", "Server_Name"),
SERVER_PORT("serverPort", "Server_Port"),
SERVER_URL("serverURL", "Server_URL"),
CONTEXT_PATH("contextPath", "Context_Path"),
SESSION_ID("sessionID", "SessionID");
private String key;
private String value;
private static final String KEY_PREFIX = "Fine-Design_CurReport_Variable_";
private FormulaConstants(String key, String value) {
this.key = key;
this.value = KEY_PREFIX + value;
}
public String getKey() {
return key;
}
public String getValue() {
return value;
}
public static String getValueByKey(String key) {
for (FormulaConstants formulaConstant : values()) {
if (formulaConstant.getKey().equals(key)) {
return formulaConstant.getValue();
}
}
return StringUtils.EMPTY;
}
}

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

@ -8,6 +8,7 @@ import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -19,6 +20,7 @@ import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.parser.FRLexer;
import com.fr.parser.FRParser;
@ -27,17 +29,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent;
@ -47,10 +39,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@ -148,10 +137,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
keyWordTextField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
//do nothing
}
@Override
public void keyReleased(KeyEvent e) {
//do nothing
}
@Override
@ -236,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected void extendCheckBoxPane(JPanel checkBoxPane) {
// do nothing
}
private void configFormulaArea() {
@ -412,6 +403,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override
public void keyTyped(KeyEvent e) {
// do nothing
}
protected void search(String keyWord, boolean findDescription) {
@ -582,14 +574,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
// alex:继续往下面走,expression为null时告知不合法公式
}
JOptionPane.showMessageDialog(
FineJOptionPane.showMessageDialog(
FormulaPane.this,
/*
* alex:仅仅只需要根据expression是否为null作合法性判断
* 不需要eval
* TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之
*/
(expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".", ProductConstants.PRODUCT_NAME,
(expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.INFORMATION_MESSAGE);
}
}
@ -779,31 +772,31 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initVariablesTreeSelectionListener() {
variablesTree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
Object selectedValue = ((DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent()).getUserObject();
DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) variablesTree.getLastSelectedPathComponent();
Object selectedValue = selectedTreeNode.getUserObject();
Object selectedParentValue = ((DefaultMutableTreeNode)selectedTreeNode.getParent()).getUserObject();
if (selectedValue == null) {
return;
}
StringBuilder desBuf = new StringBuilder();
try {
String path;
Locale locale = FRContext.getLocale();
if (locale.equals(Locale.CHINA)) {
path = "/com/fr/design/insert/formula/variable/cn/";
if (selectedValue instanceof TextUserObject) {
//有公式说明的条件:1.属于TextUserObject 2.parent是系统参数
if (ComparatorUtils.equals(((TextFolderUserObject) selectedParentValue).getText(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaPane_Variables"))) {
descriptionTextArea.setText(com.fr.design.i18n.Toolkit.i18nText(FormulaConstants.getValueByKey(((TextUserObject) selectedValue).getText())));
} else {
path = "/com/fr/design/insert/formula/variable/en/";
descriptionTextArea.setText(StringUtils.EMPTY);
}
if (selectedValue instanceof TextUserObject) {
desBuf = getText((TextUserObject) selectedValue, path);
}
} catch (IOException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} else if (selectedValue instanceof TextFolderUserObject) {
descriptionTextArea.setText(StringUtils.EMPTY);
}
descriptionTextArea.setText(desBuf.toString());
descriptionTextArea.moveCaretPosition(0);
}
});
}
private void initVariablesTree() {
// vairable.
variablesTree = new JTree();

7
designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java

@ -2,6 +2,7 @@ package com.fr.design.formula;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -161,11 +162,11 @@ public class JavaEditorPane extends BasicPane {
}
try {
WorkContext.getWorkResource().write(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, getJavaPath()), text.getBytes(EncodeConstants.ENCODING_UTF_8));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Successfully") + "!");
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Successfully") + "!");
fireSaveActionListener();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Failed") + "!");
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Failed") + "!");
}
}
@ -191,7 +192,7 @@ public class JavaEditorPane extends BasicPane {
if (StringUtils.isEmpty(message)) {
message = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Compile_Success") + "!";
}
JOptionPane.showMessageDialog(null, message);
FineJOptionPane.showMessageDialog(null, message);
} catch (InterruptedException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
Thread.currentThread().interrupt();

34
designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* 移动端书签样式扩展接口
*
* @author hades
* @version 10.0
* Created by hades on 2019/12/23
*/
public interface MobileBookMarkStyleProvider extends Mutable {
String XML_TAG = "MobileBookMarkStyleProvider";
int CURRENT_LEVEL = 1;
/**
* 书签样式
* @return
*/
Class<? extends MobileBookMarkStyle> classForMobileBookMarkStyle();
/**
* 书签样式面板
* @return
*/
Class<? extends BasicBeanPane<MobileBookMarkStyle>> classForMobileBookMarkStyleAppearance();
String displayName();
}

23
designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java

@ -0,0 +1,23 @@
package com.fr.design.fun;
import com.fr.common.annotations.Open;
import com.fr.stable.fun.mark.Mutable;
import java.util.List;
/**
* Created by kerry on 2019-11-11
*/
@Open
public interface MultiStyleUIConfigProvider extends Mutable {
String XML_TAG = "MultiStyleUIConfigProvider";
int CURRENT_LEVEL = 1;
/**
* 获取配置项list
*
* @return 配置项list
*/
List<StyleUIConfigProvider> getConfigList();
}

3
designer-base/src/main/java/com/fr/design/fun/PreviewProvider.java

@ -1,6 +1,7 @@
package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.stable.Filter;
import com.fr.stable.fun.mark.Mutable;
import java.util.Map;
@ -11,7 +12,7 @@ import java.util.Map;
* @since 8.0
* 自定义预览方式接口
*/
public interface PreviewProvider extends Mutable {
public interface PreviewProvider extends Mutable, Filter<JTemplate> {
String MARK_STRING = "PreviewProvider";

46
designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java

@ -0,0 +1,46 @@
package com.fr.design.fun;
import com.fr.design.mainframe.PaneHolder;
import com.fr.design.mainframe.PropertyItemBean;
import com.fr.stable.fun.mark.Mutable;
import org.jetbrains.annotations.Nullable;
/**
* created by Harrison on 2020/03/23
**/
public interface PropertyItemPaneProvider<T> extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "PropertyItemPaneProvider";
/**
* 独一无二的标志
*
* @return 标志
*/
String key();
/**
* 配置属性
*
* @return 熟悉
*/
PropertyItemBean getItem();
/**
* 面板持有者
*
* @param clazz 类型
* @return 持有者
*/
@Nullable
PaneHolder<T> getPaneHolder(Class<?> clazz);
/**
* 想要替代的类型
*
* @return 替代类型
*/
String replaceKey();
}

39
designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java

@ -0,0 +1,39 @@
package com.fr.design.fun;
import com.fr.base.Style;
import com.fr.common.annotations.Open;
import com.fr.stable.fun.mark.Mutable;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-11
*/
@Open
public interface StyleUIConfigProvider extends Mutable {
String XML_TAG = "CustomStyleUIConfigProvider";
int CURRENT_LEVEL = 1;
/**
* @return 配置名
*/
String configName();
/**
* @param changeListener 需要添加的listener
* @return 对应的component
*/
JComponent uiComponent(ChangeListener changeListener);
/**
* @return 更新后的样式
*/
Style updateConfig();
/**
* @param style 待渲染的样式
*/
void populateConfig(Style style);
}

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileBookMarkStyleProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
@API(level = MobileBookMarkStyleProvider.CURRENT_LEVEL)
public abstract class AbstractMobileBookMarkStyleProvider extends AbstractProvider implements MobileBookMarkStyleProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

26
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.design.fun.MultiStyleUIConfigProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kerry on 2019-11-11
*/
@API(level = MultiStyleUIConfigProvider.CURRENT_LEVEL)
public abstract class AbstractMultiStyleUIConfigProvider extends AbstractProvider implements MultiStyleUIConfigProvider {
@Override
public List<StyleUIConfigProvider> getConfigList() {
return new ArrayList<StyleUIConfigProvider>();
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

10
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPreviewProvider.java

@ -1,7 +1,9 @@
package com.fr.design.fun.impl;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.general.web.ParameterConstants;
import com.fr.stable.fun.impl.AbstractProvider;
@ -52,4 +54,12 @@ public abstract class AbstractPreviewProvider extends AbstractProvider implement
public String getActionType() {
return ParameterConstants.VIEWLET;
}
@Override
public boolean accept(JTemplate jTemplate) {
if (jTemplate == null) {
jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
}
return jTemplate == null || jTemplate.isJWorkBook() || jTemplate instanceof JVirtualTemplate;
}
}

31
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java

@ -0,0 +1,31 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.mainframe.PaneHolder;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* created by Harrison on 2020/03/23
**/
@API(level = PropertyItemPaneProvider.CURRENT_LEVEL)
public abstract class AbstractPropertyItemPaneProvider<T> extends AbstractProvider implements PropertyItemPaneProvider<T> {
@Override
public PaneHolder<T> getPaneHolder(Class<?> clazz) {
if (sign().equals(clazz)) {
return getPathHolder0();
}
return null;
}
protected abstract PaneHolder<T> getPathHolder0();
protected abstract Class<T> sign();
@Override
public int currentAPILevel() {
return PropertyItemPaneProvider.CURRENT_LEVEL;
}
}

41
designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java

@ -0,0 +1,41 @@
package com.fr.design.fun.impl;
import com.fr.base.Style;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-11
*/
@API(level = StyleUIConfigProvider.CURRENT_LEVEL)
public class AbstractStyleUIConfigProvider extends AbstractProvider implements StyleUIConfigProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String configName() {
return StringUtils.EMPTY;
}
@Override
public JComponent uiComponent(ChangeListener changeListener) {
return null;
}
@Override
public Style updateConfig() {
return null;
}
@Override
public void populateConfig(Style style) {
}
}

3
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java

@ -1,6 +1,7 @@
package com.fr.design.gui.controlpane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.stable.Nameable;
@ -32,7 +33,7 @@ class ListControlPaneHelper {
try {
listControlPane.checkValid();
} catch (Exception exp) {
JOptionPane.showMessageDialog((Component) listControlPane, exp.getMessage());
FineJOptionPane.showMessageDialog((Component) listControlPane, exp.getMessage());
listControlPane.setSelectedIndex(idx);
return true;
}

31
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -1,6 +1,7 @@
package com.fr.design.gui.controlpane;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolBarUI;
@ -9,17 +10,18 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.awt.Color;
@ -27,6 +29,7 @@ import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
@ -72,7 +75,6 @@ abstract class UIControlPane extends JControlPane {
this.creators = this.createNameableCreators();
initCardPane();
if (isNewStyle()) {
getPopupEditDialog(cardPane);
this.add(getLeftPane(), BorderLayout.CENTER);
@ -148,9 +150,7 @@ abstract class UIControlPane extends JControlPane {
topToolBar.setLayout(new BorderLayout());
ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut();
addItem.intoJToolBar(topToolBar);
JPanel leftTopPane = getLeftTopPane(topToolBar);
leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
leftPane.add(leftTopPane, BorderLayout.NORTH);
@ -171,7 +171,6 @@ abstract class UIControlPane extends JControlPane {
JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
leftTopPane.add(toolBarPane, BorderLayout.EAST);
leftTopPane.add(addItemLabel, BorderLayout.CENTER);
return leftTopPane;
}
@ -202,7 +201,6 @@ abstract class UIControlPane extends JControlPane {
topToolBar.validate();
this.controlUpdatePane = createControlUpdatePane();//REPORT-4841 刷新一下编辑面板
cardPane.add(controlUpdatePane, "EDIT");
this.repaint();
}
@ -249,6 +247,19 @@ abstract class UIControlPane extends JControlPane {
}
}
try {
//没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame()
Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get();
for (Window window : sharedOwnerFrame.getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
// 如果有可见模态对话框,则不隐藏
return;
}
}
} catch (Exception ignore) {
//do nothing
}
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
@ -256,7 +267,7 @@ abstract class UIControlPane extends JControlPane {
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
this.setAlwaysOnTop(true);
JOptionPane.showMessageDialog(this, exp.getMessage());
FineJOptionPane.showMessageDialog(this, exp.getMessage());
this.requestFocus();
return;
}
@ -268,6 +279,10 @@ abstract class UIControlPane extends JControlPane {
addWindowFocusListener(new WindowAdapter() {
@Override
public void windowLostFocus(WindowEvent e) {
//在Linux上拉回焦点,不然导致一些面板关不掉
if(OperatingSystem.isLinux()) {
requestFocus();
}
hideDialog();
}
});

8
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -437,18 +437,18 @@ public class UICalendarPanel extends JPanel {
};
}
protected EventListenerList listenerList = new EventListenerList();
protected EventListenerList eventlistenerList = new EventListenerList();
public void addDateChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l);
eventlistenerList.add(ChangeListener.class, l);
}
public void removeDateChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
eventlistenerList.remove(ChangeListener.class, l);
}
protected void fireDateChanged(ChangeEvent e) {
Object[] listeners = listenerList.getListenerList();
Object[] listeners = eventlistenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(e);

2
designer-base/src/main/java/com/fr/design/gui/frpane/AbstractAttrNoScrollPane.java

@ -65,7 +65,7 @@ public abstract class AbstractAttrNoScrollPane extends BasicPane {
}
protected void initListener(Container parentComponent) {
public void initListener(Container parentComponent) {
for (int i = 0; i < parentComponent.getComponentCount(); i++) {
Component tmpComp = parentComponent.getComponent(i);

3
designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java

@ -3,6 +3,7 @@ package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.javascript.Commit2DBJavaScriptPane;
@ -408,7 +409,7 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous
selectedIndex = dbManipulationPaneList.size()-1;
commit2DBJavaScriptPane.updateCardPane();
} else if (isOverCloseIcon(x)){
int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Remove")
int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Remove")
, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (re == JOptionPane.OK_OPTION) {
dbManipulationPaneList.remove(getTabIndex(x));

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save