|
|
@ -12,7 +12,6 @@ import com.fr.form.ui.DataControl; |
|
|
|
import com.fr.form.ui.ElementCaseEditor; |
|
|
|
import com.fr.form.ui.ElementCaseEditor; |
|
|
|
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.main.parameter.ReportParameterAttr; |
|
|
|
|
|
|
|
import com.fr.script.Calculator; |
|
|
|
import com.fr.script.Calculator; |
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
import com.fr.stable.js.WidgetName; |
|
|
|
import com.fr.stable.js.WidgetName; |
|
|
@ -20,35 +19,38 @@ import com.fr.stable.js.WidgetName; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm> { |
|
|
|
public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm<Form>> { |
|
|
|
|
|
|
|
|
|
|
|
public FormModelAdapter(BaseJForm jForm) { |
|
|
|
public FormModelAdapter(BaseJForm<Form> jForm) { |
|
|
|
super(jForm); |
|
|
|
super(jForm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 环境改变. |
|
|
|
* 环境改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void envChanged() { |
|
|
|
public void envChanged() { |
|
|
|
WidgetToolBarPane.refresh(); |
|
|
|
WidgetToolBarPane.refresh(); |
|
|
|
jTemplate.refreshAllNameWidgets(); |
|
|
|
jTemplate.refreshAllNameWidgets(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 参数改变. |
|
|
|
* 参数改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void parameterChanged() { |
|
|
|
public void parameterChanged() { |
|
|
|
//实时更新参数
|
|
|
|
//实时更新参数
|
|
|
|
jTemplate.populateParameter(); |
|
|
|
jTemplate.populateParameter(); |
|
|
|
} |
|
|
|
// 更新缓存的参数
|
|
|
|
|
|
|
|
updateCachedParameter(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 控件配置改变. |
|
|
|
* 控件配置改变. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void widgetConfigChanged() { |
|
|
|
public void widgetConfigChanged() { |
|
|
|
WidgetToolBarPane.refresh(); |
|
|
|
WidgetToolBarPane.refresh(); |
|
|
|
jTemplate.refreshAllNameWidgets(); |
|
|
|
jTemplate.refreshAllNameWidgets(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 重命名TableData后的一些操作 |
|
|
|
* 重命名TableData后的一些操作 |
|
|
@ -57,81 +59,80 @@ public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm> { |
|
|
|
* @param newName 新名字. |
|
|
|
* @param newName 新名字. |
|
|
|
* @return 返回是否名字一样. |
|
|
|
* @return 返回是否名字一样. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean renameTableData(String oldName, String newName) { |
|
|
|
public boolean renameTableData(String oldName, String newName) { |
|
|
|
if (super.renameTableData(oldName, newName)) { |
|
|
|
if (super.renameTableData(oldName, newName)) { |
|
|
|
jTemplate.refreshSelectedWidget(); |
|
|
|
jTemplate.refreshSelectedWidget(); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<WidgetName> getWidgetsName() { |
|
|
|
public List<WidgetName> getWidgetsName() { |
|
|
|
final List<WidgetName> list = new ArrayList<WidgetName>(); |
|
|
|
final List<WidgetName> list = new ArrayList<WidgetName>(); |
|
|
|
Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { |
|
|
|
Form.traversalFormWidget(this.getBook().getContainer(), new WidgetGatherAdapter() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void dealWith(Widget widget) { |
|
|
|
public void dealWith(Widget widget) { |
|
|
|
if (widget instanceof DataControl || widget instanceof MultiFileEditor) { |
|
|
|
if (widget instanceof DataControl || widget instanceof MultiFileEditor) { |
|
|
|
list.add(new WidgetName(widget.getWidgetName())); |
|
|
|
list.add(new WidgetName(widget.getWidgetName())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
return list; |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取可以被超链的对象,表单主体中的所有控件 |
|
|
|
* 获取可以被超链的对象,表单主体中的所有控件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Widget[] getLinkableWidgets() { |
|
|
|
public Widget[] getLinkableWidgets() { |
|
|
|
final ArrayList<Widget> linkAbleList = new ArrayList<Widget>(); |
|
|
|
final ArrayList<Widget> linkAbleList = new ArrayList<Widget>(); |
|
|
|
final JForm currentJForm = ((JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
final JForm currentJForm = ((JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); |
|
|
|
Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { |
|
|
|
Form.traversalWidget(currentJForm.getRootLayout(), new WidgetGatherAdapter() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean dealWithAllCards() { |
|
|
|
public boolean dealWithAllCards() { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void dealWith(Widget widget) { |
|
|
|
public void dealWith(Widget widget) { |
|
|
|
boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); |
|
|
|
boolean isSupportAsHypelink = widget.acceptType(ElementCaseEditor.class) || widget.acceptType(BaseChartEditor.class); |
|
|
|
//可以超链的对象不包含本身; 目前只有图表和报表块可以
|
|
|
|
//可以超链的对象不包含本身; 目前只有图表和报表块可以
|
|
|
|
// bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己
|
|
|
|
// bug66182 删了条件:!ComparatorUtils.equals(editingECName, widget.getWidgetName()) 让当前表单对象可以选到自己
|
|
|
|
if (isSupportAsHypelink) { |
|
|
|
if (isSupportAsHypelink) { |
|
|
|
linkAbleList.add(widget); |
|
|
|
linkAbleList.add(widget); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, Widget.class); |
|
|
|
}, Widget.class); |
|
|
|
|
|
|
|
|
|
|
|
return linkAbleList.toArray(new Widget[linkAbleList.size()]); |
|
|
|
return linkAbleList.toArray(new Widget[linkAbleList.size()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 报表参数
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Parameter[] getReportParameters() { |
|
|
|
protected Parameter[] getLatestTemplateParameters() { |
|
|
|
Parameter[] rpa = this.getBook().getTemplateParameters(); |
|
|
|
Parameter[] rpa = this.getBook().getTemplateParameters(); |
|
|
|
return rpa == null ? new Parameter[0] : rpa; |
|
|
|
return rpa == null ? new Parameter[0] : rpa; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 数据源参数
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected Parameter[] getLatestTableDataParameters() { |
|
|
|
public Parameter[] getTableDataParameters() { |
|
|
|
TableDataSource source = this.getBook(); |
|
|
|
TableDataSource source = this.getBook(); |
|
|
|
Calculator c = Calculator.createCalculator(); |
|
|
|
Calculator c = Calculator.createCalculator(); |
|
|
|
c.setAttribute(TableDataSource.KEY, source); |
|
|
|
c.setAttribute(TableDataSource.KEY, source); |
|
|
|
java.util.List<ParameterProvider> list = new java.util.ArrayList<ParameterProvider>(); |
|
|
|
java.util.List<ParameterProvider> list = new java.util.ArrayList<ParameterProvider>(); |
|
|
|
java.util.Iterator<String> nameIt = this.getBook().getTableDataNameIterator(); |
|
|
|
java.util.Iterator<String> nameIt = this.getBook().getTableDataNameIterator(); |
|
|
|
while (nameIt.hasNext()) { |
|
|
|
while (nameIt.hasNext()) { |
|
|
|
TableData td = source.getTableData(nameIt.next()); |
|
|
|
TableData td = source.getTableData(nameIt.next()); |
|
|
|
if (td.getParameters(c) != null) { |
|
|
|
if (td.getParameters(c) != null) { |
|
|
|
list.addAll(java.util.Arrays.asList(td.getParameters(c))); |
|
|
|
list.addAll(java.util.Arrays.asList(td.getParameters(c))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return list.toArray(new Parameter[list.size()]); |
|
|
|
return list.toArray(new Parameter[list.size()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected Parameter[] getLatestParameters() { |
|
|
|
public Parameter[] getParameters() { |
|
|
|
return this.getBook().getParameters(); |
|
|
|
return this.getBook().getParameters(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |