Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~zheng/C-design into release/10.0

bugfix/10.0
zheng 6 years ago
parent
commit
050b6a432a
  1. 21
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 15
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  3. 17
      designer-base/src/main/java/com/fr/design/bridge/exec/JSBridge.java
  4. 18
      designer-base/src/main/java/com/fr/design/bridge/exec/JSCallback.java
  5. 2
      designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java
  6. 58
      designer-base/src/main/java/com/fr/design/bridge/exec/JSUtils.java
  7. 42
      designer-base/src/main/java/com/fr/design/extra/PluginJavaFxExecutor.java
  8. 2
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  9. 20
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  10. 1
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  11. 1
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  12. 1
      designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java
  13. 1
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  14. 1
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  15. 1
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  16. 38
      designer-base/src/main/java/com/fr/design/fun/OemProcessor.java
  17. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java
  18. 15
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  19. 15
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  20. 7
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java
  21. 7
      designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java
  22. 1
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  23. 32
      designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java
  24. 22
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  25. 31
      designer-base/src/main/java/com/fr/design/upm/UPMBridge.java
  26. 406
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  27. 13
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  28. 4
      designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java
  29. 22
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  30. 21
      designer-base/src/main/java/com/fr/design/upm/UpmUtils.java
  31. 12
      designer-base/src/main/java/com/fr/design/upm/event/CertificateEvent.java
  32. 2
      designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java
  33. 30
      designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java
  34. 27
      designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java
  35. 52
      designer-base/src/main/java/com/fr/design/upm/task/UpmTaskWorker.java
  36. 14
      designer-base/src/main/java/com/fr/start/OemHandler.java
  37. 63
      designer-base/src/main/resources/com/fr/design/upm/warn.js
  38. 7
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java
  39. 16
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java
  40. 16
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

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

@ -2,6 +2,7 @@ package com.fr.design.actions.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -24,7 +25,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
@ -133,6 +133,7 @@ public class PreferencePane extends BasicPane {
private UICheckBox oracleSpace; private UICheckBox oracleSpace;
private UISpinner cachingTemplateSpinner; private UISpinner cachingTemplateSpinner;
private UICheckBox openDebugComboBox; private UICheckBox openDebugComboBox;
private UICheckBox useOptimizedUPMCheckbox;
private UICheckBox joinProductImprove; private UICheckBox joinProductImprove;
public PreferencePane() { public PreferencePane() {
@ -178,6 +179,11 @@ public class PreferencePane extends BasicPane {
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER); debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
advancePane.add(debuggerPane); advancePane.add(debuggerPane);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve")); JPanel improvePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImprove = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve")); joinProductImprove = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
@ -560,6 +566,8 @@ public class PreferencePane extends BasicPane {
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug()); openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove()); this.joinProductImprove.setSelected(designerEnvManager.isJoinProductImprove());
@ -641,6 +649,17 @@ public class PreferencePane extends BasicPane {
return new Class[]{Log4jConfig.class}; return new Class[]{Log4jConfig.class};
} }
}); });
Configurations.update(new Worker() {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[] {ServerPreferenceConfig.class};
}
});
} }

15
designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java

@ -1,20 +1,12 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.upm.UPM; import com.fr.design.upm.UpmFinder;
import com.fr.design.upm.UPMDialog;
import com.fr.design.upm.UPMPane;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -35,9 +27,8 @@ public class PluginManagerAction extends UpdateAction {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// 可以启用新版本的插件商店(使用JxBrowser作为容器) // 可以启用新版本的插件商店(使用JxBrowser作为容器)
if (DesignerEnvManager.getEnvManager().isOpenDebug() if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) {
||ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) { UpmFinder.showUPMDialog();
UPM.showUPMDialog();
} else { } else {
WebViewDlgHelper.createPluginDialog(); WebViewDlgHelper.createPluginDialog();
} }

17
designer-base/src/main/java/com/fr/design/bridge/exec/JSBridge.java

@ -0,0 +1,17 @@
package com.fr.design.bridge.exec;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
* 用于标记一个方法是用于和JS做桥接的避免被误删除
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface JSBridge {
}

18
designer-base/src/main/java/com/fr/design/bridge/exec/JSCallback.java

@ -0,0 +1,18 @@
package com.fr.design.bridge.exec;
/**
* Created by ibm on 2017/5/27.
*/
public class JSCallback {
private JSExecutor executeScript;
public JSCallback(JSExecutor jsExecutor) {
this.executeScript = jsExecutor;
}
public void execute(String newValue) {
executeScript.executor(newValue);
}
}

2
designer-base/src/main/java/com/fr/design/extra/exe/callback/JSExecutor.java → designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java

