diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java index 5d716b0287..4ad36b0f34 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java +++ b/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()); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 665bb518b9..049d0d69a8 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/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> 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> 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> vcsConfigLoaders = Arrays.asList( - VcsConfig.getInstance()::isUseV2AutoClean, - VcsConfig.getInstance()::getV2CleanInterval, - VcsConfig.getInstance()::getV2RetainInterval - ); - List> 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) {