|
|
@ -5,6 +5,7 @@ import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
import javafx.application.Platform; |
|
|
|
import javafx.application.Platform; |
|
|
|
import javafx.beans.value.ChangeListener; |
|
|
|
import javafx.beans.value.ChangeListener; |
|
|
|
import javafx.beans.value.ObservableValue; |
|
|
|
import javafx.beans.value.ObservableValue; |
|
|
@ -14,6 +15,7 @@ import javafx.scene.Group; |
|
|
|
import javafx.scene.Scene; |
|
|
|
import javafx.scene.Scene; |
|
|
|
import javafx.scene.web.WebEngine; |
|
|
|
import javafx.scene.web.WebEngine; |
|
|
|
import javafx.scene.web.WebView; |
|
|
|
import javafx.scene.web.WebView; |
|
|
|
|
|
|
|
import netscape.javascript.JSObject; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
|
|
|
@ -30,8 +32,8 @@ public class BBSDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
private static final int WIDTH = 600; |
|
|
|
private static final int WIDTH = 600; |
|
|
|
private static final int HEIGHT = 400; |
|
|
|
private static final int HEIGHT = 400; |
|
|
|
private static final int OUTER_WIDTH = 605; |
|
|
|
private static final int OUTER_WIDTH = 600; |
|
|
|
private static final int OUTER_HEIGHT = 428; |
|
|
|
private static final int OUTER_HEIGHT = 400; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JFXPanel jfxPanel; |
|
|
|
private JFXPanel jfxPanel; |
|
|
@ -39,7 +41,7 @@ public class BBSDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
public BBSDialog(Frame parent) { |
|
|
|
public BBSDialog(Frame parent) { |
|
|
|
super(parent); |
|
|
|
super(parent); |
|
|
|
//setUndecorated(true);
|
|
|
|
setUndecorated(true); |
|
|
|
JPanel panel = (JPanel) getContentPane(); |
|
|
|
JPanel panel = (JPanel) getContentPane(); |
|
|
|
initComponents(panel); |
|
|
|
initComponents(panel); |
|
|
|
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT)); |
|
|
|
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT)); |
|
|
@ -95,7 +97,7 @@ public class BBSDialog extends UIDialog { |
|
|
|
{ |
|
|
|
{ |
|
|
|
disableLink(eng); |
|
|
|
disableLink(eng); |
|
|
|
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
|
|
|
|
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
|
|
|
|
if(ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, BBSConstants.BBS_MOBILE_MOD)){ |
|
|
|
if(ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
openUrlAtLocalWebBrowser(eng,newValue); |
|
|
|
openUrlAtLocalWebBrowser(eng,newValue); |
|
|
@ -105,6 +107,8 @@ public class BBSDialog extends UIDialog { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) { |
|
|
|
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) { |
|
|
|
if (newValue == Worker.State.SUCCEEDED){ |
|
|
|
if (newValue == Worker.State.SUCCEEDED){ |
|
|
|
|
|
|
|
JSObject obj = (JSObject) eng.executeScript("window"); |
|
|
|
|
|
|
|
obj.setMember("BBSWebBridge", BBSDialog.this); |
|
|
|
setVisible(true); |
|
|
|
setVisible(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -112,7 +116,7 @@ public class BBSDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 在本地浏览器里打开url
|
|
|
|
// 在本地浏览器里打开url
|
|
|
|
private void openUrlAtLocalWebBrowser(WebEngine eng,String url){ |
|
|
|
private void openUrlAtLocalWebBrowser(WebEngine eng,String url){ |
|
|
|
if(Desktop.isDesktopSupported()){ |
|
|
|
if(Desktop.isDesktopSupported()){ |
|
|
@ -136,6 +140,13 @@ public class BBSDialog extends UIDialog { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 提供给web页面调用的关闭窗口 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void closeWindow() { |
|
|
|
|
|
|
|
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
|
|
|
|
|
|
this.setVisible(false); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 略 |
|
|
|
* 略 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|