@ -1,4 +1,4 @@
package com.fr.design.extra.exe.callback; package com.fr.design.bridge.exec;
/** /**
* Created by ibm on 2017/6/21. * Created by ibm on 2017/6/21.

58
designer-base/src/main/java/com/fr/design/extra/exe/callback/JSCallback.java → designer-base/src/main/java/com/fr/design/bridge/exec/JSUtils.java

@ -1,46 +1,20 @@
package com.fr.design.extra.exe.callback; package com.fr.design.bridge.exec;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.application.Platform;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* Created by ibm on 2017/5/27. * @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/ */
public class JSCallback { public class JSUtils {
private JSExecutor executeScript;
public JSCallback(final WebEngine webEngine, final JSObject callback) {
init(webEngine, callback);
}
public void init(final WebEngine webEngine, final JSObject callback){
executeScript = new JSExecutor() {
@Override
public void executor(final String newValue) {
Platform.runLater(new Runnable() {
@Override
public void run() {
String fun = "(" + callback + ")(\"" + trimText(newValue) + "\")";
try {
webEngine.executeScript(fun);
} catch (Exception e) {
webEngine.executeScript("alert(\"" + e.getMessage() + "\")");
}
}
});
}
};
}
public void execute(String newValue) {
executeScript.executor(newValue);
}
/** /**
@ -60,7 +34,7 @@ public class JSCallback {
* @param old 原始字符串 * @param old 原始字符串
* @return 处理之后的字符串 * @return 处理之后的字符串
*/ */
private String trimText(String old) { public static String trimText(String old) {
if (StringUtils.isNotBlank(old)) { if (StringUtils.isNotBlank(old)) {
String b = filterHtmlTag(old); String b = filterHtmlTag(old);
return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\");
@ -73,7 +47,7 @@ public class JSCallback {
* @param origin 原始字符串 * @param origin 原始字符串
* @return 处理之后的字符串 * @return 处理之后的字符串
*/ */
private String filterHtmlTag(String origin) { public static String filterHtmlTag(String origin) {
String regHtml = "<[^>]+>"; String regHtml = "<[^>]+>";
Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE); Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE);
Matcher matchHtml = patternHtml.matcher(origin); Matcher matchHtml = patternHtml.matcher(origin);
@ -81,5 +55,15 @@ public class JSCallback {
return origin; return origin;
} }
public String[] jsObjectToStringArray(JSObject obj) {
if (obj == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
int len = (int) obj.getMember("length");
List<String> list = new ArrayList<>();
for (int i = 0; i < len; i++) {
list.add(obj.getSlot(i).toString());
}
return list.toArray(new String[len]);
}
} }

42
designer-base/src/main/java/com/fr/design/extra/PluginJavaFxExecutor.java

@ -0,0 +1,42 @@
package com.fr.design.extra;
import com.fr.design.bridge.exec.JSExecutor;
import com.fr.design.bridge.exec.JSUtils;
import javafx.application.Platform;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class PluginJavaFxExecutor implements JSExecutor {
public static PluginJavaFxExecutor create(WebEngine webEngine, JSObject callback) {
return new PluginJavaFxExecutor(webEngine, callback);
}
private WebEngine webEngine;
private JSObject callback;
private PluginJavaFxExecutor(WebEngine webEngine, JSObject callback) {
this.webEngine = webEngine;
this.callback = callback;
}
@Override
public void executor(final String newValue) {
Platform.runLater(new Runnable() {
@Override
public void run() {
String fun = "(" + callback + ")(\"" + JSUtils.trimText(newValue) + "\")";
try {
webEngine.executeScript(fun);
} catch (Exception e) {
webEngine.executeScript("alert(\"" + e.getMessage() + "\")");
}
}
});
}
}

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

@ -3,7 +3,7 @@ package com.fr.design.extra;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.extra.exe.callback.JSCallback; import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.extra.exe.callback.UninstallPluginCallback; import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;

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

@ -3,6 +3,7 @@ package com.fr.design.extra;
import com.fr.base.passport.FinePassportManager; import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
@ -11,12 +12,9 @@ import com.fr.design.extra.exe.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor; 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.gui.ilable.UILabel;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -172,7 +170,7 @@ public class PluginWebBridge {
* @param callback 回调函数 * @param callback 回调函数
*/ */
public void installPluginOnline(final String pluginInfo, final JSObject callback) { public void installPluginOnline(final String pluginInfo, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
} }
@ -183,7 +181,7 @@ public class PluginWebBridge {
* @param filePath 插件包的路径 * @param filePath 插件包的路径
*/ */
public void installPluginFromDisk(final String filePath, final JSObject callback) { public void installPluginFromDisk(final String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
File file = new File(filePath); File file = new File(filePath);
PluginOperateUtils.installPluginFromDisk(file, jsCallback); PluginOperateUtils.installPluginFromDisk(file, jsCallback);
} }
@ -194,7 +192,7 @@ public class PluginWebBridge {
* @param pluginInfo 插件信息 * @param pluginInfo 插件信息
*/ */
public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSObject callback) { public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback);
} }
@ -204,7 +202,7 @@ public class PluginWebBridge {
* @param pluginIDs 插件集合 * @param pluginIDs 插件集合
*/ */
public void updatePluginOnline(JSObject pluginIDs, final JSObject callback) { public void updatePluginOnline(JSObject pluginIDs, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
String[] pluginInfos = jsObjectToStringArray(pluginIDs); String[] pluginInfos = jsObjectToStringArray(pluginIDs);
List<PluginMarker> pluginMarkerList = new ArrayList<PluginMarker>(); List<PluginMarker> pluginMarkerList = new ArrayList<PluginMarker>();
for (int i = 0; i < pluginInfos.length; i++) { for (int i = 0; i < pluginInfos.length; i++) {
@ -219,7 +217,7 @@ public class PluginWebBridge {
* @param filePath 插件包的路径 * @param filePath 插件包的路径
*/ */
public void updatePluginFromDisk(String filePath, final JSObject callback) { public void updatePluginFromDisk(String filePath, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
File file = new File(filePath); File file = new File(filePath);
PluginOperateUtils.updatePluginFromDisk(file, jsCallback); PluginOperateUtils.updatePluginFromDisk(file, jsCallback);
} }
@ -230,7 +228,7 @@ public class PluginWebBridge {
* @param pluginID 插件ID * @param pluginID 插件ID
*/ */
public void setPluginActive(String pluginID, final JSObject callback) { public void setPluginActive(String pluginID, final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginOperateUtils.setPluginActive(pluginID, jsCallback); PluginOperateUtils.setPluginActive(pluginID, jsCallback);
} }
@ -427,7 +425,7 @@ public class PluginWebBridge {
* @param callback * @param callback
*/ */
public void registerLoginInfo(final JSObject callback) { public void registerLoginInfo(final JSObject callback) {
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
PluginOperateUtils.getLoginInfo(jsCallback, uiLabel); PluginOperateUtils.getLoginInfo(jsCallback, uiLabel);
} }
@ -559,7 +557,7 @@ public class PluginWebBridge {
} }
public void getPackInfo(final JSObject callback){ public void getPackInfo(final JSObject callback){
JSCallback jsCallback = new JSCallback(webEngine, callback); JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback));
jsCallback.execute(StringUtils.EMPTY); jsCallback.execute(StringUtils.EMPTY);
} }

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskCallback;

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils; import com.fr.design.extra.PluginUtils;

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

@ -1,5 +1,6 @@
package com.fr.design.extra.exe.callback; package com.fr.design.extra.exe.callback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginOperateUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;

38
designer-base/src/main/java/com/fr/design/fun/OemProcessor.java

@ -0,0 +1,38 @@
package com.fr.design.fun;
import com.fr.design.menu.MenuDef;
import com.fr.start.SplashStrategy;
import java.awt.image.BufferedImage;
import java.util.List;
/**
* 设计器Oem接口
*/
public interface OemProcessor {
public static final String MARK_STRING = "OemProcessor";
/**
* 启动动画,如果不替换则返回null
*
* @return
*/
SplashStrategy createSplashStrategy();
/**
* 替换标题图标--DesignerFrame.initTitleIcon
* 如果不替换则返回null
*
* @return
*/
List<BufferedImage> createTitleIcon();
/**
* 处理设计器菜单增删改
*
* @param menuDefs 已加载的菜单
* @return 新的菜单数组
*/
MenuDef[] dealWithMenuDef(MenuDef[] menuDefs);
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java

@ -0,0 +1,25 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.OemProcessor;
import com.fr.design.menu.MenuDef;
import com.fr.start.SplashStrategy;
import java.awt.image.BufferedImage;
import java.util.List;
public abstract class AbstractOemProcessor implements OemProcessor{
@Override
public MenuDef[] dealWithMenuDef(MenuDef[] menuDefs) {
return menuDefs;
}
@Override
public List<BufferedImage> createTitleIcon() {
return null;
}
@Override
public SplashStrategy createSplashStrategy() {
return null;
}
}

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

@ -24,6 +24,7 @@ import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -57,6 +58,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
@ -458,8 +460,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try { try {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<BufferedImage> image = ICODecoder.read(DesignerFrame.class OemProcessor oemProcessor = OemHandler.findOem();
List<BufferedImage> image = null;
if (oemProcessor != null) {
try {
image = oemProcessor.createTitleIcon();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
if (image == null) {
image = ICODecoder.read(DesignerFrame.class
.getResourceAsStream("/com/fr/base/images/oem/logo.ico")); .getResourceAsStream("/com/fr/base/images/oem/logo.ico"));
}
this.setIconImages(image); this.setIconImages(image);
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

15
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -38,6 +38,7 @@ import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -56,6 +57,7 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
@ -64,6 +66,7 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType; import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -200,6 +203,18 @@ public abstract class ToolBarMenuDock {
}; };
this.menus = menus(plus); this.menus = menus(plus);
try {
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
this.menus = oemProcessor.dealWithMenuDef(this.menus);
if (this.menus == null) {
this.menus = menus(plus);
}
}
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
this.menus = menus(plus);
}
for (int i = 0; i < menus.length; i++) { for (int i = 0; i < menus.length; i++) {
menus[i].setHasRecMenu(true); menus[i].setHasRecMenu(true);
UIMenu subMenu = menus[i].createJMenu(); UIMenu subMenu = menus[i].createJMenu();

7
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/RestoreResultDialog.java

@ -1,6 +1,5 @@
package com.fr.design.onlineupdate.ui.dialog; package com.fr.design.onlineupdate.ui.dialog;
import com.fr.base.FRContext;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -8,7 +7,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.onlineupdate.domain.UpdateConstants; import com.fr.design.onlineupdate.domain.UpdateConstants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.locale.InterProviderFactory; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -176,8 +175,8 @@ public class RestoreResultDialog extends JDialog {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
for (String file : files) { for (String file : files) {
map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file),
StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file));
list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file));
} }
} }
} }

7
designer-base/src/main/java/com/fr/design/onlineupdate/ui/dialog/UpdateMainDialog.java

@ -1,6 +1,5 @@
package com.fr.design.onlineupdate.ui.dialog; package com.fr.design.onlineupdate.ui.dialog;
import com.fr.base.FRContext;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -684,7 +683,7 @@ public class UpdateMainDialog extends UIDialog {
for (String file : files) { for (String file : files) {
try { try {
IOUtils.copy( IOUtils.copy(
new File(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)), new File(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)),
new File(StableUtils.pathJoin(todayBackupDir))); new File(StableUtils.pathJoin(todayBackupDir)));
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
@ -725,8 +724,8 @@ public class UpdateMainDialog extends UIDialog {
private void putNewFilesToInstallEnv(String installHome, String[] files, Map<String, String> map, java.util.List<String> list) { private void putNewFilesToInstallEnv(String installHome, String[] files, Map<String, String> map, java.util.List<String> list) {
for (String file : files) { for (String file : files) {
map.put(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOAD_DIR, file), map.put(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOAD_DIR, file),
StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file));
list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file));
} }
} }

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

@ -49,5 +49,6 @@ public class Assistant {
ProtocolService protocolService = browserContext.getProtocolService(); ProtocolService protocolService = browserContext.getProtocolService();
// 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png // 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png
protocolService.setProtocolHandler("emb", handler); protocolService.setProtocolHandler("emb", handler);
//protocolService.setProtocolHandler("file", handler);
} }
} }

32
designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java

@ -1,7 +1,11 @@
package com.fr.design.ui; package com.fr.design.ui;
import com.fr.base.TemplateUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.codec.net.URLCodec;
import com.fr.third.org.apache.commons.io.FileUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.AtomBuilder; import com.fr.web.struct.AtomBuilder;
import com.fr.web.struct.PathGroup; import com.fr.web.struct.PathGroup;
@ -11,7 +15,12 @@ import com.teamdev.jxbrowser.chromium.ProtocolHandler;
import com.teamdev.jxbrowser.chromium.URLRequest; import com.teamdev.jxbrowser.chromium.URLRequest;
import com.teamdev.jxbrowser.chromium.URLResponse; import com.teamdev.jxbrowser.chromium.URLResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringReader;
import java.net.URI;
import java.util.Map;
/** /**
* @author richie * @author richie
@ -21,6 +30,7 @@ import java.io.InputStream;
public class EmbProtocolHandler implements ProtocolHandler { public class EmbProtocolHandler implements ProtocolHandler {
private AssembleComponent component; private AssembleComponent component;
private Map<String, String> map;
public EmbProtocolHandler() { public EmbProtocolHandler() {
@ -30,12 +40,30 @@ public class EmbProtocolHandler implements ProtocolHandler {
this.component = component; this.component = component;
} }
public EmbProtocolHandler(AssembleComponent component, Map<String, String> map) {
this.component = component;
this.map = map;
}
public EmbProtocolHandler(Map<String, String> map) {
this.map = map;
}
@Override @Override
public URLResponse onRequest(URLRequest req) { public URLResponse onRequest(URLRequest req) {
try { try {
String path = req.getURL(); String path = req.getURL();
if (path.startsWith("emb:dynamic")) { if (path.startsWith("file:")) {
String url = new URLCodec().decode(path);
String filePath = TemplateUtils.renderParameter4Tpl(url, map);
File file = new File(URI.create(filePath).getPath());
InputStream inputStream = new FileInputStream(file);
if (path.endsWith(".svg")) {
System.out.println(path);
}
return Assistant.inputStream2Response(inputStream, "file:///" + file.getAbsolutePath());
}
else if (path.startsWith("emb:dynamic")) {
URLResponse response = new URLResponse(); URLResponse response = new URLResponse();
response.setData(htmlText().getBytes()); response.setData(htmlText().getBytes());
response.getHeaders().setHeader("Content-Type", "text/html"); response.getHeaders().setHeader("Content-Type", "text/html");
@ -51,7 +79,7 @@ public class EmbProtocolHandler implements ProtocolHandler {
return Assistant.inputStream2Response(inputStream, path); return Assistant.inputStream2Response(inputStream, path);
} }
} catch (Exception ignore) { } catch (Exception ignore) {
ignore.printStackTrace();
} }
return null; return null;
} }

22
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -22,6 +22,7 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Map;
/** /**
* @author richie * @author richie
@ -164,6 +165,16 @@ public class ModernUIPane<T> extends BasicPane {
return this; return this;
} }
/**
* 加载url指向的资源
* @param url 文件的地址
*/
public Builder<T> withURL(final String url, Map<String, String> map) {
Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(map));
pane.browser.loadURL(url);
return this;
}
/** /**
* 加载Atom组件 * 加载Atom组件
* @param component Atom组件 * @param component Atom组件
@ -174,6 +185,17 @@ public class ModernUIPane<T> extends BasicPane {
return this; return this;
} }
/**
* 加载Atom组件
* @param component Atom组件
*/
public Builder<T> withComponent(AssembleComponent component, Map<String, String> map) {
Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component, map));
pane.browser.loadURL("emb:dynamic");
return this;
}
/** /**
* 加载html文本内容 * 加载html文本内容
* @param html 要加载html文本内容 * @param html 要加载html文本内容

31
designer-base/src/main/java/com/fr/design/upm/UPMBridge.java

@ -1,31 +0,0 @@
package com.fr.design.upm;
import com.fr.design.upm.event.DownloadEvent;
import com.fr.event.EventDispatcher;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-12
* 桥接Java和JavaScript的类
*/
public class UPMBridge {
private static UPMBridge bridge = new UPMBridge();
public static UPMBridge getBridge() {
return bridge;
}
public void startDownload() {
// do something.....
EventDispatcher.fire(DownloadEvent.FINISH, "start");
}
public void closeWindow() {
UPM.closeWindow();
}
}

406
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -0,0 +1,406 @@
package com.fr.design.upm;
import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader;
import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.PluginOperateUtils;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.design.upm.event.DownloadEvent;
import com.fr.design.upm.exec.UpmBrowserExecutor;
import com.fr.design.upm.task.UpmTaskWorker;
import com.fr.event.EventDispatcher;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralUtils;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSArray;
import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-12
* 桥接Java和JavaScript的类
*/
public class UpmBridge {
public static UpmBridge getBridge(Browser browser) {
return new UpmBridge(browser);
}
private JSObject window;
private UpmBridge(Browser browser) {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
}
public void startDownload(final JSFunction callback) {
new SwingWorker<Void, Void>(){
@Override
protected Void doInBackground() throws Exception {
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
return null;
}
@Override
protected void done() {
try {
get();
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.SUCCESS, "success");
} catch (Exception e) {
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
FineLoggerFactory.getLogger().error(e.getMessage(), e);
EventDispatcher.fire(DownloadEvent.ERROR, "error");
}
}
}.execute();
}
@JSBridge
public String i18nText(String key) {
return Toolkit.i18nText(key);
}
@JSBridge
public void closeWindow() {
UpmFinder.closeWindow();
}
@JSBridge
public boolean isDesigner() {
return true;
}
@JSBridge
public void getPackInfo(final JSFunction callback) {
callback.invoke(window, StringUtils.EMPTY);
}
/**
* 在线获取插件分类
*
* @param callback 回调函数
*/
@JSBridge
public void getPluginCategories(final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginCategoriesExecutor());
task.execute();
}
/**
* 根据条件获取在线插件
*
* @param info 插件信息
* @param callback 回调函数
*/
@JSBridge
public void getPluginFromStoreNew(String info, final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginFromStoreExecutor(new JSONObject(info)));
task.execute();
}
/**
* 已安装插件检查更新
*/
@JSBridge
public void readUpdateOnline(final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new ReadUpdateOnlineExecutor());
task.execute();
}
/**
* 获取已经安装的插件的数组
*/
@JSBridge
public void getInstalledPlugins(final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetInstalledPluginsExecutor());
task.execute();
}
/**
* 从插件服务器上更新选中的插件
*
* @param pluginIDs 插件集合
*/
@JSBridge
public void updatePluginOnline(Object pluginIDs, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
List<PluginMarker> pluginMarkerList = new ArrayList<>();
if (pluginIDs instanceof String) {
pluginMarkerList.add(PluginUtils.createPluginMarker(pluginIDs.toString()));
} else if (pluginIDs instanceof JSArray) {
JSArray pluginInfos = (JSArray) pluginIDs;
for (int i = 0, len = pluginInfos.length(); i < len; i++) {
String value = pluginInfos.get(i).asString().getValue();
pluginMarkerList.add(PluginUtils.createPluginMarker(value));
}
}
PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback);
}
/**
* 搜索在线插件
*
* @param keyword 关键字
*/
@JSBridge
public void searchPlugin(String keyword, final JSFunction callback) {
UpmTaskWorker<Void> worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new SearchOnlineExecutor(keyword));
worker.execute();
}
/**
* 从磁盘上选择插件安装包进行安装
*
* @param filePath 插件包的路径
*/
@JSBridge
public void installPluginFromDisk(final String filePath, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
File file = new File(filePath);
PluginOperateUtils.installPluginFromDisk(file, jsCallback);
}
/**
* 卸载当前选中的插件
*
* @param pluginInfo 插件信息
*/
@JSBridge
public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback);
}
/**
* 从插件服务器上安装插件
*
* @param pluginInfo 插件的ID
* @param callback 回调函数
*/
@JSBridge
public void installPluginOnline(final String pluginInfo, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback);
}
/**
* 从磁盘上选择插件安装包进行插件升级
*
* @param filePath 插件包的路径
*/
public void updatePluginFromDisk(String filePath, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
File file = new File(filePath);
PluginOperateUtils.updatePluginFromDisk(file, jsCallback);
}
/**
* 修改选中的插件的活跃状态
*
* @param pluginID 插件ID
*/
@JSBridge
public void setPluginActive(String pluginID, final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
PluginOperateUtils.setPluginActive(pluginID, jsCallback);
}
/**
* 选择文件对话框
*
* @return 选择的文件的路径
*/
@JSBridge
public String showFileChooser() {
return showFileChooserWithFilter(StringUtils.EMPTY, StringUtils.EMPTY);
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param filter 文件的后缀
* @return 选择的文件的路径
* 这里换用JFileChooser会卡死,不知道为什么
*/
@JSBridge
public String showFileChooserWithFilter(final String des, final String filter) {
RunnableFuture<String> future = new FutureTask<>(new Callable<String>() {
@Override
public String call() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (StringUtils.isNotEmpty(filter)) {
fileChooser.setFileFilter(new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filter)));
}
int result = fileChooser.showOpenDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile().getAbsolutePath();
}
return null;
}
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
/**
* 选择文件对话框
*
* @param des 过滤文件描述
* @param args 文件的后缀
* @return 选择的文件的路径
*/
@JSBridge
public String showFileChooserWithFilters(final String des, final Object args) {
RunnableFuture<String> future = new FutureTask<>(new Callable<String>() {
@Override
public String call() {
JFileChooser fileChooser = new JFileChooser();
List<String> filterList = new ArrayList<>();
if (args instanceof String) {
filterList.add(GeneralUtils.objectToString(args));
} else if (args instanceof JSArray) {
JSArray array = (JSArray)args;
for (int i = 0, len = array.length(); i < len; i ++) {
filterList.add(array.get(i).getStringValue());
}
}
String[] filters = filterList.toArray(new String[0]);
if (ArrayUtils.isNotEmpty(filters)) {
FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters));
fileChooser.setFileFilter(filter);
}
int result = fileChooser.showOpenDialog(UpmFinder.getDialog());
if (result == JFileChooser.APPROVE_OPTION) {
return fileChooser.getSelectedFile().getAbsolutePath();
}
return null;
}
});
SwingUtilities.invokeLater(future);
try {
return future.get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
////////登录相关///////
/**
* 获取系统登录的用户名
*/
@JSBridge
public String getLoginInfo(final JSFunction callback) {
registerLoginInfo(callback);
return MarketConfig.getInstance().getBbsUsername();
}
/**
* 系统登录注册
*
* @param callback 回调函数
*/
@JSBridge
public void registerLoginInfo(final JSFunction callback) {
JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback));
String username = MarketConfig.getInstance().getBbsUsername();
if (StringUtils.isEmpty(username)) {
jsCallback.execute(StringUtils.EMPTY);
EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY);
} else {
jsCallback.execute(username);
EventDispatcher.fire(CertificateEvent.LOGIN, username);
}
}
/**
* 设计器端的用户登录
*
* @param username 用户名
* @param password 密码
* @param callback 回调函数
*/
@JSBridge
public void defaultLogin(String username, String password, final JSFunction callback) {
UpmTaskWorker<Void> worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new PluginLoginExecutor(username, password));
worker.execute();
}
/**
* 清除用户信息
*/
public void clearUserInfo() {
MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY);
FinePassportManager.getInstance().logout();
EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY);
}
/**
* 打开论坛消息界面
*/
@JSBridge
public void getPriviteMessage() {
try {
String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default");
Desktop.getDesktop().browse(new URI(loginUrl));
} catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage());
}
}
/**
* 忘记密码
*/
@JSBridge
public void forgetHref() {
try {
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset")));
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
}
}

