Browse Source

Merge branch 'release/10.0' of https://cloud.finedevelop.com/scm/~hades/design into release/10.0

bugfix/10.0
Hades 6 years ago
parent
commit
cebf941395
  1. 23
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  3. 39
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java
  4. 32
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  5. 36
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java
  6. 39
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java
  7. 34
      designer-base/src/main/java/com/fr/design/dcm/UniversalDcmBridge.java
  8. 45
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  9. 82
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java
  10. 18
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  11. 43
      designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java
  12. 19
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  13. 70
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  14. 10
      designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java
  15. 23
      designer-base/src/main/java/com/fr/design/upm/UpmUtils.java
  16. 2
      designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java
  17. 27
      designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java
  18. 2
      designer-base/src/main/resources/com/fr/design/dcm/index.js
  19. 276
      designer-base/src/main/resources/com/fr/design/dcm/style.css
  20. 2
      designer-base/src/main/resources/com/fr/design/upm/warn.js
  21. 4
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/AbstractSendDataToCloud.java
  22. 3
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/FocusPointMessageUploader.java
  23. 4
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
  24. 2
      designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

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

@ -138,6 +138,7 @@ public class PreferencePane extends BasicPane {
private UISpinner cachingTemplateSpinner;
private UICheckBox openDebugComboBox;
private UICheckBox useOptimizedUPMCheckbox;
private UICheckBox useUniverseDBMCheckbox;
private UICheckBox joinProductImproveCheckBox;
private UICheckBox autoPushUpdateCheckBox;
@ -186,17 +187,22 @@ public class PreferencePane extends BasicPane {
JPanel oraclePane = FRGUIPaneFactory.createTitledBorderPane("Oracle" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Oracle_All_Tables"));
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
//
// JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
// openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
// debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
// advancePane.add(debuggerPane);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
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 dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
@ -636,9 +642,11 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
// openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
this.joinProductImproveCheckBox.setSelected(designerEnvManager.isJoinProductImprove());
@ -702,7 +710,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
// designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
@ -737,6 +745,7 @@ public class PreferencePane extends BasicPane {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
}
@Override

10
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,6 +1,7 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
@ -12,6 +13,7 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
@ -58,6 +60,14 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}
private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {

39
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseComponent.java

@ -0,0 +1,39 @@
package com.fr.design.dcm;
import com.fr.web.struct.AssembleComponent;
import com.fr.web.struct.Atom;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.fr.web.struct.impl.FineUI;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabaseComponent extends AssembleComponent {
public static final UniversalDatabaseComponent KEY = new UniversalDatabaseComponent();
private UniversalDatabaseComponent() {
}
@Override
public ScriptPath script(RequestClient req) {
return ScriptPath.build("/com/fr/design/dcm/index.js");
}
@Override
public StylePath style(RequestClient req) {
return StylePath.build("/com/fr/design/dcm/style.css");
}
@Override
public Atom[] refer() {
return new Atom[]{
FineUI.KEY
};
}
}

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

@ -0,0 +1,32 @@
package com.fr.design.dcm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabaseDialog extends UIDialog {
public UniversalDatabaseDialog(Frame frame, BasicPane pane) {
super(frame);
setUndecorated(true);
JPanel panel = (JPanel) getContentPane();
panel.setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
setSize(new Dimension(1000, 600));
GUICoreUtils.centerWindow(this);
setResizable(false);
}
@Override
public void checkValid() throws Exception {
}
}

36
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseOpener.java

@ -0,0 +1,36 @@
package com.fr.design.dcm;
import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
import javax.swing.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabaseOpener {
private static UIDialog dialog = null;
public static UIDialog getDialog() {
return dialog;
}
public static void showUniverseDatabaseDialog() {
UniversalDatabasePane upmPane = new UniversalDatabasePane();
if (dialog == null) {
dialog = new UniversalDatabaseDialog(DesignerContext.getDesignerFrame(), upmPane);
}
dialog.setVisible(true);
}
public static void closeWindow() {
if (dialog != null) {
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(false);
dialog = null;
}
}
}

39
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabasePane.java

@ -0,0 +1,39 @@
package com.fr.design.dcm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-16
*/
public class UniversalDatabasePane extends BasicPane {
private ModernUIPane<Object> modernUIPane;
@Override
protected String title4PopupWindow() {
return "Database";
}
public UniversalDatabasePane() {
setLayout(new BorderLayout());
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(UniversalDatabaseComponent.KEY)
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("DcmHelper", UniversalDcmBridge.getBridge(event.getBrowser()));
}
})
.build();
add(modernUIPane, BorderLayout.CENTER);
}
}

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

