Browse Source

REPORT-61788 创建组件时,弹窗出来的非常慢

【问题原因】
创建组件的面板里需要获取组件样式风格列表,列表数据来自商城服务器端,
需要网络请求。在创建面板的时候,进行了同步请求,阻塞了EDT线程.

【改动思路】
使用 LazyComboBox 替换 UIComboBox
feature/x
Starryi 3 years ago
parent
commit
e8e61428e0
  1. 11
      designer-realize/src/main/java/com/fr/design/share/ui/generate/ShareMainPane.java

11
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.extra.LoginWebBridge;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox; 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.icombobox.UIComboBox;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.icontainer.UIScrollPane; 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 com.fr.stable.pinyin.PinyinHelper;
import java.awt.TextField; import java.awt.TextField;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -299,8 +301,13 @@ public class ShareMainPane extends JPanel {
return styleComboBox.getSelectedItem() != null; return styleComboBox.getSelectedItem() != null;
} }
}; };
this.styleComboBox = ShareUIUtils.wrapUI(placeHolderUI, new UIComboBox()); this.styleComboBox = ShareUIUtils.wrapUI(placeHolderUI, new LazyComboBox() {
this.styleComboBox.refreshBoxItems(StyleTheme.getStyleThemeTypeInfo()); @Override
public Object[] load() {
List<StyleThemeBean> themeBeanList = StyleTheme.getStyleThemeTypeInfo();
return themeBeanList.toArray();
}
});
styleComboBox.setPreferredSize(new Dimension(COMBO_WIDTH, COMBO_HEIGHT)); styleComboBox.setPreferredSize(new Dimension(COMBO_WIDTH, COMBO_HEIGHT));
pane.add(styleComboBox); pane.add(styleComboBox);
return pane; return pane;

Loading…
Cancel
Save