Fangjie Hu 8 years ago
parent
commit
f14b954bfe
  1. 11
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  2. 18
      designer_base/src/com/fr/design/extra/QQLoginWebPane.java

11
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -27,6 +27,8 @@ public class LoginWebBridge {
private static final long CHECK_MESSAGE_TIME = 30 * 1000L;
//数据查询正常的标志 ok
private static final String SUCCESS_MESSAGE_STATUS = "ok";
//数据通讯失败
private static final String FAILED_MESSAGE_STATUS = "error";
//消息条数
private int messageCount;
@ -125,9 +127,12 @@ public class LoginWebBridge {
if(getMessage.isServerAlive()){
try {
String res = getMessage.getResponseText();
JSONObject jo = new JSONObject(res);
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) {
setMessageCount(Integer.parseInt(jo.getString("message")));
if (res.equals(FAILED_MESSAGE_STATUS)) {
}else {
JSONObject jo = new JSONObject(res);
if (jo.getString("status").equals(SUCCESS_MESSAGE_STATUS)) {
setMessageCount(Integer.parseInt(jo.getString("message")));
}
}
} catch (Exception e) {
FRContext.getLogger().info(e.getMessage());

18
designer_base/src/com/fr/design/extra/QQLoginWebPane.java

@ -104,12 +104,17 @@ public class QQLoginWebPane extends JFXPanel {
showAlert(event.getData());
}
});
webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) -> {
if (newValue == Worker.State.SUCCEEDED) {
window = (JSObject) webEngine.executeScript("window");
window.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine));
}
});
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
window = (JSObject) webEngine.executeScript("window");
window.setMember("QQLoginHelper", QQLoginWebBridge.getHelper(webEngine));
}
}
}
);
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
@ -151,7 +156,6 @@ public class QQLoginWebPane extends JFXPanel {
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT);
dialog.setWidth(DEFAULT_CONFIRM_WIDTH);
dialog.setIconified(false);
dialog.setAlwaysOnTop(true);
dialog.initOwner(parent);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setScene(

Loading…
Cancel
Save