Browse Source

CHART-23172 & CHART-23111 v7的jxbrowser没有正确关闭engine

new-design
WeiYanglu 3 years ago
parent
commit
b069132341
  1. 6
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java
  3. 11
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

6
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -196,13 +196,17 @@ public class ModernUIPane<T> extends BasicPane {
private ModernUIPane<T> pane; private ModernUIPane<T> pane;
public Builder() { public Builder() {
this(BrowserType.HEAVYWEIGHT);
} }
public Builder(BrowserType browserType) { public Builder(BrowserType browserType) {
this.pane = new ModernUIPane<>(browserType); this.pane = new ModernUIPane<>(browserType);
} }
public Builder<T> init() {
this.pane = new ModernUIPane<>(BrowserType.HEAVYWEIGHT);
return this;
}
public Builder<T> prepare(ScriptContextListener contextListener) { public Builder<T> prepare(ScriptContextListener contextListener) {
pane.browser.addScriptContextListener(contextListener); pane.browser.addScriptContextListener(contextListener);
return this; return this;

4
designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java

@ -13,9 +13,9 @@ public class ModernUIPaneFactory {
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() { public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() {
if (isV7()) { if (isV7()) {
return new NewModernUIPane.Builder<>(); return new NewModernUIPane.Builder<T>().init();
} else { } else {
return new ModernUIPane.Builder<>(); return new ModernUIPane.Builder<T>().init();
} }
} }

11
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -182,8 +182,7 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
public void disposeBrowser() { public void disposeBrowser() {
if (browser != null) { if (browser != null) {
browser.close(); browser.engine().close();
browser = null;
} }
} }
@ -204,7 +203,13 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
public static class Builder<T> extends ModernUIPane.Builder<T> { public static class Builder<T> extends ModernUIPane.Builder<T> {
private NewModernUIPane<T> pane = new NewModernUIPane<>(); private NewModernUIPane<T> pane;
@Override
public ModernUIPane.Builder<T> init() {
this.pane = new NewModernUIPane<>();
return this;
}
public NewModernUIPane.Builder<T> prepare(InjectJsCallback callback) { public NewModernUIPane.Builder<T> prepare(InjectJsCallback callback) {
pane.browser.set(InjectJsCallback.class, callback); pane.browser.set(InjectJsCallback.class, callback);

Loading…
Cancel
Save