Browse Source

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

Merge in DESIGN/design from ~HENRY.WANG/design:release/10.0 to release/10.0

* commit 'd0622eae43b5a8dc64e4c66f82fdf9ffef23317b':
  REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加
  REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加
  REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加
feature/big-screen
Henry.Wang 4 years ago
parent
commit
5bd759ea54
  1. 4
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  2. 17
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  3. 26
      designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java

4
designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java

@ -50,6 +50,10 @@ public interface ParameterDesignerProvider {
void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex); void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex);
default int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) {
return 0;
}
JPanel[] toolbarPanes4Form(); JPanel[] toolbarPanes4Form();
JComponent[] toolBarButton4Form(); JComponent[] toolBarButton4Form();

17
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -74,7 +74,7 @@ import java.util.List;
public class FormParaDesigner extends FormDesigner implements ParameterDesignerProvider { public class FormParaDesigner extends FormDesigner implements ParameterDesignerProvider {
private static final int NUM_IN_A_LINE = 4; private static final int NUM_IN_A_LINE = 4;
private static final int H_COMPONENT_GAP = 165; private static final int H_COMPONENT_GAP = 165;
private static final int V_COMPONENT_GAP = 25; public static final int V_COMPONENT_GAP = 25;
private static final int FIRST_V_LOCATION = 35; private static final int FIRST_V_LOCATION = 35;
private static final int FIRST_H_LOCATION = 90; private static final int FIRST_H_LOCATION = 90;
private static final int SECOND_H_LOCATION = 170; private static final int SECOND_H_LOCATION = 170;
@ -640,6 +640,18 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
* @return 是否加入 s * @return 是否加入 s
*/ */
public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) { public void addingAllParameter2Editor(Parameter[] parameterArray, int currentIndex) {
addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex);
}
/**
* @param parameterArray 参数数组
* @param currentIndex 添加所有参数前的index值
* @Description: 添加所有的参数并返回当前的currentIndex此方法为addingAllParameter2Editor的兼容方法
* @return: 添加所有参数后的index值
* @Author: Henry.Wang
* @date: 2020/8/5 19:40
*/
public int addingAllParameter2EditorWithReturnValue(Parameter[] parameterArray, int currentIndex) {
for (int i = 0; i < parameterArray.length; i++) { for (int i = 0; i < parameterArray.length; i++) {
com.fr.form.ui.Label label = new com.fr.form.ui.Label(); com.fr.form.ui.Label label = new com.fr.form.ui.Label();
label.setWidgetName("Label" + parameterArray[i].getName()); label.setWidgetName("Label" + parameterArray[i].getName());
@ -667,9 +679,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton); XCreator xCreator = XCreatorUtils.createXCreator(formSubmitButton);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * 3 + H_GAP, FIRST_V_LOCATION
+ V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) { + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
return; currentIndex = ((int) Math.ceil((currentIndex + 1) / (double) NUM_IN_A_LINE)) * NUM_IN_A_LINE;
} }
} }
return currentIndex;
} }
/** /**

26
designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java

@ -17,6 +17,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -30,6 +31,10 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.style.background.BackgroundPane; import com.fr.design.style.background.BackgroundPane;
import com.fr.form.main.parameter.FormParameterUI;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.main.parameter.ReportParameterAttr; import com.fr.main.parameter.ReportParameterAttr;
import com.fr.main.parameter.TemplateParameterAttr; import com.fr.main.parameter.TemplateParameterAttr;
@ -46,6 +51,7 @@ import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -249,6 +255,22 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
currentIndex = reportParameterAttr.getCurrentIndex();
//因为以前的版本没有保存currentIndex,所以要计算currentIndex的值
if (parameterUI != null && parameterUI instanceof FormParameterUI && currentIndex == 0) {
WLayout wLayout = ((FormParameterUI) parameterUI).getContainer();
int widgetCount = wLayout.getWidgetCount();
Rectangle endRec = null;
for (int i = 0; i < widgetCount; i++) {
Widget widget = wLayout.getWidget(i);
Rectangle tempRec = ((WAbsoluteLayout.BoundsWidget) widget).getBounds();
if (endRec == null || tempRec.y > endRec.y) {
endRec = tempRec;
}
}
if (endRec != null)
currentIndex = (int) (Math.ceil(endRec.y / FormParaDesigner.V_COMPONENT_GAP)) * NUM_IN_A_LINE;
}
paraDesignEditor.populate(parameterUI); paraDesignEditor.populate(parameterUI);
@ -268,8 +290,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
bridge.setBackground(reportParameterAttr.getBackground()); bridge.setBackground(reportParameterAttr.getBackground());
bridge.setUseParamsTemplate(reportParameterAttr.isUseParamsTemplate()); bridge.setUseParamsTemplate(reportParameterAttr.isUseParamsTemplate());
} }
currentIndex = reportParameterAttr.getCurrentIndex();
} }
@ -438,7 +458,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
return; return;
} }
paraDesignEditor.addingAllParameter2Editor(parameterArray, currentIndex); currentIndex = paraDesignEditor.addingAllParameter2EditorWithReturnValue(parameterArray, currentIndex);
parameterArray = null; parameterArray = null;
refreshParameter(); refreshParameter();

Loading…
Cancel
Save