Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~kerry/design_10.0 into feature/10.0

master
kerry 7 years ago
parent
commit
061d2b427c
  1. 7
      designer-base/pom.xml
  2. 162
      designer-base/src/com/fr/design/DesignerEnvManager.java
  3. 4
      designer-base/src/com/fr/design/ExtraDesignClassManager.java
  4. 29
      designer-base/src/com/fr/design/RestartHelper.java
  5. 25
      designer-base/src/com/fr/design/actions/community/BBSAction.java
  6. 25
      designer-base/src/com/fr/design/actions/community/BugAction.java
  7. 25
      designer-base/src/com/fr/design/actions/community/NeedAction.java
  8. 25
      designer-base/src/com/fr/design/actions/community/QuestionAction.java
  9. 25
      designer-base/src/com/fr/design/actions/community/SignAction.java
  10. 25
      designer-base/src/com/fr/design/actions/community/UpAction.java
  11. 27
      designer-base/src/com/fr/design/actions/community/VideoAction.java
  12. 21
      designer-base/src/com/fr/design/actions/core/ActionFactory.java
  13. 43
      designer-base/src/com/fr/design/actions/file/LocalePane.java
  14. 16
      designer-base/src/com/fr/design/actions/file/PreferencePane.java
  15. 51
      designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java
  16. 17
      designer-base/src/com/fr/design/actions/help/FeedBackPane.java
  17. 9
      designer-base/src/com/fr/design/actions/help/ForumAction.java
  18. 6
      designer-base/src/com/fr/design/actions/help/SupportQQAction.java
  19. 11
      designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  20. 10
      designer-base/src/com/fr/design/condition/LiteConditionPane.java
  21. 76
      designer-base/src/com/fr/design/data/datapane/ChoosePane.java
  22. 5
      designer-base/src/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  23. 3
      designer-base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java
  24. 5
      designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java
  25. 11
      designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java
  26. 34
      designer-base/src/com/fr/design/editor/editor/TextEditor.java
  27. 17
      designer-base/src/com/fr/design/extra/LoginDialog.java
  28. 4
      designer-base/src/com/fr/design/extra/PluginDetailPane.java
  29. 10
      designer-base/src/com/fr/design/extra/PluginFromStorePane.java
  30. 7
      designer-base/src/com/fr/design/extra/PluginOperateUtils.java
  31. 11
      designer-base/src/com/fr/design/extra/PluginUpdatePane.java
  32. 5
      designer-base/src/com/fr/design/extra/PluginUtils.java
  33. 16
      designer-base/src/com/fr/design/extra/PluginWebBridge.java
  34. 3
      designer-base/src/com/fr/design/extra/QQLoginWebPane.java
  35. 51
      designer-base/src/com/fr/design/extra/WebViewDlgHelper.java
  36. 6
      designer-base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  37. 4
      designer-base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java
  38. 4
      designer-base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java
  39. 6
      designer-base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  40. 6
      designer-base/src/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  41. 6
      designer-base/src/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  42. 6
      designer-base/src/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  43. 7
      designer-base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  44. 6
      designer-base/src/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java
  45. 39
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  46. 32
      designer-base/src/com/fr/design/file/MutilTempalteTabPane.java
  47. 2
      designer-base/src/com/fr/design/file/SaveSomeTemplatePane.java
  48. 56
      designer-base/src/com/fr/design/file/TemplateTreePane.java
  49. 10
      designer-base/src/com/fr/design/formula/JavaEditorPane.java
  50. 4
      designer-base/src/com/fr/design/gui/UILookAndFeel.java
  51. 6
      designer-base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java
  52. 6
      designer-base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
  53. 62
      designer-base/src/com/fr/design/gui/controlpane/UIControlPane.java
  54. 48
      designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java
  55. 17
      designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java
  56. 32
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  57. 14
      designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java
  58. 4
      designer-base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java
  59. 140
      designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  60. 48
      designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java
  61. 6
      designer-base/src/com/fr/design/gui/imenu/UIBasicMenuUI.java
  62. 6
      designer-base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java
  63. 4
      designer-base/src/com/fr/design/gui/style/NumberDragBar.java
  64. 4
      designer-base/src/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java
  65. 6
      designer-base/src/com/fr/design/mainframe/DesignerContext.java
  66. 67
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  67. 32
      designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  68. 80
      designer-base/src/com/fr/design/mainframe/JFormSliderPane.java
  69. 73
      designer-base/src/com/fr/design/mainframe/JSliderPane.java
  70. 4
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  71. 32
      designer-base/src/com/fr/design/mainframe/TemplatePane.java
  72. 63
      designer-base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  73. 88
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  74. 4
      designer-base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java
  75. 7
      designer-base/src/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java
  76. 9
      designer-base/src/com/fr/design/selection/QuickEditor.java
  77. 4
      designer-base/src/com/fr/design/style/background/BackgroundPane.java
  78. 4
      designer-base/src/com/fr/design/style/color/ColorPicker.java
  79. 4
      designer-base/src/com/fr/design/style/color/ColorSelectConfigManager.java
  80. 4
      designer-base/src/com/fr/design/style/color/CustomChooserPanel.java
  81. 41
      designer-base/src/com/fr/design/utils/DesignUtils.java
  82. 6
      designer-base/src/com/fr/design/utils/DrawRoutines.java
  83. 2
      designer-base/src/com/fr/env/DesignAuthorityConfigurable.java
  84. 11
      designer-base/src/com/fr/env/EnvListPane.java
  85. 9
      designer-base/src/com/fr/env/LocalEnvPane.java
  86. 1856
      designer-base/src/com/fr/env/RemoteEnv.java
  87. 22
      designer-base/src/com/fr/env/RemoteEnvPane.java
  88. 143
      designer-base/src/com/fr/env/RemoteEnvUtils.java
  89. 62
      designer-base/src/com/fr/env/SignIn.java
  90. 6
      designer-base/src/com/fr/start/BaseDesigner.java
  91. 31
      designer-base/src/com/fr/start/StartServer.java
  92. 4
      designer-chart/src/com/fr/design/chart/report/MapCubeLayerPane.java
  93. 6
      designer-chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java
  94. 4
      designer-chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java
  95. 4
      designer-chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  96. 4
      designer-chart/src/com/fr/design/mainframe/chart/ChartEditPane.java
  97. 4
      designer-chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  98. 6
      designer-chart/src/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java
  99. 6
      designer-chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  100. 4
      designer-chart/src/com/fr/design/mainframe/chart/gui/style/DateAxisValuePane.java
  101. Some files were not shown because too many files have changed in this diff Show More

7
designer-base/pom.xml

@ -8,6 +8,13 @@
<artifactId>design</artifactId> <artifactId>design</artifactId>
<version>10.0-FEATURE-SNAPSHOT</version> <version>10.0-FEATURE-SNAPSHOT</version>
</parent> </parent>
<dependencies>
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.7.0</version>
</dependency>
</dependencies>
<groupId>com.fr.report</groupId> <groupId>com.fr.report</groupId>
<artifactId>designer-base</artifactId> <artifactId>designer-base</artifactId>
<version>10.0-FEATURE-SNAPSHOT</version> <version>10.0-FEATURE-SNAPSHOT</version>

162
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -4,21 +4,22 @@
package com.fr.design; package com.fr.design;
import com.fr.base.BaseXMLUtils; import com.fr.base.BaseXMLUtils;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.dav.LocalEnv; import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.env.RemoteEnv;
import com.fr.env.SignIn; import com.fr.env.SignIn;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter; import com.fr.general.FRLogFormatter;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ListMap; import com.fr.stable.ListMap;
@ -33,10 +34,9 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import javax.swing.SwingWorker; import javax.swing.*;
import javax.swing.SwingWorker.StateValue; import javax.swing.SwingWorker.StateValue;
import java.awt.Color; import java.awt.*;
import java.awt.Rectangle;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
@ -72,7 +72,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showPaintToolBar = true; private boolean showPaintToolBar = true;
private int maxNumberOrPreviewRow = 200; private int maxNumberOrPreviewRow = 200;
// name和Env的键值对 // name和Env的键值对
private Map<String, Env> nameEnvMap = new ListMap(); private Map<String, EnvConfig> nameEnvMap = new ListMap();
// marks: 当前报表服务器名字 // marks: 当前报表服务器名字
private String curEnvName = null; private String curEnvName = null;
private boolean showProjectPane = true; private boolean showProjectPane = true;
@ -191,7 +191,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (installHome != null) { if (installHome != null) {
String name = Inter.getLocText("FR-Engine_DEFAULT"); String name = Inter.getLocText("FR-Engine_DEFAULT");
String envPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); String envPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME});
designerEnvManager.putEnv(name, LocalEnv.createEnv(envPath)); designerEnvManager.putEnv(name, new LocalEnvConfig(envPath));
designerEnvManager.setCurEnvName(name); designerEnvManager.setCurEnvName(name);
} }
} }
@ -227,7 +227,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error("Map Save Error"); FineLoggerFactory.getLogger().error("Map Save Error");
} }
} }
} }
@ -323,7 +323,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
// 清空前一个版本中的工作目录和最近打开 // 清空前一个版本中的工作目录和最近打开
nameEnvMap = new ListMap<String, Env>(); nameEnvMap = new ListMap<String, EnvConfig>();
recentOpenedFilePathList = new ArrayList<String>(); recentOpenedFilePathList = new ArrayList<String>();
curEnvName = null; curEnvName = null;
designerEnvManager.saveXMLFile(); designerEnvManager.saveXMLFile();
@ -470,7 +470,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @return 是默认则返回true * @return 是默认则返回true
*/ */
public boolean isCurrentEnvDefault() { public boolean isCurrentEnvDefault() {
Env currentEnv = this.getEnv(curEnvName); EnvConfig currentEnv = this.getEnv(curEnvName);
String defaultEnvPath = StableUtils.pathJoin(new String[]{StableUtils.getInstallHome(), ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); String defaultEnvPath = StableUtils.pathJoin(new String[]{StableUtils.getInstallHome(), ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME});
return ComparatorUtils.equals(new File(defaultEnvPath).getPath(), currentEnv.getPath()); return ComparatorUtils.equals(new File(defaultEnvPath).getPath(), currentEnv.getPath());
} }
@ -478,21 +478,19 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/** /**
* 返回默认环境 * 返回默认环境
*/ */
public Env getDefaultEnv() { public EnvConfig getDefaultEnv() {
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
String defaultenvPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); String defaultenvPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
defaultenvPath = new File(defaultenvPath).getPath(); defaultenvPath = new File(defaultenvPath).getPath();
if (nameEnvMap.size() >= 0) { Iterator<Entry<String, EnvConfig>> entryIt = nameEnvMap.entrySet().iterator();
Iterator<Entry<String, Env>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) { while (entryIt.hasNext()) {
Entry<String, Env> entry = entryIt.next(); Entry<String, EnvConfig> entry = entryIt.next();
Env env = entry.getValue(); EnvConfig env = entry.getValue();
if (ComparatorUtils.equals(defaultenvPath, env.getPath())) { if (ComparatorUtils.equals(defaultenvPath, env.getPath())) {
return env; return env;
} }
} }
} EnvConfig newDefaultEnv = new LocalEnvConfig(defaultenvPath);
Env newDefaultEnv = LocalEnv.createEnv(defaultenvPath);
this.putEnv(Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}), newDefaultEnv); this.putEnv(Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}), newDefaultEnv);
return newDefaultEnv; return newDefaultEnv;
} }
@ -505,10 +503,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String defaultenvPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); String defaultenvPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME});
defaultenvPath = new File(defaultenvPath).getPath(); defaultenvPath = new File(defaultenvPath).getPath();
if (nameEnvMap.size() >= 0) { if (nameEnvMap.size() >= 0) {
Iterator<Entry<String, Env>> entryIt = nameEnvMap.entrySet().iterator(); Iterator<Entry<String, EnvConfig>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) { while (entryIt.hasNext()) {
Entry<String, Env> entry = entryIt.next(); Entry<String, EnvConfig> entry = entryIt.next();
Env env = entry.getValue(); EnvConfig env = entry.getValue();
if (ComparatorUtils.equals(defaultenvPath, env.getPath())) { if (ComparatorUtils.equals(defaultenvPath, env.getPath())) {
return entry.getKey(); return entry.getKey();
} }
@ -680,7 +678,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/** /**
* 根据名称返回环境 * 根据名称返回环境
*/ */
public Env getEnv(String name) { public EnvConfig getEnv(String name) {
return this.nameEnvMap.get(name); return this.nameEnvMap.get(name);
} }
@ -690,7 +688,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @param name 名称 * @param name 名称
* @param env 对应的环境 * @param env 对应的环境
*/ */
public void putEnv(String name, Env env) { public void putEnv(String name, EnvConfig env) {
this.nameEnvMap.put(name, env); this.nameEnvMap.put(name, env);
} }
@ -1401,7 +1399,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) { if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) {
// marks:兼容6.1的 // marks:兼容6.1的
// marks:设置默认的目录. // marks:设置默认的目录.
Env reportServer = LocalEnv.createEnv(tmpVal); EnvConfig reportServer = new LocalEnvConfig(tmpVal);
String curReportServerName = Inter.getLocText("Server-Embedded_Server"); String curReportServerName = Inter.getLocText("Server-Embedded_Server");
this.putEnv(curReportServerName, reportServer); this.putEnv(curReportServerName, reportServer);
@ -1454,11 +1452,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
if (reader.isChildNode()) { if (reader.isChildNode()) {
if (reader.getTagName().equals("Env")) { // description. if (reader.getTagName().contains("Env")) { // description.
// marks:获取名字 // marks:获取名字
String reportServerName = reader.getAttrAsString("name", null); String reportServerName = reader.getAttrAsString("name", null);
Env env = readEnv(reader); EnvConfig env = readEnv(reader);
if (env == null) { if (env == null) {
return; return;
} }
@ -1584,7 +1582,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
Iterator<String> nameIt = this.getEnvNameIterator(); Iterator<String> nameIt = this.getEnvNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String envName = nameIt.next(); String envName = nameIt.next();
Env env = this.getEnv(envName); EnvConfig env = this.getEnv(envName);
writeEnv(writer, envName, env); writeEnv(writer, envName, env);
} }
@ -1745,42 +1743,42 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/* /*
* 写Env为xml * 写Env为xml
*/ */
private static void writeEnv(XMLPrintWriter writer, String name, Env env) { private static void writeEnv(XMLPrintWriter writer, String name, EnvConfig env) {
if (env == null) { if (env == null) {
return; return;
} }
writer.startTAG("Env"); writer.startTAG("EnvConfig");
writer.classAttr(env.getClass()); writer.classAttr(env.getClass());
writer.attr("name", name); writer.attr("name", name);
env.writeXML(writer); EnvConfigXMLAdapter xmlAdapter = env instanceof RemoteEnvConfig
? new RemoteEnvConfigXMLAdapter()
: new LocalEnvConfigXMLAdapter();
xmlAdapter.fromEnvConfig(env).writeXML(writer);
writer.end(); writer.end();
} }
/* /*
* 从xml读Env * 从xml读Env
*/ */
private static Env readEnv(XMLableReader reader) { private static EnvConfig readEnv(XMLableReader reader) {
Env env = null; EnvConfigXMLAdapter xmlAdapter = null;
String tmpVal; //temp value String tmpVal; //temp value
if ((tmpVal = reader.getAttrAsString("class", null)) != null) { if ((tmpVal = reader.getAttrAsString("class", null)) != null) {
if (tmpVal.endsWith(".LocalEnv")) { if (tmpVal.contains(".LocalEnv")) {
env = LocalEnv.createEnv(); xmlAdapter = new LocalEnvConfigXMLAdapter();
} else if (tmpVal.endsWith(".RemoteEnv")) { } else if (tmpVal.contains(".RemoteEnv")) {
env = new RemoteEnv(); xmlAdapter = new RemoteEnvConfigXMLAdapter();
} }
} }
if (env == null) { if (xmlAdapter == null) {
return env; return null;
} }
reader.readXMLObject(env); reader.readXMLObject(xmlAdapter);
return xmlAdapter.toEnvConfig();
return env;
} }
public AlphaFineConfigManager getAlphaFineConfigManager() { public AlphaFineConfigManager getAlphaFineConfigManager() {
@ -1790,4 +1788,78 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) {
this.alphaFineConfigManager = alphaFineConfigManager; this.alphaFineConfigManager = alphaFineConfigManager;
} }
private interface EnvConfigXMLAdapter extends XMLReadable, XMLWriter {
EnvConfig toEnvConfig();
EnvConfigXMLAdapter fromEnvConfig(EnvConfig envConfig);
}
private static class LocalEnvConfigXMLAdapter implements EnvConfigXMLAdapter {
private String path;
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
if ("DIR".equals(reader.getTagName())) {
this.path = reader.getElementValue();
}
}
}
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("DIR").textNode(this.path).end();
}
public EnvConfig toEnvConfig() {
return new LocalEnvConfig(path);
}
public EnvConfigXMLAdapter fromEnvConfig(EnvConfig envConfig) {
this.path = envConfig.getPath();
return this;
}
}
private static class RemoteEnvConfigXMLAdapter implements EnvConfigXMLAdapter {
private String path;
private String username;
private String password;
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tmpVal;
if ("DIR".equals(reader.getTagName())) {
if ((tmpVal = reader.getAttrAsString("path", null)) != null) {
this.path = tmpVal;
}
if ((tmpVal = reader.getAttrAsString("user", null)) != null) {
this.username = tmpVal;
}
if ((tmpVal = reader.getAttrAsString("password", null)) != null) {
this.password = tmpVal;
}
}
}
}
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("DIR")
.attr("path", this.path)
.attr("user", this.username)
.attr("password", this.password)
.end();
}
public EnvConfig toEnvConfig() {
return new RemoteEnvConfig(path, username, password);
}
public EnvConfigXMLAdapter fromEnvConfig(EnvConfig envConfig) {
this.path = envConfig.getPath();
this.username = EnvConfigUtils.getUsername(envConfig);
this.password = EnvConfigUtils.getPassword(envConfig);
return this;
}
}
} }

