diff --git a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java index 84fd684ae8..24dd314844 100644 --- a/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/DesignModelAdapter.java @@ -7,8 +7,11 @@ import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplateProvider; +import com.fr.form.ui.DataControl; +import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; import com.fr.stable.js.WidgetName; import java.util.Iterator; @@ -214,6 +217,17 @@ public abstract class DesignModelAdapter getWidgetsName(); + /** + * 判断是否是值编辑器可以设置的控件类型 + * @param widget 控件 + * @return 可以设置返回true,否则返回false + */ + public boolean widgetAccepted(Widget widget) { + return widget != null + && StringUtils.isNotEmpty(widget.getWidgetName()) + && (widget instanceof DataControl || widget instanceof MultiFileEditor); + } + /** * 更新缓存的参数 */ diff --git a/designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java b/designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java index 685c81a921..ffcfef58bc 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java @@ -17,6 +17,7 @@ public interface ParameterWidgetOptionProvider extends Mutable { /** * 自定义参数控件的实际类,该类需要继承自com.fr.form.ui.Widget + * 如果有控件值属性,该类需要实现DataControl接口,否则可能有部分功能无法使用,比如:值编辑器选择控件的时候无法找到插件里的控件 * @return 控件类 */ Class classForWidget(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index 090969d348..abe0c97e86 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -8,9 +8,7 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.form.main.Form; import com.fr.form.main.WidgetGatherAdapter; import com.fr.form.ui.BaseChartEditor; -import com.fr.form.ui.DataControl; import com.fr.form.ui.ElementCaseEditor; -import com.fr.form.ui.MultiFileEditor; import com.fr.form.ui.Widget; import com.fr.script.Calculator; import com.fr.stable.ParameterProvider; @@ -74,7 +72,7 @@ public class FormModelAdapter extends DesignModelAdapter> @Override public void dealWith(Widget widget) { - if (widget instanceof DataControl || widget instanceof MultiFileEditor) { + if (widgetAccepted(widget)) { list.add(new WidgetName(widget.getWidgetName())); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java index 1e55d3c9b0..7b292c3a16 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java @@ -2,6 +2,7 @@ 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; @@ -118,6 +119,20 @@ public class WorkBookModelAdapter extends DesignModelAdapter getWidgetsName() { List list = new ArrayList(); 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())); + } + } + } + } + for (int i = 0, len = wb.getReportCount(); i < len; i++) { Report report = wb.getReport(i); Iterator it = report.iteratorOfElementCase(); @@ -128,6 +143,7 @@ public class WorkBookModelAdapter extends DesignModelAdapter