13
designer-base/src/main/java/com/fr/design/upm/UPM.java → designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -18,9 +18,10 @@ import java.io.File;
* @version 10.0 * @version 10.0
* Created by richie on 2019-04-12 * Created by richie on 2019-04-12
*/ */
public class UPM { public class UpmFinder {
private static final String MAIN_RESOURCE_PATH = "/upm/plugin.html"; private static final String UPM_DIR = "/upm";
private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html";
public static String installHome = FRContext.getCommonOperator().getWebRootPath(); public static String installHome = FRContext.getCommonOperator().getWebRootPath();
@ -45,10 +46,14 @@ public class UPM {
return "file:///" + StableUtils.pathJoin(installHome, MAIN_RESOURCE_PATH); return "file:///" + StableUtils.pathJoin(installHome, MAIN_RESOURCE_PATH);
} }
public static UIDialog getDialog() {
return dialog;
}
public static void showUPMDialog() { public static void showUPMDialog() {
UPMPane upmPane = new UPMPane(); UpmShowPane upmPane = new UpmShowPane();
if (dialog == null) { if (dialog == null) {
dialog = new UPMDialog(DesignerContext.getDesignerFrame(), upmPane); dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane);
} }
dialog.setVisible(true); dialog.setVisible(true);
} }

4
designer-base/src/main/java/com/fr/design/upm/UPMDialog.java → designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java