@ -0,0 +1,34 @@
package com.fr.design.dcm;
import com.fr.decision.webservice.bean.BaseBean;
import com.fr.design.bridge.exec.JSBridge;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSObject;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-05-17
* 桥接Java和JavaScript的类
*/
public class UniversalDcmBridge {
public static UniversalDcmBridge getBridge(Browser browser) {
return new UniversalDcmBridge(browser);
}
private JSObject window;
private UniversalDcmBridge(Browser browser) {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
}
/**
* 获取所有的数据连接
* @return 数据连接集合
*/
@JSBridge
public BaseBean getConnections() {
return null;
}
}

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

@ -44,14 +44,6 @@ public class DesignerLogHandler {
private static final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final int INFO_INT = Level.INFO.toInt();
private static final int ERROR_INT = Level.ERROR.toInt();
private static final int WARN_INT = Level.WARN.toInt();
private static final int DEBUG_INT = Level.DEBUG.toInt();
private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60;
@ -127,12 +119,12 @@ public class DesignerLogHandler {
JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt();
if (logLevelInt <= INFO_INT) {
if (logLevelInt <= DesignerLogger.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) {
} else if (logLevelInt == DesignerLogger.ERROR_INT) {
jPopupMenu.add(showError);
jPopupMenu.add(showServer);
jPopupMenu.show(caption, caption.getWidth() + GAP_X, ERRO_GAP_Y);
@ -241,11 +233,11 @@ public class DesignerLogHandler {
int intLevel = event.getLevel().toInt();
Date date = new Date(event.getTimeStamp());
ThrowableInformation information = event.getThrowableInformation();
if (intLevel == INFO_INT && showInfo.isSelected()) {
if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
} else if (intLevel == ERROR_INT && showError.isSelected()) {
} else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
} else if (intLevel == WARN_INT && showServer.isSelected()) {
} else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
}
}
@ -253,11 +245,11 @@ public class DesignerLogHandler {
public void printStackTrace(String message, Level level, Date date) {
int intLevel = level.toInt();
if (intLevel == INFO_INT && showInfo.isSelected()) {
if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(message, intLevel, date);
} else if (intLevel == ERROR_INT && showError.isSelected()) {
} else if (intLevel == DesignerLogger.ERROR_INT && showError.isSelected()) {
printMessage(message, intLevel, date);
} else if (intLevel == WARN_INT && showServer.isSelected()) {
} else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(message, intLevel, date);
}
@ -287,13 +279,13 @@ public class DesignerLogHandler {
private void log(String str, int style) {
SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == ERROR_INT) {
if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true);
} else if (style == WARN_INT) {
} else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setBold(attrSet, true);
} else if (style == INFO_INT) {
} else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black);
StyleConstants.setBold(attrSet, false);
} else {
@ -310,9 +302,9 @@ public class DesignerLogHandler {
private String appendLocaleMark(String str, int style) {
if (style == ERROR_INT) {
if (style == DesignerLogger.ERROR_INT) {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":" + str + "\n";
} else if (style == WARN_INT) {
} else if (style == DesignerLogger.WARN_INT) {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":" + str + "\n";
} else {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":" + str + "\n";
@ -323,11 +315,11 @@ public class DesignerLogHandler {
private void setMessage(String message, int level) {
LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogHandler.INFO_INT && showInfo.isSelected()) {
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd();
} else if (level == DesignerLogHandler.ERROR_INT && showError.isSelected()) {
} else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) {
caption.errorAdd();
} else if (level == DesignerLogHandler.WARN_INT && showServer.isSelected()) {
} else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) {
caption.serverAdd();
}
}
@ -368,9 +360,4 @@ public class DesignerLogHandler {
};
}
public void printLoggingEvent(LoggingEvent event) {
logHandlerArea.printStackTrace(event);
}
}

82
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogger.java

@ -0,0 +1,82 @@
package com.fr.design.mainframe.loghandler;
import com.fr.log.FineLoggerFactory;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation;
/**
* 设计器日志记录
*/
public class DesignerLogger {
public static final int INFO_INT = Level.INFO.toInt();
public static final int ERROR_INT = Level.ERROR.toInt();
public static final int WARN_INT = Level.WARN.toInt();
/**
* 记录LoggingEvent对象
*
* @param event
*/
public static void log(LoggingEvent event) {
if (event == null) {
return;
}
LogParser.parse(event).log(event);
}
public enum LogParser {
DEFAULT(-1) {
@Override
public void log(LoggingEvent event) {
}
},
INFO(Level.INFO.toInt()) {
@Override
public void log(LoggingEvent event) {
FineLoggerFactory.getLogger().info(event.getRenderedMessage());
}
},
WARN(Level.WARN.toInt()) {
@Override
public void log(LoggingEvent event) {
ThrowableInformation information = event.getThrowableInformation();
FineLoggerFactory.getLogger().warn(event.getRenderedMessage(), information == null ? null : information.getThrowable());
}
},
ERROR(Level.ERROR.toInt()) {
@Override
public void log(LoggingEvent event) {
ThrowableInformation information = event.getThrowableInformation();
FineLoggerFactory.getLogger().error(event.getRenderedMessage(), information == null ? null : information.getThrowable());
}
};
private int level;
LogParser(int level) {
this.level = level;
}
public int getLevel() {
return level;
}
public static LogParser parse(LoggingEvent event) {
int intLevel = event.getLevel().toInt();
for (LogParser logParser : values()) {
if (logParser.getLevel() == intLevel) {
return logParser;
}
}
return DEFAULT;
}
public void log(LoggingEvent event) {
}
}
}

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

@ -6,8 +6,14 @@ import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse;
import javax.activation.MimetypesFileTypeMap;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* @author richie
@ -41,7 +47,15 @@ public class Assistant {
if (path.endsWith(".js")) {
return "text/javascript";
}
return "text/html";
if (path.endsWith(".svg")) {
return "image/svg+xml";
}
Path file = new File(path).toPath();
try {
return Files.probeContentType(file);
} catch (IOException e) {
return "text/html";
}
}
public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) {
@ -49,6 +63,6 @@ public class Assistant {
ProtocolService protocolService = browserContext.getProtocolService();
// 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png
protocolService.setProtocolHandler("emb", handler);
//protocolService.setProtocolHandler("file", handler);
protocolService.setProtocolHandler("file", handler);
}
}

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