4
designer-base/src/com/fr/design/ExtraDesignClassManager.java

@ -18,9 +18,9 @@ import com.fr.design.gui.core.WidgetOptionFactory;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.widget.Appearance; import com.fr.design.widget.Appearance;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.AbstractExtraClassManager; import com.fr.plugin.AbstractExtraClassManager;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection; import com.fr.plugin.injectable.PluginSingleInjection;
@ -208,7 +208,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return (Feedback) clazz.newInstance(); return (Feedback) clazz.newInstance();
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().info("no feed back support"); FineLoggerFactory.getLogger().info("no feed back support");
} }
return Feedback.EMPTY; return Feedback.EMPTY;
} }

29
designer-base/src/com/fr/design/RestartHelper.java

@ -2,11 +2,18 @@ package com.fr.design;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.*; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import java.io.*; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.channels.FileLock; import java.nio.channels.FileLock;
import java.util.ArrayList; import java.util.ArrayList;
@ -39,7 +46,7 @@ public class RestartHelper {
properties.load(file2DeleteInputStream); properties.load(file2DeleteInputStream);
file2DeleteInputStream.close(); file2DeleteInputStream.close();
} catch (IOException e) { } catch (IOException e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
if (ArrayUtils.getLength(files) != 0) { if (ArrayUtils.getLength(files) != 0) {
@ -53,7 +60,7 @@ public class RestartHelper {
properties.store(file2DeleteOutputStream, "save"); properties.store(file2DeleteOutputStream, "save");
file2DeleteOutputStream.close(); file2DeleteOutputStream.close();
} catch (IOException e) { } catch (IOException e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -71,7 +78,7 @@ public class RestartHelper {
properties.load(file2MoveInputStream); properties.load(file2MoveInputStream);
file2MoveInputStream.close(); file2MoveInputStream.close();
} catch (IOException e) { } catch (IOException e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
if (!map.isEmpty()) { if (!map.isEmpty()) {
@ -84,7 +91,7 @@ public class RestartHelper {
properties.store(file2MoveOutputStream, "save"); properties.store(file2MoveOutputStream, "save");
file2MoveOutputStream.close(); file2MoveOutputStream.close();
} catch (IOException e) { } catch (IOException e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
@ -156,10 +163,10 @@ public class RestartHelper {
FileChannel restartLockFC = randomAccessFile.getChannel(); FileChannel restartLockFC = randomAccessFile.getChannel();
FileLock restartLock = restartLockFC.tryLock(); FileLock restartLock = restartLockFC.tryLock();
if(restartLock == null) { if(restartLock == null) {
FRLogger.getLogger().error("restart lock null!"); FineLoggerFactory.getLogger().error("restart lock null!");
} }
}catch (Exception e){ }catch (Exception e){
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
if (OperatingSystem.isMacOS()) { if (OperatingSystem.isMacOS()) {
restartInMacOS(installHome, filesToBeDelete); restartInMacOS(installHome, filesToBeDelete);
@ -167,7 +174,7 @@ public class RestartHelper {
restartInWindows(installHome, filesToBeDelete); restartInWindows(installHome, filesToBeDelete);
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} finally { } finally {
DesignerContext.getDesignerFrame().exit(); DesignerContext.getDesignerFrame().exit();
} }

25
designer-base/src/com/fr/design/actions/community/BBSAction.java

@ -1,22 +1,21 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class BBSAction extends UpdateAction public class BBSAction extends UpdateAction
{ {
@ -46,12 +45,12 @@ public class BBSAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }
public static final MenuKeySet BBS = new MenuKeySet() { public static final MenuKeySet BBS = new MenuKeySet() {

25
designer-base/src/com/fr/design/actions/community/BugAction.java

@ -1,22 +1,21 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class BugAction extends UpdateAction public class BugAction extends UpdateAction
{ {
@ -40,12 +39,12 @@ public void actionPerformed(ActionEvent arg0)
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

25
designer-base/src/com/fr/design/actions/community/NeedAction.java

@ -1,22 +1,21 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class NeedAction extends UpdateAction public class NeedAction extends UpdateAction
{ {
@ -41,12 +40,12 @@ public class NeedAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

25
designer-base/src/com/fr/design/actions/community/QuestionAction.java

@ -1,22 +1,21 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class QuestionAction extends UpdateAction public class QuestionAction extends UpdateAction
{ {
@ -40,12 +39,12 @@ public void actionPerformed(ActionEvent arg0)
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

25
designer-base/src/com/fr/design/actions/community/SignAction.java

@ -1,22 +1,21 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class SignAction extends UpdateAction public class SignAction extends UpdateAction
{ {
@ -41,12 +40,12 @@ public class SignAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

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

@ -1,22 +1,21 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class UpAction extends UpdateAction public class UpAction extends UpdateAction
{ {
@ -41,12 +40,12 @@ public class UpAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

27
designer-base/src/com/fr/design/actions/community/VideoAction.java

@ -1,23 +1,22 @@
package com.fr.design.actions.community; package com.fr.design.actions.community;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
public class VideoAction extends UpdateAction public class VideoAction extends UpdateAction
{ {
@ -47,12 +46,12 @@ public class VideoAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

21
designer-base/src/com/fr/design/actions/core/ActionFactory.java

@ -7,10 +7,9 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.Action; import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
@ -55,6 +54,20 @@ public class ActionFactory {
private ActionFactory() { private ActionFactory() {
} }
/**
* 元素编辑器释放模板对象
*/
public static void editorRelease() {
for (Map.Entry<Class, QuickEditor> entry : cellEditor.entrySet()) {
entry.getValue().release();
}
for (Map.Entry<Class, QuickEditor> entry : floatEditor.entrySet()) {
entry.getValue().release();
}
}
/** /**
* 注册无需每次实例化的单元格元素编辑器 * 注册无需每次实例化的单元格元素编辑器
* *
@ -336,7 +349,7 @@ public class ActionFactory {
if (c == null) { if (c == null) {
Class<? extends QuickEditor> cClazz = findQuickEditorClass(clazz, editorClassMap); Class<? extends QuickEditor> cClazz = findQuickEditorClass(clazz, editorClassMap);
if (cClazz == null) { if (cClazz == null) {
FRLogger.getLogger().error("No Such Editor"); FineLoggerFactory.getLogger().error("No Such Editor");
return null; return null;
} }
try { try {

43
designer-base/src/com/fr/design/actions/file/LocalePane.java

@ -4,33 +4,40 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import java.awt.BorderLayout;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
import javax.swing.JTable;
import javax.swing.RowFilter;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.dialog.BasicPane;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.*; import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import java.awt.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.Vector;
/** /**
* @author : richie * @author : richie
* @since : 8.0 * @since : 8.0
@ -235,7 +242,7 @@ public class LocalePane extends BasicPane {
out.flush(); out.flush();
out.close(); out.close();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
} }
} }
} }

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

@ -1,7 +1,6 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -23,8 +22,9 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.FRLevel;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.log.Log4jConfig;
import com.fr.third.apache.log4j.Level;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -81,7 +81,7 @@ public class PreferencePane extends BasicPane {
private static final String MINUS = "MINUS"; private static final String MINUS = "MINUS";
private static final String DISPLAY_MINUS = "-"; private static final String DISPLAY_MINUS = "-";
private static final FRLevel[] LOG = {FRLevel.SEVERE, FRLevel.WARNING, FRLevel.INFO, FRLevel.DEBUG}; private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG};
private static java.util.List<String> LANGUAGE = new ArrayList<>(); private static java.util.List<String> LANGUAGE = new ArrayList<>();
private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言 private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
@ -125,7 +125,7 @@ public class PreferencePane extends BasicPane {
LANGUAGE.clear(); LANGUAGE.clear();
Map<Locale, String> map = Inter.getSupportLocaleMap(); Map<Locale, String> map = Inter.getSupportLocaleMap();
LANGUAGE.add(Inter.getLocText("FR-Designer_Language_Default")); LANGUAGE.add(Inter.getLocText("FR-Designer_Language_Default"));
for(Locale locale : map.keySet()){ for (Locale locale : map.keySet()) {
LANGUAGE.add(getLocaledLanguage(map.get(locale), locale)); LANGUAGE.add(getLocaledLanguage(map.get(locale), locale));
} }
} }
@ -177,7 +177,7 @@ public class PreferencePane extends BasicPane {
advancePane.add(spaceUpPane); advancePane.add(spaceUpPane);
} }
private static String getLocaledLanguage(String key, Locale locale){ private static String getLocaledLanguage(String key, Locale locale) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(Inter.getLocText(key)).append("("); sb.append(Inter.getLocText(key)).append("(");
sb.append(Inter.getLocText(key, locale)).append(")"); sb.append(Inter.getLocText(key, locale)).append(")");
@ -363,7 +363,7 @@ public class PreferencePane extends BasicPane {
logLevelComboBox.addActionListener(new ActionListener() { logLevelComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem());
} }
}); });
} }
@ -543,7 +543,7 @@ public class PreferencePane extends BasicPane {
this.logExportDirectoryField.setText(designerEnvManager.getLogLocation()); this.logExportDirectoryField.setText(designerEnvManager.getLogLocation());
this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(ServerConfig.getInstance().getServerLogLevel())); this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel());
this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage()));
designerEnvLanguageIndex = designerEnvManager.getLanguage(); designerEnvLanguageIndex = designerEnvManager.getLanguage();
@ -623,7 +623,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
} }
ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel()); Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem()));
} }

51
designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java

@ -1,14 +1,13 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.FRContext; import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.dav.LocalEnv; import com.fr.core.env.EnvConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -18,21 +17,16 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.env.SignIn; import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
public class SwitchExistEnv extends MenuDef { public class SwitchExistEnv extends MenuDef {
@ -42,8 +36,10 @@ public class SwitchExistEnv extends MenuDef {
this.setHasScrollSubMenu(true); this.setHasScrollSubMenu(true);
initMenuDef(); initMenuDef();
JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(t != null) { if (t != null) {
GeneralContext.addEnvWillChangedListener(t.getFullPathName(), new EnvChangedListener() { GeneralContext.addEnvWillChangedListener(
t.getFullPathName(),
new EnvChangedListener() {
public void envChanged() { public void envChanged() {
SwitchExistEnv.this.clearShortCuts(); SwitchExistEnv.this.clearShortCuts();
initMenuDef(); initMenuDef();
@ -53,7 +49,7 @@ public class SwitchExistEnv extends MenuDef {
} }
private void initMenuDef() { private void initMenuDef() {
//ButtonGroup group = new ButtonGroup(); // ButtonGroup group = new ButtonGroup();
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String name = nameIt.next(); String name = nameIt.next();
@ -66,15 +62,14 @@ public class SwitchExistEnv extends MenuDef {
public static class GetExistEnvAction extends UpdateAction implements ResponseDataSourceChange { public static class GetExistEnvAction extends UpdateAction implements ResponseDataSourceChange {
public GetExistEnvAction() { public GetExistEnvAction() {
} }
public GetExistEnvAction(String envName) { public GetExistEnvAction(String envName) {
this.setName(envName); this.setName(envName);
Env env = DesignerEnvManager.getEnvManager().getEnv(envName); EnvConfig env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env instanceof LocalEnv) { if (env instanceof LocalEnvConfig) {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png")); this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png"));
} else if (env instanceof RemoteEnv) { } else if (env instanceof RemoteEnvConfig) {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png")); this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png"));
} }
} }
@ -102,26 +97,22 @@ public class SwitchExistEnv extends MenuDef {
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
Env selectedEnv = envManager.getEnv(this.getName()); EnvConfig selectedEnv = envManager.getEnv(this.getName());
try { try {
if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) { if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(
return; DesignerContext.getDesignerFrame(),
} Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
String remoteVersion = selectedEnv.getDesignerVersion();
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
String infor = Inter.getLocText("Server-version-tip");
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo");
FRLogger.getLogger().log(Level.WARNING, infor);
new InformationWarnPane(infor, moreInfo, Inter.getLocText("Tooltips")).show();
return; return;
} }
SignIn.signIn(selectedEnv); SignIn.signIn(selectedEnv);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged(); fireDSChanged();
} catch (Exception em) { } catch (Exception em) {
FRContext.getLogger().error(em.getMessage(), em); FineLoggerFactory.getLogger().error(em.getMessage(), em);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
TemplatePane.getInstance().editItems(); TemplatePane.getInstance().editItems();
} }
} }

17
designer-base/src/com/fr/design/actions/help/FeedBackPane.java

@ -7,6 +7,8 @@ package com.fr.design.actions.help;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo; import com.fr.base.FeedBackInfo;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -16,13 +18,11 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog; import com.fr.design.utils.DesignUtils;
import com.fr.design.dialog.BasicPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.design.utils.DesignUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
@ -33,7 +33,12 @@ import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument; import javax.swing.text.PlainDocument;
import java.awt.*; import java.awt.*;
import java.awt.event.*; 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.util.Date; import java.util.Date;
import java.util.concurrent.CancellationException; import java.util.concurrent.CancellationException;
@ -275,7 +280,7 @@ public class FeedBackPane extends BasicPane {
try { try {
return DesignUtils.sendFeedBack(feedBackInfo); return DesignUtils.sendFeedBack(feedBackInfo);
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
return false; return false;
} }
} }

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

@ -10,6 +10,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -48,12 +49,12 @@ public class ForumAction extends UpdateAction {
Desktop.getDesktop().browse(new URI(url)); Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
} }
} }

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

@ -5,10 +5,10 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import javax.swing.*; import javax.swing.*;
@ -38,9 +38,9 @@ public class SupportQQAction extends UpdateAction {
Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ)); Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ));
} catch (IOException exp) { } catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) { } catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
} }

11
designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java

@ -8,12 +8,17 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.*; 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;
/** /**
* Created by XiaXiang on 2017/4/6. * Created by XiaXiang on 2017/4/6.
@ -202,7 +207,7 @@ public class AlphaFineConfigPane extends BasicPane {
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }

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

@ -3,7 +3,11 @@ package com.fr.design.condition;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.data.DataConstants; import com.fr.data.DataConstants;
import com.fr.data.condition.*; import com.fr.data.condition.CommonCondition;
import com.fr.data.condition.FormulaCondition;
import com.fr.data.condition.JoinCondition;
import com.fr.data.condition.ListCondition;
import com.fr.data.condition.ObjectCondition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
@ -18,9 +22,9 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.data.Condition; import com.fr.general.data.Condition;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -960,7 +964,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
try{ try{
newCondition = (Condition)joinCondition.getCondition().clone(); newCondition = (Condition)joinCondition.getCondition().clone();
}catch (CloneNotSupportedException e){ }catch (CloneNotSupportedException e){
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
return newCondition; return newCondition;
} }

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

@ -33,8 +33,8 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -85,6 +85,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private PopupMenuListener popupMenuListener = new PopupMenuListener() { private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
new Thread() { new Thread() {
@Override @Override
@ -94,26 +95,41 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}.start(); }.start();
} }
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
} }
@Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
} }
}; };
private PopupMenuListener listener = new PopupMenuListener() { private PopupMenuListener listener = new PopupMenuListener() {
@Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
} }
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
} }
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
executePopulateWorker(); executePopulateWorker();
} }
}; };
private FocusAdapter focusAdapter = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (schemaBox.getSelectedIndex() == -1) {
schemaBox.updateUI();
schemaBox.showPopup();
}
}
};
public ChoosePane() { public ChoosePane() {
this(null); this(null);
} }
@ -146,6 +162,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private void initBoxListener() { private void initBoxListener() {
addDSBoxListener(); addDSBoxListener();
schemaBox.addItemListener(new ItemListener() { schemaBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) { public void itemStateChanged(ItemEvent evt) {
tableNameComboBox.setSelectedItem(""); tableNameComboBox.setSelectedItem("");
} }
@ -176,16 +193,9 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
protected void addFocusListener() { protected void addFocusListener() {
schemaBox.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
if (schemaBox.getSelectedIndex() == -1) {
schemaBox.updateUI();
schemaBox.showPopup();
}
}
});
} }
@SuppressWarnings("unchecked")
protected void initDsNameComboBox() { protected void initDsNameComboBox() {
dsNameComboBox.setRefreshingModel(true); dsNameComboBox.setRefreshingModel(true);
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
@ -233,12 +243,18 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
populateWorker = new SwingWorker<com.fr.data.impl.Connection, Void>() { populateWorker = new SwingWorker<com.fr.data.impl.Connection, Void>() {
protected com.fr.data.impl.Connection doInBackground() throws Exception { @SuppressWarnings("unchecked")
@Override
protected com.fr.data.impl.Connection doInBackground() {
schemaBox.setRefreshingModel(true);
schemaBox.addItem(Inter.getLocText("FR-Designer_Loading") + "..."); schemaBox.addItem(Inter.getLocText("FR-Designer_Loading") + "...");
schemaBox.setSelectedItem(null); schemaBox.setSelectedItem(null);
schemaBox.setRefreshingModel(false);
return getConnection(); return getConnection();
} }
@SuppressWarnings("unchecked")
@Override
public void done() { public void done() {
try { try {
com.fr.data.impl.Connection selectedDatabase = get(); com.fr.data.impl.Connection selectedDatabase = get();
@ -261,12 +277,14 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
schemaBox.setSelectedIndex(index); schemaBox.setSelectedIndex(index);
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
schemaBox.setRefreshingModel(false); schemaBox.setRefreshingModel(false);
schemaBox.removePopupMenuListener(listener); schemaBox.removePopupMenuListener(listener);
schemaBox.setPopupVisible(true); schemaBox.setPopupVisible(true);
schemaBox.addPopupMenuListener(listener); schemaBox.addPopupMenuListener(listener);
schemaBox.removeFocusListener(focusAdapter);
schemaBox.addFocusListener(focusAdapter);
} }
}; };
populateWorker.execute(); populateWorker.execute();
@ -292,7 +310,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return null; // peter:选中了当前的零长度的节点,直接返回. return null; // peter:选中了当前的零长度的节点,直接返回.
} }
ConnectionConfig connectionConfig = ConnectionConfig.getInstance(); ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
for (Map.Entry<String, Connection> entry: connectionConfig.getConnections().entrySet()) { for (Map.Entry<String, Connection> entry : connectionConfig.getConnections().entrySet()) {
if (ComparatorUtils.equals(selectedDSName, entry.getKey())) { if (ComparatorUtils.equals(selectedDSName, entry.getKey())) {
return entry.getValue(); return entry.getValue();
} }
@ -303,6 +321,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 刷新没多大用而且要刷新也不是这儿刷新 * 刷新没多大用而且要刷新也不是这儿刷新
*/ */
@Override
public void refresh() { public void refresh() {
DBUtils.refreshDatabase(); DBUtils.refreshDatabase();
String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem();
@ -312,6 +331,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
TreeCellRenderer tableNameTreeRenderer = new DefaultTreeCellRenderer() { TreeCellRenderer tableNameTreeRenderer = new DefaultTreeCellRenderer() {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if (value instanceof DefaultMutableTreeNode) { if (value instanceof DefaultMutableTreeNode) {
@ -328,6 +348,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}; };
public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() { public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof TreePath) { if (value instanceof TreePath) {
@ -345,6 +366,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 添加项目监听事件 * 添加项目监听事件
*
* @param aListener 事件监听器 * @param aListener 事件监听器
*/ */
public void addItemListener(ItemListener aListener) { public void addItemListener(ItemListener aListener) {
@ -353,6 +375,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 删除项目监听事件 * 删除项目监听事件
*
* @param aListener 事件监听器 * @param aListener 事件监听器
*/ */
public void removeItemListener(ItemListener aListener) { public void removeItemListener(ItemListener aListener) {
@ -398,9 +421,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
} }
((DefaultTreeModel) tree.getModel()).reload(); ((DefaultTreeModel) tree.getModel()).reload();
/** // daniel 展开所有tree
* daniel 展开所有tree
*/
TreeNode root = (TreeNode) tree.getModel().getRoot(); TreeNode root = (TreeNode) tree.getModel().getRoot();
TreePath parent = new TreePath(root); TreePath parent = new TreePath(root);
TreeNode node = (TreeNode) parent.getLastPathComponent(); TreeNode node = (TreeNode) parent.getLastPathComponent();
@ -416,6 +437,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 创建选中的数据集数据 * 创建选中的数据集数据
*
* @return 数据集数据 * @return 数据集数据
*/ */
public TableData createSelectTableData() { public TableData createSelectTableData() {
@ -428,8 +450,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
try { try {
connect = FRContext.getCurrentEnv().testConnection(database); connect = FRContext.getCurrentEnv().testConnection(database);
} catch (Exception e1) { } catch (Exception ignored) {
connect = false;
} }
if (!connect) { if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
@ -442,9 +463,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
TableData tableData = null; TableData tableData = null;
if (FRContext.getCurrentEnv() instanceof LocalEnv) { if (FRContext.getCurrentEnv() instanceof LocalEnv) {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(),
DialectFactory.getDialectByName(paras.getDatabaseName()))); DialectFactory.getDialectByName(paras.getDatabaseName())));
tableData = tableDataLocal;
} else { } else {
try { try {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
@ -485,6 +505,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 得到当前的ColumnName[] * 得到当前的ColumnName[]
*
* @return 返回当前的ColumnName[] * @return 返回当前的ColumnName[]
*/ */
public String[] currentColumnNames() { public String[] currentColumnNames() {
@ -493,21 +514,19 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DataBaseItems paras = this.updateBean(); DataBaseItems paras = this.updateBean();
String selectedDSName = paras.getDatabaseName(); String selectedDSName = paras.getDatabaseName();
if (StringUtils.isBlank(selectedDSName)) { if (StringUtils.isBlank(selectedDSName)) {
return colNames = new String[0]; // peter:选中了当前的零长度的节点,直接返回. // peter:选中了当前的零长度的节点,直接返回.
return new String[0];
} }
String selectedTableObject = paras.getTableName(); String selectedTableObject = paras.getTableName();
if (StringUtils.isEmpty(selectedTableObject)) { if (StringUtils.isEmpty(selectedTableObject)) {
return colNames = new String[0]; return new String[0];
} }
java.sql.Connection conn = null;
try { try {
// daniel:增加参数 // daniel:增加参数
colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject); colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject);
} catch (Exception e2) { } catch (Exception e2) {
FRContext.getLogger().error(e2.getMessage(), e2); FRContext.getLogger().error(e2.getMessage(), e2);
} finally {
DBUtils.closeConnection(conn);
} }
if (colNames == null) { if (colNames == null) {
@ -518,6 +537,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 预览key value对应的数据 * 预览key value对应的数据
*
* @param key * @param key
* @param value * @param value
*/ */
@ -528,6 +548,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 默认预览 * 默认预览
*/ */
@Override
public void preview() { public void preview() {
preview(-1, -1); preview(-1, -1);
} }
@ -540,10 +561,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
/** /**
*注册listener,相应数据集改变 * 注册listener,相应数据集改变
*/ */
@Override
public void registerDSChangeListener() { public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
initDsNameComboBox(); initDsNameComboBox();
} }
@ -578,6 +601,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
this.refreshingModel = refreshingModel; this.refreshingModel = refreshingModel;
} }
@Override
public void setSelectedItem(Object ob) { public void setSelectedItem(Object ob) {
this.getModel().setSelectedItem(ob); this.getModel().setSelectedItem(ob);
if (ob != null && StringUtils.isEmpty(ob.toString())) { if (ob != null && StringUtils.isEmpty(ob.toString())) {
@ -591,11 +615,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private class ComboBoxEditor extends UIComboBoxEditor { private class ComboBoxEditor extends UIComboBoxEditor {
private Object item; private Object item;
@Override
public void setItem(Object item) { public void setItem(Object item) {
this.item = item; this.item = item;
textField.setText((item == null) ? "" : item.toString()); textField.setText((item == null) ? "" : item.toString());
} }
@Override
public Object getItem() { public Object getItem() {
return this.item; return this.item;
} }

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

@ -12,9 +12,10 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -121,7 +122,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
okButton.setEnabled(true); okButton.setEnabled(true);
message.setText(database.connectMessage(connect)); message.setText(database.connectMessage(connect));
} catch (Exception exp) { } catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} }
return null; return null;
} }

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

@ -26,6 +26,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.function.TIME; import com.fr.function.TIME;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
@ -298,7 +299,7 @@ public class PreviewTablePane extends BasicPane {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
return; return;
} }
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, Inter.getLocText("FR-Designer_Error"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, Inter.getLocText("FR-Designer_Error"), JOptionPane.ERROR_MESSAGE);
} }

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

@ -4,12 +4,13 @@ import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
@ -99,7 +100,7 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper {
createStore(false); createStore(false);
columnNameList = Arrays.asList(procedureDataModel.getColumnName()); columnNameList = Arrays.asList(procedureDataModel.getColumnName());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {

11
designer-base/src/com/fr/design/editor/editor/ColumnRowEditor.java

@ -4,12 +4,12 @@ import com.fr.design.gui.columnrow.ColumnRowPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import java.awt.*; import java.awt.BorderLayout;
/** /**
* the editor to edit ColumnRow * the editor to edit ColumnRow
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:01:37 * @since 2012-3-29下午6:01:37
*/ */
public class ColumnRowEditor extends Editor<ColumnRow> { public class ColumnRowEditor extends Editor<ColumnRow> {
@ -63,6 +63,7 @@ public class ColumnRowEditor extends Editor<ColumnRow> {
this.crPane.requestFocus(); this.crPane.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "cell"; return "cell";
} }
@ -71,4 +72,10 @@ public class ColumnRowEditor extends Editor<ColumnRow> {
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof ColumnRow; return object instanceof ColumnRow;
} }
@Override
public void clearData() {
super.clearData();
this.setValue(null);
}
} }

34
designer-base/src/com/fr/design/editor/editor/TextEditor.java

@ -3,26 +3,31 @@
*/ */
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/** /**
* CellEditor used to edit String object. * CellEditor used to edit String object.
* *
* @editor zhou * @author zhou
* @since 2012-3-29下午6:00:43 * @since 2012-3-29下午6:00:43
*/ */
public class TextEditor extends Editor<String> { public class TextEditor extends Editor<String> {
private UITextField textField; // text field. /**
// the old value of text field. * text field.
*/
private UITextField textField;
/**
* the old value of text field.
*/
private String oldValue = StringUtils.EMPTY; private String oldValue = StringUtils.EMPTY;
/** /**
@ -93,7 +98,7 @@ public class TextEditor extends Editor<String> {
value = StringUtils.EMPTY; value = StringUtils.EMPTY;
} }
oldValue = value.toString(); oldValue = value;
this.textField.setText(oldValue); this.textField.setText(oldValue);
} }
@ -110,6 +115,7 @@ public class TextEditor extends Editor<String> {
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@ -133,10 +139,12 @@ public class TextEditor extends Editor<String> {
/** /**
* 被选中时文本输入框请求焦点 * 被选中时文本输入框请求焦点
*/ */
@Override
public void selected() { public void selected() {
this.textField.requestFocus(); this.textField.requestFocus();
} }
@Override
public String getIconName() { public String getIconName() {
return "type_string"; return "type_string";
} }
@ -147,7 +155,15 @@ public class TextEditor extends Editor<String> {
* @param object 需要判断的object * @param object 需要判断的object
* @return 是字符类型则返回true * @return 是字符类型则返回true
*/ */
@Override
public boolean accept(Object object) { public boolean accept(Object object) {
return object instanceof String; return object instanceof String;
} }
@Override
public void clearData() {
super.clearData();
this.textField.setText(StringUtils.EMPTY);
this.oldValue = StringUtils.EMPTY;
}
} }

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

@ -4,8 +4,12 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
/** /**
* Created by vito on 2017/5/5. * Created by vito on 2017/5/5.
@ -15,6 +19,15 @@ public class LoginDialog extends UIDialog {
public LoginDialog(Frame frame, Component pane) { public LoginDialog(Frame frame, Component pane) {
super(frame); super(frame);
init(pane);
}
public LoginDialog(Dialog dialog, Component pane) {
super(dialog);
init(pane);
}
private void init(Component pane) {
if (StableUtils.getMajorJavaVersion() == 8) { if (StableUtils.getMajorJavaVersion() == 8) {
setUndecorated(true); setUndecorated(true);
} }

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

@ -1,8 +1,8 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -44,7 +44,7 @@ public class PluginDetailPane extends BasicPane {
try { try {
Desktop.getDesktop().browse(linkUrl.toURI()); Desktop.getDesktop().browse(linkUrl.toURI());
} catch (IOException | URISyntaxException e1) { } catch (IOException | URISyntaxException e1) {
FRLogger.getLogger().error(e1.getMessage()); FineLoggerFactory.getLogger().error(e1.getMessage());
} }
} }
} }

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

@ -5,9 +5,9 @@ import com.fr.config.MarketConfig;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
@ -15,11 +15,7 @@ import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JComponent; import javax.swing.*;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -180,7 +176,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);

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

@ -10,12 +10,12 @@ import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
import com.fr.design.extra.exe.callback.UpdateOnlineCallback; import com.fr.design.extra.exe.callback.UpdateOnlineCallback;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -26,8 +26,7 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JOptionPane; import javax.swing.*;
import javax.swing.SwingUtilities;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -117,7 +116,7 @@ public class PluginOperateUtils {
JSONArray jsonArray = new JSONArray(result); JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray); resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
return resultArray.toString(); return resultArray.toString();
} }

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

@ -4,9 +4,9 @@ import com.fr.config.MarketConfig;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
@ -14,12 +14,7 @@ import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JComponent; import javax.swing.*;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -203,7 +198,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else { } else {
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);

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

@ -1,17 +1,16 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.TemplateUtils; import com.fr.base.TemplateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.basic.version.Version; import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
@ -59,7 +58,7 @@ public class PluginUtils {
httpClient.asGet(); httpClient.asGet();
result = httpClient.getResponseText(); result = httpClient.getResponseText();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} else { } else {
result = PluginConstants.CONNECTION_404; result = PluginConstants.CONNECTION_404;

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

@ -15,11 +15,11 @@ import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.extra.exe.callback.JSCallback; import com.fr.design.extra.exe.callback.JSCallback;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -31,10 +31,8 @@ import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.JOptionPane; import java.awt.*;
import javax.swing.SwingUtilities;
import java.awt.Desktop;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -355,7 +353,7 @@ public class PluginWebBridge {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info))); Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task); threadPoolExecutor.submit(task);
} catch (JSONException e) { } catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }
@ -491,10 +489,10 @@ public class PluginWebBridge {
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
//此为uri为空时抛出异常 //此为uri为空时抛出异常
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} catch (IOException e) { } catch (IOException e) {
//此为无法获取系统默认浏览器 //此为无法获取系统默认浏览器
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }
} }
@ -506,7 +504,7 @@ public class PluginWebBridge {
try { try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register"))); Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register")));
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
} }
} }

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

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.*; import com.fr.general.*;
import com.fr.log.FineLoggerFactory;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
@ -148,7 +149,7 @@ public class QQLoginWebPane extends JFXPanel {
} }
}); });
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }

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

@ -22,6 +22,9 @@ import javax.swing.JOptionPane;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -133,18 +136,22 @@ public class WebViewDlgHelper {
if (StableUtils.getMajorJavaVersion() == VERSION_8) { if (StableUtils.getMajorJavaVersion() == VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts")); File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) { if (!file.exists()) {
int rv = JOptionPane.showConfirmDialog( confirmDownLoadShopJS();
null, } else {
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"), showLoginDlg(DesignerContext.getDesignerFrame());
Inter.getLocText("FR-Designer-Plugin_Warning"), updateShopScripts(SHOP_SCRIPTS);
JOptionPane.OK_CANCEL_OPTION, }
JOptionPane.INFORMATION_MESSAGE }
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
} }
public static void createLoginDialog(Window parent) {
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
confirmDownLoadShopJS();
} else { } else {
showLoginDlg(); showLoginDlg(parent);
updateShopScripts(SHOP_SCRIPTS); updateShopScripts(SHOP_SCRIPTS);
} }
} }
@ -164,6 +171,20 @@ public class WebViewDlgHelper {
} }
} }
private static void confirmDownLoadShopJS() {
int rv = JOptionPane.showConfirmDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Shop_Need_Install"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE
);
if (rv == JOptionPane.OK_OPTION) {
downloadShopScripts(SHOP_SCRIPTS);
}
}
private static void showPluginDlg(String mainJsPath) { private static void showPluginDlg(String mainJsPath) {
try { try {
Class<?> clazz = Class.forName("com.fr.design.extra.PluginWebPane"); Class<?> clazz = Class.forName("com.fr.design.extra.PluginWebPane");
@ -179,13 +200,17 @@ public class WebViewDlgHelper {
} }
} }
private static void showLoginDlg() { private static void showLoginDlg(Window window) {
try { try {
Class<?> clazz = Class.forName("com.fr.design.extra.LoginWebPane"); Class<?> clazz = Class.forName("com.fr.design.extra.LoginWebPane");
Constructor constructor = clazz.getConstructor(String.class); Constructor constructor = clazz.getConstructor(String.class);
Component webPane = (Component) constructor.newInstance(installHome); Component webPane = (Component) constructor.newInstance(installHome);
UIDialog qqdlg;
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane); if (window instanceof Dialog) {
qqdlg = new LoginDialog((Dialog) window, webPane);
} else {
qqdlg = new LoginDialog((Frame) window, webPane);
}
LoginWebBridge.getHelper().setDialogHandle(qqdlg); LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true); qqdlg.setVisible(true);
} catch (Throwable ignored) { } catch (Throwable ignored) {

6
designer-base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -4,11 +4,11 @@ import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
/** /**
@ -23,7 +23,7 @@ public class GetPluginFromStoreExecutor implements Executor {
private String scope; private String scope;
public GetPluginFromStoreExecutor(JSONObject info) { public GetPluginFromStoreExecutor(JSONObject info) {
this.category = info.optString("category"); this.category = info.optString("categories");
this.fee = info.optString("fee"); this.fee = info.optString("fee");
this.seller = info.optString("seller"); this.seller = info.optString("seller");
this.scope = info.optString("scope"); this.scope = info.optString("scope");
@ -72,7 +72,7 @@ public class GetPluginFromStoreExecutor implements Executor {
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr); JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr);
result = resultJSONArray.toString(); result = resultJSONArray.toString();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} else { } else {
result = PluginConstants.CONNECTION_404; result = PluginConstants.CONNECTION_404;

4
designer-base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java

@ -2,9 +2,9 @@ package com.fr.design.extra.exe;
import com.fr.design.extra.PluginsReaderFromStore; import com.fr.design.extra.PluginsReaderFromStore;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -42,7 +42,7 @@ public class ReadUpdateOnlineExecutor implements Executor {
} }
result = jsonArray.toString(); result = jsonArray.toString();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }
} }

4
designer-base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -3,11 +3,11 @@ package com.fr.design.extra.exe;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process; import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
/** /**
@ -50,7 +50,7 @@ public class SearchOnlineExecutor implements Executor {
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray);
result = resultJSONArray.toString(); result = resultJSONArray.toString();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }
} }

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

@ -2,8 +2,8 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -37,7 +37,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Success")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Plugin_Install_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
@ -76,7 +76,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback); PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE);
} }
} }

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

@ -1,8 +1,8 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.control.AbstractDealPreTaskCallback; import com.fr.plugin.manage.control.AbstractDealPreTaskCallback;
@ -35,7 +35,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result); String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FRLogger.getLogger().info(pluginInfo + Inter.getLocText("FR-Plugin_Install_Success")); FineLoggerFactory.getLogger().info(pluginInfo + Inter.getLocText("FR-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, pluginInfo + Inter.getLocText("FR-Plugin_Install_Success")); JOptionPane.showMessageDialog(null, pluginInfo + Inter.getLocText("FR-Plugin_Install_Success"));
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){ } else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
@ -55,7 +55,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback); PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed"));
JOptionPane.showMessageDialog(null, pluginInfo, Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, pluginInfo, Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

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

@ -1,8 +1,8 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -25,7 +25,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Delete_Success")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Delete_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Plugin_Delete_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Plugin_Delete_Success"));
}else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) { }else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
@ -44,7 +44,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback)); PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback));
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Delete_Failed")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

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

@ -2,8 +2,8 @@ package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -37,7 +37,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Update_Success")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Plugin_Update_Success")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Plugin_Update_Success"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) { } else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
@ -76,7 +76,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback); PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback);
}else { }else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Update_Failed")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

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

@ -1,9 +1,8 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.manage.control.AbstractDealPreTaskCallback; import com.fr.plugin.manage.control.AbstractDealPreTaskCallback;
import com.fr.plugin.manage.control.PluginTask; import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
@ -32,11 +31,11 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result); String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) { if (result.isSuccess()) {
jsCallback.execute("success"); jsCallback.execute("success");
FRLogger.getLogger().info(pluginInfo + Inter.getLocText("FR-Plugin_Update_Success")); FineLoggerFactory.getLogger().info(pluginInfo + Inter.getLocText("FR-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null,pluginInfo + Inter.getLocText("FR-Plugin_Update_Success")); JOptionPane.showMessageDialog(null,pluginInfo + Inter.getLocText("FR-Plugin_Update_Success"));
} else { } else {
jsCallback.execute("failed"); jsCallback.execute("failed");
FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Update_Failed")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Plugin_Update_Failed"));
JOptionPane.showMessageDialog(null, pluginInfo, Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, pluginInfo, Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

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

@ -2,8 +2,8 @@ package com.fr.design.extra.tradition.callback;
import com.fr.design.extra.PluginStatusCheckCompletePane; import com.fr.design.extra.PluginStatusCheckCompletePane;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode; import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -31,7 +31,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
public void done(PluginTaskResult result){ public void done(PluginTaskResult result){
if (result.isSuccess()) { if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) { } else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog( int rv = JOptionPane.showOptionDialog(
@ -49,7 +49,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
} }
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane)); PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane));
} else { } else {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Delete_Failed")); FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Delete_Failed"));
JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} }
} }

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

@ -1,40 +1,37 @@
package com.fr.design.file; package com.fr.design.file;
import java.awt.*; import com.fr.base.FRContext;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.List;
import java.util.logging.Level;
import javax.swing.*;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.design.constants.UIConstants; import com.fr.dav.LocalEnv;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.fr.base.FRContext;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ilist.UIList; import com.fr.design.gui.ilist.UIList;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.design.utils.gui.GUIPaintUtils;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class HistoryTemplateListPane extends JPanel implements FileOperations, CallbackEvent { public class HistoryTemplateListPane extends JPanel implements FileOperations, CallbackEvent {
//最大保存内存中面板数,为0时关闭优化内存 //最大保存内存中面板数,为0时关闭优化内存
@ -120,7 +117,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
try { try {
historyList.remove(contains(selected)); historyList.remove(contains(selected));
selected.getEditingFILE().closeTemplate(); selected.getEditingFILE().closeTemplate();
FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "alraedy_close"}, new String[]{selected.getEditingFILE().getName(), "."})); FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "alraedy_close"}, new String[]{selected.getEditingFILE().getName(), "."}));
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);

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

@ -8,14 +8,13 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JVirtualTemplate;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -23,10 +22,18 @@ import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI; import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.AWTEventListener;
import java.awt.geom.*; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.Arc2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D;
import java.io.File; import java.io.File;
import java.util.logging.Level;
/** /**
* Author : daisy * Author : daisy
@ -710,24 +717,13 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) {
specifiedTemplate.saveTemplate(); specifiedTemplate.saveTemplate();
FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."}));
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); }
activeTemplate(filename);
} else if (returnVal == JOptionPane.NO_OPTION) {
//不保存
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
} }
//若是点击取消关闭,则什么都不做
} else {
//若是已经保存过了,则关闭即可
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename); activeTemplate(filename);
} }
}
/** /**
* 关闭模板 * 关闭模板
* *

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

File diff suppressed because one or more lines are too long

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

@ -15,8 +15,8 @@ import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.IOFileNodeFilter; import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -34,7 +34,6 @@ import java.awt.event.MouseListener;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Level;
public class TemplateTreePane extends JPanel implements FileOperations { public class TemplateTreePane extends JPanel implements FileOperations {
@ -143,7 +142,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
public void openContainerFolder() { public void openContainerFolder() {
FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode(); FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode();
LocalEnv localEnv = (LocalEnv) FRContext.getCurrentEnv(); LocalEnv localEnv = (LocalEnv) FRContext.getCurrentEnv();
String filePath = StableUtils.pathJoin(localEnv.path, fn.getEnvPath()); String filePath = StableUtils.pathJoin(localEnv.getPath(), fn.getEnvPath());
filePath = filePath.substring(0, filePath.lastIndexOf(CoreConstants.SEPARATOR)); filePath = filePath.substring(0, filePath.lastIndexOf(CoreConstants.SEPARATOR));
try { try {
Desktop.getDesktop().open(new File(filePath)); Desktop.getDesktop().open(new File(filePath));
@ -157,7 +156,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/ */
public void refresh() { public void refresh() {
reportletsTree.refresh(); reportletsTree.refresh();
FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"File-tree", "Refresh_Successfully"}) + "!"); FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"File-tree", "Refresh_Successfully"}) + "!");
} }
/** /**
@ -193,6 +192,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
reportletsTree.refresh(); reportletsTree.refresh();
} }
@Override
public void lockFile() {
throw new UnsupportedOperationException("unsupport now");
}
@Override
public void unLockFile() {
throw new UnsupportedOperationException("unsupport now");
}
private void deleteHistory(String fileName) { private void deleteHistory(String fileName) {
int index = HistoryTemplateListPane.getInstance().contains(fileName); int index = HistoryTemplateListPane.getInstance().contains(fileName);
int size = HistoryTemplateListPane.getInstance().getHistoryCount(); int size = HistoryTemplateListPane.getInstance().getHistoryCount();
@ -218,41 +227,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();
} }
/**
* 加上文件锁
*/
public void lockFile() {
FileNode fn = reportletsTree.getSelectedFileNode();
RemoteEnv remoteEnv = (RemoteEnv) FRContext.getCurrentEnv();
if (fn == null) {
return;
}
try {
remoteEnv.getLock(new String[]{fn.getEnvPath()});
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
}
reportletsTree.refresh();
}
/**
* 文件解锁
*/
public void unLockFile() {
FileNode fn = reportletsTree.getSelectedFileNode();
if (fn == null) {
return;
}
RemoteEnv remoteEnv = (RemoteEnv) FRContext.getCurrentEnv();
try {
remoteEnv.releaseLock(new String[]{fn.getEnvPath()});
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage());
}
reportletsTree.refresh();
}
public String getSelectedTemplatePath() { public String getSelectedTemplatePath() {
return reportletsTree.getSelectedTemplatePath(); return reportletsTree.getSelectedTemplatePath();
@ -322,11 +296,11 @@ public class TemplateTreePane extends JPanel implements FileOperations {
//todo 走下这个流程,否则集群下其它节点无法同步删除 //todo 走下这个流程,否则集群下其它节点无法同步删除
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath()); FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
} catch (IOException e) { } catch (IOException e) {
FRLogger.getLogger().info(e.getMessage()); FineLoggerFactory.getLogger().info(e.getMessage());
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath()); FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
} }
} else { } else {
FRLogger.getLogger().info("No Trash Available"); FineLoggerFactory.getLogger().info("No Trash Available");
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath()); FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
} }
} }

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

@ -9,7 +9,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.JavaCompileInfo; import com.fr.stable.JavaCompileInfo;
@ -65,7 +65,7 @@ public class JavaEditorPane extends BasicPane {
javaText.setText("//Didn't find java source match the class"); javaText.setText("//Didn't find java source match the class");
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
javaText.setText("//Loading source code from server error"); javaText.setText("//Loading source code from server error");
} }
} }
@ -162,7 +162,7 @@ public class JavaEditorPane extends BasicPane {
JOptionPane.showMessageDialog(null, Inter.getLocText(new String[]{"Save", "Successfully"}) + "!"); JOptionPane.showMessageDialog(null, Inter.getLocText(new String[]{"Save", "Successfully"}) + "!");
fireSaveActionListener(); fireSaveActionListener();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(null, Inter.getLocText(new String[]{"Save", "Failed"}) + "!"); JOptionPane.showMessageDialog(null, Inter.getLocText(new String[]{"Save", "Failed"}) + "!");
} }
@ -191,9 +191,9 @@ public class JavaEditorPane extends BasicPane {
} }
JOptionPane.showMessageDialog(null, message); JOptionPane.showMessageDialog(null, message);
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
FRLogger.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} catch (ExecutionException e1) { } catch (ExecutionException e1) {
FRLogger.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} }
} }
}.execute(); }.execute();

4
designer-base/src/com/fr/design/gui/UILookAndFeel.java

@ -29,7 +29,7 @@ import com.fr.design.gui.itoolbar.UIToolBarBorder;
import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI; import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI;
import com.fr.design.gui.itooltip.UIToolTipBorder; import com.fr.design.gui.itooltip.UIToolTipBorder;
import com.fr.design.gui.itree.UITreeUI; import com.fr.design.gui.itree.UITreeUI;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
@ -195,7 +195,7 @@ public class UILookAndFeel extends MetalLookAndFeel {
"com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class); "com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class);
if (url == null) { if (url == null) {
FRLogger.getLogger().error("Icon directory could not be resolved."); FineLoggerFactory.getLogger().error("Icon directory could not be resolved.");
return null; return null;
} }
} }

6
designer-base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java

@ -10,7 +10,7 @@
package com.fr.design.gui.autocomplete; package com.fr.design.gui.autocomplete;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.PopupWindowDecorator; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.PopupWindowDecorator;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
@ -303,7 +303,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
private void installKeyBindings() { private void installKeyBindings() {
if (AutoCompletion.isDebug()) { if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("PopupWindow: Installing keybindings"); FineLoggerFactory.getLogger().debug("PopupWindow: Installing keybindings");
} }
if (escapeKap == null) { // Lazily create actions. if (escapeKap == null) { // Lazily create actions.
@ -711,7 +711,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
private void uninstallKeyBindings() { private void uninstallKeyBindings() {
if (AutoCompletion.isDebug()) { if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("PopupWindow: Removing keybindings"); FineLoggerFactory.getLogger().debug("PopupWindow: Removing keybindings");
} }
JTextComponent comp = ac.getTextComponent(); JTextComponent comp = ac.getTextComponent();

6
designer-base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java

@ -14,7 +14,7 @@ import com.fr.design.gui.autocomplete.ParameterizedCompletionInsertionInfo.Repla
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rtextarea.ChangeableHighlightPainter; import com.fr.design.gui.syntax.ui.rtextarea.ChangeableHighlightPainter;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
@ -440,7 +440,7 @@ class ParameterizedCompletionContext {
*/ */
private void installKeyBindings() { private void installKeyBindings() {
if (AutoCompletion.isDebug()) { if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("CompletionContext: Installing keybindings"); FineLoggerFactory.getLogger().debug("CompletionContext: Installing keybindings");
} }
JTextComponent tc = ac.getTextComponent(); JTextComponent tc = ac.getTextComponent();
InputMap im = tc.getInputMap(); InputMap im = tc.getInputMap();
@ -739,7 +739,7 @@ class ParameterizedCompletionContext {
private void uninstallKeyBindings() { private void uninstallKeyBindings() {
if (AutoCompletion.isDebug()) { if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("CompletionContext Uninstalling keybindings"); FineLoggerFactory.getLogger().debug("CompletionContext Uninstalling keybindings");
} }
JTextComponent tc = ac.getTextComponent(); JTextComponent tc = ac.getTextComponent();

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

@ -17,10 +17,34 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; 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.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -47,7 +71,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
public UIControlPane(BasePlot plot) { public UIControlPane(BasePlot plot) {
this.plot =plot; this.plot = plot;
this.initComponentPane(); this.initComponentPane();
} }
@ -145,7 +169,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
this.checkButtonEnabled(); this.checkButtonEnabled();
} }
protected void getPopupEditDialog (JPanel cardPane) { protected void getPopupEditDialog(JPanel cardPane) {
popupEditDialog = new PopupEditDialog(cardPane); popupEditDialog = new PopupEditDialog(cardPane);
} }
@ -169,7 +193,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
toolbarDef.addShortCut(sj.getShortCut()); toolbarDef.addShortCut(sj.getShortCut());
} }
toolBar = ToolBarDef.createJToolBar(); toolBar = ToolBarDef.createJToolBar();
toolBar.setUI(new UIToolBarUI(){ toolBar.setUI(new UIToolBarUI() {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
@ -186,7 +210,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
leftContentPane.add(toolBarPane, BorderLayout.NORTH); leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮 // 顶部标签及add按钮
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI(){ topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() {
@Override @Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
@ -207,15 +231,15 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
return leftPane; return leftPane;
} }
protected JPanel getLeftTopPane (UIToolbar topToolBar) { protected JPanel getLeftTopPane(UIToolbar topToolBar) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = { p, f, isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT}; double[] columnSize = {p, f, isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT};
double[] rowSize = {TOP_TOOLBAR_HEIGHT}; double[] rowSize = {TOP_TOOLBAR_HEIGHT};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(getAddItemText()), new JPanel(), topToolBar}, new Component[]{new UILabel(getAddItemText()), new JPanel(), topToolBar},
}; };
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
/** /**
@ -336,6 +360,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
initListener(); initListener();
} }
@Override
public void setTitle(String title) { public void setTitle(String title) {
popupToolPane.setTitle(title); popupToolPane.setTitle(title);
} }
@ -349,10 +374,21 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
// 如果有可见模态对话框,则不隐藏 // 如果有可见模态对话框,则不隐藏
for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) { for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog)window).isModal()) { if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
return; return;
} }
} }
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
checkValid();
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage());
this.requestFocus();
return;
}
saveSettings(); saveSettings();
setVisible(false); setVisible(false);
} }
@ -361,7 +397,6 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
addWindowFocusListener(new WindowAdapter() { addWindowFocusListener(new WindowAdapter() {
@Override @Override
public void windowLostFocus(WindowEvent e) { public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);
hideDialog(); hideDialog();
} }
}); });
@ -389,6 +424,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
} }
repaint(); repaint();
} }
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null; mouseDownCompCoords = null;
@ -396,6 +432,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(originColor); contentPane.setBackground(originColor);
} }
} }
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
mouseDownCompCoords = e.getPoint(); mouseDownCompCoords = e.getPoint();
@ -409,6 +446,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND); contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND);
repaint(); repaint();
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (mouseDownCompCoords != null) { if (mouseDownCompCoords != null) {

48
designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java

@ -1,34 +1,37 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.icombobox.filter.Filter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.icombobox.ComboCheckBox; import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.ExtendedComboBox; import com.fr.design.gui.icombobox.ExtendedComboBox;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.gui.icombobox.filter.Filter;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: Richer * User: Richer
@ -42,12 +45,12 @@ public class ComboBoxDemo extends JPanel {
double f = TableLayout.FILL; double f = TableLayout.FILL;
Component[][] coms = new Component[][]{ Component[][] coms = new Component[][]{
{new UILabel(Inter.getLocText("Form-ComboCheckBox")+":"), createComboCheckBox()}, {new UILabel(Inter.getLocText("Form-ComboCheckBox") + ":"), createComboCheckBox()},
{new UILabel(Inter.getLocText(new String[]{"DS-Dictionary", "Form-ComboBox"})+":"), createDictComboBox()}, {new UILabel(Inter.getLocText(new String[]{"DS-Dictionary", "Form-ComboBox"}) + ":"), createDictComboBox()},
{new UILabel(Inter.getLocText("long_data_can_not_show_fully")+":"), createExtendedComboBox()}, {new UILabel(Inter.getLocText("long_data_can_not_show_fully") + ":"), createExtendedComboBox()},
{new UILabel(Inter.getLocText(new String[]{"Filter", "Form-ComboBox"})+":"), createFilterComboBox()}, {new UILabel(Inter.getLocText(new String[]{"Filter", "Form-ComboBox"}) + ":"), createFilterComboBox()},
{new UILabel(Inter.getLocText("Form-ComboBox")+":"), createTreeComboBox()}, {new UILabel(Inter.getLocText("Form-ComboBox") + ":"), createTreeComboBox()},
{new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"})+":"), createLazyComboBox()} {new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"}) + ":"), createLazyComboBox()}
}; };
double[] rowSize = new double[coms.length]; double[] rowSize = new double[coms.length];
double[] columnSize = {p, f}; double[] columnSize = {p, f};
@ -165,6 +168,7 @@ public class ComboBoxDemo extends JPanel {
// 睡5秒 // 睡5秒
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }

17
designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java

@ -1,16 +1,15 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -19,10 +18,10 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Time: 下午4:54 * Time: 下午4:54
*/ */
public class SwingComponentsDemo extends JFrame { public class SwingComponentsDemo extends JFrame {
public SwingComponentsDemo() { private SwingComponentsDemo() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
init(); init();
JPanel contentPane = (JPanel)getContentPane(); JPanel contentPane = (JPanel) getContentPane();
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); contentPane.setLayout(FRGUIPaneFactory.createBorderLayout());
JTabbedPane tab = new JTabbedPane(); JTabbedPane tab = new JTabbedPane();
contentPane.add(tab, BorderLayout.CENTER); contentPane.add(tab, BorderLayout.CENTER);
@ -40,12 +39,12 @@ public class SwingComponentsDemo extends JFrame {
public static void main(String[] args) { public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
JFrame f = new SwingComponentsDemo(); JFrame f = new SwingComponentsDemo();
f.setSize(500, 500); f.setSize(500, 500);
f.setVisible(true); f.setVisible(true);
GUICoreUtils.centerWindow(f); GUICoreUtils.centerWindow(f);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
} }
}); });
} }

32
designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPane.java

@ -44,15 +44,12 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators()); refreshNameableCreator(createNameableCreators());
} }
}, new PluginFilter() { }, new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(HyperlinkProvider.XML_TAG); return context.contain(HyperlinkProvider.XML_TAG);
} }
}); });
@ -63,6 +60,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
* *
* @return 返回Nameable按钮数组. * @return 返回Nameable按钮数组.
*/ */
@Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new ListMap<>(); Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators(); NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
@ -82,6 +80,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
* *
* @return 返回标题字符串. * @return 返回标题字符串.
*/ */
@Override
public String title4PopupWindow() { public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Hyperlink"); return Inter.getLocText("FR-Designer_Hyperlink");
} }
@ -91,11 +90,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return Inter.getLocText("FR-Designer_Add_Hyperlink"); return Inter.getLocText("FR-Designer_Add_Hyperlink");
} }
public void populate(NameJavaScriptGroup nameHyperlink_array) { public void populate(NameJavaScriptGroup hyperlinkArray) {
java.util.List<NameObject> list = new ArrayList<NameObject>(); java.util.List<NameObject> list = new ArrayList<>();
if (nameHyperlink_array != null) { if (hyperlinkArray != null) {
for (int i = 0; i < nameHyperlink_array.size(); i++) { for (int i = 0; i < hyperlinkArray.size(); i++) {
list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript())); list.add(new NameObject(hyperlinkArray.getNameHyperlink(i).getName(), hyperlinkArray.getNameHyperlink(i).getJavaScript()));
} }
} }
@ -113,20 +112,29 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*/ */
public NameJavaScriptGroup updateJSGroup() { public NameJavaScriptGroup updateJSGroup() {
Nameable[] res = this.update(); Nameable[] res = this.update();
NameJavaScript[] res_array = new NameJavaScript[res.length]; NameJavaScript[] resArray = new NameJavaScript[res.length];
for (int i = 0; i < res.length; i++) { for (int i = 0; i < res.length; i++) {
NameObject no = (NameObject) res[i]; NameObject no = (NameObject) res[i];
res_array[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject()); resArray[i] = new NameJavaScript(no.getName(), (JavaScript) no.getObject());
} }
return new NameJavaScriptGroup(res_array); return new NameJavaScriptGroup(resArray);
} }
@Override @Override
public void saveSettings() { public void saveSettings() {
if (isPopulating) { if (isPopulating || !needAutoSave()) {
return; return;
} }
hyperlinkGroupPaneActionProvider.saveSettings(this); hyperlinkGroupPaneActionProvider.saveSettings(this);
} }
/**
* 是否需要自动保存到超级链接属性中
*
* @return 是否需要自动保存
*/
public boolean needAutoSave() {
return true;
}
} }