@ -13,11 +13,11 @@ import java.awt.*;
* @version 10.0 * @version 10.0
* Created by richie on 2019-04-12 * Created by richie on 2019-04-12
*/ */
public class UPMDialog extends UIDialog { public class UpmShowDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(900, 700); private static final Dimension DEFAULT_SHOP = new Dimension(900, 700);
public UPMDialog(Frame frame, BasicPane pane) { public UpmShowDialog(Frame frame, BasicPane pane) {
super(frame); super(frame);
setUndecorated(true); setUndecorated(true);
JPanel panel = (JPanel) getContentPane(); JPanel panel = (JPanel) getContentPane();

22
designer-base/src/main/java/com/fr/design/upm/UPMPane.java → designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -1,6 +1,5 @@
package com.fr.design.upm; package com.fr.design.upm;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.design.upm.event.DownloadEvent; import com.fr.design.upm.event.DownloadEvent;
@ -19,7 +18,7 @@ import java.awt.*;
* Created by richie on 2019-04-12 * Created by richie on 2019-04-12
* Update Plugin Manager容器 * Update Plugin Manager容器
*/ */
public class UPMPane extends BasicPane { public class UpmShowPane extends BasicPane {
private ModernUIPane<Object> modernUIPane; private ModernUIPane<Object> modernUIPane;
@ -28,11 +27,18 @@ public class UPMPane extends BasicPane {
return "UPM"; return "UPM";
} }
public UPMPane() { public UpmShowPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
if (false) { if (UpmFinder.checkUPMResourcesExist()) {
modernUIPane = new ModernUIPane.Builder<>() modernUIPane = new ModernUIPane.Builder<>()
.withURL(UPM.getMainResourcePath()) .prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
}
})
.withURL(UpmFinder.getMainResourcePath())
.build(); .build();
} else { } else {
modernUIPane = new ModernUIPane.Builder<>() modernUIPane = new ModernUIPane.Builder<>()
@ -41,13 +47,13 @@ public class UPMPane extends BasicPane {
@Override @Override
public void onScriptContextCreated(ScriptContextEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("PluginBridgeTest", UPMBridge.getBridge()); window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
} }
}).build(); }).build();
EventDispatcher.listen(DownloadEvent.FINISH, new Listener<String>() { EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override @Override
public void on(Event event, String param) { public void on(Event event, String param) {
modernUIPane.redirect(UPM.getMainResourcePath()); modernUIPane.redirect(UpmFinder.getMainResourcePath());
} }
}); });
} }

