From e8e61428e07b0ed71ea07b847a1b61e9e774833d Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 8 Nov 2021 11:09:41 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-61788=20=E5=88=9B=E5=BB=BA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=EF=BC=8C=E5=BC=B9=E7=AA=97=E5=87=BA=E6=9D=A5?= =?UTF-8?q?=E7=9A=84=E9=9D=9E=E5=B8=B8=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 创建组件的面板里需要获取组件样式风格列表,列表数据来自商城服务器端, 需要网络请求。在创建面板的时候,进行了同步请求,阻塞了EDT线程. 【改动思路】 使用 LazyComboBox 替换 UIComboBox --- .../fr/design/share/ui/generate/ShareMainPane.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java index ffeedb770..b19dbd659 100644 --- a/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java +++ b/designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java @@ -8,6 +8,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.LoginWebBridge; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombocheckbox.UIComboCheckBox; import com.fr.design.gui.icontainer.UIScrollPane; @@ -50,6 +51,7 @@ import com.fr.stable.collections.combination.Pair; import com.fr.stable.pinyin.PinyinHelper; import java.awt.TextField; +import java.util.Collections; import java.util.HashMap; import org.jetbrains.annotations.NotNull; @@ -299,8 +301,13 @@ public class ShareMainPane extends JPanel { return styleComboBox.getSelectedItem() != null; } }; - this.styleComboBox = ShareUIUtils.wrapUI(placeHolderUI, new UIComboBox()); - this.styleComboBox.refreshBoxItems(StyleTheme.getStyleThemeTypeInfo()); + this.styleComboBox = ShareUIUtils.wrapUI(placeHolderUI, new LazyComboBox() { + @Override + public Object[] load() { + List themeBeanList = StyleTheme.getStyleThemeTypeInfo(); + return themeBeanList.toArray(); + } + }); styleComboBox.setPreferredSize(new Dimension(COMBO_WIDTH, COMBO_HEIGHT)); pane.add(styleComboBox); return pane;