Browse Source

Merge pull request #829 in DESIGN/design from ~RICHIE/design:release/10.0 to release/10.0

* commit 'f38c2437d6c84a01014be5458812de8f52f9d988':
  KERNEL-442 不能识别大小写,被迫改个名字
bugfix/10.0
richie 6 years ago
parent
commit
dd4e592c0c
  1. 2
      designer-base/src/main/java/com/fr/design/upm/UPMPane.java
  2. 8
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  3. 2
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  4. 63
      designer-base/src/main/java/com/fr/design/upm/UpmModernPane.java

2
designer-base/src/main/java/com/fr/design/upm/UPMPane.java

@ -50,7 +50,7 @@ public class UpmPane extends BasicPane {
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser()));
} }
}).build(); }).build();
EventDispatcher.listen(DownloadEvent.FINISH, new Listener<String>() { EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override @Override
public void on(Event event, String param) { public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath()); modernUIPane.redirect(UpmFinder.getMainResourcePath());

8
designer-base/src/main/java/com/fr/design/upm/UpmJSBridge.java → designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -48,15 +48,15 @@ import java.util.concurrent.RunnableFuture;
* Created by richie on 2019-04-12 * Created by richie on 2019-04-12
* 桥接Java和JavaScript的类 * 桥接Java和JavaScript的类
*/ */
public class UpmJSBridge { public class UpmBridge {
public static UpmJSBridge getBridge(Browser browser) { public static UpmBridge getBridge(Browser browser) {
return new UpmJSBridge(browser); return new UpmBridge(browser);
} }
private JSObject window; private JSObject window;
private UpmJSBridge(Browser browser) { private UpmBridge(Browser browser) {
this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); this.window = browser.executeJavaScriptAndReturnValue("window").asObject();
} }

2
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -51,7 +51,7 @@ public class UpmFinder {
} }
public static void showUPMDialog() { public static void showUPMDialog() {
UpmModernPane upmPane = new UpmModernPane(); UpmPane upmPane = new UpmPane();
if (dialog == null) { if (dialog == null) {
dialog = new UpmDialog(DesignerContext.getDesignerFrame(), upmPane); dialog = new UpmDialog(DesignerContext.getDesignerFrame(), upmPane);
} }

63
designer-base/src/main/java/com/fr/design/upm/UpmModernPane.java

@ -1,63 +0,0 @@
package com.fr.design.upm;
import com.fr.design.dialog.BasicPane;
import com.fr.design.ui.ModernUIPane;
import com.fr.design.upm.event.DownloadEvent;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.awt.*;
/**
* @author richie
* @version 10.0
* Created by richie on 2019-04-12
* Update Plugin Manager容器
*/
public class UpmModernPane extends BasicPane {
private ModernUIPane<Object> modernUIPane;
@Override
protected String title4PopupWindow() {
return "UPM";
}
public UpmModernPane() {
setLayout(new BorderLayout());
if (UpmFinder.checkUPMResourcesExist()) {
modernUIPane = new ModernUIPane.Builder<>()
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("PluginHelper", UpmJSBridge.getBridge(event.getBrowser()));
}
})
.withURL(UpmFinder.getMainResourcePath())
.build();
} else {
modernUIPane = new ModernUIPane.Builder<>()
.withComponent(WarnComponent.KEY)
.prepare(new ScriptContextAdapter() {
@Override
public void onScriptContextCreated(ScriptContextEvent event) {
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window");
window.asObject().setProperty("PluginHelper", UpmJSBridge.getBridge(event.getBrowser()));
}
}).build();
EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener<String>() {
@Override
public void on(Event event, String param) {
modernUIPane.redirect(UpmFinder.getMainResourcePath());
}
});
}
add(modernUIPane, BorderLayout.CENTER);
}
}
Loading…
Cancel
Save