14
designer-base/src/com/fr/design/gui/frpane/HyperlinkGroupPaneActionProvider.java

@ -3,9 +3,23 @@ package com.fr.design.gui.frpane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
/** /**
* @author plough
* Created by plough on 2017/7/26. * Created by plough on 2017/7/26.
*/ */
public interface HyperlinkGroupPaneActionProvider { public interface HyperlinkGroupPaneActionProvider {
/**
* 刷新面板展示
*
* @param hyperlinkGroupPane 超链面板
* @param elementCasePane 模板
*/
void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane); void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane);
/**
* 保存到文件
*
* @param hyperlinkGroupPane 超联面板
*/
void saveSettings(HyperlinkGroupPane hyperlinkGroupPane); void saveSettings(HyperlinkGroupPane hyperlinkGroupPane);
} }

4
designer-base/src/com/fr/design/gui/frpane/UITabbedPaneUI.java

@ -2,7 +2,7 @@ package com.fr.design.gui.frpane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import javax.swing.*; import javax.swing.*;
@ -129,7 +129,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
tabPane.addTab(tabName, tabPane.addTab(tabName,
(Component) GeneralUtils.classForName(classpath).newInstance()); (Component) GeneralUtils.classForName(classpath).newInstance());
} catch (Exception ex) { } catch (Exception ex) {
FRLogger.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
} }
} }

