|
|
@ -1,8 +1,11 @@ |
|
|
|
package com.fr.design; |
|
|
|
package com.fr.design; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
|
|
|
|
import com.fr.base.ParameterConfig; |
|
|
|
|
|
|
|
import com.fr.base.TableData; |
|
|
|
import com.fr.base.io.BaseBook; |
|
|
|
import com.fr.base.io.BaseBook; |
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
|
|
|
|
import com.fr.data.operator.DataOperator; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
|
|
|
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
@ -11,9 +14,14 @@ import com.fr.form.ui.DataControl; |
|
|
|
import com.fr.form.ui.MultiFileEditor; |
|
|
|
import com.fr.form.ui.MultiFileEditor; |
|
|
|
import com.fr.form.ui.Widget; |
|
|
|
import com.fr.form.ui.Widget; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
|
|
|
import com.fr.stable.Filter; |
|
|
|
|
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.js.WidgetName; |
|
|
|
import com.fr.stable.js.WidgetName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.util.ParameterApplyHelper; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
@ -40,7 +48,7 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 全部的参数,包括全局参数,模板参数和数据集参数 |
|
|
|
* 全部的参数,包括全局参数,模板参数和数据集参数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Parameter[] parameters; |
|
|
|
protected Parameter[] parameters; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 数据集参数 |
|
|
|
* 数据集参数 |
|
|
@ -52,6 +60,12 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Parameter[] templateParameters; |
|
|
|
private Parameter[] templateParameters; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 数据集参数缓存 更新时刷新 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected Map<String, ParameterProvider[]> tableDataParametersMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DesignModelAdapter(S jTemplate) { |
|
|
|
public DesignModelAdapter(S jTemplate) { |
|
|
|
this.jTemplate = jTemplate; |
|
|
|
this.jTemplate = jTemplate; |
|
|
@ -241,6 +255,79 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void addTableDataParameters(Map<String, ParameterProvider> map, Filter<ParameterProvider> filter) { |
|
|
|
|
|
|
|
Iterator<String> it = this.getBook().getTableDataNameIterator(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
// 清空下缓存
|
|
|
|
|
|
|
|
tableDataParametersMap.clear(); |
|
|
|
|
|
|
|
while (it.hasNext()) { |
|
|
|
|
|
|
|
String name = it.next(); |
|
|
|
|
|
|
|
TableData tableData = this.getBook().getTableData(name); |
|
|
|
|
|
|
|
ParameterProvider[] parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData); |
|
|
|
|
|
|
|
if (filter != null) { |
|
|
|
|
|
|
|
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ParameterApplyHelper.addPara2Map(map, parameterProviders); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
tableDataParametersMap.put(name, parameterProviders); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void updateTableDataParameters(String oldName, |
|
|
|
|
|
|
|
String tdName, |
|
|
|
|
|
|
|
TableData tableData, |
|
|
|
|
|
|
|
Map<String, ParameterProvider> map, |
|
|
|
|
|
|
|
Filter<ParameterProvider> filter) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ParameterProvider[] providers = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ComparatorUtils.equals(oldName, tdName)) { |
|
|
|
|
|
|
|
// 更新下缓存名称 替换下数据集名称
|
|
|
|
|
|
|
|
providers = tableDataParametersMap.remove(oldName); |
|
|
|
|
|
|
|
if (providers != null) { |
|
|
|
|
|
|
|
tableDataParametersMap.put(tdName, providers); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
for (Map.Entry<String, ParameterProvider[]> entry : tableDataParametersMap.entrySet()) { |
|
|
|
|
|
|
|
ParameterProvider[] parameterProviders; |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(entry.getKey(), tdName)) { |
|
|
|
|
|
|
|
parameterProviders = DataOperator.getInstance().getTableDataParameters(tableData); |
|
|
|
|
|
|
|
// 用来更新缓存
|
|
|
|
|
|
|
|
providers = parameterProviders; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
parameterProviders = entry.getValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (filter != null) { |
|
|
|
|
|
|
|
ParameterApplyHelper.addPara2Map(map, parameterProviders, filter); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ParameterApplyHelper.addPara2Map(map, parameterProviders); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (providers != null) { |
|
|
|
|
|
|
|
// 更新缓存
|
|
|
|
|
|
|
|
tableDataParametersMap.put(tdName, providers); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void addGlobalParameters(Map<String, ParameterProvider> map) { |
|
|
|
|
|
|
|
// 添加全局参数
|
|
|
|
|
|
|
|
Parameter[] glbParas = ParameterConfig.getInstance().getGlobalParameters(); |
|
|
|
|
|
|
|
ParameterApplyHelper.addPara2Map(map, glbParas); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 环境改变. |
|
|
|
* 环境改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -251,6 +338,11 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract void parameterChanged(); |
|
|
|
public abstract void parameterChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 数据集参数改变 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public abstract void tableDataParametersChanged(String oldName, String tdName, TableData tableData); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 控件配置改变. |
|
|
|
* 控件配置改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|