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