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. 176
      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. 24
      designer-base/src/com/fr/design/actions/file/PreferencePane.java
  15. 63
      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. 104
      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. 125
      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. 53
      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. 34
      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. 64
      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. 34
      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. 338
      designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  60. 70
      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. 71
      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. 34
      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. 105
      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. 1752
      designer-base/src/com/fr/env/RemoteEnv.java
  87. 22
      designer-base/src/com/fr/env/RemoteEnvPane.java
  88. 167
      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. 35
      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>
<version>10.0-FEATURE-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.7.0</version>
</dependency>
</dependencies>
<groupId>com.fr.report</groupId>
<artifactId>designer-base</artifactId>
<version>10.0-FEATURE-SNAPSHOT</version>

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

@ -4,21 +4,22 @@
package com.fr.design;
import com.fr.base.BaseXMLUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
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.constants.UIConstants;
import com.fr.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.EnvChangedListener;
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.XMLableReader;
import javax.swing.SwingWorker;
import javax.swing.*;
import javax.swing.SwingWorker.StateValue;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
@ -72,7 +72,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean showPaintToolBar = true;
private int maxNumberOrPreviewRow = 200;
// name和Env的键值对
private Map<String, Env> nameEnvMap = new ListMap();
private Map<String, EnvConfig> nameEnvMap = new ListMap();
// marks: 当前报表服务器名字
private String curEnvName = null;
private boolean showProjectPane = true;
@ -191,7 +191,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (installHome != null) {
String name = Inter.getLocText("FR-Engine_DEFAULT");
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);
}
}
@ -227,7 +227,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
try {
Thread.sleep(5000);
} 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);
}
// 清空前一个版本中的工作目录和最近打开
nameEnvMap = new ListMap<String, Env>();
nameEnvMap = new ListMap<String, EnvConfig>();
recentOpenedFilePathList = new ArrayList<String>();
curEnvName = null;
designerEnvManager.saveXMLFile();
@ -470,7 +470,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @return 是默认则返回true
*/
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});
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 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();
if (nameEnvMap.size() >= 0) {
Iterator<Entry<String, Env>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) {
Entry<String, Env> entry = entryIt.next();
Env env = entry.getValue();
if (ComparatorUtils.equals(defaultenvPath, env.getPath())) {
return env;
}
Iterator<Entry<String, EnvConfig>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) {
Entry<String, EnvConfig> entry = entryIt.next();
EnvConfig env = entry.getValue();
if (ComparatorUtils.equals(defaultenvPath, env.getPath())) {
return env;
}
}
Env newDefaultEnv = LocalEnv.createEnv(defaultenvPath);
EnvConfig newDefaultEnv = new LocalEnvConfig(defaultenvPath);
this.putEnv(Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}), 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});
defaultenvPath = new File(defaultenvPath).getPath();
if (nameEnvMap.size() >= 0) {
Iterator<Entry<String, Env>> entryIt = nameEnvMap.entrySet().iterator();
Iterator<Entry<String, EnvConfig>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) {
Entry<String, Env> entry = entryIt.next();
Env env = entry.getValue();
Entry<String, EnvConfig> entry = entryIt.next();
EnvConfig env = entry.getValue();
if (ComparatorUtils.equals(defaultenvPath, env.getPath())) {
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);
}
@ -690,7 +688,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @param name 名称
* @param env 对应的环境
*/
public void putEnv(String name, Env env) {
public void putEnv(String name, EnvConfig env) {
this.nameEnvMap.put(name, env);
}
@ -1401,7 +1399,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if ((tmpVal = reader.getAttrAsString("webinfLocation", null)) != null) {
// marks:兼容6.1的
// marks:设置默认的目录.
Env reportServer = LocalEnv.createEnv(tmpVal);
EnvConfig reportServer = new LocalEnvConfig(tmpVal);
String curReportServerName = Inter.getLocText("Server-Embedded_Server");
this.putEnv(curReportServerName, reportServer);
@ -1454,11 +1452,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
if (reader.isChildNode()) {
if (reader.getTagName().equals("Env")) { // description.
if (reader.getTagName().contains("Env")) { // description.
// marks:获取名字
String reportServerName = reader.getAttrAsString("name", null);
Env env = readEnv(reader);
EnvConfig env = readEnv(reader);
if (env == null) {
return;
}
@ -1584,7 +1582,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
Iterator<String> nameIt = this.getEnvNameIterator();
while (nameIt.hasNext()) {
String envName = nameIt.next();
Env env = this.getEnv(envName);
EnvConfig env = this.getEnv(envName);
writeEnv(writer, envName, env);
}
@ -1743,44 +1741,44 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
/*
* 写Env为xml
*/
private static void writeEnv(XMLPrintWriter writer, String name, Env env) {
* 写Env为xml
*/
private static void writeEnv(XMLPrintWriter writer, String name, EnvConfig env) {
if (env == null) {
return;
}
writer.startTAG("Env");
writer.startTAG("EnvConfig");
writer.classAttr(env.getClass());
writer.attr("name", name);
env.writeXML(writer);
EnvConfigXMLAdapter xmlAdapter = env instanceof RemoteEnvConfig
? new RemoteEnvConfigXMLAdapter()
: new LocalEnvConfigXMLAdapter();
xmlAdapter.fromEnvConfig(env).writeXML(writer);
writer.end();
}
/*
* 从xml读Env
*/
private static Env readEnv(XMLableReader reader) {
Env env = null;
* 从xml读Env
*/
private static EnvConfig readEnv(XMLableReader reader) {
EnvConfigXMLAdapter xmlAdapter = null;
String tmpVal; //temp value
if ((tmpVal = reader.getAttrAsString("class", null)) != null) {
if (tmpVal.endsWith(".LocalEnv")) {
env = LocalEnv.createEnv();
} else if (tmpVal.endsWith(".RemoteEnv")) {
env = new RemoteEnv();
if (tmpVal.contains(".LocalEnv")) {
xmlAdapter = new LocalEnvConfigXMLAdapter();
} else if (tmpVal.contains(".RemoteEnv")) {
xmlAdapter = new RemoteEnvConfigXMLAdapter();
}
}
if (env == null) {
return env;
if (xmlAdapter == null) {
return null;
}
reader.readXMLObject(env);
return env;
reader.readXMLObject(xmlAdapter);
return xmlAdapter.toEnvConfig();
}
public AlphaFineConfigManager getAlphaFineConfigManager() {
@ -1790,4 +1788,78 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setAlphaFineConfigManager(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.widget.Appearance;
import com.fr.form.ui.Widget;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.AbstractExtraClassManager;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection;
@ -208,7 +208,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return (Feedback) clazz.newInstance();
}
} catch (Exception e) {
FRLogger.getLogger().info("no feed back support");
FineLoggerFactory.getLogger().info("no feed back support");
}
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.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.stable.*;
import java.io.*;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
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.FileLock;
import java.util.ArrayList;
@ -39,7 +46,7 @@ public class RestartHelper {
properties.load(file2DeleteInputStream);
file2DeleteInputStream.close();
} catch (IOException e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
if (ArrayUtils.getLength(files) != 0) {
@ -53,7 +60,7 @@ public class RestartHelper {
properties.store(file2DeleteOutputStream, "save");
file2DeleteOutputStream.close();
} 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);
file2MoveInputStream.close();
} catch (IOException e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
if (!map.isEmpty()) {
@ -84,7 +91,7 @@ public class RestartHelper {
properties.store(file2MoveOutputStream, "save");
file2MoveOutputStream.close();
} 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();
FileLock restartLock = restartLockFC.tryLock();
if(restartLock == null) {
FRLogger.getLogger().error("restart lock null!");
FineLoggerFactory.getLogger().error("restart lock null!");
}
}catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
if (OperatingSystem.isMacOS()) {
restartInMacOS(installHome, filesToBeDelete);
@ -167,7 +174,7 @@ public class RestartHelper {
restartInWindows(installHome, filesToBeDelete);
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
} finally {
DesignerContext.getDesignerFrame().exit();
}

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

@ -1,22 +1,21 @@
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -46,12 +45,12 @@ public class BBSAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
}
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;
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -40,12 +39,12 @@ public void actionPerformed(ActionEvent arg0)
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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;
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -41,12 +40,12 @@ public class NeedAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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;
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -40,12 +39,12 @@ public void actionPerformed(ActionEvent arg0)
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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;
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -41,12 +40,12 @@ public class SignAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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;
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -41,12 +40,12 @@ public class UpAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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;
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.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
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
{
@ -47,12 +46,12 @@ public class VideoAction extends UpdateAction
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
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) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import javax.swing.Action;
import javax.swing.KeyStroke;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
@ -55,6 +54,20 @@ public class 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) {
Class<? extends QuickEditor> cClazz = findQuickEditorClass(clazz, editorClassMap);
if (cClazz == null) {
FRLogger.getLogger().error("No Such Editor");
FineLoggerFactory.getLogger().error("No Such Editor");
return null;
}
try {

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

@ -4,33 +4,40 @@
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.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.dialog.BasicPane;
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.StringUtils;
import com.fr.stable.bridge.StableFactory;
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
* @since : 8.0
@ -235,7 +242,7 @@ public class LocalePane extends BasicPane {
out.flush();
out.close();
} catch (Exception e) {
FRLogger.getLogger().info(e.getMessage());
FineLoggerFactory.getLogger().info(e.getMessage());
}
}
}

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

@ -1,7 +1,6 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
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.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.FRLevel;
import com.fr.general.Inter;
import com.fr.general.log.Log4jConfig;
import com.fr.third.apache.log4j.Level;
import javax.swing.*;
import java.awt.*;
@ -81,7 +81,7 @@ public class PreferencePane extends BasicPane {
private static final String MINUS = "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 int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
@ -125,7 +125,7 @@ public class PreferencePane extends BasicPane {
LANGUAGE.clear();
Map<Locale, String> map = Inter.getSupportLocaleMap();
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));
}
}
@ -177,7 +177,7 @@ public class PreferencePane extends BasicPane {
advancePane.add(spaceUpPane);
}
private static String getLocaledLanguage(String key, Locale locale){
private static String getLocaledLanguage(String key, Locale locale) {
StringBuilder sb = new StringBuilder();
sb.append(Inter.getLocText(key)).append("(");
sb.append(Inter.getLocText(key, locale)).append(")");
@ -362,8 +362,8 @@ public class PreferencePane extends BasicPane {
logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel());
Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem());
}
});
}
@ -380,7 +380,7 @@ public class PreferencePane extends BasicPane {
languageLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final LocalePane localePane = new LocalePane();
final LocalePane localePane = new LocalePane();
BasicDialog dlg = localePane.showLargeWindow(SwingUtilities.getWindowAncestor(PreferencePane.this), new DialogActionAdapter() {
@Override
public void doOk() {
@ -542,8 +542,8 @@ public class PreferencePane extends BasicPane {
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor());
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()));
designerEnvLanguageIndex = designerEnvManager.getLanguage();
@ -622,8 +622,8 @@ public class PreferencePane extends BasicPane {
if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
}
ServerConfig.getInstance().setServerLogLevel(((FRLevel) logLevelComboBox.getSelectedItem()).getLevel());
Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem()));
}

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

@ -1,14 +1,13 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.dav.LocalEnv;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext;
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.env.RemoteEnv;
import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
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.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
public class SwitchExistEnv extends MenuDef {
@ -42,18 +36,20 @@ public class SwitchExistEnv extends MenuDef {
this.setHasScrollSubMenu(true);
initMenuDef();
JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(t != null) {
GeneralContext.addEnvWillChangedListener(t.getFullPathName(), new EnvChangedListener() {
public void envChanged() {
SwitchExistEnv.this.clearShortCuts();
initMenuDef();
}
});
if (t != null) {
GeneralContext.addEnvWillChangedListener(
t.getFullPathName(),
new EnvChangedListener() {
public void envChanged() {
SwitchExistEnv.this.clearShortCuts();
initMenuDef();
}
});
}
}
private void initMenuDef() {
//ButtonGroup group = new ButtonGroup();
// ButtonGroup group = new ButtonGroup();
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator();
while (nameIt.hasNext()) {
String name = nameIt.next();
@ -66,15 +62,14 @@ public class SwitchExistEnv extends MenuDef {
public static class GetExistEnvAction extends UpdateAction implements ResponseDataSourceChange {
public GetExistEnvAction() {
}
public GetExistEnvAction(String envName) {
this.setName(envName);
Env env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env instanceof LocalEnv) {
EnvConfig env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env instanceof LocalEnvConfig) {
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"));
}
}
@ -102,28 +97,24 @@ public class SwitchExistEnv extends MenuDef {
*/
public void actionPerformed(ActionEvent e) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
Env selectedEnv = envManager.getEnv(this.getName());
EnvConfig selectedEnv = envManager.getEnv(this.getName());
try {
if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
return;
}
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();
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
return;
}
SignIn.signIn(selectedEnv);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged();
} catch (Exception em) {
FRContext.getLogger().error(em.getMessage(), em);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
FineLoggerFactory.getLogger().error(em.getMessage(), em);
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
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.FeedBackInfo;
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.icontainer.UIScrollPane;
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.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.utils.DesignUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.design.utils.DesignUtils;
import javax.swing.*;
import javax.swing.border.Border;
@ -33,7 +33,12 @@ import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
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.concurrent.CancellationException;
@ -275,7 +280,7 @@ public class FeedBackPane extends BasicPane {
try {
return DesignUtils.sendFeedBack(feedBackInfo);
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
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.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -48,12 +49,12 @@ public class ForumAction extends UpdateAction {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
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;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import javax.swing.*;
@ -38,9 +38,9 @@ public class SupportQQAction extends UpdateAction {
Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), 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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
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.
@ -202,7 +207,7 @@ public class AlphaFineConfigPane extends BasicPane {
DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile();
} 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.BaseUtils;
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.dialog.DialogActionAdapter;
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.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.data.Condition;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -960,7 +964,7 @@ public abstract class LiteConditionPane<T extends Condition> extends BasicBeanPa
try{
newCondition = (Condition)joinCondition.getCondition().clone();
}catch (CloneNotSupportedException e){
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
return newCondition;
}

104
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.file.ConnectionConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -85,6 +85,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
new Thread() {
@Override
@ -94,26 +95,41 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}.start();
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
};
private PopupMenuListener listener = new PopupMenuListener() {
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
executePopulateWorker();
}
};
private FocusAdapter focusAdapter = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (schemaBox.getSelectedIndex() == -1) {
schemaBox.updateUI();
schemaBox.showPopup();
}
}
};
public ChoosePane() {
this(null);
}
@ -146,6 +162,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private void initBoxListener() {
addDSBoxListener();
schemaBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
tableNameComboBox.setSelectedItem("");
}
@ -176,16 +193,9 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
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() {
dsNameComboBox.setRefreshingModel(true);
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>() {
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.setSelectedItem(null);
schemaBox.setRefreshingModel(false);
return getConnection();
}
@SuppressWarnings("unchecked")
@Override
public void done() {
try {
com.fr.data.impl.Connection selectedDatabase = get();
@ -261,12 +277,14 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
schemaBox.setSelectedIndex(index);
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
schemaBox.setRefreshingModel(false);
schemaBox.removePopupMenuListener(listener);
schemaBox.setPopupVisible(true);
schemaBox.addPopupMenuListener(listener);
schemaBox.removeFocusListener(focusAdapter);
schemaBox.addFocusListener(focusAdapter);
}
};
populateWorker.execute();
@ -292,7 +310,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return null; // peter:选中了当前的零长度的节点,直接返回.
}
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())) {
return entry.getValue();
}
@ -303,6 +321,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/**
* 刷新没多大用而且要刷新也不是这儿刷新
*/
@Override
public void refresh() {
DBUtils.refreshDatabase();
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() {
@Override
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);
if (value instanceof DefaultMutableTreeNode) {
@ -328,6 +348,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
};
public static UIComboBoxRenderer listCellRenderer = new UIComboBoxRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof TreePath) {
@ -344,16 +365,18 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/**
* 添加项目监听事件
* @param aListener 事件监听器
* 添加项目监听事件
*
* @param aListener 事件监听器
*/
public void addItemListener(ItemListener aListener) {
this.tableNameComboBox.addItemListener(aListener);
}
/**
* 删除项目监听事件
* @param aListener 事件监听器
* 删除项目监听事件
*
* @param aListener 事件监听器
*/
public void removeItemListener(ItemListener aListener) {
this.tableNameComboBox.removeItemListener(aListener);
@ -398,9 +421,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
}
((DefaultTreeModel) tree.getModel()).reload();
/**
* daniel 展开所有tree
*/
// daniel 展开所有tree
TreeNode root = (TreeNode) tree.getModel().getRoot();
TreePath parent = new TreePath(root);
TreeNode node = (TreeNode) parent.getLastPathComponent();
@ -416,42 +437,41 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/**
* 创建选中的数据集数据
* @return 数据集数据
*
* @return 数据集数据
*/
public TableData createSelectTableData() {
DataBaseItems paras = this.updateBean();
boolean connect = false;
com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName());
if (database == null) {
failedToFindTable();
failedToFindTable();
return TableData.EMPTY_TABLEDATA;
}
try {
connect = FRContext.getCurrentEnv().testConnection(database);
} catch (Exception e1) {
connect = false;
} catch (Exception ignored) {
}
if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
JOptionPane.showMessageDialog(designerFrame, Inter.getLocText("Datasource-Connection_failed"),
Inter.getLocText("FR-Designer_Failed"), JOptionPane.INFORMATION_MESSAGE);
failedToFindTable();
Inter.getLocText("FR-Designer_Failed"), JOptionPane.INFORMATION_MESSAGE);
failedToFindTable();
return null;
}
// 显示Table数据.
TableData tableData = null;
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())));
tableData = tableDataLocal;
} else {
try {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
tableData = FRContext.getCurrentEnv().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP,
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
} catch (Exception e) {
failedToFindTable();
failedToFindTable();
FRContext.getLogger().error(e.getMessage(), e);
}
}
@ -463,8 +483,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return this.dsNameComboBox.getSelectedItem();
}
protected void failedToFindTable() {
}
protected void failedToFindTable() {
}
protected String getTableName() {
String tableName = "";
@ -485,7 +505,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/**
* 得到当前的ColumnName[]
* @return 返回当前的ColumnName[]
*
* @return 返回当前的ColumnName[]
*/
public String[] currentColumnNames() {
String[] colNames = null;
@ -493,21 +514,19 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
DataBaseItems paras = this.updateBean();
String selectedDSName = paras.getDatabaseName();
if (StringUtils.isBlank(selectedDSName)) {
return colNames = new String[0]; // peter:选中了当前的零长度的节点,直接返回.
// peter:选中了当前的零长度的节点,直接返回.
return new String[0];
}
String selectedTableObject = paras.getTableName();
if (StringUtils.isEmpty(selectedTableObject)) {
return colNames = new String[0];
return new String[0];
}
java.sql.Connection conn = null;
try {
// daniel:增加参数
colNames = FRContext.getCurrentEnv().getColumns(selectedDSName, paras.getSchemaName(), selectedTableObject);
} catch (Exception e2) {
FRContext.getLogger().error(e2.getMessage(), e2);
} finally {
DBUtils.closeConnection(conn);
}
if (colNames == null) {
@ -517,9 +536,10 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
/**
* 预览key value对应的数据
* 预览key value对应的数据
*
* @param key
* @param value
* @param value
*/
public void preview(int key, int value) {
PreviewTablePane.previewTableData(createSelectTableData(), key, value);
@ -528,6 +548,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/**
* 默认预览
*/
@Override
public void preview() {
preview(-1, -1);
}
@ -540,10 +561,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
}
/**
*注册listener,相应数据集改变
* 注册listener,相应数据集改变
*/
@Override
public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
initDsNameComboBox();
}
@ -578,6 +601,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
this.refreshingModel = refreshingModel;
}
@Override
public void setSelectedItem(Object ob) {
this.getModel().setSelectedItem(ob);
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 Object item;
@Override
public void setItem(Object item) {
this.item = item;
textField.setText((item == null) ? "" : item.toString());
}
@Override
public Object getItem() {
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.layout.FRGUIPaneFactory;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
@ -121,7 +122,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
okButton.setEnabled(true);
message.setText(database.connectMessage(connect));
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
}
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.general.FRFont;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
@ -298,7 +299,7 @@ public class PreviewTablePane extends BasicPane {
FRContext.getLogger().error(e.getMessage(), e);
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);
}

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

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

@ -4,71 +4,78 @@ import com.fr.design.gui.columnrow.ColumnRowPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ColumnRow;
import java.awt.*;
import java.awt.BorderLayout;
/**
* the editor to edit ColumnRow
*
* @editor zhou
* @author zhou
* @since 2012-3-29下午6:01:37
*/
public class ColumnRowEditor extends Editor<ColumnRow> {
private ColumnRowPane crPane;
public ColumnRowEditor() {
this("");
}
public ColumnRowEditor(String name) {
this(null, name);
}
public ColumnRowEditor(ColumnRow value) {
this(value, "");
}
public ColumnRowEditor(ColumnRow value, String name) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
crPane = new ColumnRowPane();
this.add(crPane, BorderLayout.CENTER);
this.setValue(value);
this.setName(name);
}
@Override
public ColumnRow getValue() {
return this.crPane.update();
}
@Override
public void setValue(ColumnRow value) {
if (value == null) {
value = ColumnRow.valueOf(0, 0);
}
this.crPane.populate(value);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.crPane.setEnabled(enabled);
}
@Override
public void requestFocus() {
this.crPane.requestFocus();
}
public String getIconName() {
return "cell";
}
@Override
public boolean accept(Object object) {
return object instanceof ColumnRow;
}
private ColumnRowPane crPane;
public ColumnRowEditor() {
this("");
}
public ColumnRowEditor(String name) {
this(null, name);
}
public ColumnRowEditor(ColumnRow value) {
this(value, "");
}
public ColumnRowEditor(ColumnRow value, String name) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
crPane = new ColumnRowPane();
this.add(crPane, BorderLayout.CENTER);
this.setValue(value);
this.setName(name);
}
@Override
public ColumnRow getValue() {
return this.crPane.update();
}
@Override
public void setValue(ColumnRow value) {
if (value == null) {
value = ColumnRow.valueOf(0, 0);
}
this.crPane.populate(value);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.crPane.setEnabled(enabled);
}
@Override
public void requestFocus() {
this.crPane.requestFocus();
}
@Override
public String getIconName() {
return "cell";
}
@Override
public boolean accept(Object object) {
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;
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.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
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.
*
* @editor zhou
* @author zhou
* @since 2012-3-29下午6:00:43
*/
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;
/**
@ -93,7 +98,7 @@ public class TextEditor extends Editor<String> {
value = StringUtils.EMPTY;
}
oldValue = value.toString();
oldValue = value;
this.textField.setText(oldValue);
}
@ -110,6 +115,7 @@ public class TextEditor extends Editor<String> {
/**
* 请求焦点
*/
@Override
public void requestFocus() {
this.textField.requestFocus();
}
@ -133,10 +139,12 @@ public class TextEditor extends Editor<String> {
/**
* 被选中时文本输入框请求焦点
*/
@Override
public void selected() {
this.textField.requestFocus();
}
@Override
public String getIconName() {
return "type_string";
}
@ -147,7 +155,15 @@ public class TextEditor extends Editor<String> {
* @param object 需要判断的object
* @return 是字符类型则返回true
*/
@Override
public boolean accept(Object object) {
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.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
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.
@ -15,6 +19,15 @@ public class LoginDialog extends UIDialog {
public LoginDialog(Frame frame, Component pane) {
super(frame);
init(pane);
}
public LoginDialog(Dialog dialog, Component pane) {
super(dialog);
init(pane);
}
private void init(Component pane) {
if (StableUtils.getMajorJavaVersion() == 8) {
setUndecorated(true);
}

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

@ -1,8 +1,8 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
@ -44,7 +44,7 @@ public class PluginDetailPane extends BasicPane {
try {
Desktop.getDesktop().browse(linkUrl.toURI());
} 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.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
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.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File;
import java.util.List;
@ -180,7 +176,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
@Override
public void done(PluginTaskResult result) {
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"));
} else {
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.UpdateOnlineCallback;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
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.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.*;
import java.io.File;
import java.util.List;
@ -117,7 +116,7 @@ public class PluginOperateUtils {
JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
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.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
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.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File;
import java.util.List;
@ -203,7 +198,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
@Override
public void done(PluginTaskResult result) {
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"));
} else {
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;
import com.fr.base.TemplateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView;
@ -59,7 +58,7 @@ public class PluginUtils {
httpClient.asGet();
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
} else {
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.gui.ilable.UILabel;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.manage.PluginManager;
@ -31,10 +31,8 @@ import javafx.stage.FileChooser;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.awt.Desktop;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
@ -355,7 +353,7 @@ public class PluginWebBridge {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info)));
threadPoolExecutor.submit(task);
} catch (JSONException e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
@ -491,10 +489,10 @@ public class PluginWebBridge {
}
} catch (NullPointerException e) {
//此为uri为空时抛出异常
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
} catch (IOException e) {
//此为无法获取系统默认浏览器
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
}
}
@ -506,7 +504,7 @@ public class PluginWebBridge {
try {
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.register")));
} 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.general.*;
import com.fr.log.FineLoggerFactory;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
@ -148,7 +149,7 @@ public class QQLoginWebPane extends JFXPanel {
}
});
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
}

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

@ -22,6 +22,9 @@ import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
@ -133,18 +136,22 @@ public class WebViewDlgHelper {
if (StableUtils.getMajorJavaVersion() == VERSION_8) {
File file = new File(StableUtils.pathJoin(installHome, "scripts"));
if (!file.exists()) {
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);
}
confirmDownLoadShopJS();
} else {
showLoginDlg();
showLoginDlg(DesignerContext.getDesignerFrame());
updateShopScripts(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 {
showLoginDlg(parent);
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) {
try {
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 {
Class<?> clazz = Class.forName("com.fr.design.extra.LoginWebPane");
Constructor constructor = clazz.getConstructor(String.class);
Component webPane = (Component) constructor.newInstance(installHome);
UIDialog qqdlg = new LoginDialog(DesignerContext.getDesignerFrame(), webPane);
UIDialog qqdlg;
if (window instanceof Dialog) {
qqdlg = new LoginDialog((Dialog) window, webPane);
} else {
qqdlg = new LoginDialog((Frame) window, webPane);
}
LoginWebBridge.getHelper().setDialogHandle(qqdlg);
qqdlg.setVisible(true);
} 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.PluginUtils;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
/**
@ -23,7 +23,7 @@ public class GetPluginFromStoreExecutor implements Executor {
private String scope;
public GetPluginFromStoreExecutor(JSONObject info) {
this.category = info.optString("category");
this.category = info.optString("categories");
this.fee = info.optString("fee");
this.seller = info.optString("seller");
this.scope = info.optString("scope");
@ -72,7 +72,7 @@ public class GetPluginFromStoreExecutor implements Executor {
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr);
result = resultJSONArray.toString();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
} else {
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.Process;
import com.fr.general.FRLogger;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
@ -42,7 +42,7 @@ public class ReadUpdateOnlineExecutor implements Executor {
}
result = jsonArray.toString();
} 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.PluginUtils;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
/**
@ -50,7 +50,7 @@ public class SearchOnlineExecutor implements Executor {
JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray);
result = resultJSONArray.toString();
} 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.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
@ -37,7 +37,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
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"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
@ -76,7 +76,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
PluginOperateUtils.updatePluginFromDisk(zipFile, jsCallback);
}else {
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);
}
}

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

@ -1,8 +1,8 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.control.AbstractDealPreTaskCallback;
@ -35,7 +35,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) {
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"));
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog(
@ -55,7 +55,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
PluginOperateUtils.updatePluginOnline(pluginMarker, jsCallback);
}else {
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);
}
}

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

@ -1,8 +1,8 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
@ -25,7 +25,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
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"));
}else if (result.errorCode() == PluginErrorCode.NeedUninstallDependingPluginFirst) {
int rv = JOptionPane.showOptionDialog(
@ -44,7 +44,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
PluginManager.getController().uninstall(pluginMarker, true, new UninstallPluginCallback(pluginMarker, jsCallback));
} else {
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);
}
}

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.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
@ -37,7 +37,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
public void done(PluginTaskResult result) {
if (result.isSuccess()) {
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"));
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
@ -76,7 +76,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
PluginOperateUtils.installPluginFromDisk(zipFile, jsCallback);
}else {
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);
}
}

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

@ -1,9 +1,8 @@
package com.fr.design.extra.exe.callback;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.manage.control.AbstractDealPreTaskCallback;
import com.fr.plugin.manage.control.PluginTask;
import com.fr.plugin.manage.control.PluginTaskResult;
@ -32,11 +31,11 @@ public class UpdateOnlineCallback extends AbstractDealPreTaskCallback {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) {
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"));
} else {
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);
}
}

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.PluginUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
@ -31,7 +31,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
public void done(PluginTaskResult result){
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"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
@ -49,7 +49,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
}
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateOnlineCallback(pluginMarker, toPluginMarker, pane));
} 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);
}
}

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

@ -1,40 +1,37 @@
package com.fr.design.file;
import java.awt.*;
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.FRContext;
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.constants.UIConstants;
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.dav.LocalEnv;
import com.fr.design.DesignModelAdapter;
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.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
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 {
//最大保存内存中面板数,为0时关闭优化内存
@ -120,7 +117,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
try {
historyList.remove(contains(selected));
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);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);

34
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.mainframe.DesignerContext;
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.GUIPaintUtils;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.fr.stable.ProductConstants;
import com.fr.stable.project.ProjectConstants;
@ -23,10 +22,18 @@ import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.event.AWTEventListener;
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.util.logging.Level;
/**
* Author : daisy
@ -710,22 +717,11 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) {
specifiedTemplate.saveTemplate();
FRLogger.getLogger().log(Level.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);
FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."}));
}
//若是点击取消关闭,则什么都不做
} else {
//若是已经保存过了,则关闭即可
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
activeTemplate(filename);
}
HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate);
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.IOFileNodeFilter;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
@ -34,7 +34,6 @@ import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
public class TemplateTreePane extends JPanel implements FileOperations {
@ -143,7 +142,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
public void openContainerFolder() {
FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode();
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));
try {
Desktop.getDesktop().open(new File(filePath));
@ -157,7 +156,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/
public void 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();
}
@Override
public void lockFile() {
throw new UnsupportedOperationException("unsupport now");
}
@Override
public void unLockFile() {
throw new UnsupportedOperationException("unsupport now");
}
private void deleteHistory(String fileName) {
int index = HistoryTemplateListPane.getInstance().contains(fileName);
int size = HistoryTemplateListPane.getInstance().getHistoryCount();
@ -218,41 +227,6 @@ public class TemplateTreePane extends JPanel implements FileOperations {
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() {
return reportletsTree.getSelectedTemplatePath();
@ -322,11 +296,11 @@ public class TemplateTreePane extends JPanel implements FileOperations {
//todo 走下这个流程,否则集群下其它节点无法同步删除
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
} catch (IOException e) {
FRLogger.getLogger().info(e.getMessage());
FineLoggerFactory.getLogger().info(e.getMessage());
FRContext.getCurrentEnv().deleteFile(nodeFile.getPath());
}
} else {
FRLogger.getLogger().info("No Trash Available");
FineLoggerFactory.getLogger().info("No Trash Available");
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.SyntaxConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.stable.EncodeConstants;
import com.fr.stable.JavaCompileInfo;
@ -65,7 +65,7 @@ public class JavaEditorPane extends BasicPane {
javaText.setText("//Didn't find java source match the class");
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
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"}) + "!");
fireSaveActionListener();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
JOptionPane.showMessageDialog(null, Inter.getLocText(new String[]{"Save", "Failed"}) + "!");
}
@ -191,9 +191,9 @@ public class JavaEditorPane extends BasicPane {
}
JOptionPane.showMessageDialog(null, message);
} catch (InterruptedException e1) {
FRLogger.getLogger().error(e1.getMessage(), e1);
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} catch (ExecutionException e1) {
FRLogger.getLogger().error(e1.getMessage(), e1);
FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
}
}
}.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.itooltip.UIToolTipBorder;
import com.fr.design.gui.itree.UITreeUI;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.IOUtils;
import javax.swing.ImageIcon;
@ -195,7 +195,7 @@ public class UILookAndFeel extends MetalLookAndFeel {
"com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class);
if (url == null) {
FRLogger.getLogger().error("Icon directory could not be resolved.");
FineLoggerFactory.getLogger().error("Icon directory could not be resolved.");
return null;
}
}

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

@ -10,7 +10,7 @@
package com.fr.design.gui.autocomplete;
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.event.CaretEvent;
@ -303,7 +303,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
private void installKeyBindings() {
if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("PopupWindow: Installing keybindings");
FineLoggerFactory.getLogger().debug("PopupWindow: Installing keybindings");
}
if (escapeKap == null) { // Lazily create actions.
@ -711,7 +711,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
private void uninstallKeyBindings() {
if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("PopupWindow: Removing keybindings");
FineLoggerFactory.getLogger().debug("PopupWindow: Removing keybindings");
}
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.RSyntaxTextArea;
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.event.CaretEvent;
@ -440,7 +440,7 @@ class ParameterizedCompletionContext {
*/
private void installKeyBindings() {
if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("CompletionContext: Installing keybindings");
FineLoggerFactory.getLogger().debug("CompletionContext: Installing keybindings");
}
JTextComponent tc = ac.getTextComponent();
InputMap im = tc.getInputMap();
@ -739,7 +739,7 @@ class ParameterizedCompletionContext {
private void uninstallKeyBindings() {
if (AutoCompletion.isDebug()) {
FRLogger.getLogger().debug("CompletionContext Uninstalling keybindings");
FineLoggerFactory.getLogger().debug("CompletionContext Uninstalling keybindings");
}
JTextComponent tc = ac.getTextComponent();

64
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.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 java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
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.
@ -47,7 +71,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
}
public UIControlPane(BasePlot plot) {
this.plot =plot;
this.plot = plot;
this.initComponentPane();
}
@ -145,8 +169,8 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
this.checkButtonEnabled();
}
protected void getPopupEditDialog (JPanel cardPane) {
popupEditDialog = new PopupEditDialog(cardPane);
protected void getPopupEditDialog(JPanel cardPane) {
popupEditDialog = new PopupEditDialog(cardPane);
}
protected abstract JPanel createControlUpdatePane();
@ -169,7 +193,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
toolbarDef.addShortCut(sj.getShortCut());
}
toolBar = ToolBarDef.createJToolBar();
toolBar.setUI(new UIToolBarUI(){
toolBar.setUI(new UIToolBarUI() {
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
@ -186,7 +210,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
leftContentPane.add(toolBarPane, BorderLayout.NORTH);
// 顶部标签及add按钮
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI(){
topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() {
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
@ -207,15 +231,15 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
return leftPane;
}
protected JPanel getLeftTopPane (UIToolbar topToolBar) {
protected JPanel getLeftTopPane(UIToolbar topToolBar) {
double p = TableLayout.PREFERRED;
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};
Component[][] components = new Component[][]{
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();
}
@Override
public void setTitle(String title) {
popupToolPane.setTitle(title);
}
@ -349,10 +374,21 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
}
// 如果有可见模态对话框,则不隐藏
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;
}
}
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
checkValid();
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
JOptionPane.showMessageDialog(UIControlPane.this.controlUpdatePane, exp.getMessage());
this.requestFocus();
return;
}
saveSettings();
setVisible(false);
}
@ -361,7 +397,6 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
addWindowFocusListener(new WindowAdapter() {
@Override
public void windowLostFocus(WindowEvent e) {
super.windowLostFocus(e);
hideDialog();
}
});
@ -389,6 +424,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
}
repaint();
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
@ -396,6 +432,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(originColor);
}
}
@Override
public void mousePressed(MouseEvent e) {
mouseDownCompCoords = e.getPoint();
@ -409,6 +446,7 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH
contentPane.setBackground(UIConstants.POPUP_TITLE_BACKGROUND);
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
if (mouseDownCompCoords != null) {

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

@ -1,34 +1,37 @@
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.design.gui.icombobox.filter.Filter;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.ExtendedComboBox;
import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterComboBox;
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.TableLayout;
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.stable.ParameterProvider;
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.
* User: Richer
@ -42,12 +45,12 @@ public class ComboBoxDemo extends JPanel {
double f = TableLayout.FILL;
Component[][] coms = new Component[][]{
{new UILabel(Inter.getLocText("Form-ComboCheckBox")+":"), createComboCheckBox()},
{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(new String[]{"Filter", "Form-ComboBox"})+":"), createFilterComboBox()},
{new UILabel(Inter.getLocText("Form-ComboBox")+":"), createTreeComboBox()},
{new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"})+":"), createLazyComboBox()}
{new UILabel(Inter.getLocText("Form-ComboCheckBox") + ":"), createComboCheckBox()},
{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(new String[]{"Filter", "Form-ComboBox"}) + ":"), createFilterComboBox()},
{new UILabel(Inter.getLocText("Form-ComboBox") + ":"), createTreeComboBox()},
{new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"}) + ":"), createLazyComboBox()}
};
double[] rowSize = new double[coms.length];
double[] columnSize = {p, f};
@ -165,6 +168,7 @@ public class ComboBoxDemo extends JPanel {
// 睡5秒
try {
Thread.sleep(5000);
} catch (InterruptedException 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;
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.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.BorderLayout;
/**
* Created by IntelliJ IDEA.
@ -19,10 +18,10 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Time: 下午4:54
*/
public class SwingComponentsDemo extends JFrame {
public SwingComponentsDemo() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
private SwingComponentsDemo() {
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
init();
JPanel contentPane = (JPanel)getContentPane();
JPanel contentPane = (JPanel) getContentPane();
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout());
JTabbedPane tab = new JTabbedPane();
contentPane.add(tab, BorderLayout.CENTER);
@ -40,12 +39,12 @@ public class SwingComponentsDemo extends JFrame {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JFrame f = new SwingComponentsDemo();
f.setSize(500, 500);
f.setVisible(true);
GUICoreUtils.centerWindow(f);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
});
}

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

@ -44,15 +44,12 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override
public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators());
refreshNameableCreator(createNameableCreators());
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(HyperlinkProvider.XML_TAG);
}
});
@ -63,6 +60,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*
* @return 返回Nameable按钮数组.
*/
@Override
public NameableCreator[] createNameableCreators() {
Map<String, NameableCreator> nameCreators = new ListMap<>();
NameableCreator[] creators = DesignModuleFactory.getHyperlinkGroupType().getHyperlinkCreators();
@ -82,6 +80,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
*
* @return 返回标题字符串.
*/
@Override
public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Hyperlink");
}
@ -91,11 +90,11 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
return Inter.getLocText("FR-Designer_Add_Hyperlink");
}
public void populate(NameJavaScriptGroup nameHyperlink_array) {
java.util.List<NameObject> list = new ArrayList<NameObject>();
if (nameHyperlink_array != null) {
for (int i = 0; i < nameHyperlink_array.size(); i++) {
list.add(new NameObject(nameHyperlink_array.getNameHyperlink(i).getName(), nameHyperlink_array.getNameHyperlink(i).getJavaScript()));
public void populate(NameJavaScriptGroup hyperlinkArray) {
java.util.List<NameObject> list = new ArrayList<>();
if (hyperlinkArray != null) {
for (int i = 0; i < hyperlinkArray.size(); i++) {
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() {
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++) {
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
public void saveSettings() {
if (isPopulating) {
if (isPopulating || !needAutoSave()) {
return;
}
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;
/**
* @author plough
* Created by plough on 2017/7/26.
*/
public interface HyperlinkGroupPaneActionProvider {
/**
* 刷新面板展示
*
* @param hyperlinkGroupPane 超链面板
* @param elementCasePane 模板
*/
void populate(HyperlinkGroupPane hyperlinkGroupPane, TargetComponent elementCasePane);
/**
* 保存到文件
*
* @param 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.design.constants.UIConstants;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralUtils;
import javax.swing.*;
@ -129,7 +129,7 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
tabPane.addTab(tabName,
(Component) GeneralUtils.classForName(classpath).newInstance());
} catch (Exception ex) {
FRLogger.getLogger().error(ex.getMessage(), ex);
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
}
}

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

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

70
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.UIObserver;
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.basic.ComboPopup;
import java.awt.*;
import java.awt.Dimension;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
@ -112,8 +113,6 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
public void setRenderer(ListCellRenderer aRenderer) {
if (aRenderer instanceof UIComboBoxRenderer) {
super.setRenderer(aRenderer);
} else {
//throw new IllegalArgumentException("Must be UIComboBoxRenderer");
}
}
@ -121,13 +120,15 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
return null;
}
@Override
public void setGlobalName(String name) {
comboBoxName = name;
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);//加5的原因在于:render里,每一个项前面了空了一格,要多几像素
//加5的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);
}
/**
@ -144,70 +145,53 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
}
/**
*
*/
/**
*
*/
@Override
public void updateUI() {
setUI(getUIComboBoxUI());
}
/**
*
* @param listener 观察者监听事件
*/
/**
* @param listener 观察者监听事件
*/
@Override
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
public void removeChangeListener(){
public void removeChangeListener() {
uiObserverListener = null;
}
public UIObserverListener getUiObserverListener(){
public UIObserverListener getUiObserverListener() {
return uiObserverListener;
}
/**
* @return
* @return 是否响应变更事件
*/
@Override
public boolean shouldResponseChangeListener() {
return true;
}
/**
*
* @param listener 观察者监听事件
*/
/**
* @param listener 观察者监听事件
*/
@Override
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
*
* @return
*/
public boolean shouldResponseNameListener() {
return true;
}
/**
* @param args
* @return 是否响应名称事件
*/
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);
@Override
public boolean shouldResponseNameListener() {
return 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.FRLogger;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import javax.swing.event.*;
@ -504,7 +504,7 @@ public class UIBasicMenuUI extends UIBasicMenuItemUI {
}
if (DEBUG) {
FRLogger.getLogger().info("in TinyMenuUI.menuKeyTyped for " + menuItem.getText());
FineLoggerFactory.getLogger().info("in TinyMenuUI.menuKeyTyped for " + menuItem.getText());
}
if (!crossMenuMnemonic) {
@ -544,7 +544,7 @@ public class UIBasicMenuUI extends UIBasicMenuItemUI {
return;
}
if (DEBUG) {
FRLogger.getLogger().info("in TinyMenuUI.menuKeyPressed for " + menuItem.getText());
FineLoggerFactory.getLogger().info("in TinyMenuUI.menuKeyPressed for " + menuItem.getText());
}
char keyChar = e.getKeyChar();
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;
import com.fr.design.beans.BasicBeanPane;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Nameable;
public class UIMenuNameableCreator implements Nameable{
@ -46,9 +46,9 @@ public class UIMenuNameableCreator implements Nameable{
try {
cloneObj = obj.getClass().newInstance();
} catch (InstantiationException e) {
FRLogger.getLogger().error("UIMenuNameableCreator InstantiationException");
FineLoggerFactory.getLogger().error("UIMenuNameableCreator InstantiationException");
} catch (IllegalAccessException e) {
FRLogger.getLogger().error("UIMenuNameableCreator IllegalAccessException");
FineLoggerFactory.getLogger().error("UIMenuNameableCreator IllegalAccessException");
}
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;
import com.fr.design.constants.UIConstants;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -126,7 +126,7 @@ public class NumberDragBar extends JComponent {
repaint();
revalidate();
} 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;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.IOUtils;
import com.fr.script.ScriptFactory;
@ -42,7 +42,7 @@ public class JavaScriptFormatHelper {
Invocable invocable = (Invocable) scriptEngine;
result = (String) invocable.invokeFunction("js_beautify", jsCode, option.toFormatArgument());
} catch (ScriptException | NoSuchMethodException e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
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.design.designer.TargetComponent;
import com.fr.design.dialog.BasicDialog;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import javax.swing.*;
@ -73,14 +73,14 @@ public class DesignerContext {
return (Clipboard) clipMethod.invoke(transferAction, new Object[]{comp});
} catch (Exception securityException) {
FRLogger.getLogger().error(securityException.getMessage(), securityException);
FineLoggerFactory.getLogger().error(securityException.getMessage(), securityException);
//用反射机制,获得TransferHandler的getClipboard
//这样可以保证和TextField直接的copy paste
try {
//控件的Clipboard.
DesignerContext.clipboard = comp.getToolkit().getSystemClipboard();
} catch (Exception exp) {
FRLogger.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
DesignerContext.clipboard = new Clipboard("FR");
}
}

71
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.Env;
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.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent;
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.gui.ibutton.UIButton;
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.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.general.env.EnvContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
@ -54,15 +61,29 @@ import javax.swing.border.MatteBorder;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.*;
import java.awt.event.*;
import java.awt.dnd.DnDConstants;
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.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
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 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"));
this.setIconImages(image);
} 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"));
}
}
@ -609,10 +630,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
defaultTitleSB.append(ProductConstants.BRANCH);
// james:标识登录的用户和登录的ENV
String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
Env env = DesignerEnvManager.getEnvManager().getEnv(envName);
EnvConfig env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env != null) {
defaultTitleSB.append(env.getUser()).append('@').append(envName).append('[');
defaultTitleSB.append(env.getEnvDescription());
defaultTitleSB.append(EnvConfigUtils.getUsername(env)).append('@').append(envName).append('[');
defaultTitleSB.append(Inter.getLocText("Env-Remote_Server"));
defaultTitleSB.append(']');
if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath();
@ -703,18 +724,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate();
FRLogger.getLogger().log(
Level.INFO,
Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "."}));
FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "."}));
}
} else {
if (editingTemplate.saveTemplate()) {
editingTemplate.saveTemplate();
FRLogger.getLogger().log(
Level.INFO,
Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "."}));
FineLoggerFactory.getLogger().info(Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{
editingTemplate.getEditingFILE().getName(), "."}));
}
}
}
@ -734,6 +751,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 添加的模板.
*/
public void addAndActivateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) {
return;
}
@ -750,6 +769,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板
*/
public void activateJTemplate(JTemplate<?, ?> jt) {
//释放模板对象
ActionFactory.editorRelease();
if (jt == null || jt.getEditingFILE() == null) {
return;
}
@ -809,7 +830,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return;
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
// p:判断一下,如何文件为空或者文件不存在,直接返回.
@ -823,7 +844,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try {
openFile(tplFile);
} catch (Throwable t) {
FRLogger.getLogger().error(t.getMessage(), t);
FineLoggerFactory.getLogger().error(t.getMessage(), t);
addAndActivateJTemplate();
}
@ -927,7 +948,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try {
thread.join();
} catch (InterruptedException e) {
FRLogger.getLogger().error("Map Thread Error");
FineLoggerFactory.getLogger().error("Map Thread Error");
}
DesignerEnvManager.getEnvManager().setLastOpenFile(
@ -946,11 +967,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
Env currentEnv = FRContext.getCurrentEnv();
try {
EnvContext.fireBeforeSignOut();
EventDispatcher.fire(BEFORE_SIGN_OUT);
currentEnv.signOut();
EnvContext.fireAfterSignOut();
EventDispatcher.fire(AFTER_SIGN_OUT);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
this.setVisible(false);
this.dispose();
@ -1006,7 +1027,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
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.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.ChangeListener;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
import java.awt.*;
import java.awt.event.*;
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.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;
/**
@ -51,7 +71,6 @@ public class JFormSliderPane extends JPanel {
private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JFormSliderPane THIS;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider;
@ -62,7 +81,7 @@ public class JFormSliderPane extends JPanel {
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
@ -83,7 +102,7 @@ public class JFormSliderPane extends JPanel {
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
@ -91,7 +110,7 @@ public class JFormSliderPane extends JPanel {
initShowValButton();
initUIRadioButton();
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(slider);
panel.add(upButton);
@ -100,17 +119,13 @@ public class JFormSliderPane extends JPanel {
this.add(panel, BorderLayout.NORTH);
}
public static final JFormSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JFormSliderPane();
return THIS;
public static JFormSliderPane getInstance() {
return new JFormSliderPane();
}
private void initSlider() {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED){
public Point getToolTipLocation(MouseEvent event){
slider = new UISlider(0, HUNDRED, HALF_HUNDRED) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -123,8 +138,8 @@ public class JFormSliderPane extends JPanel {
}
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)){
public Point getToolTipLocation(MouseEvent event){
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -134,16 +149,16 @@ public class JFormSliderPane extends JPanel {
}
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")){
public Point getToolTipLocation(MouseEvent event){
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) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
downButton.setOpaque(false);
downButton.setBorderPainted(false);
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")){
public Point getToolTipLocation(MouseEvent event){
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) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
@ -164,10 +179,11 @@ public class JFormSliderPane extends JPanel {
showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
}
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
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));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
@ -194,7 +210,7 @@ public class JFormSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
@ -217,7 +233,7 @@ public class JFormSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR);
@ -227,7 +243,7 @@ public class JFormSliderPane extends JPanel {
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()}
@ -247,14 +263,14 @@ public class JFormSliderPane extends JPanel {
return spinnerPanel;
}
ActionListener showValButtonActionListener = new ActionListener() {
private ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
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) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
@ -296,7 +312,7 @@ public class JFormSliderPane extends JPanel {
}
};
ItemListener radioButtonItemListener = new ItemListener() {
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
@ -312,7 +328,7 @@ public class JFormSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) {
} else {
slider.setValue(HALF_HUNDRED);
}
}
@ -336,7 +352,7 @@ public class JFormSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
private ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
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.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.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.DefaultFormatterFactory;
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.ActionListener;
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);
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider;
@ -70,12 +90,14 @@ public class JSliderPane extends JPanel {
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
/**
* 拖动条处理和button直接输入不一样
*/
private boolean isButtonOrIsTxt = true;
private PopupPane dialog;
private int upButtonX;
@ -91,7 +113,7 @@ public class JSliderPane extends JPanel {
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
@ -99,7 +121,7 @@ public class JSliderPane extends JPanel {
initShowValButton();
initUIRadioButton();
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(slider);
panel.add(upButton);
@ -109,12 +131,8 @@ public class JSliderPane extends JPanel {
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
public static JSliderPane getInstance() {
return new JSliderPane();
}
private void initSlider() {
@ -178,7 +196,7 @@ public class JSliderPane extends JPanel {
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
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));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
@ -205,7 +223,7 @@ public class JSliderPane extends JPanel {
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
@ -228,7 +246,7 @@ public class JSliderPane extends JPanel {
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
SevenFiveButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
selfAdaptButton.setBackground(BACK_COLOR);
@ -238,7 +256,7 @@ public class JSliderPane extends JPanel {
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{SevenFiveButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{selfAdaptButton, null},
@ -259,14 +277,14 @@ public class JSliderPane extends JPanel {
return spinnerPanel;
}
ActionListener showValButtonActionListener = new ActionListener() {
private ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
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) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
@ -309,7 +327,7 @@ public class JSliderPane extends JPanel {
}
};
ItemListener radioButtonItemListener = new ItemListener() {
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
@ -325,7 +343,7 @@ public class JSliderPane extends JPanel {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else if (showValue == HUNDRED) {
} else {
slider.setValue(HALF_HUNDRED);
}
}
@ -343,7 +361,7 @@ public class JSliderPane extends JPanel {
return this.showValue;
}
public void reset(){
public void reset() {
this.showValSpinner.setValue(HUNDRED);
}
@ -353,7 +371,7 @@ public class JSliderPane extends JPanel {
return b1.divide(b2, scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
private ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
@ -390,7 +408,7 @@ public class JSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else {
times = (int) (SIX * value - TWO_HUNDRED);
times = SIX * value - TWO_HUNDRED;
}
}
@ -448,11 +466,9 @@ class JSliderPaneUI extends BasicSliderUI {
super(b);
}
/** */
/**
* 绘制指示物
*/
public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g;
@ -460,7 +476,6 @@ class JSliderPaneUI extends BasicSliderUI {
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.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
@ -531,7 +531,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false;
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}

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

@ -1,7 +1,7 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.core.env.EnvConfig;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
@ -22,8 +22,19 @@ import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
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.ActionListener;
import java.awt.event.MouseEvent;
@ -97,6 +108,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/**
* 是否可扩展
*
* @return 同上
*/
public boolean IsExpanded() {
@ -111,7 +123,7 @@ public class TemplatePane extends JPanel implements MouseListener {
private boolean envListOkAction(EnvListPane envListPane) {
String selectedName = envListPane.updateEnvManager();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
Env selectedEnv = envManager.getEnv(selectedName);
EnvConfig selectedEnv = envManager.getEnv(selectedName);
GeneralContext.fireEnvWillChangeListener();
try {
//如果是远程的还要先测试下,如果失败就不切换
@ -120,7 +132,7 @@ public class TemplatePane extends JPanel implements MouseListener {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
return false;
} else {
String remoteVersion = selectedEnv.getDesignerVersion();
String remoteVersion = getDesignerVersion(selectedEnv);
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");
@ -147,6 +159,11 @@ public class TemplatePane extends JPanel implements MouseListener {
return true;
}
private String getDesignerVersion(EnvConfig selectedEnv) {
// return selectedEnv.getDesignerVersion();
throw new UnsupportedOperationException("unsupport now");
}
/**
* 编辑items
*/
@ -161,7 +178,7 @@ public class TemplatePane extends JPanel implements MouseListener {
}
public void doCancel() {
envListDialog.setVisible(false);
envListDialog.setVisible(false);
}
});
envListDialog.setVisible(true);
@ -209,6 +226,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/**
* 鼠标点击
*
* @param e 事件
*/
@Override
@ -217,6 +235,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/**
* 鼠标按下
*
* @param e 事件
*/
@Override
@ -231,6 +250,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/**
* 鼠标放开
*
* @param e 事件
*/
@Override
@ -239,6 +259,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/**
* 鼠标进入
*
* @param e 事件
*/
@Override
@ -247,6 +268,7 @@ public class TemplatePane extends JPanel implements MouseListener {
/**
* 鼠标离开
*
* @param e 事件
*/
@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.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogLevel;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
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.stable.EnvChangedListener;
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;
public class DesignerLogHandler {
protected static final int INFO_INT = FRLogLevel.INFO.intValue();
protected static final int ERRO_INT = FRLogLevel.ERROR.intValue();
protected static final int SERVER_INT = FRLogLevel.SEVERE.intValue();
protected static final int INFO_INT = com.fr.third.apache.log4j.Level.INFO.toInt();
protected static final int ERROR_INT = com.fr.third.apache.log4j.Level.ERROR.toInt();
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 INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40;
@ -50,7 +51,7 @@ public class DesignerLogHandler {
@Override
public void envChanged() {
// envchange后需要重新读取webinf里的log4j配置, 重新添加appender
FRLogger.getLogger().addLogAppender(new LogHandler<DesignerLogAppender>() {
FineLoggerFactory.getLogger().addLogAppender(new LogHandler<DesignerLogAppender>() {
@Override
public DesignerLogAppender getHandler() {
return new DesignerLogAppender();
@ -118,20 +119,20 @@ public class DesignerLogHandler {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu showsetPopup = new JPopupMenu();
int logLevelvalue = ServerConfig.getInstance().getServerLogLevel().intValue();
if (logLevelvalue <= INFO_INT) {
showsetPopup.add(showInfo);
showsetPopup.add(showError);
showsetPopup.add(showServer);
showsetPopup.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y);
} else if (logLevelvalue == ERRO_INT) {
showsetPopup.add(showError);
showsetPopup.add(showServer);
showsetPopup.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y);
JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt();
if (logLevelInt <= INFO_INT) {
jPopupMenu.add(showInfo);
jPopupMenu.add(showError);
jPopupMenu.add(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, INFO_GAP_Y);
} else if (logLevelInt == ERROR_INT) {
jPopupMenu.add(showError);
jPopupMenu.add(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y);
} else {
showsetPopup.add(showServer);
showsetPopup.show(caption, caption.getWidth() + GAP_X, SERVER_GAP_Y);
jPopupMenu.add(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, SERVER_GAP_Y);
}
}
});
@ -222,9 +223,9 @@ public class DesignerLogHandler {
int logLevelvalue = logRecord.getLevel().intValue();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
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());
} else if (logLevelvalue == SERVER_INT && showServer.isSelected()) {
} else if (logLevelvalue == WARN_INT && showServer.isSelected()) {
printMessage(logRecord.getMessage(), logLevelvalue, date, logRecord.getThrown());
}
@ -234,9 +235,9 @@ public class DesignerLogHandler {
int logLevelvalue = level.intValue();
if (logLevelvalue == INFO_INT && showInfo.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == ERRO_INT && showError.isSelected()) {
} else if (logLevelvalue == ERROR_INT && showError.isSelected()) {
printMessage(message, logLevelvalue, date);
} else if (logLevelvalue == SERVER_INT && showServer.isSelected()) {
} else if (logLevelvalue == WARN_INT && showServer.isSelected()) {
printMessage(message, logLevelvalue, date);
}
@ -264,10 +265,10 @@ public class DesignerLogHandler {
private void log(String str, int style) {
SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == ERRO_INT) {
if (style == ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true);
} else if (style == SERVER_INT) {
} else if (style == WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setBold(attrSet, true);
} else if (style == INFO_INT) {
@ -286,9 +287,9 @@ public class DesignerLogHandler {
}
private String swithInter(String str, int style) {
if (style == ERRO_INT) {
if (style == ERROR_INT) {
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";
} else {
str = Inter.getLocText("FR-Designer_Normal") + ":" + str + "\n";
@ -300,9 +301,9 @@ public class DesignerLogHandler {
LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogHandler.INFO_INT && showInfo.isSelected()) {
caption.infoAdd();
} else if (level == DesignerLogHandler.ERRO_INT && showError.isSelected()) {
} else if (level == DesignerLogHandler.ERROR_INT && showError.isSelected()) {
caption.errorAdd();
} else if (level == DesignerLogHandler.SERVER_INT && showServer.isSelected()) {
} else if (level == DesignerLogHandler.WARN_INT && showServer.isSelected()) {
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.env.RemoteEnv;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.SiteCenter;
@ -207,7 +207,7 @@ public class TemplateInfoCollector<T extends BaseBook> implements Serializable,
FileOutputStream out = new FileOutputStream(getInfoFile());
XMLTools.writeOutputStreamXML(this, out);
} 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() {
DesignAuthority[] authorities = managerPane.update();
if (!FRContext.getCurrentEnv().isLocalEnv()) {
try {
((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities);
} catch (Exception exception) {
FRContext.getLogger().error(exception.getMessage());
}
boolean success = ((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities);
FRContext.getLogger().info("update remote design authority: " + success);
}
}

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 javax.swing.*;
import javax.swing.JComponent;
/**
* 快速编辑区域
@ -39,11 +39,15 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
tc.fireTargetModified();
}
/**
* 刷新面板
*/
protected abstract void refresh();
/**
* for 关闭时候释放
* 关闭模板时释放模板对象
* 所有持有tc的对象也必须置空或者丢弃对于tc的引用
*/
public void release() {
tc = null;
@ -53,7 +57,6 @@ public abstract class QuickEditor<T extends TargetComponent> extends JComponent
@Override
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.dialog.BasicPane;
import com.fr.general.Background;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
public class BackgroundPane extends BasicPane {
@ -139,7 +139,7 @@ public class BackgroundPane extends BasicPane {
try {
return quickPane.update();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
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.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import java.awt.*;
@ -73,7 +73,7 @@ public class ColorPicker extends JDialog implements ActionListener
try {
Thread.sleep(100); // 等待弹窗关闭
} catch (InterruptedException e) {
FRLogger.getLogger().error(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
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.file.XMLFileManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.xml.XMLPrintWriter;
@ -99,7 +99,7 @@ public class ColorSelectConfigManager extends XMLFileManager implements ColorSel
try {
FRContext.getCurrentEnv().writeResource(manager);
} 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.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
/**
@ -241,7 +241,7 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
}
} catch (BadLocationException e1) {
FRLogger.getLogger().error(e1.getMessage());
FineLoggerFactory.getLogger().error(e1.getMessage());
}
}
}

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

@ -1,11 +1,11 @@
package com.fr.design.utils;
import com.fr.base.BaseUtils;
import com.fr.base.ServerConfig;
import com.fr.base.Env;
import com.fr.base.EnvException;
import com.fr.base.FRContext;
import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.dav.DavXMLUtils;
@ -19,10 +19,11 @@ import com.fr.env.RemoteEnv;
import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
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.CodeUtils;
import com.fr.stable.EncodeConstants;
@ -51,7 +52,6 @@ import java.net.URLEncoder;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Locale;
import java.util.logging.Level;
/**
@ -74,7 +74,8 @@ public class DesignUtils {
/**
* 通过端口是否被占用判断设计器有没有启动
* s
* s
*
* @return 启动了返回true
*/
public static boolean isStarted() {
@ -120,18 +121,19 @@ public class DesignUtils {
}
/**
*建立监听端口
* @param startPort 端口
* @param suffixs 文件后缀
* 建立监听端口
*
* @param startPort 端口
* @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() {
public void run() {
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(startPort);
} 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) {
try {
@ -146,7 +148,7 @@ public class DesignUtils {
String path = f.getAbsolutePath();
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]);
}
if (isMatch) {
@ -209,18 +211,18 @@ public class DesignUtils {
// 更新CurrentEnv于FRContext & DesignerEnvManager
FRContext.setCurrentEnv(env);
refreshDesignerFrame(env);
// 当换了运行环境,重置服务器,让它下次预览时重启
if (env instanceof LocalEnv && !ComparatorUtils.equals(env.getPath(), oldEnvPath)) {
StartServer.currentEnvChanged();
}
}
public static void refreshDesignerFrame(Env env) {
final Env run_env = env;
// 刷新DesignerFrame里面的面板
SwingUtilities.invokeLater(new Runnable() {
@ -233,7 +235,7 @@ public class DesignUtils {
}
});
}
/**
* p:初始化look and feel, 把一切放到这个里面.可以让多个地方调用.
*/
@ -242,7 +244,7 @@ public class DesignUtils {
try {
UIManager.setLookAndFeel(UILookAndFeel.class.getName());
} 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();
@ -256,55 +258,55 @@ public class DesignUtils {
}
}
}
private static boolean isTextField(String key){
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
private static boolean isTextField(String key) {
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
}
private static FRFont getCurrentLocaleFont(){
private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else if(isDisplayDialog(defaultLocale)) {
} else if (isDisplayDialog(defaultLocale)) {
guiFRFont = getNamedFont("Dialog");
} else {
guiFRFont = getNamedFont("Tahoma");
}
//先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整.
Locale designerLocale = FRContext.getLocale();
String file = Inter.getLocText("FR-Designer_File");
char displayChar = file.charAt(0);
if (!guiFRFont.canDisplay(displayChar)) {
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
guiFRFont = getNamedFont("SimSun");
if (!guiFRFont.canDisplay(displayChar)) {
//如果不能用默认的语言显示字体, 比如想在英文系统里用中文设计器
//默认语言(中文:宋体, 英文:Tahoma, 其他:Dialog)
guiFRFont = getNamedFont("SimSun");
if (!guiFRFont.canDisplay(displayChar)) {
//比如想在中文或英文系统里用韩文设计器
guiFRFont = getNamedFont("Dialog");
if(!guiFRFont.canDisplay(displayChar)) {
if (!guiFRFont.canDisplay(displayChar)) {
FRContext.getLogger().error(Inter.getLocText("FR-Base_SimSun_Not_Found"));
}
}
}
}
}
return guiFRFont;
}
private static FRFont getNamedFont(String name){
return FRFont.getInstance(name, Font.PLAIN, 12);
private static FRFont getNamedFont(String name) {
return FRFont.getInstance(name, Font.PLAIN, 12);
}
private static boolean isDisplaySimSun(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
private static boolean isDisplaySimSun(Locale defaultLocale) {
return ComparatorUtils.equals(defaultLocale, Locale.SIMPLIFIED_CHINESE);
}
private static boolean isDisplayDialog(Locale defaultLocale){
return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
private static boolean isDisplayDialog(Locale defaultLocale) {
return ComparatorUtils.equals(defaultLocale, Locale.TRADITIONAL_CHINESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPANESE)
|| ComparatorUtils.equals(defaultLocale, Locale.JAPAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREAN)
|| ComparatorUtils.equals(defaultLocale, Locale.KOREA);
}
@ -313,7 +315,7 @@ public class DesignUtils {
* 访问服务器环境-空参数
*/
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)) {
String time = Calendar.getInstance().getTime().toString().replaceAll(" ", "");
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();
Desktop.getDesktop().browse(new URI(urlPath + postfixOfUri));
@ -474,10 +479,10 @@ public class DesignUtils {
private static InputStream postBytes2ServerB(byte[] bytes) throws Exception {
HttpClient client = new HttpClient("http://114.215.175.35:8080/WebReport/product_advice.jsp");
HttpClient client = new HttpClient("http://114.215.175.35:8080/WebReport/product_advice.jsp");
client.asGet();
client.setContent(bytes);
return execute4InputStream(client);
client.setContent(bytes);
return execute4InputStream(client);
}
@ -486,8 +491,8 @@ public class DesignUtils {
*/
private static ByteArrayInputStream execute4InputStream(HttpClient client) throws Exception {
int statusCode = client.getResponseCode();
if(statusCode != HttpURLConnection.HTTP_OK){
throw new EnvException("Method failed: " + statusCode);
if (statusCode != HttpURLConnection.HTTP_OK) {
throw new EnvException("Method failed: " + statusCode);
}
InputStream in = client.getResponseStream();
if (in == null) {

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

@ -1,7 +1,7 @@
package com.fr.design.utils;
import com.fr.design.utils.ColorRoutines;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
import java.awt.*;
@ -205,11 +205,11 @@ public class DrawRoutines {
try {
grabber.grabPixels();
} 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) {
FRLogger.getLogger().info("Image fetch aborted or errored.");
FineLoggerFactory.getLogger().info("Image fetch aborted or errored.");
} else {
for (int y = 0; y < h; y++) {
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();
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;
import com.fr.base.Env;
import com.fr.dav.LocalEnv;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
@ -59,9 +60,9 @@ public class EnvListPane extends JListControlPane {
@Override
public NameableCreator[] createNameableCreators() {
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",
RemoteEnv.class, RemoteEnvPane.class);
RemoteEnvConfig.class, RemoteEnvPane.class);
return new NameableCreator[]{local, remote};
}
@ -104,7 +105,7 @@ public class EnvListPane extends JListControlPane {
Nameable[] res = this.update();
for (Nameable re : res) {
NameObject nameObject = (NameObject) re;
mgr.putEnv(nameObject.getName(), (Env) nameObject.getObject());
mgr.putEnv(nameObject.getName(), (EnvConfig) nameObject.getObject());
}
return this.getSelectedName();
}

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

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

1752
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;
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.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
@ -49,7 +51,7 @@ import static com.fr.design.layout.TableLayout.PREFERRED;
/**
* @author yaohwu
*/
public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
public class RemoteEnvPane extends BasicBeanPane<RemoteEnvConfig> {
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 配置面板
*/
@ -151,6 +153,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
@Override
public void removeUpdate(DocumentEvent e) {
actionURLInputChange();
}
@ -250,7 +253,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
}
@Override
public void populateBean(RemoteEnv ob) {
public void populateBean(RemoteEnvConfig ob) {
if (StringUtils.isEmpty(ob.getPath())) {
remoteEnvURL = RemoteEnvURL.createDefaultURL();
@ -265,18 +268,20 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
fileChooserButton.setEnabled(remoteEnvURL.getHttps());
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());
}
@Override
public RemoteEnv updateBean() {
public RemoteEnvConfig updateBean() {
String path = remoteEnvURL.getURL();
String user = this.usernameInput.getText();
String password = new String(this.passwordInput.getPassword());
return new RemoteEnv(path, user, password);
return new RemoteEnvConfig(path, user, password);
}
@Override
@ -465,11 +470,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteEnv> {
}
private boolean testConnection() {
RemoteEnv env = new RemoteEnv();
String url = remoteEnvURL.getURL();
env.setPath(url);
env.setUser(usernameInput.getText());
env.setPassword(new String(passwordInput.getPassword()));
RemoteEnv env = new RemoteEnv(url, usernameInput.getText(), new String(passwordInput.getPassword()));
boolean connect = false;
try {
if (StringUtils.isNotEmpty(url)) {

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

@ -1,86 +1,167 @@
package com.fr.env;
import com.fr.base.EnvException;
import com.fr.base.FRContext;
import com.fr.general.IOUtils;
import com.fr.report.DesignAuthority;
import com.fr.report.util.AuthorityXMLUtils;
import com.fr.stable.EncodeConstants;
import com.fr.third.org.apache.http.HttpEntity;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
import com.fr.third.org.apache.commons.io.IOUtils;
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.RequestBuilder;
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.impl.client.CloseableHttpClient;
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.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.Map;
public class 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 userID = env.getUserID();
RequestBuilder builder = RequestBuilder.post(path);
String res = null;
CloseableHttpClient httpClient = HttpClients.createDefault();
InputStream inputStream = null;
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);
InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML);
InputStream inputStream = null;
for (Map.Entry<String, String> entry : parameters.entrySet()) {
builder.addParameter(entry.getKey(), entry.getValue());
}
if (!isSignIn) {
builder.addParameter("id", env.getUserID());
}
HttpUriRequest request = RequestBuilder.post(path)
.addParameter("id", userID)
.addParameter("op", "remote_design_authority")
.addParameter("cmd", "update_authorities")
.setEntity(reqEntity)
.build();
try {
CloseableHttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
res = IOUtils.inputStream2String(entity.getContent(), EncodeConstants.ENCODING_UTF_8);
EntityUtils.consume(entity);
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);
return res != null && Boolean.valueOf(res);
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 DesignAuthority[] getAuthorities(RemoteEnv env) {
public static InputStream updateAuthorities(DesignAuthority[] authorities, RemoteEnv env) {
String path = env.getPath();
// 远程设计临时用户id
String userID = env.getUserID();
DesignAuthority[] authorities = null;
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpUriRequest request = RequestBuilder.get(path)
.addParameter("id", userID)
.addParameter("op", "remote_design_authority")
.addParameter("cmd", "get_authorities")
.build();
try {
CloseableHttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
authorities = AuthorityXMLUtils.readDesignAuthoritiesXML(entity.getContent());
EntityUtils.consume(entity);
} catch (Exception e) {
InputStream inputStream = null;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
AuthorityXMLUtils.writeDesignAuthoritiesXML(authorities, outputStream);
InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(outputStream.toByteArray()), ContentType.TEXT_XML);
try (CloseableHttpClient httpClient = HttpClients.createSystem()) {
HttpUriRequest request = RequestBuilder.post(path)
.addParameter("id", userID)
.addParameter("op", "remote_design_authority")
.addParameter("cmd", "update_authorities")
.setEntity(reqEntity)
.build();
inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage());
}
return authorities;
return inputStream;
}
public static InputStream getAuthorities(RemoteEnv env) throws EnvException {
String path = env.getPath();
// 远程设计临时用户id
String userID = env.getUserID();
InputStream inputStream = null;
try (CloseableHttpClient httpClient = HttpClients.createSystem();) {
HttpUriRequest request = RequestBuilder.get(path)
.addParameter("id", userID)
.addParameter("op", "remote_design_authority")
.addParameter("cmd", "get_authorities")
.build();
inputStream = httpClient.execute(request, responseHandler);
} catch (IOException e) {
FRContext.getLogger().error(e.getMessage());
}
return inputStream;
}
}

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

@ -1,43 +1,61 @@
package com.fr.env;
import com.fr.base.Env;
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.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.env.EnvContext;
import com.fr.general.Inter;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
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 选择的环境
* @throws Exception 异常
*/
public static void signIn(Env selectedEnv) throws Exception {
boolean validServer;
signOutOldEnv(selectedEnv);
selectedEnv.signIn();
validServer = true;
if (validServer) {
DesignUtils.switchToEnv(selectedEnv);
lastSelectedEnv = selectedEnv;
public static void signIn(EnvConfig selectedEnv) throws Exception {
if (EnvContext.currentEnv() != null && !ComparatorUtils.equals(EnvContext.currentEnv(), selectedEnv)) {
EnvContext.signOut();
}
EnvContext.signIn(selectedEnv);
DesignUtils.switchToEnv(trans(selectedEnv));
}
private static void signOutOldEnv(Env newEnv) {
// 环境相同直接返回,避免浪费过多时间
if (lastSelectedEnv == null || ComparatorUtils.equals(lastSelectedEnv, newEnv)) {
return;
}
try {
EnvContext.fireBeforeSignOut();
lastSelectedEnv.signOut();
EnvContext.fireAfterSignOut();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
private static com.fr.base.Env trans(EnvConfig env) {
if (env instanceof RemoteEnvConfig) {
return new RemoteEnv(env.getPath(), EnvConfigUtils.getUsername(env), EnvConfigUtils.getPassword(env));
} else {
return new LocalEnv();
}
}
}

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

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

@ -1,7 +1,7 @@
package com.fr.start;
import com.fr.base.ServerConfig;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
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.GeneralContext;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.server.TomcatHost;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Font;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@ -69,7 +72,7 @@ public class StartServer {
TemplateTreePane.getInstance().refreshDockingView();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
}
initDemoServerAndBrowser();
}
@ -98,7 +101,7 @@ public class StartServer {
tomcatHost.start();
}
} catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
} finally {
//先访问Demo, 后访问报表, 不需要重置服务器.
NEED_LOAD_ENV = false;
@ -121,14 +124,14 @@ public class StartServer {
tomcatHost.addAndStartLocalEnvHomeWebApp();
}
}
if (!tomcatHost.isStarted()) {
tomcatHost.start();
if (!tomcatHost.isStarted()) {
tomcatHost.start();
}
}
} catch (InterruptedException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
} catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage());
FineLoggerFactory.getLogger().error(e.getMessage());
} finally {
NEED_LOAD_ENV = false;
}
@ -169,10 +172,10 @@ public class StartServer {
} catch (IOException e) {
startBrowserFromCommand(uri, e);
} catch (URISyntaxException e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (Exception e) {
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
FRContext.getLogger().error("Can not open the browser for URL: " + uri);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
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);
} catch (IOException ee) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} 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.UIDialog;
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.stable.ArrayUtils;
import com.fr.stable.StringUtils;
@ -275,7 +275,7 @@ public class MapCubeLayerPane extends BasicBeanPane<String>{
@Override
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.DesignerFrame;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.stable.CoreConstants;
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}));
refresh();
}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
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.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
@ -477,7 +477,7 @@ public class UIGroupExtensionPane extends BasicPane {
try {
list.setSelectedIndices(null);
} 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.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import java.awt.*;
@ -71,7 +71,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
try {
cc.addChart((Chart) chart.clone());
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} 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.ChartTypePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import javax.swing.JPanel;
@ -117,7 +117,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
try {
lastCollection = (ChartCollection) collection.clone();
} 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)){
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.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
@ -142,7 +142,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
editingCollection.addNamedChart(name, newChart);
editingCollection.addFunctionRecord(newChart);
} catch (CloneNotSupportedException e1) {
FRLogger.getLogger().error("Error in Clone");
FineLoggerFactory.getLogger().error("Error in Clone");
}
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.design.gui.icombobox.UIComboBox;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
/**
@ -56,10 +56,10 @@ public class CalculateComboBox extends UIComboBox{
return (AbstractDataFunction)CLASS_ARRAY[selectIndex].newInstance();
}
} catch (InstantiationException e) {
FRLogger.getLogger().error("Function Error");
FineLoggerFactory.getLogger().error("Function Error");
return null;
} catch (IllegalAccessException e) {
FRLogger.getLogger().error("Function Error");
FineLoggerFactory.getLogger().error("Function Error");
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.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
@ -265,9 +265,9 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
try {
return (DataFunction) CalculateComboBox.CLASS_ARRAY[index].newInstance();
} catch (InstantiationException e) {
FRLogger.getLogger().error("Function Error");
FineLoggerFactory.getLogger().error("Function Error");
} catch (IllegalAccessException e) {
FRLogger.getLogger().error("Function Error");
FineLoggerFactory.getLogger().error("Function Error");
}
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.style.FormatBox;
import com.fr.general.DateUtils;
import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
@ -358,7 +358,7 @@ public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{
String tmp = DateUtils.getDate2LStr(toDate);
toDate = DateUtils.DATETIMEFORMAT2.parse(tmp);
} catch (ParseException e) {
FRLogger.getLogger().error(Inter.getLocText("Cannot_Get_Date"));
FineLoggerFactory.getLogger().error(Inter.getLocText("Cannot_Get_Date"));
}
return toDate;
}

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

Loading…
Cancel
Save