@ -2,6 +2,8 @@ package com.fr.design.ui;
import com.fr.base.TemplateUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.codec.net.URLCodec;
import com.fr.third.org.apache.commons.io.FileUtils;
@ -15,11 +17,14 @@ import com.teamdev.jxbrowser.chromium.ProtocolHandler;
import com.teamdev.jxbrowser.chromium.URLRequest;
import com.teamdev.jxbrowser.chromium.URLResponse;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Map;
/**
@ -51,21 +56,20 @@ public class EmbProtocolHandler implements ProtocolHandler {
@Override
public URLResponse onRequest(URLRequest req) {
InputStream inputStream = null;
try {
String path = req.getURL();
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")) {
inputStream = IOUtils.readResource(file.getAbsolutePath());
String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
text = TemplateUtils.renderParameter4Tpl(text, map);
return Assistant.inputStream2Response(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), path);
} else if (path.startsWith("emb:dynamic")) {
URLResponse response = new URLResponse();
response.setData(htmlText().getBytes());
response.setData(htmlText(map).getBytes());
response.getHeaders().setHeader("Content-Type", "text/html");
return response;
} else {
@ -75,16 +79,24 @@ public class EmbProtocolHandler implements ProtocolHandler {
} else {
path = path.substring(4);
}
InputStream inputStream = IOUtils.readResource(path);
inputStream = IOUtils.readResource(path);
return Assistant.inputStream2Response(inputStream, path);
}
} catch (Exception ignore) {
ignore.printStackTrace();
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
return null;
}
private String htmlText() {
private String htmlText(Map<String, String> map) {
PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component);
StylePath[] stylePaths = pathGroup.toStylePathGroup();
StringBuilder styleText = new StringBuilder();
@ -106,6 +118,13 @@ public class EmbProtocolHandler implements ProtocolHandler {
}
}
result = result.replaceAll("##script##", scriptText.toString());
if (map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
result = result.replaceAll("\\$\\{" + key + "}", value);
}
}
return result;
}
}

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

@ -52,6 +52,8 @@ public class ModernUIPane<T> extends BasicPane {
toolbar.add(openDebugButton);
UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload"));
toolbar.add(reloadButton);
UIButton closeButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Close_Window"));
toolbar.add(closeButton);
openDebugButton.addActionListener(new ActionListener() {
@Override
@ -66,6 +68,13 @@ public class ModernUIPane<T> extends BasicPane {
browser.reloadIgnoringCache();
}
});
closeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false);
}
});
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER);
@ -107,6 +116,16 @@ public class ModernUIPane<T> extends BasicPane {
browser.loadURL(url);
}
/**
* 转向一个新的地址相当于重新加载
* @param url 新的地址
* @param map 初始化参数
*/
public void redirect(String url, Map<String, String> map) {
Assistant.setEmbProtocolHandler(browser, new EmbProtocolHandler(map));
browser.loadURL(url);
}
@Override
protected String title4PopupWindow() {
return "Modern";

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

@ -2,6 +2,7 @@ package com.fr.design.upm;
import com.fr.base.passport.FinePassportManager;
import com.fr.config.MarketConfig;
import com.fr.config.ServerPreferenceConfig;
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;
@ -10,6 +11,7 @@ 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.GetPluginPrefixExecutor;
import com.fr.design.extra.exe.PluginLoginExecutor;
import com.fr.design.extra.exe.ReadUpdateOnlineExecutor;
import com.fr.design.extra.exe.SearchOnlineExecutor;
@ -60,12 +62,34 @@ public class UpmBridge {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
}
public void startDownload(final JSFunction callback) {
/**
* 更新插件管理中心资源文件这个方法仅仅是为了语义上的作用更新
* @param callback 安装完成后的回调函数
*/
@JSBridge
public void update(final JSFunction callback) {
callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
try {
UpmResourceLoader.INSTANCE.download();
UpmResourceLoader.INSTANCE.install();
callback.invoke(window, "success", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
EventDispatcher.fire(DownloadEvent.UPDATE, "success");
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
}
}
/**
* 下载并安装插件管理中心的资源文件
* @param callback 安装完成后的回调函数
*/
@JSBridge
public void startDownload(final JSFunction callback) {
callback.invoke(window, "start", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start"));
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;
@ -75,10 +99,10 @@ public class UpmBridge {
protected void done() {
try {
get();
callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success"));
callback.invoke(window, "success", 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"));
callback.invoke(window, "error", Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error"));
FineLoggerFactory.getLogger().error(e.getMessage(), e);
EventDispatcher.fire(DownloadEvent.ERROR, "error");
}
@ -86,6 +110,15 @@ public class UpmBridge {
}.execute();
}
/**
* 获取upm的版本信息
* @return 版本信息
*/
@JSBridge
public String getVersion() {
return ServerPreferenceConfig.getInstance().getOptimizedUPMVersion();
}
@JSBridge
public String i18nText(String key) {
return Toolkit.i18nText(key);
@ -107,6 +140,12 @@ public class UpmBridge {
callback.invoke(window, StringUtils.EMPTY);
}
@JSBridge
public void getPluginPrefix(final JSFunction callback) {
UpmTaskWorker<Void> task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginPrefixExecutor());
task.execute();
}
/**
* 在线获取插件分类
*
@ -403,4 +442,27 @@ public class UpmBridge {
FineLoggerFactory.getLogger().info(e.getMessage());
}
}
/**
* 使用系统浏览器打开网页
* @param url 要打开的网页
*/
@JSBridge
public void openShopUrlAtWebBrowser(String url) {
if (Desktop.isDesktopSupported()) {
try {
//创建一个URI实例,注意不是URL
URI uri = URI.create(url);
//获取当前系统桌面扩展
Desktop desktop = Desktop.getDesktop();
//判断系统桌面是否支持要执行的功能
if (desktop.isSupported(Desktop.Action.BROWSE)) {
//获取系统默认浏览器打开链接
desktop.browse(uri);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}

10
designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java

@ -38,8 +38,14 @@ public class UpmShowPane extends BasicPane {
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
}
})
.withURL(UpmFinder.getMainResourcePath())
.withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap())
.build();
EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() {
@Override
public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
}
});
} else {
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(WarnComponent.KEY)
@ -53,7 +59,7 @@ public class UpmShowPane extends BasicPane {
EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override
public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath());
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap());
}
});
}

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

@ -1,7 +1,14 @@
package com.fr.design.upm;
import com.fr.common.annotations.Negative;
import com.fr.config.ServerPreferenceConfig;
import com.fr.general.CloudCenter;
import com.fr.stable.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author richie
@ -18,4 +25,20 @@ public class UpmUtils {
}
return list.toArray(new String[0]);
}
@Negative(until = "2019-08-30")
public static Map<String, String> renderMap() {
Map<String, String> map4Tpl = new HashMap<>();
map4Tpl.put("version", ServerPreferenceConfig.getInstance().getOptimizedUPMVersion());
map4Tpl.put("new_version", fetchLatestVersion());
return map4Tpl;
}
private static String fetchLatestVersion() {
String version = CloudCenter.getInstance().acquireUrlByKind("upm.script.version");
if (StringUtils.isBlank(version)) {
version = "1.0";
}
return version;
}
}

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> {
SUCCESS, ERROR
SUCCESS, ERROR, UPDATE
}

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