21
designer-base/src/main/java/com/fr/design/upm/UpmUtils.java

@ -0,0 +1,21 @@
package com.fr.design.upm;
import java.util.ArrayList;
import java.util.List;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class UpmUtils {
public static String[] findMatchedExtension(String... extensions) {
List<String> list = new ArrayList<>();
for (String ext : extensions) {
String[] arr = ext.split("\\.");
list.add(arr[arr.length - 1]);
}
return list.toArray(new String[0]);
}
}

12
designer-base/src/main/java/com/fr/design/upm/event/CertificateEvent.java

@ -0,0 +1,12 @@
package com.fr.design.upm.event;
import com.fr.event.Event;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public enum CertificateEvent implements Event<String> {
LOGIN,LOGOUT
}

2
designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java

@ -9,5 +9,5 @@ import com.fr.event.Event;
*/ */
public enum DownloadEvent implements Event<String> { public enum DownloadEvent implements Event<String> {
FINISH SUCCESS, ERROR
} }

30
designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java

@ -0,0 +1,30 @@
package com.fr.design.upm.exec;
import com.fr.design.bridge.exec.JSExecutor;
import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class UpmBrowserExecutor implements JSExecutor {
public static UpmBrowserExecutor create(JSObject window, JSFunction callback) {
return new UpmBrowserExecutor(window, callback);
}
private JSObject window;
private JSFunction callback;
private UpmBrowserExecutor(JSObject window, JSFunction callback) {
this.window = window;
this.callback = callback;
}
@Override
public void executor(String newValue) {
callback.invoke(window, newValue);
}
}

