Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

fix-lag
Henry.Wang 3 years ago
parent
commit
6e05acab59
  1. 21
      designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java
  2. 16
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 35
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

21
designer-base/src/main/java/com/fr/design/data/DesignerStrategyConfigUtils.java → designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java

@ -26,7 +26,7 @@ import java.util.Set;
* @version 10.0
* Created by rinoux on 2020/10/28
*/
public class DesignerStrategyConfigUtils {
public class StrategyConfigAttrUtils {
/**
* 获取当前编辑模版的数据集缓存配置属性
@ -56,25 +56,6 @@ public class DesignerStrategyConfigUtils {
}
/**
* 当前编辑的模版是否被批量开启
*
* @return
*/
public static boolean isEditingTemplateRecommended() {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) {
FILE file = jTemplate.getEditingFILE();
if (file != null) {
String path = file.getPath();
return StrategyConfigService.isTemplateEnabled(path);
}
}
return false;
}
/**
* 获取模版数据集配置
*

16
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -11,7 +11,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.DesignerStrategyConfigUtils;
import com.fr.design.data.StrategyConfigAttrUtils;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane;
@ -291,10 +291,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
editingConfig.setDsName(tdName);
if (!ComparatorUtils.equals(oldName, tdName)) {
//重命名
DesignerStrategyConfigUtils.removeStrategyConfig(oldName);
StrategyConfigAttrUtils.removeStrategyConfig(oldName);
}
DesignerStrategyConfigUtils.addStrategyConfig(editingConfig);
StrategyConfigAttrUtils.addStrategyConfig(editingConfig);
}
((DBTableData) td).setDsName(tdName);
}
@ -588,7 +588,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
if (wrapper.getTableData() instanceof DBTableData) {
DBTableData td = (DBTableData) wrapper.getTableData();
StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(wrapper.getTableDataName());
StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(wrapper.getTableDataName());
if (config == null) {
result.put(td, td.isShare() ? ESDStatus.SINGLE_ON : ESDStatus.SINGLE_OFF);
} else {
@ -632,14 +632,14 @@ public class TableDataTreePane extends BasicTableDataTreePane {
StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName);
strategyConfig.setEnable(true);
strategyConfig.setUseGlobal(false);
DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig);
StrategyConfigAttrUtils.addStrategyConfig(strategyConfig);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
}
}
private @NotNull StrategyConfig getOrCreateStrategyConfig(String dsName) {
StrategyConfig config = DesignerStrategyConfigUtils.getStrategyConfig(dsName);
StrategyConfig config = StrategyConfigAttrUtils.getStrategyConfig(dsName);
if (config == null) {
config = StrategyConfigHelper.createStrategyConfig(true);
@ -680,7 +680,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
StrategyConfig strategyConfig = getOrCreateStrategyConfig(dsName);
strategyConfig.setEnable(false);
strategyConfig.setUseGlobal(false);
DesignerStrategyConfigUtils.addStrategyConfig(strategyConfig);
StrategyConfigAttrUtils.addStrategyConfig(strategyConfig);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}
}
@ -814,7 +814,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
checkButtonEnabled();
//删掉缓存配置
DesignerStrategyConfigUtils.removeStrategyConfig(selectedNO.getName());
StrategyConfigAttrUtils.removeStrategyConfig(selectedNO.getName());
// 如果一个模版是平台开启,这个数据集的配置不会存xml,预览模版时直接从全局配置copy,这样
// 导致删除的时候StrategyConfigsAttrSavedHook没有通过前后配置比较感知数据集被删除,因此不会发出事件让其失效

35
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -12,7 +12,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignerStrategyConfigUtils;
import com.fr.design.data.StrategyConfigAttrUtils;
import com.fr.design.data.datapane.ESDStrategyConfigPane;
import com.fr.design.data.datapane.connect.ConnectionTableProcedurePane;
import com.fr.design.data.datapane.preview.PreviewTablePane;
@ -106,7 +106,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
//配置
private StrategyConfig strategyConfig;
private StrategyConfigHandler configHandler;
private StrategyConfigHandler<DBTableData> configHandler;
public DBTableDataPane() {
@ -353,7 +353,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
//判断是不是模版数据集
switch (this.dbTableData.getScope()) {
case TEMPLATE:
setEsdEnableStatus(DesignerStrategyConfigUtils.isEditingTemplateRecommended(), false);
String tplPath = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath();
setEsdEnableStatus(StrategyConfigService.isTemplateEnabled(tplPath), false);
break;
case SERVER:
//不会走到这里
@ -706,21 +707,31 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
String dsName = getTableData().getDsName();
//这里为了之前兼容插件创建的配置,缓存配置不在DBTableData,而是从模版attr读取
strategyConfig = DesignerStrategyConfigUtils.getStrategyConfig(dsName);
if (strategyConfig == null || strategyConfig.isUseGlobal()) {
//模版里面没有配置,检查模版是否被开启
boolean tplEnabled = StrategyConfigService.isTemplateEnabled(tplPath);
if (tplEnabled) {
//使用全局配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true);
}
strategyConfig = StrategyConfigAttrUtils.getStrategyConfig(dsName);
if (useGlobal(getTableData(), strategyConfig, tplPath)) {
//使用全局配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true);
} else if (getTableData().isShare()) {
//使用共享数据集兼容配置
strategyConfig = StrategyConfigHelper.createStrategyConfig(true, false, true);
}
}
return strategyConfig;
}
private boolean useGlobal(DBTableData dbTableData, StrategyConfig strategyConfig, String tplPath) {
//非共享且配置为空或者指定使用全局配置时,检查是否全局开启
if (!dbTableData.isShare() && (strategyConfig == null || strategyConfig.isUseGlobal())) {
//模版里面没有配置,检查模版是否被开启
return StrategyConfigService.isTemplateEnabled(tplPath);
}
return false;
}
@Override
public void save(DBTableData saved, StrategyConfig config) {

Loading…
Cancel
Save