140
designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java

@ -3,108 +3,115 @@
*/ */
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.Dimension; import com.fr.log.FineLoggerFactory;
import java.util.ArrayList; import com.fr.general.Inter;
import java.util.List;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.basic.BasicComboPopup; import java.awt.Dimension;
import java.util.concurrent.ExecutionException;
import com.fr.general.Inter;
/** /**
* @author richer * @author richer
* @version 2018年2月6日14点43分 by @yaoh.wu
* @since 6.5.5 创建于2011-6-15 延迟加载的下拉框 * @since 6.5.5 创建于2011-6-15 延迟加载的下拉框
*/ */
public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener { public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener {
private static final int NUM = 80;
private static final String[] PENDING_CONTENT = new String[]{"", Inter.getLocText("Loading") + "..."};
/**
* 是否加载完成
*/
protected boolean loaded = false; protected boolean loaded = false;
private List<EventListener> ls = new ArrayList<EventListener>();
private Object initialSelected = null;
private static final int NUM=80;
public static final Object PENDING = new Object() { /**
* 初始化选项
*/
private Object initialSelected = null;
@Override
public String toString() {
return Inter.getLocText("Loading") + "...";
}
};
public LazyComboBox() { protected LazyComboBox() {
super(); super();
this.setEditor(new FilterComboBoxEditor()); this.setEditor(new FilterComboBoxEditor());
addPopupMenuListener(this); addPopupMenuListener(this);
// updateUI();
} }
public void setLoaded(boolean loaded) { public void setLoaded(boolean loaded) {
this.loaded = loaded; this.loaded = loaded;
} }
/**
* 加载下拉框中的选项
*
* @return 下拉框中的选项
*/
public abstract Object[] load(); public abstract Object[] load();
@Override
public void setSelectedItem(Object anObject) { public void setSelectedItem(Object anObject) {
initialSelected = anObject; initialSelected = anObject;
if (loaded) { if (loaded) {
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} else { } else {
this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject}));
setModel(new DefaultComboBoxModel(new Object[] { anObject }));
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} }
} }
/**
* 通过调用该方法在点击下拉框按钮之前就加载好数据
*/
public void loadInstant() {
if (loaded) {
return;
}
setModel(new DefaultComboBoxModel(load()));
loaded = true;
}
@Override @Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (loaded) { if (loaded) {
return; return;
} }
DefaultComboBoxModel loadingModel = new DefaultComboBoxModel(new String[]{"", Inter.getLocText("Loading") + "..."}); DefaultComboBoxModel<String> loadingModel = new DefaultComboBoxModel<>(PENDING_CONTENT);
LazyComboBox.this.setModel(loadingModel); this.setModel(loadingModel);
new SwingWorker<Void, Void>() { new SwingWorker<Object[], Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Object[] doInBackground() {
final Object selectedObj = getSelectedItem(); return load();
loadList();
return null;
} }
@Override @Override
public void done() { public void done() {
LazyComboBox.this.updateUI(); try {
LazyComboBox.this.fireEvent(); LazyComboBox.this.loadList(get());
} catch (InterruptedException | ExecutionException exception) {
FineLoggerFactory.getLogger().debug(exception.getMessage());
}
LazyComboBox.this.showPopup(); LazyComboBox.this.showPopup();
} }
}.execute(); }.execute();
}
/**
* 加载下拉列表
*/
public void loadList() {
DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(load());
model.setSelectedItem(initialSelected);
this.setModel(model);
this.selectedItemReminder = initialSelected;
loaded = true;
} }
/** /**
* 计算加载下拉列表 * 加载下拉列表
*
* @param contents 下拉列表内容
*/ */
public void loadList() { private void loadList(Object[] contents) {
DefaultComboBoxModel model = new DefaultComboBoxModel(load()); DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(contents);
model.setSelectedItem(initialSelected); model.setSelectedItem(initialSelected);
LazyComboBox.this.setModel(model); this.setModel(model);
LazyComboBox.this.selectedItemReminder = initialSelected ; this.selectedItemReminder = initialSelected;
loaded = true; loaded = true;
} }
@ -118,19 +125,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
} }
public void addClickListener(EventListener l) {
if (ls == null) {
ls = new ArrayList<LazyComboBox.EventListener>();
}
ls.add(l);
}
public void fireEvent() {
for (int i = 0, n = ls.size(); i < n; i++) {
ls.get(i).fireEvent();
}
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -138,26 +132,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
return dim; return dim;
} }
private static class LazyPopMenu extends BasicComboPopup {
public LazyPopMenu(final JComboBox combo) {
super(combo);
LazyComboBox comboc = (LazyComboBox) combo;
comboc.addClickListener(new EventListener() {
@Override
public void fireEvent() {
LazyPopMenu.this.show();
combo.showPopup();
}
});
}
}
private interface EventListener {
void fireEvent();
}
class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener { class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private Object item; private Object item;
private volatile boolean filtering = false; private volatile boolean filtering = false;
@ -168,12 +142,12 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
textField.getDocument().addDocumentListener(this); textField.getDocument().addDocumentListener(this);
} }
@Override
public void setItem(Object item) { public void setItem(Object item) {
if (filtering) { if (filtering) {
return; return;
} }
this.item = item; this.item = item;
this.setting = true; this.setting = true;
textField.setSetting(true); textField.setSetting(true);
String newText = (item == null) ? "" : item.toString(); String newText = (item == null) ? "" : item.toString();
@ -182,23 +156,27 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
this.setting = false; this.setting = false;
} }
@Override
public Object getItem() { public Object getItem() {
return this.item; return this.item;
} }
@Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
protected void handleChange() { void handleChange() {
if (setting) { if (setting) {
return; return;
} }

48
designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java

@ -4,12 +4,13 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.ListCellRenderer;
import javax.swing.plaf.ComboBoxUI; import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import java.awt.*; import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -112,8 +113,6 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
public void setRenderer(ListCellRenderer aRenderer) { public void setRenderer(ListCellRenderer aRenderer) {
if (aRenderer instanceof UIComboBoxRenderer) { if (aRenderer instanceof UIComboBoxRenderer) {
super.setRenderer(aRenderer); super.setRenderer(aRenderer);
} else {
//throw new IllegalArgumentException("Must be UIComboBoxRenderer");
} }
} }
@ -121,13 +120,15 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
return null; return null;
} }
@Override
public void setGlobalName(String name) { public void setGlobalName(String name) {
comboBoxName = name; comboBoxName = name;
} }
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);//加5的原因在于:render里,每一个项前面了空了一格,要多几像素 //加5的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);
} }
/** /**
@ -147,68 +148,51 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
/** /**
* *
*/ */
@Override
public void updateUI() { public void updateUI() {
setUI(getUIComboBoxUI()); setUI(getUIComboBoxUI());
} }
/** /**
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener; uiObserverListener = listener;
} }
public void removeChangeListener(){ public void removeChangeListener() {
uiObserverListener = null; uiObserverListener = null;
} }
public UIObserverListener getUiObserverListener(){ public UIObserverListener getUiObserverListener() {
return uiObserverListener; return uiObserverListener;
} }
/** /**
* @return * @return 是否响应变更事件
*/ */
@Override
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
/** /**
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerNameListener(GlobalNameListener listener) { public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener; globalNameListener = listener;
} }
/** /**
* * @return 是否响应名称事件
* @return
*/ */
@Override
public boolean shouldResponseNameListener() { public boolean shouldResponseNameListener() {
return true; return true;
} }
/**
* @param args
*/
public static void main(String... args) {
LayoutManager layoutManager = null;
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(layoutManager);
UIComboBox bb = new UIComboBox(new String[]{"", "jerry", "kunsnat", "richer"});
bb.setEditable(true);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
} }

