Browse Source

Merge pull request #2018 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '95bfb27f1408418aeee57c2a86abe8f3d4251680':
  主要修改: 补充了一个test
  主要修改: 修改了对搜索结果排序的比较器,分为以关键词开头和不以关键词开头两部分,各自以字母表顺序排列,其中在以关键词开头的部分,最为匹配关键词的放在第一行
  REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加
  无jira 编译等级调到1.8
  REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加
  CHART-14928 数据格式改为数据形式
  REPORT-34847 远程设计权限-文件夹权限,需要重新连接才能生效
  REPORT-36386 自适应模板出现不自适应情况
  CHART-14936 初始化数据类型切换button
  CHART-14924 更换icon
  REPORT-35569 参数面板,添加一个参数控件,撤销之后,再次添加的控件会空一个位置添加
research/11.0
superman 4 years ago
parent
commit
63eaf6ff0d
  1. 2
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  2. 20
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/parameter/ParameterDesignerProvider.java
  4. 8
      designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java
  5. 4
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java
  6. 3
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java
  7. BIN
      designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png
  8. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  9. 17
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  10. 26
      designer-realize/src/main/java/com/fr/design/parameter/ParameterDefinitePane.java
  11. 4
      pom.xml

2
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -226,6 +226,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/ */
@Override @Override
public void refresh() { public void refresh() {
// 刷新远程文件夹权限
NodeAuthProcessor.getInstance().refresh();
reportletsTree.refresh(); reportletsTree.refresh();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!");
} }

20
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -1008,15 +1008,23 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
this.searchKey = searchKey.toLowerCase(); this.searchKey = searchKey.toLowerCase();
} }
/**
* 把以关键词开头的和不以关键词开头的分别按照字母表顺序排序
* @param o1 待比较对象1
* @param o2 待比较对象2
* @return 比较结果1表示 o1 > o2, -1表示 o1 < o2, 0表示 o1 = o2
*/
@Override @Override
public int compare(String o1, String o2) { public int compare(String o1, String o2) {
if (o1.toLowerCase().startsWith(searchKey)) { int result;
return -1; boolean o1StartWith = o1.toLowerCase().startsWith(searchKey);
} boolean o2StartWith = o2.toLowerCase().startsWith(searchKey);
if (o2.toLowerCase().startsWith(searchKey)) { if (o1StartWith) {
return 1; result = o2StartWith ? o1.compareTo(o2) : -1;
} else {
result = o2StartWith ? 1 : o1.compareTo(o2);
} }
return o2.compareTo(o1); return result;
} }
} }

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

8
designer-base/src/test/java/com/fr/design/formula/FormulaPaneTest.java

@ -22,4 +22,12 @@ public class FormulaPaneTest extends TestCase {
Assert.assertArrayEquals(result, strs); Assert.assertArrayEquals(result, strs);
} }
@Test
public void test4SimilarComparator() {
String[] strs = new String[]{"TESTB", "TESTACD", "Ftest", "Gtest", "TEST"};
String[] result = new String[]{"TEST", "TESTACD", "TESTB", "Ftest", "Gtest"};
Arrays.sort(strs, new FormulaPane.SimilarComparator("test"));
Assert.assertArrayEquals(result, strs);
}
} }

4
designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java

@ -37,13 +37,14 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane
this.add(createSeriesPane(parent), BorderLayout.CENTER); this.add(createSeriesPane(parent), BorderLayout.CENTER);
initDataTypeListener(); initDataTypeListener();
checkDataPaneVisible();
} }
private JPanel createDataTypePane() { private JPanel createDataTypePane() {
JPanel pane = new JPanel(new BorderLayout(4, 0)); JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Form"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{ String[] names = new String[]{
@ -52,6 +53,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane
}; };
dataType = new UIButtonGroup(names); dataType = new UIButtonGroup(names);
dataType.setSelectedIndex(0);
dataType.setPreferredSize(new Dimension(100, 20)); dataType.setPreferredSize(new Dimension(100, 20));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));

3
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java

@ -54,7 +54,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
JPanel pane = new JPanel(new BorderLayout(4, 0)); JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Form"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{ String[] names = new String[]{
@ -63,6 +63,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
}; };
dataType = new UIButtonGroup(names); dataType = new UIButtonGroup(names);
dataType.setSelectedIndex(0);
dataType.setPreferredSize(new Dimension(100, 20)); dataType.setPreferredSize(new Dimension(100, 20));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));

BIN
designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

After

Width:  |  Height:  |  Size: 1.6 KiB

8
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -19,6 +19,7 @@ import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -1125,7 +1126,12 @@ public class XWFitLayout extends XLayoutContainer {
public Component getBottomComp(int x, int y, int h) { public Component getBottomComp(int x, int y, int h) {
int val = getAcualInterval(); int val = getAcualInterval();
return this.getComponentAt(x, y+h+default_Length+val); Component comp = this.getComponentAt(x, y+h+default_Length+val);
if (ComparatorUtils.equals(this, comp)) {
// 如果获取组件等于自身 说明存在偏移 加上一个默认偏移量
return this.getComponentAt(x + default_Length, y+h+default_Length+val);
}
return comp;
} }
public Component getRightTopComp(int x, int y, int w) { public Component getRightTopComp(int x, int y, int w) {

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

4
pom.xml

@ -28,8 +28,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.7</source> <source>1.8</source>
<target>1.7</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

Loading…
Cancel
Save