27
designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java

@ -0,0 +1,27 @@
package com.fr.design.upm.loader;
import com.fr.decision.webservice.bean.plugin.store.ProjectInfoBean;
import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-18
*/
public class UpmDesignResourceLoader extends BaseResourceLoader {
@Override
public String getPluginPath() {
return "upm/plugin_design.html";
}
@Override
public void checkResourceExist(ProjectInfoBean projectInfoBean) throws Exception {
}
@Override
public String getDownloadPath() throws Exception {
return "http://fanruan-market.oss-cn-shanghai.aliyuncs.com/upm/1.0/upm-10.0.zip";
}
}

52
designer-base/src/main/java/com/fr/design/upm/task/UpmTaskWorker.java

@ -0,0 +1,52 @@
package com.fr.design.upm.task;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.bridge.exec.JSUtils;
import com.fr.design.extra.Process;
import com.fr.design.extra.exe.Command;
import com.fr.design.extra.exe.Executor;
import com.fr.stable.StringUtils;
import javax.swing.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-17
*/
public class UpmTaskWorker<V> extends SwingWorker<V, String> {
private Executor executor;
private JSCallback callback;
public UpmTaskWorker(final JSCallback callback, final Executor executor) {
this.executor = executor;
this.callback = callback;
}
@Override
protected V doInBackground() throws Exception {
Command[] commands = executor.getCommands();
for (Command command : commands) {
String message = command.getExecuteMessage();
if (StringUtils.isNotBlank(message)) {
publish(message);
}
command.run(new Process<String>() {
@Override
public void process(String s) {
if (StringUtils.isNotBlank(s)) {
publish(JSUtils.trimText(s));
}
}
});
}
return null;
}
@Override
protected void done() {
String result = executor.getTaskFinishMessage();
callback.execute(result);
}
}