6
designer-base/src/com/fr/design/gui/imenu/UIBasicMenuUI.java

@ -6,7 +6,7 @@ package com.fr.design.gui.imenu;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*; import javax.swing.event.*;
@ -504,7 +504,7 @@ public class UIBasicMenuUI extends UIBasicMenuItemUI {
} }
if (DEBUG) { if (DEBUG) {
FRLogger.getLogger().info("in TinyMenuUI.menuKeyTyped for " + menuItem.getText()); FineLoggerFactory.getLogger().info("in TinyMenuUI.menuKeyTyped for " + menuItem.getText());
} }
if (!crossMenuMnemonic) { if (!crossMenuMnemonic) {
@ -544,7 +544,7 @@ public class UIBasicMenuUI extends UIBasicMenuItemUI {
return; return;
} }
if (DEBUG) { if (DEBUG) {
FRLogger.getLogger().info("in TinyMenuUI.menuKeyPressed for " + menuItem.getText()); FineLoggerFactory.getLogger().info("in TinyMenuUI.menuKeyPressed for " + menuItem.getText());
} }
char keyChar = e.getKeyChar(); char keyChar = e.getKeyChar();
if (!Character.isLetterOrDigit(keyChar)){ if (!Character.isLetterOrDigit(keyChar)){

6
designer-base/src/com/fr/design/gui/imenutable/UIMenuNameableCreator.java

@ -1,7 +1,7 @@
package com.fr.design.gui.imenutable; package com.fr.design.gui.imenutable;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
public class UIMenuNameableCreator implements Nameable{ public class UIMenuNameableCreator implements Nameable{
@ -46,9 +46,9 @@ public class UIMenuNameableCreator implements Nameable{
try { try {
cloneObj = obj.getClass().newInstance(); cloneObj = obj.getClass().newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
FRLogger.getLogger().error("UIMenuNameableCreator InstantiationException"); FineLoggerFactory.getLogger().error("UIMenuNameableCreator InstantiationException");
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException"); FineLoggerFactory.getLogger().error("UIMenuNameableCreator IllegalAccessException");
} }
return new UIMenuNameableCreator(name, cloneObj, this.paneClazz); return new UIMenuNameableCreator(name, cloneObj, this.paneClazz);

4
designer-base/src/com/fr/design/gui/style/NumberDragBar.java

@ -1,7 +1,7 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -126,7 +126,7 @@ public class NumberDragBar extends JComponent {
repaint(); repaint();
revalidate(); revalidate();
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error(e.toString()); FineLoggerFactory.getLogger().error(e.toString());
} }
} }
}); });

4
designer-base/src/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java

@ -1,7 +1,7 @@
package com.fr.design.javascript.beautify; package com.fr.design.javascript.beautify;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.script.ScriptFactory; import com.fr.script.ScriptFactory;
@ -42,7 +42,7 @@ public class JavaScriptFormatHelper {
Invocable invocable = (Invocable) scriptEngine; Invocable invocable = (Invocable) scriptEngine;
result = (String) invocable.invokeFunction("js_beautify", jsCode, option.toFormatArgument()); result = (String) invocable.invokeFunction("js_beautify", jsCode, option.toFormatArgument());
} catch (ScriptException | NoSuchMethodException e) { } catch (ScriptException | NoSuchMethodException e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return result; return result;
} }

6
designer-base/src/com/fr/design/mainframe/DesignerContext.java

@ -6,7 +6,7 @@ package com.fr.design.mainframe;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.*; import javax.swing.*;
@ -73,14 +73,14 @@ public class DesignerContext {
return (Clipboard) clipMethod.invoke(transferAction, new Object[]{comp}); return (Clipboard) clipMethod.invoke(transferAction, new Object[]{comp});
} catch (Exception securityException) { } catch (Exception securityException) {
FRLogger.getLogger().error(securityException.getMessage(), securityException); FineLoggerFactory.getLogger().error(securityException.getMessage(), securityException);
//用反射机制,获得TransferHandler的getClipboard //用反射机制,获得TransferHandler的getClipboard
//这样可以保证和TextField直接的copy paste //这样可以保证和TextField直接的copy paste
try { try {
//控件的Clipboard. //控件的Clipboard.
DesignerContext.clipboard = comp.getToolkit().getSystemClipboard(); DesignerContext.clipboard = comp.getToolkit().getSystemClipboard();
} catch (Exception exp) { } catch (Exception exp) {
FRLogger.getLogger().error(exp.getMessage(), exp); FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
DesignerContext.clipboard = new Clipboard("FR"); DesignerContext.clipboard = new Clipboard("FR");
} }
} }

