Browse Source

Pull request #6376: REPORT-61521 主题下载引导页加载异常

Merge in DESIGN/design from ~TOMMY/design:final/11.0 to final/11.0

* commit 'ec99e25755fcdcfa3173e895a1f3e2d98e66ecfe':
  REPORT-61521 主题下载引导页加载异常
final/11.0
Tommy 3 years ago
parent
commit
62e626b602
  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();
}
private void setContent() {
public void setContent() {
if (sharableWidgets != null) {
initContentPane();
addCenterPane();
@ -144,14 +144,25 @@ public class OnlineWidgetRepoPane extends BasicPane {
private boolean initContentPane() {
boolean loadWidgetsSuccess = loadWidgets();
if (loadWidgetsSuccess) {
if (componentTabPane != null) {
componentTabPane.removeTabChangeListener(tabChangeListener);
}
this.componentTabPane = new OnlineWidgetTabPane(sharableWidgets[0].toArray(new OnlineShareWidget[sharableWidgets[0].size()]),
sharableWidgets[1].toArray(new OnlineShareWidget[sharableWidgets[1].size()]));
this.componentTabPane.addTabChangeListener(tabChangeListener);
} else {
switchPane(Status.DISCONNECTED);
}
return loadWidgetsSuccess;
}
private OnlineWidgetTabPane.TabChangeListener tabChangeListener = new OnlineWidgetTabPane.TabChangeListener() {
@Override
public void tabChange(int selectedIndex) {
setShowPackagePanel(selectedIndex != 0);
}
};
private void reload() {
this.removeAll();
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 java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.List;
/**
* Created by kerry on 2020-10-19
@ -20,8 +23,10 @@ public class OnlineWidgetTabPane extends JPanel {
private CardLayout cardLayout;
private JPanel centerPane;
private boolean packagePaneCreated = false;
private List<TabChangeListener> tabChangeListeners;
public OnlineWidgetTabPane(OnlineShareWidget[] sharableWidgets, OnlineShareWidget[] sharableWidgetPackage) {
tabChangeListeners = new ArrayList<>();
initPane(sharableWidgets, sharableWidgetPackage);
}
@ -33,7 +38,9 @@ public class OnlineWidgetTabPane extends JPanel {
//延迟组件包面板的初始化,防止组件面板里组件的缩略图和组件包面板里组件的缩略图一起加载
UITabGroup headGroup = new UITabGroup(new String[]{COMPONENT, COMPONENT_PACKAGE}) {
public void tabChanged(int newSelectedIndex) {
OnlineWidgetRepoPane.getInstance().setShowPackagePanel(newSelectedIndex != 0);
for (TabChangeListener changeListener : tabChangeListeners) {
changeListener.tabChange(newSelectedIndex);
}
if (newSelectedIndex == 0) {
cardLayout.show(centerPane, COMPONENT);
} else {
@ -45,6 +52,7 @@ public class OnlineWidgetTabPane extends JPanel {
}
cardLayout.show(centerPane, COMPONENT_PACKAGE);
}
}
};
headGroup.setSelectedIndex(0);
@ -55,4 +63,18 @@ public class OnlineWidgetTabPane extends JPanel {
this.add(jPanel, BorderLayout.NORTH);
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().switchTabTo(EastRegionContainerPane.KEY_WIDGET_SETTINGS);
OnlineWidgetRepoPane onlineWidgetRepoPane = OnlineWidgetRepoPane.getInstance();
onlineWidgetRepoPane.setContent();
OnlineWidgetTabPane tabPane = (OnlineWidgetTabPane) ComponentUtils.findComponentByClass(onlineWidgetRepoPane, OnlineWidgetTabPane.class);
UITabGroup tabGroup = (UITabGroup) ComponentUtils.findComponentByClass(tabPane, UITabGroup.class);
JPanel centerPane = (JPanel) tabPane.getComponent(1);

Loading…
Cancel
Save