Browse Source

REPORT-141296 设计器UI操作性能优化

fbp/feature
Richard.Fang 3 weeks ago
parent
commit
43631fb3f2
  1. 6
      designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java
  2. 37
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

6
designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java

@ -32,10 +32,10 @@ public class PreferenceAction extends UpdateAction {
public void actionPerformed(ActionEvent e) {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final PreferencePane preferencePane = new PreferencePane();
// 将当前环境配置填充到PreferencePane中
preferencePane.populate(DesignerEnvManager.getEnvManager());
BasicDialog basicDialog = preferencePane.showWindow(designerFrame);
basicDialog.setButtonEnabled(false);
// 将当前环境配置填充到PreferencePane中
preferencePane.populate(basicDialog, DesignerEnvManager.getEnvManager());
basicDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
preferencePane.update(DesignerEnvManager.getEnvManager());

37
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -870,7 +870,7 @@ public class PreferencePane extends BasicPane {
*
* @param designerEnvManager 设计器环境管理器
*/
public void populate(DesignerEnvManager designerEnvManager) {
public void populate(BasicDialog basicDialog, DesignerEnvManager designerEnvManager) {
if (designerEnvManager == null) {
return;
}
@ -880,6 +880,8 @@ public class PreferencePane extends BasicPane {
loadVersionControlSettings(designerEnvManager);
// 高级
loadAdvanceSettings(designerEnvManager);
// 异步加载配置后启用面板确认按钮
loadConfigsAsync(basicDialog);
}
/**
@ -952,20 +954,26 @@ public class PreferencePane extends BasicPane {
previewResolutionBtnM.setEnabled(enabled);
// 设计器启动选项-延迟启动云端运维模块
this.cloudAnalyticsDelayCheckBox.setSelected(designerEnvManager.isCloudAnalyticsDelay());
// 异步加载高级配置
loadAdvanceConfigAsync();
}
private void loadAdvanceConfigAsync() {
private void loadConfigsAsync(BasicDialog dialog) {
List<Supplier<Object>> advanceConfigLoaders = Arrays.asList(
GcConfig.getInstance()::isGcEnable,
ServerPreferenceConfig.getInstance()::isUseUniverseDBM,
ReportConfigManager.getProviderInstance()::getImageExportAttr
ReportConfigManager.getProviderInstance()::getImageExportAttr,
VcsConfig.getInstance()::isUseV2AutoClean,
VcsConfig.getInstance()::getV2CleanInterval,
VcsConfig.getInstance()::getV2RetainInterval,
() -> null
);
List<Consumer<Object>> advanceConfigUpdaters = Arrays.asList(
gcEnable -> updateGcConfigUI((Boolean) gcEnable),
useUniverseDBM -> useUniverseDBMCheckbox.setSelected((Boolean) useUniverseDBM),
imageExportAttr -> updateImageExportUI((ImageExportAttr) imageExportAttr)
imageExportAttr -> updateImageExportUI((ImageExportAttr) imageExportAttr),
useV2AutoClean -> useVcsAutoCleanScheduleCheckBox.setSelected(true),
v2CleanInterval -> autoCleanIntervalComboBox.setSelectedIndex(getIndex((Integer) v2CleanInterval)),
v2RetainInterval -> autoCleanRetainIntervalComboBox.setSelectedIndex(getIndex((Integer) v2RetainInterval)),
obj -> dialog.setButtonEnabled(true)
);
UIUtil.loadConfigsAndUpdateUI(advanceConfigLoaders, advanceConfigUpdaters);
}
@ -989,6 +997,7 @@ public class PreferencePane extends BasicPane {
vcsEnableCheckBox.setEnabled(false);
vcsEnableCheckBox.setSelected(false);
}
useVcsAutoSaveScheduleCheckBox.setSelected(vcsConfigManager.isUseAutoSave());
autoSaveIntervalEditor.setValue(vcsConfigManager.getAutoSaveInterval());
//版本管理-存储与清理机制
if (!vcsEnableCheckBox.isSelected()) {
@ -999,22 +1008,6 @@ public class PreferencePane extends BasicPane {
saveIntervalEditor.setValue(vcsConfigManager.getSaveInterval());
saveCommitCheckBox.setSelected(vcsConfigManager.isSaveCommit());
useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval());
// 异步加载版本管理配置
loadVersionControlConfigsAsync();
}
private void loadVersionControlConfigsAsync() {
List<Supplier<Object>> vcsConfigLoaders = Arrays.asList(
VcsConfig.getInstance()::isUseV2AutoClean,
VcsConfig.getInstance()::getV2CleanInterval,
VcsConfig.getInstance()::getV2RetainInterval
);
List<Consumer<Object>> vcsConfigUpdaters = Arrays.asList(
useV2AutoClean -> useVcsAutoSaveScheduleCheckBox.setSelected((Boolean) useV2AutoClean),
v2CleanInterval -> autoCleanIntervalComboBox.setSelectedIndex(getIndex((Integer) v2CleanInterval)),
v2RetainInterval -> autoCleanRetainIntervalComboBox.setSelectedIndex(getIndex((Integer) v2RetainInterval))
);
UIUtil.loadConfigsAndUpdateUI(vcsConfigLoaders, vcsConfigUpdaters);
}
private void updateGcConfigUI(Boolean gcEnable) {

Loading…
Cancel
Save