|
|
|
@ -5,6 +5,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
|
|
|
|
|
import com.fr.general.CloudCenter; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import javafx.application.Platform; |
|
|
|
|
import javafx.beans.value.ChangeListener; |
|
|
|
|
import javafx.beans.value.ObservableValue; |
|
|
|
@ -102,7 +103,7 @@ public class BBSDialog extends UIDialog {
|
|
|
|
|
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
openUrlAtLocalWebBrowser(eng, newValue); |
|
|
|
|
openUrlAtLocalWebBrowser(newValue); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
eng.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() { |
|
|
|
@ -125,7 +126,10 @@ public class BBSDialog extends UIDialog {
|
|
|
|
|
* @param eng web引擎 |
|
|
|
|
* @param url 要打开的地址 |
|
|
|
|
*/ |
|
|
|
|
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { |
|
|
|
|
public void openUrlAtLocalWebBrowser(String url) { |
|
|
|
|
if (StringUtils.isBlank(url)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (Desktop.isDesktopSupported()) { |
|
|
|
|
try { |
|
|
|
|
//创建一个URI实例,注意不是URL
|
|
|
|
@ -137,9 +141,6 @@ public class BBSDialog extends UIDialog {
|
|
|
|
|
//获取系统默认浏览器打开链接
|
|
|
|
|
desktop.browse(uri); |
|
|
|
|
} |
|
|
|
|
} catch (NullPointerException e) { |
|
|
|
|
//此为uri为空时抛出异常
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
//此为无法获取系统默认浏览器
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|