From 3470b1c3730f4d512e822541b9c0bb935bb5e8ad Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Wed, 5 Aug 2020 20:02:03 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-35569=20=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=8E=A7=E4=BB=B6=EF=BC=8C=E6=92=A4=E9=94=80=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=B7=BB=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=BC=9A=E7=A9=BA=E4=B8=80=E4=B8=AA=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parameter/ParameterDesignerProvider.java | 6 ++- .../form/parameter/FormParaDesigner.java | 45 ++++++++++++++++++- .../parameter/ParameterDefinitePane.java | 2 +- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java index e0b69fea05..efafa7cb2e 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java +++ b/designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java @@ -48,7 +48,11 @@ public interface ParameterDesignerProvider { boolean addingParameter2EditorWithQueryButton(Parameter parameter, int index); - int addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); + void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); + + default int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) { + return 0; + } JPanel[] toolbarPanes4Form(); diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index b918850616..95fb284589 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -637,9 +637,50 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP * * @param parameterArray 参数 c * @param currentIndex 位置 w - * @return currentIndex的最新值 + * @return 是否加入 s + */ + public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { + for (int i = 0; i < parameterArray.length; i++) { + com.fr.form.ui.Label label = new com.fr.form.ui.Label(); + label.setWidgetName("Label" + parameterArray[i].getName()); + label.setWidgetValue(new WidgetValue(parameterArray[i].getName() + ":")); + XCreator xCreator = XCreatorUtils.createXCreator(label); + + if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + + FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + break; + } + // 每行显示5组 + EditorHolder editor = new EditorHolder(parameterArray[i]); + editor.setWidgetName(parameterArray[i].getName()); + xCreator = XCreatorUtils.createXCreator(editor); + if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + + SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + break; + } + currentIndex++; + } + if (!isWithQueryButton()) { + FormSubmitButton formSubmitButton = new FormSubmitButton(); + formSubmitButton.setWidgetName("Search"); + formSubmitButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Query")); + XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton); + if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION + + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + return; + } + } + } + + /** + * @Description: 添加所有的参数,并返回当前的currentIndex。此方法为addingAllParameter2Editor的兼容方法。 + * @param parameterArray 参数数组 + * @param currentIndex 添加所有参数前的index值 + * @return: 添加所有参数后的index值 + * @Author: Henry.Wang + * @date: 2020/8/5 19:40 */ - public int addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { + public int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) { for (int i = 0; i < parameterArray.length; i++) { com.fr.form.ui.Label label = new com.fr.form.ui.Label(); label.setWidgetName("Label" + parameterArray[i].getName()); diff --git a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java index 74f1435a4d..11ae412ece 100644 --- a/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java @@ -458,7 +458,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus return; } - currentIndex = paraDesignEditor.addingAllParameter2Editor(parameterArray, currentIndex); + currentIndex = paraDesignEditor.addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex); parameterArray = null; refreshParameter();