@ -1,27 +0,0 @@
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";
}
}

2
designer-base/src/main/resources/com/fr/design/dcm/index.js

File diff suppressed because one or more lines are too long

276
designer-base/src/main/resources/com/fr/design/dcm/style.css

@ -0,0 +1,276 @@
.bi-plugin-redis {
padding: 20px; }
.database-connection-layout {
width: 100%;
height: 100%;
background-color: #f7f8fa; }
.database-connection-layout .title {
background-color: #fff;
border-bottom: 1px solid #e8eaed; }
.database-connection-layout .title .title-item {
height: 39px;
line-height: 39px;
padding-left: 15px;
padding-right: 15px;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
flex-shrink: 0;
font-weight: 700;
cursor: pointer; }
.database-connection-layout .title .close-button {
position: absolute !important;
right: 5px;
top: 5px;
width: 30px;
height: 30px;
cursor: pointer;
background-image: url(./img/icon_close9x9_normal.png);
background-repeat: no-repeat;
background-position: center; }
.database-connection-layout .linkset {
margin: 10px;
bottom: 0px;
background-color: #ffffff; }
.database-connection-layout .linkStatus {
margin: 10px;
top: 40px;
background-color: #ffffff; }
.database-left {
border-right: 1px solid #e8eaed; }
.database-left .select-group {
border-bottom: 1px solid #e8eaed; }
.database-left .select-group .select {
margin: 10px; }
.database-left .select-group .select .database-link-items {
padding-left: 10px; }
.database-left .select-group .select .database-link-items .link-item {
border-top: 1px solid #e8eaed; }
.database-left .select-group .status-title {
font-weight: 700;
margin-left: 12px;
margin-top: 12px; }
.database-left .left-list {
margin: 10px; }
.database-left .left-list .left-item {
height: 24px;
line-height: 24px;
cursor: pointer; }
.database-left .left-list .left-item:hover {
background-color: rgba(54, 133, 242, 0.05); }
.database-left .left-list .left-item:hover .icons .action-icon {
visibility: visible !important; }
.database-left .left-list .left-item .icons {
float: right !important; }
.database-left .left-list .left-item .icons .action-icon {
visibility: hidden; }
.database-left .left-list .left-item .icons .b-font {
font-size: 16px; }
.database-left .left-list .left-item-selected {
background-color: rgba(54, 133, 242, 0.05); }
.database-left .left-list .left-item-selected .link-title {
color: #3685f2; }
.database-right {
min-width: 400px;
overflow: auto; }
.database-right .bi-flex-center-adapt-layout {
height: 100%; }
.database-right .bi-flex-center-adapt-layout .data-connection-background {
background: url(./img/resources.png) center center no-repeat;
background-size: contain; }
.database-right .right-status-title {
border-bottom: 1px solid #e8eaed;
color: #3d4d66;
line-height: 40px;
padding-left: 10px;
font-weight: 700; }
.database-right .right-status-body {
margin: 10px 30px 0px 30px;
height: 50%; }
.database-right .right-status-body .right-status-item {
height: 150px;
width: 50%;
top: 0;
left: 0;
position: absolute !important; }
.database-right .right-status-body .right-status-item .right-status-board {
margin-left: 25px;
position: relative !important;
left: -25px; }
.database-right .right-status-body .right-status-right {
height: 150px;
width: 50%;
top: 0;
right: 0;
position: absolute !important; }
.database-right .right-status-body .right-status-right .right-status-board {
margin-right: 25px;
position: relative !important;
left: 25px; }
.database-right .right-status-body .right-status-board {
background-color: #f7f8fa;
color: #3d4d66;
width: 100%;
height: 100%; }
.database-right .right-status-body .right-status-board .right-status-board-item {
text-align: center;
margin-top: 38px; }
.database-right .right-status-body .right-status-board .right-status-board-item .right-status-text {
display: inline-block; }
.database-right .right-status-body .right-status-board .right-status-board-item .card-font1 {
color: #13CD66;
font-size: 32px; }
.database-right .right-status-body .right-status-board .right-status-board-item .card-font2 {
color: #3685F2;
font-size: 32px; }
.database-right .right-content {
height: 100%; }
.database-right .right-content .right-title {
border-bottom: 1px solid #e8eaed;
color: #3d4d66;
line-height: 40px;
padding-left: 10px; }
.database-right .right-content .right-title .right-title-text {
font-weight: 700; }
.database-right .right-content .right-title .right-title-button {
float: right !important;
margin-right: 10px;
margin-top: 8px; }
.database-right .right-content .right-show {
margin: 10px; }
.database-right .right-content .right-show .right-form {
width: 100%; }
.both-side {
line-height: 24px;
margin-bottom: 10px; }
.both-side .left {
white-space: nowrap;
text-overflow: ellipsis;
position: relative;
flex-shrink: 0;
font-weight: 700; }
.both-side .hint {
padding-left: 5px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
position: relative;
flex-shrink: 0;
margin-left: 5px;
color: #9ea6b2; }
.shared-component-title {
height: 24px;
line-height: 24px;
margin-bottom: 10px;
color: #9ea6b2;
border-bottom: 1px solid #e8eaed; }
.comfirm-content {
margin-top: 40px;
margin-left: 20px; }
.comfirm-content .comfirm-icon {
background-image: url(./img/warning.png);
background-size: contain;
margin-right: 12px; }
.comfirm-content .bi-text {
height: 50px;
line-height: 50px;
margin-left: 12px; }
.more-link .more-link-item {
width: 538px;
overflow: hidden auto;
left: -10px !important;
right: 0px;
top: 10px;
bottom: 0px;
position: absolute;
height: 380px; }
.more-link .more-link-item .link-item {
margin-left: 10px;
margin-bottom: 10px;
cursor: pointer;
border: solid 1px #fff; }
.more-link .more-link-item .link-item:hover {
border: solid 1px #3480f2; }
.more-link .more-link-item .link-item .selected {
position: absolute !important;
right: -1px;
top: -1px;
height: 30px;
width: 30px;
background: url(./img/database-selected.png) center center no-repeat;
background-size: contain; }
.more-link .more-link-item .link-item .text {
height: 27px;
line-height: 27px;
padding-left: 2px;
padding-right: 2px;
text-align: center;
white-space: nowrap;
background: #F0F3F7; }
.popover-notitle .bi-header-background {
display: none; }
.popover-notitle .bi-absolute-layout {
top: 0px !important; }
.bi-custom-show .show-content {
text-align: center; }
.bi-custom-show .show-content .loading-icon {
display: block;
background: url(./img/loading.gif) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .success-icon {
display: block;
background: url(./img/success.png) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .error-icon {
display: block;
background: url(./img/error.png) center center no-repeat;
background-size: contain;
margin: 0 auto;
margin-bottom: 18px; }
.bi-custom-show .show-content .buttons {
margin-top: 18px; }
.bi-custom-show .show-content .buttons div {
margin: 0 4px; }
.bi-custom-show .show-more {
text-align: left !important;
height: 73px;
background: #F2F4F7;
margin-bottom: 10px;
padding: 5px;
margin-top: 10px; }
.link-font .b-font:before {
content: "\e759";
color: inherit; }
.link-text-font .b-font:before {
content: "\e763";
color: inherit; }
.info-font .b-font:before {
content: "\e63c";
color: inherit; }
.delete-font .b-font:before {
content: "\e6c4";
color: inherit; }
/*# sourceMappingURL=style.css.map*/

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

@ -4,7 +4,7 @@ window.onload = function () {
text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"),
height: 30
});
let callback = function(text) {
let callback = function(status, text) {
download.setValue(text);
};
let buttonOK = BI.createWidget({

4
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/AbstractSendDataToCloud.java

@ -98,9 +98,11 @@ public abstract class AbstractSendDataToCloud implements XMLable {
}
private <T> void generateThisPageFile(DataList<T> points) {
File file = null;
try {
JSONArray jsonArray = dealWithSendFunctionContent(points);
if (jsonArray == null) {
return;
}
//生成json文件
fileEntityBuilder.generateFile(jsonArray, getFileEntityBuilder().getFolderName());
} catch (Exception e) {

3
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/impl/FocusPointMessageUploader.java

@ -38,6 +38,9 @@ public class FocusPointMessageUploader extends AbstractSendDataToCloud {
@Override
public <T> JSONArray dealWithSendFunctionContent(DataList<T> focusPoints) {
if (focusPoints == null) {
return null;
}
JSONArray ja = new JSONArray();
for(T t:focusPoints.getList()){
FocusPoint focusPoint = (FocusPoint)t;

4
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -5,7 +5,7 @@ import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.design.mainframe.loghandler.DesignerLogger;
import com.fr.event.EventDispatcher;
import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
@ -46,7 +46,7 @@ public class DesignerSocketIO {
if (ArrayUtils.isNotEmpty(objects)) {
try {
LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]);
DesignerLogHandler.getInstance().printLoggingEvent(event);
DesignerLogger.log(event);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

2
designer-realize/src/main/java/com/fr/design/widget/ui/ParameterTreeComboBox.java

@ -161,7 +161,7 @@ public class ParameterTreeComboBox extends FRTreeComboBox {
// 全局数据源参数
parameters = new Parameter[0];
Calculator c = Calculator.createCalculator();
TableDataConfig tableDataConfig = TableDataConfig.getInstance();
TableDataConfig tableDataConfig = TableDataConfig.getInstance().mirror();
Iterator<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator();
while (nameIt.hasNext()) {
TableData tableData = tableDataConfig.getTableData(nameIt.next());

Loading…
Cancel
Save