67
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -6,16 +6,23 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.core.env.EnvConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.*; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
@ -28,15 +35,15 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.env.EnvContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -54,15 +61,29 @@ import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.*; import java.awt.dnd.DnDConstants;
import java.awt.event.*; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import static com.fr.core.env.EnvEvents.AFTER_SIGN_OUT;
import static com.fr.core.env.EnvEvents.BEFORE_SIGN_OUT;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
public static final String DESIGNER_FRAME_NAME = "designer_frame"; public static final String DESIGNER_FRAME_NAME = "designer_frame";
@ -332,7 +353,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
.getResourceAsStream("/com/fr/base/images/oem/logo.ico")); .getResourceAsStream("/com/fr/base/images/oem/logo.ico"));
this.setIconImages(image); this.setIconImages(image);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
} }
} }
@ -609,10 +630,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
defaultTitleSB.append(ProductConstants.BRANCH); defaultTitleSB.append(ProductConstants.BRANCH);
// james:标识登录的用户和登录的ENV // james:标识登录的用户和登录的ENV
String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
Env env = DesignerEnvManager.getEnvManager().getEnv(envName); EnvConfig env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env != null) { if (env != null) {
defaultTitleSB.append(env.getUser()).append('@').append(envName).append('['); defaultTitleSB.append(EnvConfigUtils.getUsername(env)).append('@').append(envName).append('[');
defaultTitleSB.append(env.getEnvDescription()); defaultTitleSB.append(Inter.getLocText("Env-Remote_Server"));
defaultTitleSB.append(']'); defaultTitleSB.append(']');
if (editingTemplate != null) { if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath(); String path = editingTemplate.getEditingFILE().getPath();
@ -703,17 +724,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate(); editingTemplate.saveTemplate();
FRLogger.getLogger().log( FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
Level.INFO,
Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "."})); editingTemplate.getEditingFILE().getName(), "."}));
} }
} else { } else {
if (editingTemplate.saveTemplate()) { if (editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate(); editingTemplate.saveTemplate();
FRLogger.getLogger().log( FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
Level.INFO,
Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "."})); editingTemplate.getEditingFILE().getName(), "."}));
} }
} }
@ -734,6 +751,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板. * @param jt 添加的模板.
*/ */
public void addAndActivateJTemplate(JTemplate<?, ?> jt) { public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }
@ -750,6 +769,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板 * @param jt 模板
*/ */
public void activateJTemplate(JTemplate<?, ?> jt) { public void activateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) { if (jt == null || jt.getEditingFILE() == null) {
return; return;
} }
@ -809,7 +830,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
// p:判断一下,如何文件为空或者文件不存在,直接返回. // p:判断一下,如何文件为空或者文件不存在,直接返回.
@ -823,7 +844,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try { try {
openFile(tplFile); openFile(tplFile);
} catch (Throwable t) { } catch (Throwable t) {
FRLogger.getLogger().error(t.getMessage(), t); FineLoggerFactory.getLogger().error(t.getMessage(), t);
addAndActivateJTemplate(); addAndActivateJTemplate();
} }
@ -927,7 +948,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try { try {
thread.join(); thread.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error("Map Thread Error"); FineLoggerFactory.getLogger().error("Map Thread Error");
} }
DesignerEnvManager.getEnvManager().setLastOpenFile( DesignerEnvManager.getEnvManager().setLastOpenFile(
@ -946,11 +967,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
Env currentEnv = FRContext.getCurrentEnv(); Env currentEnv = FRContext.getCurrentEnv();
try { try {
EnvContext.fireBeforeSignOut(); EventDispatcher.fire(BEFORE_SIGN_OUT);
currentEnv.signOut(); currentEnv.signOut();
EnvContext.fireAfterSignOut(); EventDispatcher.fire(AFTER_SIGN_OUT);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
this.setVisible(false); this.setVisible(false);
this.dispose(); this.dispose();
@ -1006,7 +1027,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
event.dropComplete(true); event.dropComplete(true);

32
designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -249,38 +249,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
} }
} }
/*
* 加锁
*/
private class GetLockAction extends UpdateAction {
public GetLockAction() {
this.setName(Inter.getLocText("FR-Designer_Get_Lock"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/lock.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
selectedOperation.lockFile();
}
}
/*
* 解锁
*/
private class ReleaseLockAction extends UpdateAction {
public ReleaseLockAction() {
this.setName(Inter.getLocText("FR-Designer_Release_Lock"));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/unlock.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
selectedOperation.unLockFile();
}
}
/** /**
* 按钮状态改变 * 按钮状态改变
*/ */

80
designer-base/src/com/fr/design/mainframe/JFormSliderPane.java

@ -14,13 +14,33 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter; import javax.swing.text.NumberFormatter;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
@ -51,7 +71,6 @@ public class JFormSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JFormSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner; private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
@ -62,7 +81,7 @@ public class JFormSliderPane extends JPanel {
private UISliderButton showValButton; private UISliderButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton; private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton; private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton; private UIRadioButton selfAdaptButton;
@ -83,7 +102,7 @@ public class JFormSliderPane extends JPanel {
showValSpinner.setEditor(editor); showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true); textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false); formatter.setAllowsInvalid(false);
@ -91,7 +110,7 @@ public class JFormSliderPane extends JPanel {
initShowValButton(); initShowValButton();
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -100,17 +119,13 @@ public class JFormSliderPane extends JPanel {
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
public static final JFormSliderPane getInstance() { public static JFormSliderPane getInstance() {
// if (THIS == null) { return new JFormSliderPane();
// THIS = new JSliderPane();
// }
THIS = new JFormSliderPane();
return THIS;
} }
private void initSlider() { private void initSlider() {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED){ slider = new UISlider(0, HUNDRED, HALF_HUNDRED) {
public Point getToolTipLocation(MouseEvent event){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
@ -123,8 +138,8 @@ public class JFormSliderPane extends JPanel {
} }
private void initShowValSpinner() { private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)){ showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
@ -134,16 +149,16 @@ public class JFormSliderPane extends JPanel {
} }
private void initDownUpButton() { private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")){ downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) {
public Point getToolTipLocation(MouseEvent event){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
downButton.setOpaque(false); downButton.setOpaque(false);
downButton.setBorderPainted(false); downButton.setBorderPainted(false);
downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down")); downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")){ upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")) {
public Point getToolTipLocation(MouseEvent event){ public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y); return new Point(event.getX(), event.getY() - TOOLTIP_Y);
} }
}; };
@ -164,10 +179,11 @@ public class JFormSliderPane extends JPanel {
showValButton.addActionListener(showValButtonActionListener); showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade")); showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
} }
private void initUIRadioButton() { private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%"); twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%"); oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%"); sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
@ -176,7 +192,7 @@ public class JFormSliderPane extends JPanel {
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() { customButton.addItemListener(new ItemListener() {
@ -194,7 +210,7 @@ public class JFormSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton); bg.add(oneHundredButton);
bg.add(SevenFiveButton); bg.add(sevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
@ -217,7 +233,7 @@ public class JFormSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR); septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR); // selfAdaptButton.setBackground(BACK_COLOR);
@ -227,7 +243,7 @@ public class JFormSliderPane extends JPanel {
new Component[]{septPane, null}, new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()} new Component[]{customButton, createSpinnerPanel()}
@ -247,14 +263,14 @@ public class JFormSliderPane extends JPanel {
return spinnerPanel; return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() { private ActionListener showValButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
popupDialog(); popupDialog();
} }
}; };
ChangeListener showValSpinnerChangeListener = new ChangeListener() { private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
@ -277,7 +293,7 @@ public class JFormSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() { private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -296,7 +312,7 @@ public class JFormSliderPane extends JPanel {
} }
}; };
ItemListener radioButtonItemListener = new ItemListener() { private ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource(); JRadioButton temp = (JRadioButton) e.getSource();
@ -312,7 +328,7 @@ public class JFormSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) { } else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) { } else {
slider.setValue(HALF_HUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -336,7 +352,7 @@ public class JFormSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue(); return b1.divide(b2, scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue(); showValue = (int) showValSpinner.getValue();

73
designer-base/src/com/fr/design/mainframe/JSliderPane.java

@ -15,13 +15,34 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter; import javax.swing.text.NumberFormatter;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -59,7 +80,6 @@ public class JSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner; private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
@ -70,12 +90,14 @@ public class JSliderPane extends JPanel {
private UISliderButton showValButton; private UISliderButton showValButton;
private UIRadioButton twoHundredButton; private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton; private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton; private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton; private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton; private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton; private UIRadioButton selfAdaptButton;
private UIRadioButton customButton; private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样 /**
* 拖动条处理和button直接输入不一样
*/
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
private PopupPane dialog; private PopupPane dialog;
private int upButtonX; private int upButtonX;
@ -91,7 +113,7 @@ public class JSliderPane extends JPanel {
showValSpinner.setEditor(editor); showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true); textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false); formatter.setAllowsInvalid(false);
@ -99,7 +121,7 @@ public class JSliderPane extends JPanel {
initShowValButton(); initShowValButton();
initUIRadioButton(); initUIRadioButton();
initPane(); initPane();
JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
@ -109,12 +131,8 @@ public class JSliderPane extends JPanel {
} }
public static final JSliderPane getInstance() { public static JSliderPane getInstance() {
// if (THIS == null) { return new JSliderPane();
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
} }
private void initSlider() { private void initSlider() {
@ -178,7 +196,7 @@ public class JSliderPane extends JPanel {
private void initUIRadioButton() { private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%"); twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%"); oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%"); sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%"); fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
@ -187,7 +205,7 @@ public class JSliderPane extends JPanel {
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener); twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() { customButton.addItemListener(new ItemListener() {
@ -205,7 +223,7 @@ public class JSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组 ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton); bg.add(oneHundredButton);
bg.add(SevenFiveButton); bg.add(sevenFiveButton);
bg.add(fiveTenButton); bg.add(fiveTenButton);
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
@ -228,7 +246,7 @@ public class JSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR); septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR); sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR);
selfAdaptButton.setBackground(BACK_COLOR); selfAdaptButton.setBackground(BACK_COLOR);
@ -238,7 +256,7 @@ public class JSliderPane extends JPanel {
new Component[]{septPane, null}, new Component[]{septPane, null},
new Component[]{twoHundredButton, null}, new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null}, new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null}, new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null}, new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null}, new Component[]{twoFiveButton, null},
new Component[]{selfAdaptButton, null}, new Component[]{selfAdaptButton, null},
@ -259,14 +277,14 @@ public class JSliderPane extends JPanel {
return spinnerPanel; return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() { private ActionListener showValButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
popupDialog(); popupDialog();
} }
}; };
ChangeListener showValSpinnerChangeListener = new ChangeListener() { private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
@ -289,7 +307,7 @@ public class JSliderPane extends JPanel {
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() { private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) { if (!isButtonOrIsTxt) {
@ -309,7 +327,7 @@ public class JSliderPane extends JPanel {
} }
}; };
ItemListener radioButtonItemListener = new ItemListener() { private ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource(); JRadioButton temp = (JRadioButton) e.getSource();
@ -325,7 +343,7 @@ public class JSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) { } else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) { } else {
slider.setValue(HALF_HUNDRED); slider.setValue(HALF_HUNDRED);
} }
} }
@ -343,7 +361,7 @@ public class JSliderPane extends JPanel {
return this.showValue; return this.showValue;
} }
public void reset(){ public void reset() {
this.showValSpinner.setValue(HUNDRED); this.showValSpinner.setValue(HUNDRED);
} }
@ -353,7 +371,7 @@ public class JSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue(); return b1.divide(b2, scale).doubleValue();
} }
ActionListener buttonActionListener = new ActionListener() { private ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue(); showValue = (int) showValSpinner.getValue();
@ -390,7 +408,7 @@ public class JSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) { } else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN); times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else { } else {
times = (int) (SIX * value - TWO_HUNDRED); times = SIX * value - TWO_HUNDRED;
} }
} }
@ -448,11 +466,9 @@ class JSliderPaneUI extends BasicSliderUI {
super(b); super(b);
} }
/** */
/** /**
* 绘制指示物 * 绘制指示物
*/ */
public void paintThumb(Graphics g) { public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect; Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -460,7 +476,6 @@ class JSliderPaneUI extends BasicSliderUI {
g2d.dispose(); g2d.dispose();
} }
/** */
/** /**
* 绘制刻度轨迹 * 绘制刻度轨迹
*/ */

4
designer-base/src/com/fr/design/mainframe/JTemplate.java

@ -45,7 +45,7 @@ import com.fr.file.MemFILE;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
@ -531,7 +531,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }

32
designer-base/src/com/fr/design/mainframe/TemplatePane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.core.env.EnvConfig;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -22,8 +22,19 @@ import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -97,6 +108,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/** /**
* 是否可扩展 * 是否可扩展
*
* @return 同上 * @return 同上
*/ */
public boolean IsExpanded() { public boolean IsExpanded() {
@ -111,7 +123,7 @@ public class TemplatePane extends JPanel implements MouseListener {
private boolean envListOkAction(EnvListPane envListPane) { private boolean envListOkAction(EnvListPane envListPane) {
String selectedName = envListPane.updateEnvManager(); String selectedName = envListPane.updateEnvManager();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
Env selectedEnv = envManager.getEnv(selectedName); EnvConfig selectedEnv = envManager.getEnv(selectedName);
GeneralContext.fireEnvWillChangeListener(); GeneralContext.fireEnvWillChangeListener();
try { try {
//如果是远程的还要先测试下,如果失败就不切换 //如果是远程的还要先测试下,如果失败就不切换
@ -120,7 +132,7 @@ public class TemplatePane extends JPanel implements MouseListener {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
return false; return false;
} else { } else {
String remoteVersion = selectedEnv.getDesignerVersion(); String remoteVersion = getDesignerVersion(selectedEnv);
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) { if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
String infor = Inter.getLocText("Server-version-tip"); String infor = Inter.getLocText("Server-version-tip");
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo"); String moreInfo = Inter.getLocText("Server-version-tip-moreInfo");
@ -147,6 +159,11 @@ public class TemplatePane extends JPanel implements MouseListener {
return true; return true;
} }
private String getDesignerVersion(EnvConfig selectedEnv) {
// return selectedEnv.getDesignerVersion();
throw new UnsupportedOperationException("unsupport now");
}
/** /**
* 编辑items * 编辑items
*/ */
@ -209,6 +226,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/** /**
* 鼠标点击 * 鼠标点击
*
* @param e 事件 * @param e 事件
*/ */
@Override @Override
@ -217,6 +235,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/** /**
* 鼠标按下 * 鼠标按下
*
* @param e 事件 * @param e 事件
*/ */
@Override @Override
@ -231,6 +250,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/** /**
* 鼠标放开 * 鼠标放开
*
* @param e 事件 * @param e 事件
*/ */
@Override @Override
@ -239,6 +259,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/** /**
* 鼠标进入 * 鼠标进入
*
* @param e 事件 * @param e 事件
*/ */
@Override @Override
@ -247,6 +268,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/** /**
* 鼠标离开 * 鼠标离开
*
* @param e 事件 * @param e 事件
*/ */
@Override @Override

63
designer-base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -7,10 +7,11 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogLevel;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory;
import com.fr.log.LogHandler; import com.fr.log.LogHandler;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.LogRecordTimeProvider; import com.fr.stable.xml.LogRecordTimeProvider;
@ -37,9 +38,9 @@ import java.util.logging.LogRecord;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler { public class DesignerLogHandler {
protected static final int INFO_INT = FRLogLevel.INFO.intValue(); protected static final int INFO_INT = com.fr.third.apache.log4j.Level.INFO.toInt();
protected static final int ERRO_INT = FRLogLevel.ERROR.intValue(); protected static final int ERROR_INT = com.fr.third.apache.log4j.Level.ERROR.toInt();
protected static final int SERVER_INT = FRLogLevel.SEVERE.intValue(); protected static final int WARN_INT = com.fr.third.apache.log4j.Level.WARN.toInt();
private static final int GAP_X = -150; private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60; private static final int INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40; private static final int ERRO_GAP_Y = -40;
@ -50,7 +51,7 @@ public class DesignerLogHandler {
@Override @Override
public void envChanged() { public void envChanged() {
// envchange后需要重新读取webinf里的log4j配置, 重新添加appender // envchange后需要重新读取webinf里的log4j配置, 重新添加appender
FRLogger.getLogger().addLogAppender(new LogHandler<DesignerLogAppender>() { FineLoggerFactory.getLogger().addLogAppender(new LogHandler<DesignerLogAppender>() {
@Override @Override
public DesignerLogAppender getHandler() { public DesignerLogAppender getHandler() {
return new DesignerLogAppender(); return new DesignerLogAppender();
@ -118,20 +119,20 @@ public class DesignerLogHandler {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
JPopupMenu showsetPopup = new JPopupMenu(); JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelvalue = ServerConfig.getInstance().getServerLogLevel().intValue(); int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt();
if (logLevelvalue <= INFO_INT) { if (logLevelInt <= INFO_INT) {
showsetPopup.add(showInfo); jPopupMenu.add(showInfo);
showsetPopup.add(showError); jPopupMenu.add(showError);
showsetPopup.add(showServer); jPopupMenu.add(showServer);
showsetPopup.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y); jPopupMenu.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y);
} else if (logLevelvalue == ERRO_INT) { } else if (logLevelInt == ERROR_INT) {
showsetPopup.add(showError); jPopupMenu.add(showError);
showsetPopup.add(showServer); jPopupMenu.add(showServer);
showsetPopup.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y); jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y);
} else { } else {
showsetPopup.add(showServer); jPopupMenu.add(showServer);
showsetPopup.show(caption, caption.getWidth() + GAP_X, SERVER_GAP_Y); jPopupMenu.show(caption, caption.getWidth() + GAP_X, SERVER_GAP_Y);
} }
} }
}); });
@ -222,9 +223,9 @@ public class DesignerLogHandler {
int logLevelvalue = logRecord.getLevel().intValue(); int logLevelvalue = logRecord.getLevel().intValue();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) { if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown()); printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown());
} else if (logLevelvalue == ERRO_INT && showError.isSelected()) { } else if (logLevelvalue == ERROR_INT && showError.isSelected()) {
printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown()); printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown());
} else if (logLevelvalue == SERVER_INT && showServer.isSelected()) { } else if (logLevelvalue == WARN_INT && showServer.isSelected()) {
printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown()); printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown());
} }
@ -234,9 +235,9 @@ public class DesignerLogHandler {
int logLevelvalue = level.intValue(); int logLevelvalue = level.intValue();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) { if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
printMessage(message, logLevelvalue, date); printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == ERRO_INT && showError.isSelected()) { } else if (logLevelvalue == ERROR_INT && showError.isSelected()) {
printMessage(message, logLevelvalue, date); printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == SERVER_INT && showServer.isSelected()) { } else if (logLevelvalue == WARN_INT && showServer.isSelected()) {
printMessage(message, logLevelvalue, date); printMessage(message, logLevelvalue, date);
} }
@ -264,10 +265,10 @@ public class DesignerLogHandler {
private void log(String str, int style) { private void log(String str, int style) {
SimpleAttributeSet attrSet = new SimpleAttributeSet(); SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == ERRO_INT) { if (style == ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29)); StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == SERVER_INT) { } else if (style == WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red); StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setBold(attrSet, true); StyleConstants.setBold(attrSet, true);
} else if (style == INFO_INT) { } else if (style == INFO_INT) {
@ -286,9 +287,9 @@ public class DesignerLogHandler {
} }
private String swithInter(String str, int style) { private String swithInter(String str, int style) {
if (style == ERRO_INT) { if (style == ERROR_INT) {
str = Inter.getLocText("FR-Designer_Alert") + ":" + str + "\n"; str = Inter.getLocText("FR-Designer_Alert") + ":" + str + "\n";
} else if (style == SERVER_INT) { } else if (style == WARN_INT) {
str = Inter.getLocText("FR-Designer_Seriously") + ":" + str + "\n"; str = Inter.getLocText("FR-Designer_Seriously") + ":" + str + "\n";
} else { } else {
str = Inter.getLocText("FR-Designer_Normal") + ":" + str + "\n"; str = Inter.getLocText("FR-Designer_Normal") + ":" + str + "\n";
@ -300,9 +301,9 @@ public class DesignerLogHandler {
LogMessageBar.getInstance().setMessage(message); LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogHandler.INFO_INT && showInfo.isSelected()) { if (level == DesignerLogHandler.INFO_INT && showInfo.isSelected()) {
caption.infoAdd(); caption.infoAdd();
} else if (level == DesignerLogHandler.ERRO_INT && showError.isSelected()) { } else if (level == DesignerLogHandler.ERROR_INT && showError.isSelected()) {
caption.errorAdd(); caption.errorAdd();
} else if (level == DesignerLogHandler.SERVER_INT && showServer.isSelected()) { } else if (level == DesignerLogHandler.WARN_INT && showServer.isSelected()) {
caption.serverAdd(); caption.serverAdd();
} }
} }
@ -341,4 +342,8 @@ public class DesignerLogHandler {
}; };
} }
public void printRemoteLog(LogRecordTime logRecordTime) {
logHandlerArea.printStackTrace(logRecordTime);
}
} }

