Browse Source

Pull request #7954: REPORT-66930 & REPORT-66254

Merge in DESIGN/design from ~STARRYI/design:release/11.0 to release/11.0

* commit 'a8572a9e0c37099316dff36c069459918b5d316b':
  REPORT-66306 组件包下载面板无遮罩阴影
  REPORT-66254 【组件商城风格优化】打开商城窗口到商城内容显示出来,期间大概有5秒空白状态,需要优化下
  REPORT-66930 【组件商城风格优化】网慢时多次点击下载出现多个弹窗
bugfix/11.0
starryi 3 years ago
parent
commit
c8f60f1198
  1. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java
  2. 8
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java
  3. 11
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java
  4. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java
  5. 73
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java
  6. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java
  7. 15
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/OnlineWidgetBlock.java

@ -337,8 +337,7 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
null,
this
);
return;
}
} else {
//如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层
if (!isRightClickPopupMenuVisible() && (isMouseEnter || downloading)) {
Graphics2D g2d = (Graphics2D) g;
@ -372,6 +371,8 @@ public class OnlineWidgetBlock extends AbstractOnlineWidgetBlock {
if (isUnusable) {
paintUnusableMask((Graphics2D) g);
}
}
if (this.parentPane != null) {
this.parentPane.refreshShowPaneUI();
}

8
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java

@ -256,4 +256,12 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
}
}
}
@Override
public void refreshShowPaneUI() {
if (downloadProgressPane != null && downloadProgressPane.isShowing()) {
downloadProgressPane.invalidate();
downloadProgressPane.repaint();
}
}
}

11
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java

