|
|
|
@ -32,23 +32,14 @@ public class UpmShowPane extends BasicPane {
|
|
|
|
|
|
|
|
|
|
UpmShowPane() { |
|
|
|
|
setLayout(new BorderLayout()); |
|
|
|
|
modernUIPane = ModernUIPaneFactory.modernUIPaneBuilder() |
|
|
|
|
.prepareForV6(new ScriptContextAdapter() { |
|
|
|
|
modernUIPane = new ModernUIPane.Builder<>() |
|
|
|
|
.prepare(new ScriptContextAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void onScriptContextCreated(ScriptContextEvent event) { |
|
|
|
|
// 6.x
|
|
|
|
|
JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); |
|
|
|
|
window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.prepareForV7(params -> { |
|
|
|
|
// 7.x
|
|
|
|
|
JsObject window = params.frame().executeJavaScript("window"); |
|
|
|
|
if (window != null) { |
|
|
|
|
window.putProperty("PluginHelper", NewUpmBridge.getBridge(window)); |
|
|
|
|
} |
|
|
|
|
return InjectJsCallback.Response.proceed(); |
|
|
|
|
}) |
|
|
|
|
.withURL(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()) |
|
|
|
|
.build(); |
|
|
|
|
EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() { |
|
|
|
@ -57,6 +48,12 @@ public class UpmShowPane extends BasicPane {
|
|
|
|
|
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
EventDispatcher.listen(DownloadEvent.UPDATE, new Listener<String>() { |
|
|
|
|
@Override |
|
|
|
|
public void on(Event event, String param) { |
|
|
|
|
modernUIPane.redirect(UpmFinder.getMainResourcePath(), UpmUtils.renderMap()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
add(modernUIPane, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|