88
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -0,0 +1,88 @@
package com.fr.design.mainframe.loghandler.socketio;
import com.fr.base.env.EnvContext;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvEvents;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.third.guava.base.Optional;
import com.fr.web.WebSocketConfig;
import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import java.io.ByteArrayInputStream;
import java.net.URI;
import java.net.URL;
public class DesignerSocketIO {
private static Optional<Socket> socketIO = Optional.absent();
private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override
public void call(Object... objects) {
try {
LogRecordTime[] logRecordTimes = LogUtils.readXMLLogRecords(new ByteArrayInputStream((byte[]) objects[0]));
for (LogRecordTime logRecordTime : logRecordTimes) {
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
};
static {
EventDispatcher.listen(EnvEvents.AFTER_SIGN_OUT, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
if (socketIO.isPresent()) {
socketIO.get().close();
socketIO = Optional.absent();
}
}
});
EventDispatcher.listen(EnvEvents.AFTER_SIGN_IN, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
updateSocket();
}
});
}
public static void init() {
updateSocket();
}
private static void updateSocket() {
EnvConfig env = EnvContext.currentEnv();
if (env instanceof LocalEnvConfig) {
return;
}
try {
String uri = String.format("http://%s:%s%s?%s=%s",
new URL(env.getPath()).getHost(),
WebSocketConfig.getInstance().getPort(),
EnvConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
EnvContext.currentToken());
socketIO = Optional.of(IO.socket(new URI(uri)));
socketIO.get().on(EnvConstants.WS_LOGRECORD, printLog);
socketIO.get().connect();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}

4
designer-base/src/com/fr/design/mainframe/templateinfo/TemplateInfoCollector.java

@ -9,7 +9,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
@ -207,7 +207,7 @@ public class TemplateInfoCollector<T extends BaseBook> implements Serializable,
FileOutputStream out = new FileOutputStream(getInfoFile()); FileOutputStream out = new FileOutputStream(getInfoFile());
XMLTools.writeOutputStreamXML(this, out); XMLTools.writeOutputStreamXML(this, out);
} catch (Exception ex) { } catch (Exception ex) {
FRLogger.getLogger().error(ex.getMessage()); FineLoggerFactory.getLogger().error(ex.getMessage());
} }
} }

7
designer-base/src/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java

@ -48,11 +48,8 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
public void doOk() { public void doOk() {
DesignAuthority[] authorities = managerPane.update(); DesignAuthority[] authorities = managerPane.update();
if (!FRContext.getCurrentEnv().isLocalEnv()) { if (!FRContext.getCurrentEnv().isLocalEnv()) {
try { boolean success = ((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities);
((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities); FRContext.getLogger().info("update remote design authority: " + success);
} catch (Exception exception) {
FRContext.getLogger().error(exception.getMessage());
}
} }
} }

9
designer-base/src/com/fr/design/selection/QuickEditor.java

@ -2,7 +2,7 @@ package com.fr.design.selection;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import javax.swing.*; import javax.swing.JComponent;
/** /**
* 快速编辑区域 * 快速编辑区域
@ -39,11 +39,15 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
tc.fireTargetModified(); tc.fireTargetModified();
} }
/**
* 刷新面板
*/
protected abstract void refresh(); protected abstract void refresh();
/** /**
* for 关闭时候释放 * 关闭模板时释放模板对象
* 所有持有tc的对象也必须置空或者丢弃对于tc的引用
*/ */
public void release() { public void release() {
tc = null; tc = null;
@ -53,7 +57,6 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
@Override @Override
protected void refresh() { protected void refresh() {
} }
}; };

4
designer-base/src/com/fr/design/style/background/BackgroundPane.java

@ -17,7 +17,7 @@ import javax.swing.event.EventListenerList;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
public class BackgroundPane extends BasicPane { public class BackgroundPane extends BasicPane {
@ -139,7 +139,7 @@ public class BackgroundPane extends BasicPane {
try { try {
return quickPane.update(); return quickPane.update();
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
return null; return null;
} }

4
designer-base/src/com/fr/design/style/color/ColorPicker.java

@ -5,7 +5,7 @@ package com.fr.design.style.color;
*/ */
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -73,7 +73,7 @@ public class ColorPicker extends JDialog implements ActionListener
try { try {
Thread.sleep(100); // 等待弹窗关闭 Thread.sleep(100); // 等待弹窗关闭
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
colorPickerPanel.captureScreen(); colorPickerPanel.captureScreen();
} }

4
designer-base/src/com/fr/design/style/color/ColorSelectConfigManager.java

@ -3,7 +3,7 @@ package com.fr.design.style.color;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.file.XMLFileManager; import com.fr.file.XMLFileManager;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
@ -99,7 +99,7 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
try { try {
FRContext.getCurrentEnv().writeResource(manager); FRContext.getCurrentEnv().writeResource(manager);
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }

4
designer-base/src/com/fr/design/style/color/CustomChooserPanel.java

@ -28,7 +28,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
@ -241,7 +241,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
} }
} catch (BadLocationException e1) { } catch (BadLocationException e1) {
FRLogger.getLogger().error(e1.getMessage()); FineLoggerFactory.getLogger().error(e1.getMessage());
} }
} }
} }

41
designer-base/src/com/fr/design/utils/DesignUtils.java

