Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
xiqiu 3 years ago
parent
commit
a36c9f80cb
  1. 4
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  2. 22
      designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java
  3. 29
      designer-realize/src/main/java/com/fr/design/deeplink/FileOpen4MacDeepLink.java
  4. 1
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

4
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -108,7 +108,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
private static final String DOCUMENT_SEARCH_URL = CloudCenter.getInstance().acquireUrlByKind("af.doc_search");
private static final String DOCUMENT_SEARCH_URL = "https://help.fanruan.com/finereport/api-helpdoc-title-";
private String currentValue;
@ -352,7 +352,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void doHelpDocumentSearch() {
Object value = interfaceNameList.getSelectedValue();
if (value != null) {
String url = DOCUMENT_SEARCH_URL + value.toString();
String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString();
try {
String result = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(result);

22
designer-realize/src/main/java/com/fr/design/deeplink/DeepLinkManager.java

@ -9,16 +9,19 @@ import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.org.apache.http.NameValuePair;
import com.fr.web.URLUtils;
import javax.swing.SwingUtilities;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -49,6 +52,7 @@ public class DeepLinkManager {
}
public void prepare() {
register(new FileOpen4MacDeepLink());
register(new TemplateThemeInstallationDeepLink());
FineStartupNotificationFactory.getNotification()
@ -115,7 +119,7 @@ public class DeepLinkManager {
FineLoggerFactory.getLogger().info("consume deep link: " + this.pendingURL);
performDeepLinks(this.pendingURL, host, path, params);
this.pendingURL = null;
markPendingURLConsumed();
}
private void performDeepLinks(String url, String host, String path, Map<String, Object> params) {
@ -130,4 +134,20 @@ public class DeepLinkManager {
}
});
}
public String[] createNewArgs(String[] args) {
String filePath = this.pendingURL;
if (OperatingSystem.isMacos() && StringUtils.isNotEmpty(filePath) && new File(filePath).exists()) {
List<String> argList = Arrays.asList(args);
argList.add(filePath);
markPendingURLConsumed();
return argList.toArray(new String[]{});
} else {
return args;
}
}
private void markPendingURLConsumed() {
this.pendingURL = null;
}
}

29
designer-realize/src/main/java/com/fr/design/deeplink/FileOpen4MacDeepLink.java

@ -0,0 +1,29 @@
package com.fr.design.deeplink;
import com.fr.design.mainframe.DesignerContext;
import com.fr.file.FileFILE;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import java.io.File;
import java.util.Map;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2022/1/13
*/
public class FileOpen4MacDeepLink extends DeepLink {
@Override
public boolean accept(String url, String host, String path, Map<String, Object> params) {
return OperatingSystem.isMacos() && StringUtils.isEmpty(host) && StringUtils.isEmpty(path) && params.isEmpty();
}
@Override
public void run(String url, String host, String path, Map<String, Object> params) {
File file = new File(url);
if (file.exists()) {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file));
}
}
}

1
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -122,6 +122,7 @@ public class MainDesigner extends BaseDesigner {
});
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
//传递启动参数
args = DeepLinkManager.getInstance().createNewArgs(args);
designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));
try {
designerRoot.start();

Loading…
Cancel
Save