Browse Source

REPORT-10171

final/10.0
Mata.Li 6 years ago
parent
commit
34709bd740
  1. 17
      designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java
  2. 17
      designer-base/src/main/java/com/fr/design/actions/community/BugAction.java
  3. 17
      designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java
  4. 17
      designer-base/src/main/java/com/fr/design/actions/community/CusDemandAction.java
  5. 17
      designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java
  6. 18
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  7. 17
      designer-base/src/main/java/com/fr/design/actions/community/SignAction.java
  8. 17
      designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java
  9. 17
      designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java
  10. 52
      designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java
  11. 54
      designer-base/src/main/java/com/fr/start/ServerStarter.java

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

@ -5,6 +5,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -37,21 +38,7 @@ public class BBSAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet BBS = new MenuKeySet() { public static final MenuKeySet BBS = new MenuKeySet() {
@Override @Override

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -31,21 +32,7 @@ public class BugAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.bugs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.bugs");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet BUG = new MenuKeySet() { public static final MenuKeySet BUG = new MenuKeySet() {

17
designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java

@ -3,6 +3,7 @@ package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -32,21 +33,7 @@ public class CenterAction extends UpAction{
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.center"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.center");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet CENTER = new MenuKeySet() { public static final MenuKeySet CENTER = new MenuKeySet() {

17
designer-base/src/main/java/com/fr/design/actions/community/CusDemandAction.java

@ -3,6 +3,7 @@ package com.fr.design.actions.community;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -32,21 +33,7 @@ public class CusDemandAction extends UpAction{
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.demand"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.demand");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet DEMAND = new MenuKeySet() { public static final MenuKeySet DEMAND = new MenuKeySet() {

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -32,21 +33,7 @@ public class NeedAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.needs"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.needs");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet NEED = new MenuKeySet() { public static final MenuKeySet NEED = new MenuKeySet() {

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -31,22 +32,7 @@ public class QuestionAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.questions");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet QUESTIONS = new MenuKeySet() { public static final MenuKeySet QUESTIONS = new MenuKeySet() {
@Override @Override

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

@ -5,6 +5,7 @@ import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -32,21 +33,7 @@ public class SignAction extends UpdateAction
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.aut"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.aut");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet SIGN = new MenuKeySet() { public static final MenuKeySet SIGN = new MenuKeySet() {

17
designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -33,21 +34,7 @@ public class TechSolutionAction extends UpdateAction{
public void actionPerformed(ActionEvent arg0) public void actionPerformed(ActionEvent arg0)
{ {
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.solution"); String url = CloudCenter.getInstance().acquireUrlByKind("bbs.solution");
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet TSO = new MenuKeySet() { public static final MenuKeySet TSO = new MenuKeySet() {

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -38,21 +39,7 @@ public class VideoAction extends UpdateAction
} else { } else {
url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); url = CloudCenter.getInstance().acquireUrlByKind("bbs.video");
} }
if (StringUtils.isEmpty(url)) { BrowseUtils.browser(url);
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate"));
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
} }
public static final MenuKeySet VIDEO = new MenuKeySet() { public static final MenuKeySet VIDEO = new MenuKeySet() {

52
designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java

@ -0,0 +1,52 @@
package com.fr.design.utils;
import com.fr.base.FRContext;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* Created by XINZAI on 2018/8/23.
*/
public class BrowseUtils {
public static void startBrowserFromCommand(String uri, IOException e) {
if (OperatingSystem.isWindows()) {
try {
// win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开.
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri);
} catch (IOException ee) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate"));
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public static void browser(String url) {
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
startBrowserFromCommand(url, exp);
} catch (URISyntaxException exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + url);
}
}
}

54
designer-base/src/main/java/com/fr/start/ServerStarter.java

@ -1,25 +1,15 @@
package com.fr.start; package com.fr.start;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig; import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.utils.BrowseUtils;
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.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.start.server.FineEmbedServer; import com.fr.start.server.FineEmbedServer;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class ServerStarter { public class ServerStarter {
/** /**
@ -30,7 +20,7 @@ public class ServerStarter {
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
//有问题,这里拿不到远程的http端口 //有问题,这里拿不到远程的http端口
browser(WorkContext.getCurrent().getPath()); BrowseUtils.browser(WorkContext.getCurrent().getPath());
} }
else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用 else if (ComparatorUtils.equals(StableUtils.getInstallHome(), ".")) {//august:供代码使用
String web = GeneralContext.getCurrentAppNameOfEnv(); String web = GeneralContext.getCurrentAppNameOfEnv();
@ -48,7 +38,7 @@ public class ServerStarter {
FineEmbedServer.start(); FineEmbedServer.start();
} finally { } finally {
//先访问Demo, 后访问报表, 不需要重置服务器. //先访问Demo, 后访问报表, 不需要重置服务器.
browser("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + GeneralContext.getCurrentAppNameOfEnv() + "/" + ServerConfig.getInstance().getServletName()); BrowseUtils.browser("http://localhost:" + DesignerEnvManager.getEnvManager().getEmbedServerPort() + "/" + GeneralContext.getCurrentAppNameOfEnv() + "/" + ServerConfig.getInstance().getServletName());
} }
} }
@ -60,42 +50,6 @@ public class ServerStarter {
public static void browserURLWithLocalEnv(String url) { public static void browserURLWithLocalEnv(String url) {
FineEmbedServer.start(); FineEmbedServer.start();
browser(url); BrowseUtils.browser(url);
} }
private static void browser(String uri) {
if (StringUtils.isEmpty(uri)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(uri));
} catch (IOException e) {
startBrowserFromCommand(uri, e);
} catch (URISyntaxException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineLoggerFactory.getLogger().error("Can not open the browser for URL: " + uri);
}
}
private static void startBrowserFromCommand(String uri, IOException e) {
if (OperatingSystem.isWindows()) {
try {
// win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开.
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri);
} catch (IOException ee) {
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate"));
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
} }

Loading…
Cancel
Save