@ -1,11 +1,11 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ServerConfig;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.base.EnvException; import com.fr.base.EnvException;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo; import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants; import com.fr.base.remote.RemoteDeziConstants;
import com.fr.dav.DavXMLUtils; import com.fr.dav.DavXMLUtils;
@ -19,10 +19,11 @@ import com.fr.env.RemoteEnv;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory;
import com.fr.security.JwtUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
@ -51,7 +52,6 @@ import java.net.URLEncoder;
import java.util.Calendar; import java.util.Calendar;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Level;
/** /**
@ -75,6 +75,7 @@ public class DesignUtils {
/** /**
* 通过端口是否被占用判断设计器有没有启动 * 通过端口是否被占用判断设计器有没有启动
* s * s
*
* @return 启动了返回true * @return 启动了返回true
*/ */
public static boolean isStarted() { public static boolean isStarted() {
@ -120,18 +121,19 @@ public class DesignUtils {
} }
/** /**
*建立监听端口 * 建立监听端口
*
* @param startPort 端口 * @param startPort 端口
* @param suffixs 文件后缀 * @param suffixs 文件后缀
*/ */
public static void creatListeningServer(final int startPort,final String[] suffixs) { public static void creatListeningServer(final int startPort, final String[] suffixs) {
Thread serverSocketThread = new Thread() { Thread serverSocketThread = new Thread() {
public void run() { public void run() {
ServerSocket serverSocket = null; ServerSocket serverSocket = null;
try { try {
serverSocket = new ServerSocket(startPort); serverSocket = new ServerSocket(startPort);
} catch (IOException e1) { } catch (IOException e1) {
FRLogger.getLogger().log(Level.WARNING, "Cannot create server socket on" + port); FineLoggerFactory.getLogger().error("Cannot create server socket on" + port);
} }
while (true) { while (true) {
try { try {
@ -146,7 +148,7 @@ public class DesignUtils {
String path = f.getAbsolutePath(); String path = f.getAbsolutePath();
boolean isMatch = false; boolean isMatch = false;
for(int i= 0; i<suffixs.length;i++){ for (int i = 0; i < suffixs.length; i++) {
isMatch = isMatch || path.endsWith(suffixs[i]); isMatch = isMatch || path.endsWith(suffixs[i]);
} }
if (isMatch) { if (isMatch) {
@ -242,7 +244,7 @@ public class DesignUtils {
try { try {
UIManager.setLookAndFeel(UILookAndFeel.class.getName()); UIManager.setLookAndFeel(UILookAndFeel.class.getName());
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().log(Level.WARNING, "Substance Raven Graphite failed to initialize"); FineLoggerFactory.getLogger().error("Substance Raven Graphite failed to initialize");
} }
//获取当前系统语言下设计器用的默认字体 //获取当前系统语言下设计器用的默认字体
FRFont guiFRFont = getCurrentLocaleFont(); FRFont guiFRFont = getCurrentLocaleFont();
@ -257,17 +259,17 @@ public class DesignUtils {
} }
} }
private static boolean isTextField(String key){ private static boolean isTextField(String key) {
return key.startsWith("TextField.") || key.startsWith("PasswordField."); return key.startsWith("TextField.") || key.startsWith("PasswordField.");
} }
private static FRFont getCurrentLocaleFont(){ private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont; FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault(); Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) { if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun"); guiFRFont = getNamedFont("SimSun");
} else if(isDisplayDialog(defaultLocale)) { } else if (isDisplayDialog(defaultLocale)) {
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
} else { } else {
guiFRFont = getNamedFont("Tahoma"); guiFRFont = getNamedFont("Tahoma");
@ -284,7 +286,7 @@ public class DesignUtils {
if (!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {
//比如想在中文或英文系统里用韩文设计器 //比如想在中文或英文系统里用韩文设计器
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
if(!guiFRFont.canDisplay(displayChar)) { if (!guiFRFont.canDisplay(displayChar)) {
FRContext.getLogger().error(Inter.getLocText("FR-Base_SimSun_Not_Found")); FRContext.getLogger().error(Inter.getLocText("FR-Base_SimSun_Not_Found"));
} }
} }
@ -293,15 +295,15 @@ public class DesignUtils {
return guiFRFont; return guiFRFont;
} }
private static FRFont getNamedFont(String name){ private static FRFont getNamedFont(String name) {
return FRFont.getInstance(name, Font.PLAIN, 12); return FRFont.getInstance(name, Font.PLAIN, 12);
} }
private static boolean isDisplaySimSun(Locale defaultLocale){ private static boolean isDisplaySimSun(Locale defaultLocale) {
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE); return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
} }
private static boolean isDisplayDialog(Locale defaultLocale){ private static boolean isDisplayDialog(Locale defaultLocale) {
return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE) return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPANESE) || ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN) || ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
@ -313,7 +315,7 @@ public class DesignUtils {
* 访问服务器环境-空参数 * 访问服务器环境-空参数
*/ */
public static void visitEnvServer() { public static void visitEnvServer() {
visitEnvServerByParameters(StringUtils.EMPTY, new String[] {}, new String[] {}); visitEnvServerByParameters(StringUtils.EMPTY, new String[]{}, new String[]{});
} }
/** /**
@ -342,8 +344,11 @@ public class DesignUtils {
if (Utils.isEmbeddedParameter(postfixOfUri)) { if (Utils.isEmbeddedParameter(postfixOfUri)) {
String time = Calendar.getInstance().getTime().toString().replaceAll(" ", ""); String time = Calendar.getInstance().getTime().toString().replaceAll(" ", "");
boolean isUserPrivilege = ((RemoteEnv) FRContext.getCurrentEnv()).writePrivilegeMap(time, postfixOfUri); boolean isUserPrivilege = ((RemoteEnv) FRContext.getCurrentEnv()).writePrivilegeMap(time, postfixOfUri);
postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID(): postfixOfUri ; postfixOfUri = isUserPrivilege ? postfixOfUri + "&fr_check_url=" + time + "&id=" + FRContext.getCurrentEnv().getUserID() : postfixOfUri;
} }
// 加参数给远程设计校验权限。
String design = JwtUtils.createDefaultJWT(FRContext.getCurrentEnv().getUser());
postfixOfUri = postfixOfUri + "&design=" + design;
String urlPath = getWebBrowserPath(); String urlPath = getWebBrowserPath();
Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri)); Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri));
@ -486,7 +491,7 @@ public class DesignUtils {
*/ */
private static ByteArrayInputStream execute4InputStream(HttpClient client) throws Exception { private static ByteArrayInputStream execute4InputStream(HttpClient client) throws Exception {
int statusCode = client.getResponseCode(); int statusCode = client.getResponseCode();
if(statusCode != HttpURLConnection.HTTP_OK){ if (statusCode != HttpURLConnection.HTTP_OK) {
throw new EnvException("Method failed: " + statusCode); throw new EnvException("Method failed: " + statusCode);
} }
InputStream in = client.getResponseStream(); InputStream in = client.getResponseStream();

6
designer-base/src/com/fr/design/utils/DrawRoutines.java

@ -1,7 +1,7 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.design.utils.ColorRoutines; import com.fr.design.utils.ColorRoutines;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -205,11 +205,11 @@ public class DrawRoutines {
try { try {
grabber.grabPixels(); grabber.grabPixels();
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRLogger.getLogger().error("PixelGrabber interrupted waiting for pixels"); FineLoggerFactory.getLogger().error("PixelGrabber interrupted waiting for pixels");
} }
if ((grabber.getStatus() & ImageObserver.ABORT) != 0) { if ((grabber.getStatus() & ImageObserver.ABORT) != 0) {
FRLogger.getLogger().info("Image fetch aborted or errored."); FineLoggerFactory.getLogger().info("Image fetch aborted or errored.");
} else { } else {
for (int y = 0; y < h; y++) { for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) { for (int x = 0; x < w; x++) {

2
designer-base/src/com/fr/env/DesignAuthorityConfigurable.java vendored

@ -6,5 +6,5 @@ public interface DesignAuthorityConfigurable {
DesignAuthority[] getAuthorities(); DesignAuthority[] getAuthorities();
boolean updateAuthorities(DesignAuthority[] authorities) throws Exception; boolean updateAuthorities(DesignAuthority[] authorities);
} }

11
designer-base/src/com/fr/env/EnvListPane.java vendored

@ -1,7 +1,8 @@
package com.fr.env; package com.fr.env;
import com.fr.base.Env; import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.dav.LocalEnv; import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
@ -59,9 +60,9 @@ public class EnvListPane extends JListControlPane {
@Override @Override
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
NameableCreator local = new NameObjectCreator(Inter.getLocText("Env-Local_Directory"), "com/fr/design/images/data/bind/localconnect.png", NameableCreator local = new NameObjectCreator(Inter.getLocText("Env-Local_Directory"), "com/fr/design/images/data/bind/localconnect.png",
LocalEnv.class, LocalEnvPane.class); LocalEnvConfig.class, LocalEnvPane.class);
NameableCreator remote = new NameObjectCreator(Inter.getLocText("Env-Remote_Server"), "com/fr/design/images/data/bind/distanceconnect.png", NameableCreator remote = new NameObjectCreator(Inter.getLocText("Env-Remote_Server"), "com/fr/design/images/data/bind/distanceconnect.png",
RemoteEnv.class, RemoteEnvPane.class); RemoteEnvConfig.class, RemoteEnvPane.class);
return new NameableCreator[]{local, remote}; return new NameableCreator[]{local, remote};
} }
@ -104,7 +105,7 @@ public class EnvListPane extends JListControlPane {
Nameable[] res = this.update(); Nameable[] res = this.update();
for (Nameable re : res) { for (Nameable re : res) {
NameObject nameObject = (NameObject) re; NameObject nameObject = (NameObject) re;
mgr.putEnv(nameObject.getName(), (Env) nameObject.getObject()); mgr.putEnv(nameObject.getName(), (EnvConfig) nameObject.getObject());
} }
return this.getSelectedName(); return this.getSelectedName();
} }

9
designer-base/src/com/fr/env/LocalEnvPane.java vendored

@ -1,5 +1,6 @@
package com.fr.env; package com.fr.env;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.dav.LocalEnv; import com.fr.dav.LocalEnv;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -21,7 +22,7 @@ import java.io.File;
/** /**
* @author yaohwu * @author yaohwu
*/ */
public class LocalEnvPane extends BasicBeanPane<LocalEnv> { public class LocalEnvPane extends BasicBeanPane<LocalEnvConfig> {
private UITextField pathTextField; private UITextField pathTextField;
private JFileTree localEnvTree; private JFileTree localEnvTree;
@ -70,9 +71,9 @@ public class LocalEnvPane extends BasicBeanPane<LocalEnv> {
} }
@Override @Override
public LocalEnv updateBean() { public LocalEnvConfig updateBean() {
String path = pathTextField.getText(); String path = pathTextField.getText();
return LocalEnv.createEnv(path); return new LocalEnvConfig(path);
} }
public String getPath() { public String getPath() {
@ -80,7 +81,7 @@ public class LocalEnvPane extends BasicBeanPane<LocalEnv> {
} }
@Override @Override
public void populateBean(LocalEnv ob) { public void populateBean(LocalEnvConfig ob) {
if (StringUtils.isBlank(ob.getPath())) { if (StringUtils.isBlank(ob.getPath())) {
return; return;
} }

1856
designer-base/src/com/fr/env/RemoteEnv.java vendored

File diff suppressed because it is too large Load Diff

22
designer-base/src/com/fr/env/RemoteEnvPane.java vendored

@ -1,6 +1,8 @@
package com.fr.env; package com.fr.env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
@ -49,7 +51,7 @@ import static com.fr.design.layout.TableLayout.PREFERRED;
/** /**
* @author yaohwu * @author yaohwu
*/ */
public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> { public class RemoteEnvPane extends BasicBeanPane<RemoteEnvConfig> {
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
@ -100,7 +102,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
/** /**
* 主机位置 * 主机位置
*/ */
private RemoteEnvURL remoteEnvURL; private RemoteEnvURL remoteEnvURL = new RemoteEnvURL("");
/** /**
* https 配置面板 * https 配置面板
*/ */
@ -151,6 +153,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
actionURLInputChange(); actionURLInputChange();
} }
@ -250,7 +253,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
} }
@Override @Override
public void populateBean(RemoteEnv ob) { public void populateBean(RemoteEnvConfig ob) {
if (StringUtils.isEmpty(ob.getPath())) { if (StringUtils.isEmpty(ob.getPath())) {
remoteEnvURL = RemoteEnvURL.createDefaultURL(); remoteEnvURL = RemoteEnvURL.createDefaultURL();
@ -265,18 +268,20 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
fileChooserButton.setEnabled(remoteEnvURL.getHttps()); fileChooserButton.setEnabled(remoteEnvURL.getHttps());
updateHttpsConfigPanel(); updateHttpsConfigPanel();
this.usernameInput.setText(ob.getUser() == null ? StringUtils.EMPTY : ob.getUser()); String username = EnvConfigUtils.getUsername(ob);
String pwd = EnvConfigUtils.getPassword(ob);
this.usernameInput.setText(username == null ? StringUtils.EMPTY : pwd);
this.passwordInput.setText(ob.getPassword() == null ? StringUtils.EMPTY : ob.getPassword()); this.passwordInput.setText(ob.getPassword() == null ? StringUtils.EMPTY : ob.getPassword());
} }
@Override @Override
public RemoteEnv updateBean() { public RemoteEnvConfig updateBean() {
String path = remoteEnvURL.getURL(); String path = remoteEnvURL.getURL();
String user = this.usernameInput.getText(); String user = this.usernameInput.getText();
String password = new String(this.passwordInput.getPassword()); String password = new String(this.passwordInput.getPassword());
return new RemoteEnv(path, user, password); return new RemoteEnvConfig(path, user, password);
} }
@Override @Override
@ -465,11 +470,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
} }
private boolean testConnection() { private boolean testConnection() {
RemoteEnv env = new RemoteEnv();
String url = remoteEnvURL.getURL(); String url = remoteEnvURL.getURL();
env.setPath(url); RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword()));
env.setUser(usernameInput.getText());
env.setPassword(new String(passwordInput.getPassword()));
boolean connect = false; boolean connect = false;
try { try {
if (StringUtils.isNotEmpty(url)) { if (StringUtils.isNotEmpty(url)) {

143
designer-base/src/com/fr/env/RemoteEnvUtils.java vendored

@ -1,86 +1,167 @@
package com.fr.env; package com.fr.env;
import com.fr.base.EnvException;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.IOUtils;
import com.fr.report.DesignAuthority; import com.fr.report.DesignAuthority;
import com.fr.report.util.AuthorityXMLUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.third.org.apache.http.HttpEntity; import com.fr.third.org.apache.commons.io.IOUtils;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; import com.fr.third.org.apache.http.HttpResponse;
import com.fr.third.org.apache.http.HttpStatus;
import com.fr.third.org.apache.http.client.ClientProtocolException;
import com.fr.third.org.apache.http.client.ResponseHandler;
import com.fr.third.org.apache.http.client.methods.HttpUriRequest; import com.fr.third.org.apache.http.client.methods.HttpUriRequest;
import com.fr.third.org.apache.http.client.methods.RequestBuilder; import com.fr.third.org.apache.http.client.methods.RequestBuilder;
import com.fr.third.org.apache.http.entity.ContentType; import com.fr.third.org.apache.http.entity.ContentType;
import com.fr.third.org.apache.http.entity.InputStreamEntity; import com.fr.third.org.apache.http.entity.InputStreamEntity;
import com.fr.third.org.apache.http.impl.client.CloseableHttpClient; import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
import com.fr.third.org.apache.http.impl.client.HttpClients; import com.fr.third.org.apache.http.impl.client.HttpClients;
import com.fr.third.org.apache.http.util.EntityUtils;
import com.fr.web.utils.AuthorityXMLUtils;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.Map;
public class RemoteEnvUtils { public class RemoteEnvUtils {
private RemoteEnvUtils() { private RemoteEnvUtils() {
} }
public static boolean updateAuthorities(DesignAuthority[] authorities, RemoteEnv env) { private static ResponseHandler<InputStream> responseHandler = new ResponseHandler<InputStream>() {
@Override
public InputStream handleResponse(HttpResponse response) throws IOException {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
throw new ClientProtocolException("Method failed: " + response.getStatusLine().toString());
}
InputStream in = response.getEntity().getContent();
if (in == null) {
return null;
}
// 读取并返回
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, out);
return new ByteArrayInputStream(out.toByteArray());
}
};
public static InputStream simulateRPCByHttpPost(byte[] bytes, Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
String path = env.getPath(); String path = env.getPath();
String userID = env.getUserID(); RequestBuilder builder = RequestBuilder.post(path);
String res = null; InputStream inputStream = null;
CloseableHttpClient httpClient = HttpClients.createDefault();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue());
}
if (!isSignIn) {
builder.addParameter("id", env.getUserID());
}
InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(bytes));
AuthorityXMLUtils.writeDesignAuthoritiesXML(authorities, outputStream); try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = builder
.setEntity(reqEntity)
.build();
inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage());
}
return inputStream;
}
public static InputStream simulateRPCByHttpPost(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
String path = env.getPath();
RequestBuilder builder = RequestBuilder.post(path);
InputStream inputStream = null;
for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue());
}
if (!isSignIn) {
builder.addParameter("id", env.getUserID());
}
try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = builder
.build();
inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage());
}
return inputStream;
}
public static InputStream simulateRPCByHttpGet(Map<String, String> parameters, boolean isSignIn, RemoteEnv env) throws EnvException {
String path = env.getPath();
RequestBuilder builder = RequestBuilder.get(path);
InputStream inputStream = null;
for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue());
}
if (!isSignIn) {
builder.addParameter("id", env.getUserID());
}
try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = builder.build();
inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage());
}
return inputStream;
}
public static InputStream updateAuthorities(DesignAuthority[] authorities, RemoteEnv env) {
String path = env.getPath();
// 远程设计临时用户id
String userID = env.getUserID();
InputStream inputStream = null;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
AuthorityXMLUtils.writeDesignAuthoritiesXML(authorities, outputStream);
InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML); InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML);
try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = RequestBuilder.post(path) HttpUriRequest request = RequestBuilder.post(path)
.addParameter("id", userID) .addParameter("id", userID)
.addParameter("op", "remote_design_authority") .addParameter("op", "remote_design_authority")
.addParameter("cmd", "update_authorities") .addParameter("cmd", "update_authorities")
.setEntity(reqEntity) .setEntity(reqEntity)
.build(); .build();
inputStream = httpClient.execute(request, responseHandler);
try {
CloseableHttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
res = IOUtils.inputStream2String(entity.getContent(), EncodeConstants.ENCODING_UTF_8);
EntityUtils.consume(entity);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
return res != null && Boolean.valueOf(res); return inputStream;
} }
public static DesignAuthority[] getAuthorities(RemoteEnv env) { public static InputStream getAuthorities(RemoteEnv env) throws EnvException {
String path = env.getPath(); String path = env.getPath();
// 远程设计临时用户id
String userID = env.getUserID(); String userID = env.getUserID();
DesignAuthority[] authorities = null; InputStream inputStream = null;
CloseableHttpClient httpClient = HttpClients.createDefault();
try (CloseableHttpClient httpClient = HttpClients.createSystem();) {
HttpUriRequest request = RequestBuilder.get(path) HttpUriRequest request = RequestBuilder.get(path)
.addParameter("id", userID) .addParameter("id", userID)
.addParameter("op", "remote_design_authority") .addParameter("op", "remote_design_authority")
.addParameter("cmd", "get_authorities") .addParameter("cmd", "get_authorities")
.build(); .build();
inputStream = httpClient.execute(request, responseHandler);
try { } catch (IOException e) {
CloseableHttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
authorities = AuthorityXMLUtils.readDesignAuthoritiesXML(entity.getContent());
EntityUtils.consume(entity);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
return authorities; return inputStream;
} }
} }

62
designer-base/src/com/fr/env/SignIn.java vendored

@ -1,43 +1,61 @@
package com.fr.env; package com.fr.env;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.env.EnvContext;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvEvents;
import com.fr.dav.LocalEnv;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.env.EnvContext; import com.fr.general.Inter;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
public class SignIn { public class SignIn {
public static Env lastSelectedEnv;// 记录最后登录的Env
static {
EventDispatcher.listen(EnvEvents.CONNECTION_ERROR, new Listener<Null>() {
@Override
public void on(Event event, Null param) {
if (JOptionPane.showConfirmDialog(null, Inter.getLocText("FR-Remote_Connect2Server_Again"), UIManager.getString("OptionPane.titleText"), JOptionPane.YES_NO_OPTION)
== JOptionPane.OK_OPTION) {
try {
EnvContext.signIn(EnvContext.currentEnv());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
}
});
}
/** /**
* 注册入环境 * 注册入环境
* @param selectedEnv 选择的环境 * @param selectedEnv 选择的环境
* @throws Exception 异常 * @throws Exception 异常
*/ */
public static void signIn(Env selectedEnv) throws Exception { public static void signIn(EnvConfig selectedEnv) throws Exception {
boolean validServer; if (EnvContext.currentEnv() != null && !ComparatorUtils.equals(EnvContext.currentEnv(), selectedEnv)) {
signOutOldEnv(selectedEnv); EnvContext.signOut();
selectedEnv.signIn();
validServer = true;
if (validServer) {
DesignUtils.switchToEnv(selectedEnv);
lastSelectedEnv = selectedEnv;
} }
EnvContext.signIn(selectedEnv);
DesignUtils.switchToEnv(trans(selectedEnv));
} }
private static void signOutOldEnv(Env newEnv) { private static com.fr.base.Env trans(EnvConfig env) {
// 环境相同直接返回,避免浪费过多时间 if (env instanceof RemoteEnvConfig) {
if (lastSelectedEnv == null || ComparatorUtils.equals(lastSelectedEnv, newEnv)) { return new RemoteEnv(env.getPath(), EnvConfigUtils.getUsername(env), EnvConfigUtils.getPassword(env));
return; } else {
} return new LocalEnv();
try {
EnvContext.fireBeforeSignOut();
lastSelectedEnv.signOut();
EnvContext.fireAfterSignOut();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
} }
} }
} }

6
designer-base/src/com/fr/start/BaseDesigner.java

@ -17,7 +17,7 @@ import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import java.awt.*; import java.awt.*;
@ -94,7 +94,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} }
isException = openFile(df, isException, file); isException = openFile(df, isException, file);
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (!isException) { if (!isException) {
showDesignerFrame(args, df, true); showDesignerFrame(args, df, true);
} else { } else {
@ -147,7 +147,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
Window.class, boolean.class}); Window.class, boolean.class});
method.invoke(null, window, true); method.invoke(null, window, true);
} catch (Throwable t) { } catch (Throwable t) {
FRLogger.getLogger().error("Full screen mode is not supported"); FineLoggerFactory.getLogger().error("Full screen mode is not supported");
} }
} }

31
designer-base/src/com/fr/start/StartServer.java

@ -1,7 +1,7 @@
package com.fr.start; package com.fr.start;
import com.fr.base.ServerConfig;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
@ -15,16 +15,19 @@ import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.server.TomcatHost; import com.fr.start.server.TomcatHost;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Font;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
@ -69,7 +72,7 @@ public class StartServer {
TemplateTreePane.getInstance().refreshDockingView(); TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
initDemoServerAndBrowser(); initDemoServerAndBrowser();
} }
@ -98,7 +101,7 @@ public class StartServer {
tomcatHost.start(); tomcatHost.start();
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} finally { } finally {
//先访问Demo, 后访问报表, 不需要重置服务器. //先访问Demo, 后访问报表, 不需要重置服务器.
NEED_LOAD_ENV = false; NEED_LOAD_ENV = false;
@ -121,14 +124,14 @@ public class StartServer {
tomcatHost.addAndStartLocalEnvHomeWebApp(); tomcatHost.addAndStartLocalEnvHomeWebApp();
} }
}
if (!tomcatHost.isStarted()) { if (!tomcatHost.isStarted()) {
tomcatHost.start(); tomcatHost.start();
} }
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} finally { } finally {
NEED_LOAD_ENV = false; NEED_LOAD_ENV = false;
} }
@ -169,10 +172,10 @@ public class StartServer {
} catch (IOException e) { } catch (IOException e) {
startBrowserFromCommand(uri, e); startBrowserFromCommand(uri, e);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
FRContext.getLogger().error("Can not open the browser for URL: " + uri); FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + uri);
} }
} }
@ -183,10 +186,10 @@ public class StartServer {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri); Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri);
} catch (IOException ee) { } catch (IOException ee) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser")); JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

4
designer-chart/src/com/fr/design/chart/report/MapCubeLayerPane.java

@ -11,7 +11,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -275,7 +275,7 @@ public class MapCubeLayerPane extends BasicBeanPane<String>{
@Override @Override
protected void done() { protected void done() {
FRLogger.getLogger().info("Map Save End"); FineLoggerFactory.getLogger().info("Map Save End");
} }
}; };

6
designer-chart/src/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java

@ -22,7 +22,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -367,7 +367,7 @@ public class MapGroupExtensionPane extends BasicPane implements UIObserver {
StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION})); StableUtils.pathJoin(new String[]{MapSvgXMLHelper.relativeCustomMapPath(),oldName+SvgProvider.EXTENSION}));
refresh(); refresh();
}catch (Exception exp){ }catch (Exception exp){
FRLogger.getLogger().error(exp.getMessage()); FineLoggerFactory.getLogger().error(exp.getMessage());
} }
} }
} }
@ -399,7 +399,7 @@ public class MapGroupExtensionPane extends BasicPane implements UIObserver {
@Override @Override
protected void done() { protected void done() {
FRLogger.getLogger().info(Inter.getLocText("FR-Chart-Map_Saved")); // 地图已经保存. FineLoggerFactory.getLogger().info(Inter.getLocText("FR-Chart-Map_Saved")); // 地图已经保存.
} }
}; };

4
designer-chart/src/com/fr/design/chart/series/PlotSeries/UIGroupExtensionPane.java

@ -19,7 +19,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -477,7 +477,7 @@ public class UIGroupExtensionPane extends BasicPane {
try { try {
list.setSelectedIndices(null); list.setSelectedIndices(null);
} catch (Exception e) { } catch (Exception e) {
FRLogger.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
} }
} }

4
designer-chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -13,7 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane; import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import java.awt.*; import java.awt.*;
@ -71,7 +71,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
try { try {
cc.addChart((Chart) chart.clone()); cc.addChart((Chart) chart.clone());
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRLogger.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} else { } else {

4
designer-chart/src/com/fr/design/mainframe/chart/ChartEditPane.java

@ -19,7 +19,7 @@ import com.fr.design.mainframe.chart.gui.ChartOtherPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.design.mainframe.chart.gui.ChartTypePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -117,7 +117,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
try { try {
lastCollection = (ChartCollection) collection.clone(); lastCollection = (ChartCollection) collection.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("error in clone ChartEditPane"); FineLoggerFactory.getLogger().error("error in clone ChartEditPane");
} }
if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){ if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){
dealWithStyleChange(); dealWithStyleChange();

4
designer-chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -18,7 +18,7 @@ import com.fr.design.gui.imenutable.UIMenuNameableCreator;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -142,7 +142,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
editingCollection.addNamedChart(name, newChart); editingCollection.addNamedChart(name, newChart);
editingCollection.addFunctionRecord(newChart); editingCollection.addFunctionRecord(newChart);
} catch (CloneNotSupportedException e1) { } catch (CloneNotSupportedException e1) {
FRLogger.getLogger().error("Error in Clone"); FineLoggerFactory.getLogger().error("Error in Clone");
} }
checkoutChange(); checkoutChange();
} }

6
designer-chart/src/com/fr/design/mainframe/chart/gui/data/CalculateComboBox.java

@ -9,7 +9,7 @@ import com.fr.data.util.function.NoneFunction;
import com.fr.data.util.function.SumFunction; import com.fr.data.util.function.SumFunction;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
@ -56,10 +56,10 @@ public class CalculateComboBox extends UIComboBox{
return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance(); return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance();
} }
} catch (InstantiationException e) { } catch (InstantiationException e) {
FRLogger.getLogger().error("Function Error"); FineLoggerFactory.getLogger().error("Function Error");
return null; return null;
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRLogger.getLogger().error("Function Error"); FineLoggerFactory.getLogger().error("Function Error");
return null; return null;
} }

6
designer-chart/src/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -19,7 +19,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -265,9 +265,9 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
try { try {
return (DataFunction) CalculateComboBox.CLASS_ARRAY[index].newInstance(); return (DataFunction) CalculateComboBox.CLASS_ARRAY[index].newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
FRLogger.getLogger().error("Function Error"); FineLoggerFactory.getLogger().error("Function Error");
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
FRLogger.getLogger().error("Function Error"); FineLoggerFactory.getLogger().error("Function Error");
} }
return new NoneFunction(); return new NoneFunction();
} }

4
designer-chart/src/com/fr/design/mainframe/chart/gui/style/DateAxisValuePane.java

@ -22,7 +22,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.FormatBox; import com.fr.design.style.FormatBox;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.FRLogger; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -358,7 +358,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
String tmp = DateUtils.getDate2LStr(toDate); String tmp = DateUtils.getDate2LStr(toDate);
toDate = DateUtils.DATETIMEFORMAT2.parse(tmp); toDate = DateUtils.DATETIMEFORMAT2.parse(tmp);
} catch (ParseException e) { } catch (ParseException e) {
FRLogger.getLogger().error(Inter.getLocText("Cannot_Get_Date")); FineLoggerFactory.getLogger().error(Inter.getLocText("Cannot_Get_Date"));
} }
return toDate; return toDate;
} }

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

Loading…
Cancel
Save