|
|
|
@ -42,6 +42,7 @@ import com.fr.design.mainframe.vcs.common.VcsHelper;
|
|
|
|
|
import com.fr.design.mainframe.vcs.ui.UIPositiveIntEditor; |
|
|
|
|
import com.fr.design.mainframe.vcs.ui.VcsMovePanel; |
|
|
|
|
import com.fr.design.os.impl.SupportOSImpl; |
|
|
|
|
import com.fr.design.ui.util.UIUtil; |
|
|
|
|
import com.fr.design.unit.UnitConvertUtil; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.design.widget.FRWidgetFactory; |
|
|
|
@ -55,6 +56,7 @@ import com.fr.log.FineLoggerFactory;
|
|
|
|
|
import com.fr.report.ReportConfigManager; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
import com.fr.third.apache.logging.log4j.Level; |
|
|
|
|
import com.fr.third.guava.base.Supplier; |
|
|
|
|
import com.fr.third.guava.collect.BiMap; |
|
|
|
|
import com.fr.third.guava.collect.HashBiMap; |
|
|
|
|
import com.fr.transaction.Configurations; |
|
|
|
@ -67,6 +69,9 @@ import com.fr.workspace.server.vcs.VcsConfig;
|
|
|
|
|
import com.fr.workspace.server.vcs.git.config.GcConfig; |
|
|
|
|
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanSchedule; |
|
|
|
|
import com.fr.workspace.server.vcs.v2.scheduler.VcsAutoCleanService; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.function.Consumer; |
|
|
|
|
import java.util.List; |
|
|
|
|
import org.jetbrains.annotations.NotNull; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
@ -869,23 +874,33 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
if (designerEnvManager == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 常用
|
|
|
|
|
loadCommonSettings(designerEnvManager); |
|
|
|
|
// 版本管理
|
|
|
|
|
loadVersionControlSettings(designerEnvManager); |
|
|
|
|
// 高级
|
|
|
|
|
loadAdvanceSettings(designerEnvManager); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 选项-常用 |
|
|
|
|
* @param designerEnvManager |
|
|
|
|
*/ |
|
|
|
|
private void loadCommonSettings(DesignerEnvManager designerEnvManager) { |
|
|
|
|
// 功能设置
|
|
|
|
|
supportUndoCheckBox.setSelected(designerEnvManager.isSupportUndo()); |
|
|
|
|
if (designerEnvManager.isSupportUndo()) { |
|
|
|
|
maxUndoLimit.setSelectedIndex(chooseCase(designerEnvManager.getUndoLimit())); |
|
|
|
|
} else { |
|
|
|
|
maxUndoLimit.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
supportDefaultParentCalculateCheckBox.setSelected(designerEnvManager.isSupportDefaultParentCalculate()); |
|
|
|
|
|
|
|
|
|
showTemplateMissingPlugin.setSelected(designerEnvManager.isShowTemplateMissingPlugin()); |
|
|
|
|
|
|
|
|
|
this.startWithEmptyFile.setSelected(designerEnvManager.isStartWithEmptyFile()); |
|
|
|
|
// 编辑器设置
|
|
|
|
|
supportStringToFormulaBox.setSelected(designerEnvManager.isSupportStringToFormula()); |
|
|
|
|
|
|
|
|
|
shortCutLabel.setText(getDisplayShortCut(designerEnvManager.getAutoCompleteShortcuts())); |
|
|
|
|
shortCutKeyStore = convert2KeyStroke(designerEnvManager.getAutoCompleteShortcuts()); |
|
|
|
|
|
|
|
|
|
if (supportStringToFormulaBox.isSelected()) { |
|
|
|
|
defaultStringToFormulaBox.setEnabled(true); |
|
|
|
|
defaultStringToFormulaBox.setSelected(designerEnvManager.isDefaultStringToFormula()); |
|
|
|
@ -893,13 +908,74 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
defaultStringToFormulaBox.setEnabled(false); |
|
|
|
|
defaultStringToFormulaBox.setSelected(false); |
|
|
|
|
} |
|
|
|
|
// 颜色设置
|
|
|
|
|
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor()); |
|
|
|
|
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor()); |
|
|
|
|
// 语言选择
|
|
|
|
|
this.languageComboBox.setSelectedItem(designerEnvManager.getLanguage()); |
|
|
|
|
// 启动页配置
|
|
|
|
|
this.startupPageEnabledCheckBox.setSelected(designerEnvManager.isStartupPageEnabled()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 高级 |
|
|
|
|
* @param designerEnvManager |
|
|
|
|
*/ |
|
|
|
|
private void loadAdvanceSettings(DesignerEnvManager designerEnvManager) { |
|
|
|
|
// Log导出配置
|
|
|
|
|
this.logExportDirectoryField.setText(designerEnvManager.getLogLocation()); |
|
|
|
|
this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); |
|
|
|
|
// 标尺单位配置
|
|
|
|
|
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); |
|
|
|
|
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); |
|
|
|
|
// 端口设置
|
|
|
|
|
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); |
|
|
|
|
// 插件管理器选项
|
|
|
|
|
if (useOptimizedUPMCheckbox != null) { |
|
|
|
|
useOptimizedUPMCheckbox.setSelected(true); |
|
|
|
|
} |
|
|
|
|
// 显示oracle所有表
|
|
|
|
|
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); |
|
|
|
|
// 模板内存优化
|
|
|
|
|
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); |
|
|
|
|
// 产品改良
|
|
|
|
|
this.joinProductImproveCheckBox.setSelected(designerEnvManager.isJoinProductImprove()); |
|
|
|
|
if (this.autoPushUpdateCheckBox != null) { |
|
|
|
|
this.autoPushUpdateCheckBox.setSelected(designerEnvManager.isAutoPushUpdateEnabled()); |
|
|
|
|
} |
|
|
|
|
// 模板预览性能
|
|
|
|
|
this.imageCompressPanelCheckBox.setSelected(designerEnvManager.isImageCompress()); |
|
|
|
|
boolean enabled = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot(); |
|
|
|
|
previewRenderSpeed.setEnabled(enabled); |
|
|
|
|
previewRenderQuality.setEnabled(enabled); |
|
|
|
|
previewResolutionBtnS.setEnabled(enabled); |
|
|
|
|
previewResolutionBtnM.setEnabled(enabled); |
|
|
|
|
// 设计器启动选项-延迟启动云端运维模块
|
|
|
|
|
this.cloudAnalyticsDelayCheckBox.setSelected(designerEnvManager.isCloudAnalyticsDelay()); |
|
|
|
|
List<Supplier<Object>> advanceConfigLoaders = Arrays.asList( |
|
|
|
|
GcConfig.getInstance()::isGcEnable, |
|
|
|
|
ServerPreferenceConfig.getInstance()::isUseUniverseDBM, |
|
|
|
|
ReportConfigManager.getProviderInstance()::getImageExportAttr |
|
|
|
|
); |
|
|
|
|
List<Consumer<Object>> advanceConfigUpdaters = Arrays.asList( |
|
|
|
|
gcEnable -> updateGcConfigUI((Boolean) gcEnable), |
|
|
|
|
useUniverseDBM -> useUniverseDBMCheckbox.setSelected((Boolean) useUniverseDBM), |
|
|
|
|
imageExportAttr -> updateImageExportUI((ImageExportAttr) imageExportAttr) |
|
|
|
|
); |
|
|
|
|
UIUtil.loadConfigsAndUpdateUI(advanceConfigLoaders, advanceConfigUpdaters); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 选项-版本管理 |
|
|
|
|
* @param designerEnvManager |
|
|
|
|
*/ |
|
|
|
|
private void loadVersionControlSettings(DesignerEnvManager designerEnvManager) { |
|
|
|
|
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); |
|
|
|
|
//如果是集群并且是老版本则不可用
|
|
|
|
|
if (VcsHelper.getInstance().isLegacyMode() && WorkContext.getCurrent().isCluster()) { |
|
|
|
|
vcsEnableCheckBox.setEnabled(false); |
|
|
|
|
gcEnableCheckBox.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (VcsHelper.getInstance().needInit()) { |
|
|
|
|
vcsEnableCheckBox.setSelected(vcsConfigManager.isVcsEnable()); |
|
|
|
|
} else { |
|
|
|
@ -911,71 +987,40 @@ public class PreferencePane extends BasicPane {
|
|
|
|
|
saveIntervalEditor.setEnabled(false); |
|
|
|
|
useIntervalCheckBox.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
saveIntervalEditor.setValue(vcsConfigManager.getSaveInterval()); |
|
|
|
|
saveCommitCheckBox.setSelected(vcsConfigManager.isSaveCommit()); |
|
|
|
|
useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval()); |
|
|
|
|
gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable()); |
|
|
|
|
gcButton.setEnabled(gcEnableCheckBox.isSelected()); |
|
|
|
|
|
|
|
|
|
useVcsAutoSaveScheduleCheckBox.setSelected(vcsConfigManager.isUseAutoSave()); |
|
|
|
|
useVcsAutoCleanScheduleCheckBox.setSelected(VcsConfig.getInstance().isUseV2AutoClean()); |
|
|
|
|
//版本管理-存储与清理机制
|
|
|
|
|
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); |
|
|
|
|
autoSaveIntervalEditor.setValue(vcsConfigManager.getAutoSaveInterval()); |
|
|
|
|
autoCleanIntervalComboBox.setSelectedIndex(getIndex(VcsConfig.getInstance().getV2CleanInterval())); |
|
|
|
|
autoCleanRetainIntervalComboBox.setSelectedIndex(getIndex(VcsConfig.getInstance().getV2RetainInterval())); |
|
|
|
|
|
|
|
|
|
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor()); |
|
|
|
|
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor()); |
|
|
|
|
|
|
|
|
|
this.logExportDirectoryField.setText(designerEnvManager.getLogLocation()); |
|
|
|
|
|
|
|
|
|
this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); |
|
|
|
|
|
|
|
|
|
this.languageComboBox.setSelectedItem(designerEnvManager.getLanguage()); |
|
|
|
|
|
|
|
|
|
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); |
|
|
|
|
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); |
|
|
|
|
|
|
|
|
|
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); |
|
|
|
|
|
|
|
|
|
if (useOptimizedUPMCheckbox != null) { |
|
|
|
|
useOptimizedUPMCheckbox.setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); |
|
|
|
|
|
|
|
|
|
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); |
|
|
|
|
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); |
|
|
|
|
this.joinProductImproveCheckBox.setSelected(designerEnvManager.isJoinProductImprove()); |
|
|
|
|
|
|
|
|
|
if (this.autoPushUpdateCheckBox != null) { |
|
|
|
|
this.autoPushUpdateCheckBox.setSelected(designerEnvManager.isAutoPushUpdateEnabled()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.startWithEmptyFile.setSelected(designerEnvManager.isStartWithEmptyFile()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.imageCompressPanelCheckBox.setSelected(designerEnvManager.isImageCompress()); |
|
|
|
|
private void updateGcConfigUI(Boolean gcEnable) { |
|
|
|
|
gcEnableCheckBox.setSelected(gcEnable); |
|
|
|
|
gcButton.setEnabled(gcEnable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ImageExportAttr attr = ReportConfigManager.getProviderInstance().getImageExportAttr(); |
|
|
|
|
private void updateImageExportUI(ImageExportAttr attr) { |
|
|
|
|
if (attr.getPreviewRenderQuality() == ImageExportAttr.RENDER_SPEED) { |
|
|
|
|
previewRenderSpeed.setSelected(true); |
|
|
|
|
} else { |
|
|
|
|
previewRenderQuality.setSelected(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (attr.getPreviewResolutionScale() == DPI_SCALE_S) { |
|
|
|
|
previewResolutionBtnS.setSelected(true); |
|
|
|
|
} else { |
|
|
|
|
previewResolutionBtnM.setSelected(true); |
|
|
|
|
} |
|
|
|
|
boolean enabled = WorkContext.getCurrent().isLocal() || WorkContext.getCurrent().isRoot(); |
|
|
|
|
previewRenderSpeed.setEnabled(enabled); |
|
|
|
|
previewRenderQuality.setEnabled(enabled); |
|
|
|
|
previewResolutionBtnS.setEnabled(enabled); |
|
|
|
|
previewResolutionBtnM.setEnabled(enabled); |
|
|
|
|
|
|
|
|
|
this.cloudAnalyticsDelayCheckBox.setSelected(designerEnvManager.isCloudAnalyticsDelay()); |
|
|
|
|
this.startupPageEnabledCheckBox.setSelected(designerEnvManager.isStartupPageEnabled()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int chooseCase(int sign) { |
|
|
|
|