|
|
|
@ -2,20 +2,17 @@ package com.fr.design.mainframe;
|
|
|
|
|
|
|
|
|
|
import com.fr.base.Parameter; |
|
|
|
|
import com.fr.base.TableData; |
|
|
|
|
import com.fr.base.parameter.ParameterUI; |
|
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
|
import com.fr.design.DesignModelAdapter; |
|
|
|
|
import com.fr.design.bridge.DesignToolbarProvider; |
|
|
|
|
import com.fr.form.ui.Widget; |
|
|
|
|
import com.fr.main.impl.WorkBook; |
|
|
|
|
import com.fr.main.impl.WorkBookHelper; |
|
|
|
|
import com.fr.main.parameter.ReportParameterAttr; |
|
|
|
|
import com.fr.report.cell.CellElement; |
|
|
|
|
import com.fr.report.cell.DefaultTemplateCellElement; |
|
|
|
|
import com.fr.report.cell.FloatElement; |
|
|
|
|
import com.fr.report.elementcase.ElementCase; |
|
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
|
import com.fr.report.report.Report; |
|
|
|
|
import com.fr.script.Calculator; |
|
|
|
|
import com.fr.stable.Filter; |
|
|
|
|
import com.fr.stable.ParameterProvider; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.bridge.StableFactory; |
|
|
|
@ -31,6 +28,7 @@ import java.util.List;
|
|
|
|
|
*/ |
|
|
|
|
public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WorkBookModelAdapter(JWorkBook jworkbook) { |
|
|
|
|
super(jworkbook); |
|
|
|
|
} |
|
|
|
@ -116,42 +114,21 @@ public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook
|
|
|
|
|
* |
|
|
|
|
* @return widgetName 控件列表. |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<WidgetName> getWidgetsName() { |
|
|
|
|
List<WidgetName> list = new ArrayList<WidgetName>(); |
|
|
|
|
WorkBook wb = this.getBook(); |
|
|
|
|
ReportParameterAttr parameterAttr = wb.getReportParameterAttr(); |
|
|
|
|
if (parameterAttr != null) { |
|
|
|
|
ParameterUI parameterUI = parameterAttr.getParameterUI(); |
|
|
|
|
if (parameterUI != null) { |
|
|
|
|
Widget[] paraWidgets = parameterUI.getAllWidgets(); |
|
|
|
|
for (int i = 0; i < paraWidgets.length; i++) { |
|
|
|
|
Widget wi = paraWidgets[i]; |
|
|
|
|
if (widgetAccepted(wi)) { |
|
|
|
|
list.add(new WidgetName(wi.getWidgetName())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return WorkBookHelper.listWidgetNamesInWorkBook(wb, new Filter<Widget>() { |
|
|
|
|
@Override |
|
|
|
|
public boolean accept(Widget widget) { |
|
|
|
|
return widgetAccepted(widget); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0, len = wb.getReportCount(); i < len; i++) { |
|
|
|
|
Report report = wb.getReport(i); |
|
|
|
|
Iterator it = report.iteratorOfElementCase(); |
|
|
|
|
while (it.hasNext()) { |
|
|
|
|
ElementCase ec = (ElementCase) it.next(); |
|
|
|
|
Iterator cs = ec.cellIterator(); |
|
|
|
|
while (cs.hasNext()) { |
|
|
|
|
CellElement ce = (CellElement) cs.next(); |
|
|
|
|
if (ce instanceof DefaultTemplateCellElement) { |
|
|
|
|
Widget widget = ((DefaultTemplateCellElement) ce).getWidget(); |
|
|
|
|
//todo 这边有没有必要统一改成widgetAccepted?暂时不改,插件那边可能会有影响,因为插件有的控件并没有实现DataControl的
|
|
|
|
|
if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) { |
|
|
|
|
list.add(new WidgetName(widget.getWidgetName())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, new Filter<Widget>() { |
|
|
|
|
@Override |
|
|
|
|
public boolean accept(Widget widget) { |
|
|
|
|
//todo 这边有没有必要统一改成widgetAccepted?暂时不改,插件那边可能会有影响,因为插件有的控件并没有实现DataControl的
|
|
|
|
|
return widget != null && StringUtils.isNotEmpty(widget.getWidgetName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|