14
designer-base/src/main/java/com/fr/start/OemHandler.java

@ -0,0 +1,14 @@
package com.fr.start;
import com.fr.design.fun.OemProcessor;
import com.fr.stable.bridge.StableFactory;
/**
* OEM处理中心
*/
public class OemHandler {
public static OemProcessor findOem() {
return StableFactory.getMarkedInstanceObjectFromClass(OemProcessor.MARK_STRING, OemProcessor.class);
}
}

63
designer-base/src/main/resources/com/fr/design/upm/warn.js

@ -1,20 +1,61 @@
window.onload = function () { window.onload = function () {
let button = BI.createWidget({ let label = BI.createWidget({
type : "bi.button", type: "bi.label",
text : "点击我跳转到插件商店", text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"),
height: 30
});
let callback = function(text) {
download.setValue(text);
};
let buttonOK = BI.createWidget({
type: "bi.button",
text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download"),
level: 'common', level: 'common',
height: 30, height: 30,
handler : function () { handler: function () {
PluginBridgeTest.startDownload(); PluginHelper.startDownload(callback);
}
});
let buttonClose = BI.createWidget({
type: "bi.button",
text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Close"),
level: 'warning',
height: 30,
handler: function () {
PluginHelper.closeWindow();
} }
}); });
let download = BI.createWidget({
type: "bi.label",
height: 30
});
let left = 300;
let top = 200;
BI.createWidget({ BI.createWidget({
type:"bi.absolute", type: "bi.absolute",
element: "body", element: "body",
items: [{ items: [
el: button, {
left: 100, el: label,
top: 100 left: left,
}] top: top
},
{
el : buttonOK,
left : left,
top : top + 40
},
{
el : buttonClose,
left : left + 100,
top : top + 40
},
{
el : download,
left : left,
top : top + 80
}
]
}); });
}; };

7
designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java

@ -11,6 +11,7 @@ import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -138,4 +139,10 @@ public class ExtendedOtherPane<T extends AbstractChart> extends AbstractChartAtt
return PaneTitleConstants.CHART_OTHER_TITLE; return PaneTitleConstants.CHART_OTHER_TITLE;
} }
@Override
protected void initContentPane() {
leftContentPane = createContentPane();
leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 3, 0, 10, original));
this.add(leftContentPane, BorderLayout.CENTER);
}
} }

16
designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -16,8 +16,12 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
@ -208,6 +212,18 @@ public class UserInfoLabel extends UILabel {
updateInfoPane(); updateInfoPane();
} }
}); });
EventDispatcher.listen(CertificateEvent.LOGIN, new Listener<String>() {
@Override
public void on(Event event, String text) {
setText(text);
}
});
EventDispatcher.listen(CertificateEvent.LOGOUT, new Listener<String>() {
@Override
public void on(Event event, String text) {
setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn"));
}
});
} }
private void clearLoginInformation() { private void clearLoginInformation() {

16
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -2,6 +2,7 @@ package com.fr.start.module;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper; import com.fr.design.RestartHelper;
import com.fr.design.fun.OemProcessor;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort; import com.fr.design.utils.DesignerPort;
@ -14,6 +15,7 @@ import com.fr.stable.BuildContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.start.OemHandler;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy; import com.fr.start.SplashStrategy;
import com.fr.start.fx.SplashFx; import com.fr.start.fx.SplashFx;
@ -123,7 +125,19 @@ public class PreStartActivator extends Activator {
service.shutdown(); service.shutdown();
} }
private static SplashStrategy createSplash() { private SplashStrategy createSplash() {
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
SplashStrategy splashStrategy = null;
try {
splashStrategy = oemProcessor.createSplashStrategy();
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (splashStrategy != null) {
return splashStrategy;
}
}
// 这里可以开接口加载自定义启动画面 // 这里可以开接口加载自定义启动画面
if (OperatingSystem.isWindows()) { if (OperatingSystem.isWindows()) {
return new SplashFx(); return new SplashFx();

Loading…
Cancel
Save