Browse Source

Merge pull request #6394 in DESIGN/design from release/11.0 to feature/x

* commit 'a309a96cd3d07c8b5f52b36dceeb10be20958174':
  REPORT-61521 主题下载引导页加载异常
feature/x
superman 3 years ago
parent
commit
4aed4cd545
  1. 13
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java
  2. 24
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetTabPane.java
  3. 1
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

13
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineWidgetRepoPane.java

@ -95,7 +95,7 @@ public class OnlineWidgetRepoPane extends BasicPane {
setContent(); setContent();
} }
private void setContent() { public void setContent() {
if (sharableWidgets != null) { if (sharableWidgets != null) {
initContentPane(); initContentPane();
addCenterPane(); addCenterPane();
@ -144,14 +144,25 @@ public class OnlineWidgetRepoPane extends BasicPane {
private boolean initContentPane() { private boolean initContentPane() {
boolean loadWidgetsSuccess = loadWidgets(); boolean loadWidgetsSuccess = loadWidgets();
if (loadWidgetsSuccess) { if (loadWidgetsSuccess) {
if (componentTabPane != null) {
componentTabPane.removeTabChangeListener(tabChangeListener);
}
this.componentTabPane = new OnlineWidgetTabPane(sharableWidgets[0].toArray(new OnlineShareWidget[sharableWidgets[0].size()]), this.componentTabPane = new OnlineWidgetTabPane(sharableWidgets[0].toArray(new OnlineShareWidget[sharableWidgets[0].size()]),
sharableWidgets[1].toArray(new OnlineShareWidget[sharableWidgets[1].size()])); sharableWidgets[1].toArray(new OnlineShareWidget[sharableWidgets[1].size()]));
this.componentTabPane.addTabChangeListener(tabChangeListener);
} else { } else {
switchPane(Status.DISCONNECTED); switchPane(Status.DISCONNECTED);
} }
return loadWidgetsSuccess; return loadWidgetsSuccess;
} }
private OnlineWidgetTabPane.TabChangeListener tabChangeListener = new OnlineWidgetTabPane.TabChangeListener() {
@Override
public void tabChange(int selectedIndex) {
setShowPackagePanel(selectedIndex != 0);
}
};
private void reload() { private void reload() {
this.removeAll(); this.removeAll();
sharableWidgets = null; sharableWidgets = null;

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

@ -10,6 +10,9 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.List;
/** /**
* Created by kerry on 2020-10-19 * Created by kerry on 2020-10-19
@ -20,8 +23,10 @@ public class OnlineWidgetTabPane extends JPanel {
private CardLayout cardLayout; private CardLayout cardLayout;
private JPanel centerPane; private JPanel centerPane;
private boolean packagePaneCreated = false; private boolean packagePaneCreated = false;
private List<TabChangeListener> tabChangeListeners;
public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) { public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) {
tabChangeListeners = new ArrayList<>();
initPane(sharableWidgets, sharableWidgetPackage); initPane(sharableWidgets, sharableWidgetPackage);
} }
@ -33,7 +38,9 @@ public class OnlineWidgetTabPane extends JPanel {
//延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载 //延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载
UITabGroup headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) { UITabGroup headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) {
public void tabChanged(int newSelectedIndex) { public void tabChanged(int newSelectedIndex) {
OnlineWidgetRepoPane.getInstance().setShowPackagePanel(newSelectedIndex != 0); for (TabChangeListener changeListener : tabChangeListeners) {
changeListener.tabChange(newSelectedIndex);
}
if (newSelectedIndex == 0) { if (newSelectedIndex == 0) {
cardLayout.show(centerPane, COMPONENT); cardLayout.show(centerPane, COMPONENT);
} else { } else {
@ -45,6 +52,7 @@ public class OnlineWidgetTabPane extends JPanel {
} }
cardLayout.show(centerPane, COMPONENT_PACKAGE); cardLayout.show(centerPane, COMPONENT_PACKAGE);
} }
} }
}; };
headGroup.setSelectedIndex(0); headGroup.setSelectedIndex(0);
@ -55,4 +63,18 @@ public class OnlineWidgetTabPane extends JPanel {
this.add(jPanel, BorderLayout.NORTH); this.add(jPanel, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
public void addTabChangeListener(TabChangeListener listener) {
if (!tabChangeListeners.contains(listener)) {
tabChangeListeners.add(listener);
}
}
public void removeTabChangeListener(TabChangeListener listener) {
tabChangeListeners.remove(listener);
}
public interface TabChangeListener extends EventListener {
void tabChange(int selectedIndex);
}
} }

1
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

@ -102,6 +102,7 @@ public class DownloadComponentPackageGuide {
EastRegionContainerPane.getInstance().showContainer(); EastRegionContainerPane.getInstance().showContainer();
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS); EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance(); OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance();
onlineWidgetRepoPane.setContent();
OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class); OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class);
UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class); UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class);
JPanel centerPane = (JPanel) tabPane.getComponent(1); JPanel centerPane = (JPanel) tabPane.getComponent(1);

Loading…
Cancel
Save