@ -16,6 +16,7 @@ import com.fr.form.share.bean.OnlineShareWidget;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.BorderLayout;
@ -44,6 +45,7 @@ public class OnlineWidgetTabPane extends JPanel {
private boolean packagePaneCreated = false;
private final List<TabChangeListener> tabChangeListeners;
private OnlineEmbedFilterShowPane embedFilterShowPane;
private OnlineWidgetPackagesShowPane widgetPackagesShowPane;
public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) {
tabChangeListeners = new ArrayList<>();
@ -70,7 +72,8 @@ public class OnlineWidgetTabPane extends JPanel {
ComponentCollector.getInstance().collectCmpPktClick();
//延迟组件包面板的初始化,防止组件面板里组件和缩略图和组件包面板里组件的缩略图一起加载
if (!packagePaneCreated) {
centerPane.add(new OnlineWidgetPackagesShowPane(sharableWidgetPackages), COMPONENT_PACKAGE);
widgetPackagesShowPane = new OnlineWidgetPackagesShowPane(sharableWidgetPackages);
centerPane.add(widgetPackagesShowPane, COMPONENT_PACKAGE);
packagePaneCreated = true;
}
cardLayout.show(centerPane, COMPONENT_PACKAGE);
@ -89,6 +92,8 @@ public class OnlineWidgetTabPane extends JPanel {
this.add(centerPane, BorderLayout.CENTER);
}
private JPanel createMiniShopEntryPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
@ -136,6 +141,10 @@ public class OnlineWidgetTabPane extends JPanel {
if (embedFilterShowPane != null) {
this.embedFilterShowPane.refreshUI();
}
if (headGroup.getSelectedIndex() == COMPONENT_PACKAGE_TAB_INDEX && widgetPackagesShowPane != null) {
widgetPackagesShowPane.refreshShowPaneUI();
}
}

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/MiniComponentShopDialog.java

@ -106,6 +106,11 @@ public class MiniComponentShopDialog {
if (frame == null) {
frame = createFrame();
}
if (!frame.isVisible()) {
for (WindowListener listener: windowListeners) {
listener.windowOpened(null);
}
}
frame.setVisible(true);
}

73
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeProductBridge.java

@ -37,10 +37,15 @@ import java.util.Set;
* Created by Starryi on 2021/12/20
*/
public class NativeProductBridge {
private static final Map<String, ComponentInstallationTask> createdComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> createdComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> createdTemplateThemeInstallationTasks = new HashMap<>();
private static final Map<String, ComponentInstallationTask> startedComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> startedComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> startedTemplateThemeInstallationTasks = new HashMap<>();
private final Object window;
private static final Map<String, ComponentInstallationTask> executingComponentInstallationTasks = new HashMap<>();
private static final Map<String, ComponentsPackageInstallationTask> executingComponentsPackageInstallationTasks = new HashMap<>();
private static final Map<String, TemplateThemeInstallationTask> executingTemplateThemeInstallationTasks = new HashMap<>();
private final Map<String, Set<Object>> componentDownloadTaskStartListeners = new HashMap<>();
private final Map<String, Set<Object>> componentsPackageDownloadTaskStartListeners = new HashMap<>();
@ -115,7 +120,7 @@ public class NativeProductBridge {
boolean isPackage = widget.isWidgetPackage();
Map<String, ? extends NativeTaskBridge> executingDownloadTask =
isPackage ? executingComponentsPackageInstallationTasks : executingComponentInstallationTasks;
isPackage ? startedComponentsPackageInstallationTasks : startedComponentInstallationTasks;
NativeTaskBridge task = executingDownloadTask.get(uuid);
if (task != null) {
task.checkJSEnvChange(this.window);
@ -131,9 +136,22 @@ public class NativeProductBridge {
OnlineShareWidget widget = OnlineShareWidget.parseFromJSONObject(object);
int childrenCount = object.optInt("pkgsize", 0);
if (childrenCount > 0) {
return new ComponentsPackageInstallationTask(this, window, widget, childrenCount);
if (createdComponentsPackageInstallationTasks.containsKey(widget.getUuid())) {
return createdComponentsPackageInstallationTasks.get(widget.getUuid());
} else {
ComponentsPackageInstallationTask task = new ComponentsPackageInstallationTask(this, window, widget, childrenCount);
createdComponentsPackageInstallationTasks.put(widget.getUuid(), task);
return task;
}
} else {
return new ComponentInstallationTask(this, window, widget);
if (createdComponentInstallationTasks.containsKey(widget.getUuid())) {
return createdComponentInstallationTasks.get(widget.getUuid());
} else {
ComponentInstallationTask task = new ComponentInstallationTask(this, window, widget);
createdComponentInstallationTasks.put(widget.getUuid(), task);
return task;
}
}
}
@ -165,7 +183,7 @@ public class NativeProductBridge {
@JsAccessible
@JSBridge
public Object getExecutingThemeDownloadTask(String themePath) {
NativeTaskBridge task = (NativeTaskBridge) executingTemplateThemeInstallationTasks.get(themePath);
NativeTaskBridge task = startedTemplateThemeInstallationTasks.get(themePath);
if (task != null) {
task.checkJSEnvChange(this.window);
}
@ -176,7 +194,13 @@ public class NativeProductBridge {
@JsAccessible
@JSBridge
public Object createTemplateThemeDownloadTask(String themePath) {
return new TemplateThemeInstallationTask(this, window, themePath);
if (createdTemplateThemeInstallationTasks.containsKey(themePath)) {
return createdTemplateThemeInstallationTasks.get(themePath);
} else {
TemplateThemeInstallationTask task = new TemplateThemeInstallationTask(this, window, themePath);
createdTemplateThemeInstallationTasks.put(themePath, task);
return task;
}
}
public static class ComponentInstallationTask extends NativeTaskBridge {
@ -217,6 +241,9 @@ public class NativeProductBridge {
@JSBridge
@Override
public void execute() {
if (isExecuting) {
return;
}
super.execute();
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -257,7 +284,7 @@ public class NativeProductBridge {
@Override
protected void fireStartEvent(String event) {
executingComponentInstallationTasks.put(widget.getUuid(), this);
startedComponentInstallationTasks.put(widget.getUuid(), this);
Set<Object> startListeners = env.componentDownloadTaskStartListeners.get(widget.getUuid());
SafeJSFunctionInvoker.invoke(startListeners, env.window);
super.fireStartEvent(event);
@ -265,13 +292,15 @@ public class NativeProductBridge {
@Override
protected void fireFailureEvent(String event) {
executingComponentInstallationTasks.remove(widget.getUuid());
startedComponentInstallationTasks.remove(widget.getUuid());
createdComponentInstallationTasks.remove(widget.getUuid());
super.fireFailureEvent(event);
}
@Override
protected void fireSuccessEvent(String event) {
executingComponentInstallationTasks.remove(widget.getUuid());
startedComponentInstallationTasks.remove(widget.getUuid());
createdComponentInstallationTasks.remove(widget.getUuid());
super.fireSuccessEvent(event);
}
}
@ -317,6 +346,9 @@ public class NativeProductBridge {
@JSBridge
@Override
public void execute() {
if (isExecuting) {
return;
}
super.execute();
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -373,7 +405,7 @@ public class NativeProductBridge {
@Override
protected void fireStartEvent(String event) {
executingComponentsPackageInstallationTasks.put(widget.getUuid(), this);
startedComponentsPackageInstallationTasks.put(widget.getUuid(), this);
super.fireStartEvent(event);
Set<Object> startListeners = env.componentsPackageDownloadTaskStartListeners.get(widget.getUuid());
@ -382,13 +414,15 @@ public class NativeProductBridge {
@Override
protected void fireFailureEvent(String event) {
executingComponentsPackageInstallationTasks.remove(widget.getUuid());
startedComponentsPackageInstallationTasks.remove(widget.getUuid());
createdComponentsPackageInstallationTasks.remove(widget.getUuid());
super.fireFailureEvent(event);
}
@Override
protected void fireSuccessEvent(String event) {
executingComponentsPackageInstallationTasks.remove(widget.getUuid());
startedComponentsPackageInstallationTasks.remove(widget.getUuid());
createdComponentsPackageInstallationTasks.remove(widget.getUuid());
super.fireSuccessEvent(event);
}
}
@ -426,6 +460,9 @@ public class NativeProductBridge {
@JSBridge
@Override
public void execute() {
if (isExecuting) {
return;
}
super.execute();
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -452,7 +489,7 @@ public class NativeProductBridge {
@Override
protected void fireStartEvent(String event) {
executingTemplateThemeInstallationTasks.put(themePath, this);
startedTemplateThemeInstallationTasks.put(themePath, this);
Set<Object> startListeners = env.themeDownloadTaskStartListeners.get(themePath);
SafeJSFunctionInvoker.invoke(startListeners, env.window);
super.fireStartEvent(event);
@ -460,13 +497,15 @@ public class NativeProductBridge {
@Override
protected void fireFailureEvent(String event) {
executingTemplateThemeInstallationTasks.remove(themePath);
startedTemplateThemeInstallationTasks.remove(themePath);
createdTemplateThemeInstallationTasks.remove(themePath);
super.fireFailureEvent(event);
}
@Override
protected void fireSuccessEvent(String event) {
executingTemplateThemeInstallationTasks.remove(themePath);
startedTemplateThemeInstallationTasks.remove(themePath);
createdTemplateThemeInstallationTasks.remove(themePath);
super.fireSuccessEvent(event);
}
}

6
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/mini/bridge/NativeTaskBridge.java

@ -18,6 +18,7 @@ public class NativeTaskBridge implements MiniShopNativeTask {
private Object window;
protected final Set<Object> statusCbs = new HashSet<>();
protected boolean isExecuting = false;
public NativeTaskBridge(Object window) {
this.window = window;
@ -49,6 +50,9 @@ public class NativeTaskBridge implements MiniShopNativeTask {
@JsAccessible
@Override
public void execute() {
if (!isExecuting) {
isExecuting = true;
}
}
@JSBridge
@ -68,10 +72,12 @@ public class NativeTaskBridge implements MiniShopNativeTask {
SafeJSFunctionInvoker.invoke(statusCbs, window, "PROGRESS", event);
}
protected void fireSuccessEvent(String event) {
isExecuting = false;
MiniShopNativeTaskManager.getInstance().removeCompletedTask(this);
SafeJSFunctionInvoker.invoke(statusCbs, window, "SUCCESS", event);
}
protected void fireFailureEvent(String event) {
isExecuting = false;
MiniShopNativeTaskManager.getInstance().removeCompletedTask(this);
SafeJSFunctionInvoker.invoke(statusCbs, window, "FAILURE", event);
}

15
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/widgetpackage/OnlineWidgetPackagesShowPane.java

@ -48,6 +48,7 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane {
private JPanel detailPane;
private String currentPackageId;
private OnlineWidgetSelectPane onlineWidgetSelectPane;
private OnlineDownloadPackagePane onlineDownloadPackagePane;
private UILabel downloadLabel;
private final Map<String, OnlineWidgetSelectPane> cachePanelMap = new HashMap<>();
@ -109,15 +110,15 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane {
private void downLoadPackage() {
downloadLabel.setVisible(false);
detailPane.removeAll();
OnlineDownloadPackagePane widgetSelectPane = new OnlineDownloadPackagePane(this, onlineWidgetSelectPane.getSharableWidgetProviders(), 50);
detailPane.add(widgetSelectPane, BorderLayout.CENTER);
onlineDownloadPackagePane = new OnlineDownloadPackagePane(this, onlineWidgetSelectPane.getSharableWidgetProviders(), 50);
detailPane.add(onlineDownloadPackagePane, BorderLayout.CENTER);
cardLayout.show(centerPane, WIDGET_DETAIL);
cachePanelMap.put(currentPackageId, widgetSelectPane);
cachePanelMap.put(currentPackageId, onlineDownloadPackagePane);
for (OnlineShareWidget onlineShareWidget : getSharableWidgetProviders()) {
if (StringUtils.equals(onlineShareWidget.getId(), currentPackageId)) {
widgetSelectPane.downloadWidget(onlineShareWidget);
onlineDownloadPackagePane.downloadWidget(onlineShareWidget);
break;
}
}
@ -193,4 +194,10 @@ public class OnlineWidgetPackagesShowPane extends AbstractOnlineWidgetShowPane {
protected FilterPane createFilterPane() {
return FilterPane.createOnlinePackageFilterPane();
}
public void refreshShowPaneUI() {
if (onlineDownloadPackagePane != null && onlineDownloadPackagePane.isShowing()) {
onlineDownloadPackagePane.refreshShowPaneUI();
}
}
}

Loading…
Cancel
Save