|
|
@ -3,6 +3,8 @@ package com.fr.design; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
import com.fr.base.Parameter; |
|
|
|
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.design.file.HistoryTemplateListCache; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplateProvider; |
|
|
|
import com.fr.design.mainframe.JTemplateProvider; |
|
|
|
import com.fr.form.ui.Widget; |
|
|
|
import com.fr.form.ui.Widget; |
|
|
@ -14,68 +16,159 @@ import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当前的设计器模式 |
|
|
|
* 设计器模式 FormModel or WorkBookModel |
|
|
|
|
|
|
|
* <p> |
|
|
|
|
|
|
|
* 指的是编辑的模板是普通报表还是决策报表 |
|
|
|
* |
|
|
|
* |
|
|
|
* @author zhou |
|
|
|
* @author zhou |
|
|
|
* @since 2012-7-26上午11:24:54 |
|
|
|
* @since 2012-7-26上午11:24:54 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplateProvider> { |
|
|
|
public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplateProvider<T>> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 当前的设计模式 FormModel or WorkBookModel |
|
|
|
|
|
|
|
*/ |
|
|
|
private static DesignModelAdapter<?, ?> currentModelAdapter; |
|
|
|
private static DesignModelAdapter<?, ?> currentModelAdapter; |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 模板 |
|
|
|
|
|
|
|
*/ |
|
|
|
protected S jTemplate; |
|
|
|
protected S jTemplate; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 全部的参数,包括全局参数,模板参数和数据集参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Parameter[] parameters; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 数据集参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Parameter[] tableDataParameters; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 模板参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private Parameter[] templateParameters; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DesignModelAdapter(S jTemplate) { |
|
|
|
public DesignModelAdapter(S jTemplate) { |
|
|
|
this.jTemplate = jTemplate; |
|
|
|
this.jTemplate = jTemplate; |
|
|
|
|
|
|
|
updateCachedParameter(); |
|
|
|
setCurrentModelAdapter(this); |
|
|
|
setCurrentModelAdapter(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void setCurrentModelAdapter(DesignModelAdapter<?, ?> model) { |
|
|
|
|
|
|
|
currentModelAdapter = model; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static DesignModelAdapter<?, ?> getCurrentModelAdapter() { |
|
|
|
|
|
|
|
return currentModelAdapter; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取当前编辑的模板 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return template |
|
|
|
|
|
|
|
* @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) |
|
|
|
|
|
|
|
* @see HistoryTemplateListCache#getCurrentEditingTemplate() |
|
|
|
|
|
|
|
* @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Deprecated |
|
|
|
public S getjTemplate() { |
|
|
|
public S getjTemplate() { |
|
|
|
return jTemplate; |
|
|
|
return jTemplate; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设置当前编辑的模板 |
|
|
|
|
|
|
|
* 不要脱离上下文直接调用 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param jTemplate jt |
|
|
|
|
|
|
|
* @see DesignerFrameFileDealerPane#setCurrentEditingTemplate(JTemplate) |
|
|
|
|
|
|
|
* @deprecated use {@link HistoryTemplateListCache#setCurrentEditingTemplate(JTemplate)} instead |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Deprecated |
|
|
|
public void setjTemplate(S jTemplate) { |
|
|
|
public void setjTemplate(S jTemplate) { |
|
|
|
this.jTemplate = jTemplate; |
|
|
|
this.jTemplate = jTemplate; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public T getBook() { |
|
|
|
public T getBook() { |
|
|
|
return (T) ((JTemplate) jTemplate).getTarget(); |
|
|
|
return jTemplate.getTarget(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void setCurrentModelAdapter(DesignModelAdapter<?, ?> model) { |
|
|
|
|
|
|
|
currentModelAdapter = model; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static DesignModelAdapter<?, ?> getCurrentModelAdapter() { |
|
|
|
|
|
|
|
return currentModelAdapter; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 响应目标改变事件. |
|
|
|
* 响应正在编辑的模板改变事件. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void fireTargetModified() { |
|
|
|
public void fireTargetModified() { |
|
|
|
((JTemplate) this.jTemplate).fireTargetModified(); |
|
|
|
this.jTemplate.fireTargetModified(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取悬浮元素名称数组 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return String[] 悬浮元素名称数组 |
|
|
|
|
|
|
|
*/ |
|
|
|
public String[] getFloatNames() { |
|
|
|
public String[] getFloatNames() { |
|
|
|
return new String[0]; |
|
|
|
return new String[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取编辑模板的所有参数 |
|
|
|
|
|
|
|
* <p> |
|
|
|
|
|
|
|
* 由于在参数面板拖动过程中频繁获取 |
|
|
|
|
|
|
|
* 远程设计时数据集参数rpc 调用需要考虑网络等因素,因此会比较缓慢,引起参数面板拖动卡顿, |
|
|
|
|
|
|
|
* 所以缓存一下,并且在参数改动时及时缓存 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return Parameter[] 模板的所有参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
public Parameter[] getParameters() { |
|
|
|
public Parameter[] getParameters() { |
|
|
|
return new Parameter[0]; |
|
|
|
return parameters == null ? new Parameter[0] : parameters; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 报表参数
|
|
|
|
/** |
|
|
|
|
|
|
|
* 模板参数(报表参数) |
|
|
|
|
|
|
|
* <p> |
|
|
|
|
|
|
|
* 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return Parameter[] 模板参数 |
|
|
|
|
|
|
|
* @deprecated use {@link DesignModelAdapter#getTemplateParameters()} instead |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Deprecated |
|
|
|
public Parameter[] getReportParameters() { |
|
|
|
public Parameter[] getReportParameters() { |
|
|
|
return new Parameter[0]; |
|
|
|
return getTableDataParameters(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 模板参数(报表参数) |
|
|
|
|
|
|
|
* <p> |
|
|
|
|
|
|
|
* 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return Parameter[] 模板参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public Parameter[] getTemplateParameters() { |
|
|
|
|
|
|
|
return templateParameters == null ? new Parameter[0] : templateParameters; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 数据源参数 |
|
|
|
* 数据源参数 |
|
|
|
|
|
|
|
* <p> |
|
|
|
|
|
|
|
* 既然全部参数都,那么这个也缓存一下,并且在参数改动时及时缓存 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return Parameter[] 数据源参数 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Parameter[] getTableDataParameters() { |
|
|
|
public Parameter[] getTableDataParameters() { |
|
|
|
return new Parameter[0]; |
|
|
|
return tableDataParameters == null ? new Parameter[0] : tableDataParameters; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 重命名TableData后的一些操作 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param oldName 旧名字 |
|
|
|
|
|
|
|
* @param newName 新名字. |
|
|
|
|
|
|
|
* @return 返回是否名字一样. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean renameTableData(String oldName, String newName) { |
|
|
|
|
|
|
|
return renameTableData(oldName, newName, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -101,17 +194,6 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 重命名TableData后的一些操作 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param oldName 旧名字 |
|
|
|
|
|
|
|
* @param newName 新名字. |
|
|
|
|
|
|
|
* @return 返回是否名字一样. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean renameTableData(String oldName, String newName) { |
|
|
|
|
|
|
|
return renameTableData(oldName, newName, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 重命名tabledata |
|
|
|
* 重命名tabledata |
|
|
|
* |
|
|
|
* |
|
|
@ -128,10 +210,23 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public abstract Widget[] getLinkableWidgets() ; |
|
|
|
public abstract Widget[] getLinkableWidgets(); |
|
|
|
|
|
|
|
|
|
|
|
public abstract List<WidgetName> getWidgetsName(); |
|
|
|
public abstract List<WidgetName> getWidgetsName(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新缓存的参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void updateCachedParameter() { |
|
|
|
|
|
|
|
// 全部参数
|
|
|
|
|
|
|
|
this.parameters = getLatestParameters(); |
|
|
|
|
|
|
|
// 数据及参数
|
|
|
|
|
|
|
|
this.tableDataParameters = getLatestTableDataParameters(); |
|
|
|
|
|
|
|
// 模板参数
|
|
|
|
|
|
|
|
this.templateParameters = getLatestTemplateParameters(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 环境改变. |
|
|
|
* 环境改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -146,4 +241,19 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate |
|
|
|
* 控件配置改变. |
|
|
|
* 控件配置改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract void widgetConfigChanged(); |
|
|
|
public abstract void widgetConfigChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取变更后的模板参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected abstract Parameter[] getLatestTemplateParameters(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取变更后的数据集参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected abstract Parameter[] getLatestTableDataParameters(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取变更后的全部参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected abstract Parameter[] getLatestParameters(); |
|
|
|
} |
|
|
|
} |