Browse Source

REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加

feature/big-screen
Henry.Wang 4 years ago
parent
commit
3470b1c373
  1. 6
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  2. 45
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  3. 2
      designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java

6
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();

45
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());

2
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();

Loading…
Cancel
Save