From 504e171e1069a15e00072e259ea77aa845109a4a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 31 Jul 2020 17:43:52 +0800 Subject: [PATCH 1/9] =?UTF-8?q?REPORT-30352=20=E7=9B=B4=E6=8E=A5=E5=B0=86R?= =?UTF-8?q?TextAreaBase=E7=9A=84border=E7=9A=84=E5=80=BC=E6=94=B9=E4=B8=BA?= =?UTF-8?q?0=EF=BC=8C=E4=BB=A5=E5=92=8C8.0=E7=89=88=E6=9C=AC=E5=A4=96?= =?UTF-8?q?=E8=A7=82=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 50bec254fd..708888dba6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -22,9 +22,11 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JTextArea; +import javax.swing.border.EmptyBorder; import javax.swing.event.CaretEvent; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.TextUI; +import javax.swing.plaf.basic.BasicBorders; import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; import javax.swing.text.Caret; @@ -645,7 +647,7 @@ int currentCaretY; // Used to know when to rehighlight current line. setTabsEmulated(false); // Stuff needed by the caret listener below. - setMargin(getInsets()); + setBorder(new BasicBorders.MarginBorder()); previousCaretY = currentCaretY = getInsets().top; // Stuff to highlight the current line. From af1a3184ca257795f1acad72f411820a15aab963 Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" <1536296691@qq.com> Date: Fri, 31 Jul 2020 17:46:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?REPORT-30352=20=E5=88=A0=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java index 708888dba6..985a9527fa 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java @@ -22,7 +22,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JTextArea; -import javax.swing.border.EmptyBorder; import javax.swing.event.CaretEvent; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.TextUI; From f92697c91e16df1caf1596cd1a24b81ad08fba4b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 1 Aug 2020 16:40:51 +0800 Subject: [PATCH 3/9] =?UTF-8?q?CHART-14744=20=E7=AE=B1=E5=9E=8B=E5=9B=BE?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E6=95=B0=E6=8D=AE=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CategoryPlotReportDataContentPane.java | 41 ++++-- .../box/BoxIndependentVanChartInterface.java | 4 +- .../data/BoxPlotReportDataContentPane.java | 11 -- .../BoxPlotReportResultDataSeriesPane.java | 4 - .../report/BoxPlotReportDataContentPane.java | 137 ++++++++++++++++++ .../BoxPlotReportDetailedDataSeriesPane.java | 38 +++++ .../BoxPlotReportResultDataSeriesPane.java | 133 +++++++++++++++++ .../report/BoxReportDefinitionHelper.java | 58 ++++++++ .../table/BoxPlotTableDataContentPane.java | 19 +-- 9 files changed, 402 insertions(+), 43 deletions(-) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDetailedDataSeriesPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxReportDefinitionHelper.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java index 298ee49370..55eec3a7fc 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java @@ -8,6 +8,7 @@ import com.fr.chart.chartdata.NormalReportDataDefinition; import com.fr.chart.chartdata.SeriesDefinition; import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; @@ -27,35 +28,35 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent protected TinyFormulaPane categoryName; protected ChartDataFilterPane filterPane; - + public CategoryPlotReportDataContentPane(){ - + } public CategoryPlotReportDataContentPane(ChartDataPane parent) { initEveryPane(); - categoryName = initCategoryBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name")); + categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); categoryName.setPreferredSize(new Dimension(246,30)); categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7)); this.add(categoryName, "0,0,2,0"); filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane); panel.setBorder(getSidesBorder()); filterPane.setBorder(getFilterPaneBorder()); this.add(panel, "0,6,2,4"); } - + protected TinyFormulaPane initCategoryBox(final String leftLabel) { TinyFormulaPane categoryName = new TinyFormulaPane() { @Override protected void initLayout() { this.setLayout(new BorderLayout(4, 0)); - + if(StringUtils.isNotEmpty(leftLabel)) { - UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name")); + UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); label1.setPreferredSize(new Dimension(75, 20)); this.add(label1, BorderLayout.WEST); } - + formulaTextField.setPreferredSize(new Dimension(100, 20)); this.add(formulaTextField, BorderLayout.CENTER); this.add(formulaTextFieldButton, BorderLayout.EAST); @@ -84,15 +85,15 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent checkBoxUse(); } }); - + return categoryName; } @Override protected String[] columnNames() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value") + Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + Toolkit.i18nText("Fine-Design_Chart_Series_Value") }; } @@ -100,6 +101,10 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent checkBoxUse(); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + populateDefinition(definition); + } + + public void populateDefinition(TopDefinitionProvider definition) { if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; if (reportDefinition.getCategoryName() != null) { @@ -110,20 +115,25 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent populateList(list); } } - + seriesPane.doLayout(); } - filterPane.populateBean(collection); + filterPane.populateDefinition(definition, true); } public void updateBean(ChartCollection collection) { collection.getSelectedChart().setFilterDefinition(new NormalReportDataDefinition()); TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + updateDefinition(definition); + } + + public void updateDefinition(TopDefinitionProvider definition) { + if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - + reportDefinition.setCategoryName(canBeFormula(categoryName.getUITextField().getText())); List list = updateList(); @@ -136,6 +146,7 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent reportDefinition.add(sd); } } - filterPane.updateBean(collection); + + filterPane.updateDefinition(definition); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java index cb08abcbd1..e7981599fa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java @@ -13,7 +13,7 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; -import com.fr.van.chart.box.data.BoxPlotReportDataContentPane; +import com.fr.van.chart.box.data.report.BoxPlotReportDataContentPane; import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.other.VanChartOtherPane; @@ -50,7 +50,7 @@ public class BoxIndependentVanChartInterface extends AbstractIndependentVanChart } public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { - return new BoxPlotReportDataContentPane(parent); + return new BoxPlotReportDataContentPane(plot, parent); } public AbstractChartTypePane getPlotTypePane() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java deleted file mode 100644 index cce6bf9649..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.fr.van.chart.box.data; - -import com.fr.design.mainframe.chart.gui.ChartDataPane; -import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; - -public class BoxPlotReportDataContentPane extends CategoryPlotReportDataContentPane { - - public BoxPlotReportDataContentPane(ChartDataPane parent) { - super(parent); - } -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java deleted file mode 100644 index 629c67a5f5..0000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fr.van.chart.box.data; - -public class BoxPlotReportResultDataSeriesPane { -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java new file mode 100644 index 0000000000..b43af66908 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java @@ -0,0 +1,137 @@ +package com.fr.van.chart.box.data.report; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.plugin.chart.box.VanChartBoxPlot; +import com.fr.plugin.chart.box.data.VanBoxReportDefinition; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane { + + private UIButtonGroup dataType; + + private BoxPlotReportDetailedDataSeriesPane detailedDataSeriesPane; + private BoxPlotReportResultDataSeriesPane resultDataSeriesPane; + + private Plot initplot; + + public BoxPlotReportDataContentPane(Plot plot, ChartDataPane parent) { + this.initplot = plot; + + this.setLayout(new BorderLayout()); + + this.add(createDataTypePane(), BorderLayout.NORTH); + this.add(createSeriesPane(parent), BorderLayout.CENTER); + + initDataTypeListener(); + } + + private JPanel createDataTypePane() { + JPanel pane = new JPanel(new BorderLayout(4, 0)); + pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); + + UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); + label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); + + String[] names = new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"), + Toolkit.i18nText("Fine-Design_Chart_Result_Data") + }; + + dataType = new UIButtonGroup(names); + dataType.setPreferredSize(new Dimension(100, 20)); + + pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); + pane.setPreferredSize(new Dimension(246, 30)); + pane.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); + + return pane; + } + + private JPanel createSeriesPane(ChartDataPane parent) { + detailedDataSeriesPane = new BoxPlotReportDetailedDataSeriesPane(parent); + resultDataSeriesPane = new BoxPlotReportResultDataSeriesPane(); + + JPanel pane = new JPanel(new BorderLayout(4, 0)); + + pane.add(resultDataSeriesPane, BorderLayout.NORTH); + pane.add(detailedDataSeriesPane, BorderLayout.CENTER); + + return pane; + } + + private void initDataTypeListener() { + dataType.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + checkDataPaneVisible(); + } + }); + } + + private void checkDataPaneVisible() { + if (detailedDataSeriesPane != null) { + detailedDataSeriesPane.setVisible(dataType.getSelectedIndex() == 0); + } + if (resultDataSeriesPane != null) { + resultDataSeriesPane.setVisible(dataType.getSelectedIndex() == 1); + } + } + + public void updateBean(ChartCollection collection) { + collection.getSelectedChart().setFilterDefinition(new VanBoxReportDefinition()); + VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(collection); + + if (report != null) { + boolean isDetailed = dataType.getSelectedIndex() == 0; + + report.setDetailed(isDetailed); + ((VanChartBoxPlot) initplot).setDetailed(isDetailed); + } + if (detailedDataSeriesPane != null) { + detailedDataSeriesPane.updateBean(collection); + } + if (resultDataSeriesPane != null) { + resultDataSeriesPane.updateBean(collection); + } + } + + public void populateBean(ChartCollection collection) { + VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(collection); + + if (report == null) { + dataType.setSelectedIndex(0); + checkDataPaneVisible(); + return; + } + + if (dataType != null) { + dataType.setSelectedIndex(BoxReportDefinitionHelper.isDetailedReportDataType(collection) ? 0 : 1); + } + if (detailedDataSeriesPane != null) { + detailedDataSeriesPane.populateBean(collection); + } + if (resultDataSeriesPane != null) { + resultDataSeriesPane.populateBean(collection); + } + + checkDataPaneVisible(); + } + + protected String[] columnNames() { + return new String[0]; + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDetailedDataSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDetailedDataSeriesPane.java new file mode 100644 index 0000000000..9354ae384b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDetailedDataSeriesPane.java @@ -0,0 +1,38 @@ +package com.fr.van.chart.box.data.report; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; +import com.fr.plugin.chart.box.data.VanBoxReportDefinition; +import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition; + +public class BoxPlotReportDetailedDataSeriesPane extends CategoryPlotReportDataContentPane { + + public BoxPlotReportDetailedDataSeriesPane(ChartDataPane parent) { + super(parent); + } + + public void populateBean(ChartCollection ob) { + VanBoxReportDetailedDefinition definition = BoxReportDefinitionHelper.getBoxReportDetailedDefinition(ob); + + if (definition == null) { + return; + } + + this.populateDefinition(definition); + } + + public void updateBean(ChartCollection ob) { + VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(ob); + + if (report == null) { + return; + } + + VanBoxReportDetailedDefinition detailedDefinition = new VanBoxReportDetailedDefinition(); + + this.updateDefinition(detailedDefinition); + + report.setDetailedDefinition(detailedDefinition); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java new file mode 100644 index 0000000000..240905c65e --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java @@ -0,0 +1,133 @@ +package com.fr.van.chart.box.data.report; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.plugin.chart.box.data.VanBoxReportDefinition; +import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; + +public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContentPane { + + private TinyFormulaPane category; + private TinyFormulaPane seriesName; + private TinyFormulaPane max; + private TinyFormulaPane q3; + private TinyFormulaPane median; + private TinyFormulaPane q1; + private TinyFormulaPane min; + + public BoxPlotReportResultDataSeriesPane() { + this.setLayout(new BorderLayout()); + + initContentComponents(); + + JPanel panel = createContentPane(); + + panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); + + this.add(panel, BorderLayout.CENTER); + } + + private void initContentComponents() { + + category = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category")); + seriesName = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Series_Name")); + max = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Max")); + q3 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")); + median = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Median")); + q1 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")); + min = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Min")); + } + + private JPanel createContentPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p, p, p, p, p, p, p}; + double[] col = {f}; + + Component[][] components = new Component[][]{ + new Component[]{category}, + new Component[]{seriesName}, + new Component[]{max}, + new Component[]{q3}, + new Component[]{median}, + new Component[]{q1}, + new Component[]{min} + }; + + return TableLayoutHelper.createTableLayoutPane(components, row, col); + } + + private TinyFormulaPane createTinyFormulaPaneWithTitle(final String title) { + + return new TinyFormulaPane() { + protected void initLayout() { + this.setLayout(new BorderLayout(4, 0)); + + UILabel label = new UILabel(title); + label.setPreferredSize(new Dimension(75, 20)); + this.add(label, BorderLayout.WEST); + + formulaTextField.setPreferredSize(new Dimension(100, 20)); + this.add(formulaTextField, BorderLayout.CENTER); + this.add(formulaTextFieldButton, BorderLayout.EAST); + } + }; + } + + public void populateBean(ChartCollection ob) { + VanBoxReportResultDefinition detailedDefinition = BoxReportDefinitionHelper.getBoxReportResultDefinition(ob); + + if (detailedDefinition == null) { + return; + } + + populateFormulaPane(category, detailedDefinition.getCategoryName()); + populateFormulaPane(seriesName, detailedDefinition.getSeriesName()); + populateFormulaPane(max, detailedDefinition.getMax()); + populateFormulaPane(q3, detailedDefinition.getQ3()); + populateFormulaPane(median, detailedDefinition.getMedian()); + populateFormulaPane(q1, detailedDefinition.getQ1()); + populateFormulaPane(min, detailedDefinition.getMin()); + } + + private void populateFormulaPane(TinyFormulaPane pane, Object ob) { + if (ob != null) { + pane.populateBean(ob.toString()); + } + } + + public void updateBean(ChartCollection ob) { + VanBoxReportDefinition report = BoxReportDefinitionHelper.getBoxReportDefinition(ob); + + if (report == null) { + return; + } + + VanBoxReportResultDefinition resultDefinition = new VanBoxReportResultDefinition(); + + resultDefinition.setCategoryName(canBeFormula(category.getUITextField().getText())); + resultDefinition.setSeriesName(canBeFormula(seriesName.getUITextField().getText())); + resultDefinition.setMax(canBeFormula(max.getUITextField().getText())); + resultDefinition.setQ3(canBeFormula(q3.getUITextField().getText())); + resultDefinition.setMedian(canBeFormula(median.getUITextField().getText())); + resultDefinition.setQ1(canBeFormula(q1.getUITextField().getText())); + resultDefinition.setMin(canBeFormula(min.getUITextField().getText())); + + report.setResultDefinition(resultDefinition); + } + + protected String[] columnNames() { + return new String[0]; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxReportDefinitionHelper.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxReportDefinitionHelper.java new file mode 100644 index 0000000000..28bf92fe1b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxReportDefinitionHelper.java @@ -0,0 +1,58 @@ +package com.fr.van.chart.box.data.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.plugin.chart.box.data.VanBoxReportDefinition; +import com.fr.plugin.chart.box.data.VanBoxReportDetailedDefinition; +import com.fr.plugin.chart.box.data.VanBoxReportResultDefinition; + +public class BoxReportDefinitionHelper { + + public static VanBoxReportDefinition getBoxReportDefinition(ChartCollection collection) { + if (collection != null) { + + Chart chart = collection.getSelectedChart(); + + if (chart != null) { + TopDefinitionProvider definitionProvider = chart.getFilterDefinition(); + + if (definitionProvider instanceof VanBoxReportDefinition) { + return (VanBoxReportDefinition) definitionProvider; + } + } + } + + return null; + } + + public static VanBoxReportResultDefinition getBoxReportResultDefinition(ChartCollection collection) { + VanBoxReportDefinition report = getBoxReportDefinition(collection); + + if (report != null) { + return report.getResultDefinition(); + } + + return null; + } + + public static VanBoxReportDetailedDefinition getBoxReportDetailedDefinition(ChartCollection collection) { + VanBoxReportDefinition report = getBoxReportDefinition(collection); + + if (report != null) { + return report.getDetailedDefinition(); + } + + return null; + } + + public static boolean isDetailedReportDataType(ChartCollection collection) { + VanBoxReportDefinition report = getBoxReportDefinition(collection); + + if (report != null) { + return report.isDetailed(); + } + + return true; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java index bb17a6f2cd..cb2de668a0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java @@ -146,8 +146,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { } public void updateBean(ChartCollection collection) { - checkChartCollection(collection); - + collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition()); VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); if (table != null) { @@ -168,7 +167,13 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { } public void populateBean(ChartCollection collection) { - checkChartCollection(collection); + VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); + + if (table == null) { + dataType.setSelectedIndex(0); + checkDataPaneVisible(); + return; + } if (dataType != null) { dataType.setSelectedIndex(BoxTableDefinitionHelper.isDetailedTableDataType(collection) ? 0 : 1); @@ -186,14 +191,6 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane { checkDataPaneVisible(); } - private void checkChartCollection(ChartCollection collection) { - VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection); - - if (table == null) { - collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition()); - } - } - private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) { NormalTableDataDefinition detailedDefinition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection); From 8acab5c30f020382f3e14921e6c61ffaa6a9f1e2 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 1 Aug 2020 16:47:31 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/CategoryPlotReportDataContentPane.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java index e4595df89b..fe05a43b00 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java @@ -34,28 +34,16 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent public CategoryPlotReportDataContentPane(ChartDataPane parent) { initEveryPane(); -<<<<<<< HEAD categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); categoryName.setPreferredSize(new Dimension(246,30)); categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7)); this.add(categoryName, "0,0,2,0"); -======= - categoryName = initCategoryBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name")); - categoryName.setPreferredSize(new Dimension(236,30)); - categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20)); - this.add(categoryName, "0,0,1,0"); ->>>>>>> e4e801e2792ee3f3f6cef022e6c646ff7ec97091 filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); panel.setBorder(getSidesBorder()); filterPane.setBorder(getFilterPaneBorder()); -<<<<<<< HEAD this.add(panel, "0,6,2,4"); } -======= - this.add(panel, "0,6,1,4"); } - ->>>>>>> e4e801e2792ee3f3f6cef022e6c646ff7ec97091 protected TinyFormulaPane initCategoryBox(final String leftLabel) { TinyFormulaPane categoryName = new TinyFormulaPane() { @Override From a412bd1f16a7810e1a22acab83fd9f37a3ca2648 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sat, 1 Aug 2020 16:52:28 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=9B=9E=E9=80=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/report/CategoryPlotReportDataContentPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java index fe05a43b00..65f8ea01b7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java @@ -35,14 +35,14 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent public CategoryPlotReportDataContentPane(ChartDataPane parent) { initEveryPane(); categoryName = initCategoryBox(Toolkit.i18nText("Fine-Design_Chart_Category_Name")); - categoryName.setPreferredSize(new Dimension(246,30)); - categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7)); - this.add(categoryName, "0,0,2,0"); + categoryName.setPreferredSize(new Dimension(236,30)); + categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20)); + this.add(categoryName, "0,0,1,0"); filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane); panel.setBorder(getSidesBorder()); filterPane.setBorder(getFilterPaneBorder()); - this.add(panel, "0,6,2,4"); } + this.add(panel, "0,6,1,4"); } protected TinyFormulaPane initCategoryBox(final String leftLabel) { TinyFormulaPane categoryName = new TinyFormulaPane() { From 879cf2f2fdccab27ae1db0dc876114fb26375ba5 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Sun, 2 Aug 2020 15:43:04 +0800 Subject: [PATCH 6/9] =?UTF-8?q?CHART-14744=20=E7=BB=93=E6=9E=9C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BD=BF=E7=94=A8=E5=8F=AF=E7=BC=96=E8=BE=91=E6=A0=87?= =?UTF-8?q?=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BoxPlotReportResultDataSeriesPane.java | 75 ++++++--- .../data/report/TinyFormulaWithEditLabel.java | 71 ++++++++ .../BoxPlotTableResultDataSeriesPane.java | 155 +++++++++++------- .../data/table/UIComboBoxWithEditLabel.java | 86 ++++++++++ 4 files changed, 312 insertions(+), 75 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/report/TinyFormulaWithEditLabel.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java index 240905c65e..347d150f98 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportResultDataSeriesPane.java @@ -20,11 +20,12 @@ public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContent private TinyFormulaPane category; private TinyFormulaPane seriesName; - private TinyFormulaPane max; - private TinyFormulaPane q3; - private TinyFormulaPane median; - private TinyFormulaPane q1; - private TinyFormulaPane min; + + private TinyFormulaWithEditLabel max; + private TinyFormulaWithEditLabel q3; + private TinyFormulaWithEditLabel median; + private TinyFormulaWithEditLabel q1; + private TinyFormulaWithEditLabel min; public BoxPlotReportResultDataSeriesPane() { this.setLayout(new BorderLayout()); @@ -42,11 +43,12 @@ public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContent category = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Category")); seriesName = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Series_Name")); - max = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Max")); - q3 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")); - median = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Median")); - q1 = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")); - min = createTinyFormulaPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Min")); + + max = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")); + q3 = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")); + median = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")); + q1 = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")); + min = createTinyFormulaWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")); } private JPanel createContentPane() { @@ -85,6 +87,25 @@ public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContent }; } + private TinyFormulaWithEditLabel createTinyFormulaWithEditLabel(String title) { + + return new TinyFormulaWithEditLabel(title) { + protected void clearAllBackground() { + clearAllLabelBackground(); + } + }; + } + + private void clearAllLabelBackground() { + TinyFormulaWithEditLabel[] editLabels = new TinyFormulaWithEditLabel[]{max, q3, median, q1, min}; + + for (TinyFormulaWithEditLabel label : editLabels) { + if (label != null) { + label.clearBackGround(); + } + } + } + public void populateBean(ChartCollection ob) { VanBoxReportResultDefinition detailedDefinition = BoxReportDefinitionHelper.getBoxReportResultDefinition(ob); @@ -94,11 +115,18 @@ public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContent populateFormulaPane(category, detailedDefinition.getCategoryName()); populateFormulaPane(seriesName, detailedDefinition.getSeriesName()); - populateFormulaPane(max, detailedDefinition.getMax()); - populateFormulaPane(q3, detailedDefinition.getQ3()); - populateFormulaPane(median, detailedDefinition.getMedian()); - populateFormulaPane(q1, detailedDefinition.getQ1()); - populateFormulaPane(min, detailedDefinition.getMin()); + + max.setHeaderName(detailedDefinition.getMaxLabel()); + q3.setHeaderName(detailedDefinition.getQ3Label()); + median.setHeaderName(detailedDefinition.getMedianLabel()); + q1.setHeaderName(detailedDefinition.getQ1Label()); + min.setHeaderName(detailedDefinition.getMinLabel()); + + max.populateFormula(detailedDefinition.getMax()); + q3.populateFormula(detailedDefinition.getQ3()); + median.populateFormula(detailedDefinition.getMedian()); + q1.populateFormula(detailedDefinition.getQ1()); + min.populateFormula(detailedDefinition.getMin()); } private void populateFormulaPane(TinyFormulaPane pane, Object ob) { @@ -118,11 +146,18 @@ public class BoxPlotReportResultDataSeriesPane extends AbstractReportDataContent resultDefinition.setCategoryName(canBeFormula(category.getUITextField().getText())); resultDefinition.setSeriesName(canBeFormula(seriesName.getUITextField().getText())); - resultDefinition.setMax(canBeFormula(max.getUITextField().getText())); - resultDefinition.setQ3(canBeFormula(q3.getUITextField().getText())); - resultDefinition.setMedian(canBeFormula(median.getUITextField().getText())); - resultDefinition.setQ1(canBeFormula(q1.getUITextField().getText())); - resultDefinition.setMin(canBeFormula(min.getUITextField().getText())); + + resultDefinition.setMaxLabel(max.getHeaderName()); + resultDefinition.setQ3Label(q3.getHeaderName()); + resultDefinition.setMedianLabel(median.getHeaderName()); + resultDefinition.setQ1Label(q1.getHeaderName()); + resultDefinition.setMinLabel(min.getHeaderName()); + + resultDefinition.setMax(canBeFormula(max.updateFormula())); + resultDefinition.setQ3(canBeFormula(q3.updateFormula())); + resultDefinition.setMedian(canBeFormula(median.updateFormula())); + resultDefinition.setQ1(canBeFormula(q1.updateFormula())); + resultDefinition.setMin(canBeFormula(min.updateFormula())); report.setResultDefinition(resultDefinition); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/report/TinyFormulaWithEditLabel.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/TinyFormulaWithEditLabel.java new file mode 100644 index 0000000000..2c99230e3b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/report/TinyFormulaWithEditLabel.java @@ -0,0 +1,71 @@ +package com.fr.van.chart.box.data.report; + +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.mainframe.chart.gui.UIEditLabel; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Dimension; + +public abstract class TinyFormulaWithEditLabel extends JPanel implements UIObserver { + + private UIEditLabel editLabel; + private TinyFormulaPane tinyFormulaPane; + + protected UIObserverListener listener; + + public TinyFormulaWithEditLabel(String text) { + editLabel = new UIEditLabel(text, SwingConstants.LEFT) { + protected void doAfterMousePress() { + clearAllBackground(); + } + + protected boolean appendOriginalLabel() { + return false; + } + }; + + editLabel.setPreferredSize(new Dimension(75, 20)); + tinyFormulaPane = new TinyFormulaPane(); + + this.setLayout(new BorderLayout(4, 0)); + this.add(editLabel, BorderLayout.WEST); + this.add(tinyFormulaPane, BorderLayout.CENTER); + } + + protected abstract void clearAllBackground(); + + public void clearBackGround() { + editLabel.resetNomalrBackground(); + } + + public boolean shouldResponseChangeListener() { + return true; + } + + public void registerChangeListener(UIObserverListener listener) { + this.listener = listener; + editLabel.registerChangeListener(listener); + } + + public void populateFormula(Object ob) { + if (ob != null) { + tinyFormulaPane.populateBean(ob.toString()); + } + } + + public Object updateFormula() { + return tinyFormulaPane.getUITextField().getText(); + } + + public String getHeaderName() { + return editLabel.getText(); + } + + public void setHeaderName(String text) { + editLabel.setText(text); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java index ff5391d111..a9813f2d39 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java @@ -6,12 +6,12 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.plugin.chart.box.data.VanBoxTableDefinition; import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -24,11 +24,15 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa private UIComboBox category; private UIComboBox seriesName; - private UIComboBox max; - private UIComboBox q3; - private UIComboBox median; - private UIComboBox q1; - private UIComboBox min; + + private JPanel categoryPane; + private JPanel seriesNamePane; + + private UIComboBoxWithEditLabel max; + private UIComboBoxWithEditLabel q3; + private UIComboBoxWithEditLabel median; + private UIComboBoxWithEditLabel q1; + private UIComboBoxWithEditLabel min; public BoxPlotTableResultDataSeriesPane() { @@ -41,23 +45,49 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa } private void initComboxSize() { - Dimension preferredSize = new Dimension(100, 20); - category = new UIComboBox(); seriesName = new UIComboBox(); - max = new UIComboBox(); - q3 = new UIComboBox(); - median = new UIComboBox(); - q1 = new UIComboBox(); - min = new UIComboBox(); - - category.setPreferredSize(preferredSize); - seriesName.setPreferredSize(preferredSize); - max.setPreferredSize(preferredSize); - q3.setPreferredSize(preferredSize); - median.setPreferredSize(preferredSize); - q1.setPreferredSize(preferredSize); - min.setPreferredSize(preferredSize); + + categoryPane = createUIComboBoxPane(category, Toolkit.i18nText("Fine-Design_Chart_Category")); + seriesNamePane = createUIComboBoxPane(seriesName, Toolkit.i18nText("Fine-Design_Chart_Series_Name")); + + max = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")); + q3 = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")); + median = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")); + q1 = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")); + min = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")); + } + + private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) { + UILabel label = new UILabel(title); + label.setPreferredSize(new Dimension(75, 20)); + + JPanel panel = new JPanel(); + + panel.setLayout(new BorderLayout(4, 0)); + panel.add(label, BorderLayout.WEST); + panel.add(comboBox, BorderLayout.CENTER); + + return panel; + } + + private UIComboBoxWithEditLabel createUIComboBoxWithEditLabel(String title) { + + return new UIComboBoxWithEditLabel(title) { + protected void clearAllBackground() { + clearAllLabelBackground(); + } + }; + } + + private void clearAllLabelBackground() { + UIComboBoxWithEditLabel[] editLabels = new UIComboBoxWithEditLabel[]{max, q3, median, q1, min}; + + for (UIComboBoxWithEditLabel label : editLabels) { + if (label != null) { + label.clearBackGround(); + } + } } private void addItemListener() { @@ -73,24 +103,23 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa private JPanel createDataSeriesPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - - double[] column = {f, COMPONENT_WIDTH}; double[] row = {p, p, p, p, p, p, p}; - - Component[][] components_north = new Component[][]{ - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category")), category}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), seriesName}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")), max}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")), q3}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")), median}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")), q1}, - new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")), min}, + double[] col = {f}; + + Component[][] components = new Component[][]{ + new Component[]{categoryPane}, + new Component[]{seriesNamePane}, + new Component[]{max}, + new Component[]{q3}, + new Component[]{median}, + new Component[]{q1}, + new Component[]{min} }; - JPanel center = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, row, column); - center.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15)); + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); + panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); - return center; + return panel; } public void checkBoxUse(boolean hasUse) { @@ -99,21 +128,23 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa protected void refreshBoxListWithSelectTableData(List list) { refreshBoxItems(category, list); refreshBoxItems(seriesName, list); - refreshBoxItems(max, list); - refreshBoxItems(q3, list); - refreshBoxItems(median, list); - refreshBoxItems(q1, list); - refreshBoxItems(min, list); + + refreshBoxItems(max.getComboBox(), list); + refreshBoxItems(q3.getComboBox(), list); + refreshBoxItems(median.getComboBox(), list); + refreshBoxItems(q1.getComboBox(), list); + refreshBoxItems(min.getComboBox(), list); } public void clearAllBoxList() { clearBoxItems(category); clearBoxItems(seriesName); - clearBoxItems(max); - clearBoxItems(q3); - clearBoxItems(median); - clearBoxItems(q1); - clearBoxItems(min); + + clearBoxItems(max.getComboBox()); + clearBoxItems(q3.getComboBox()); + clearBoxItems(median.getComboBox()); + clearBoxItems(q1.getComboBox()); + clearBoxItems(min.getComboBox()); } public void populateBean(ChartCollection collection) { @@ -127,11 +158,18 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa combineCustomEditValue(category, definition.getCategoryName()); combineCustomEditValue(seriesName, definition.getSeriesName()); - combineCustomEditValue(max, definition.getMax()); - combineCustomEditValue(q3, definition.getQ3()); - combineCustomEditValue(median, definition.getMedian()); - combineCustomEditValue(q1, definition.getQ1()); - combineCustomEditValue(min, definition.getMin()); + + max.populateComboBox(definition.getMax()); + q3.populateComboBox(definition.getQ3()); + median.populateComboBox(definition.getMedian()); + q1.populateComboBox(definition.getQ1()); + min.populateComboBox(definition.getMin()); + + max.setHeaderName(definition.getMaxLabel()); + q3.setHeaderName(definition.getQ3Label()); + median.setHeaderName(definition.getMedianLabel()); + q1.setHeaderName(definition.getQ1Label()); + min.setHeaderName(definition.getMinLabel()); } public void updateBean(ChartCollection collection) { @@ -141,11 +179,12 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa Object resultCategory = category.getSelectedItem(); Object resultSeries = seriesName.getSelectedItem(); - Object resultMax = max.getSelectedItem(); - Object resultQ3 = q3.getSelectedItem(); - Object resultMedian = median.getSelectedItem(); - Object resultQ1 = q1.getSelectedItem(); - Object resultMin = min.getSelectedItem(); + + Object resultMax = max.updateComboBox(); + Object resultQ3 = q3.updateComboBox(); + Object resultMedian = median.updateComboBox(); + Object resultQ1 = q1.updateComboBox(); + Object resultMin = min.updateComboBox(); if (resultCategory == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultCategory)) { definition.setCategoryName(StringUtils.EMPTY); @@ -173,6 +212,12 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa definition.setMin(resultMin.toString()); } + definition.setMaxLabel(max.getHeaderName()); + definition.setQ3Label(q3.getHeaderName()); + definition.setMedianLabel(median.getHeaderName()); + definition.setQ1Label(q1.getHeaderName()); + definition.setMinLabel(min.getHeaderName()); + table.setResultDefinition(definition); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java new file mode 100644 index 0000000000..dbfcae01fe --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java @@ -0,0 +1,86 @@ +package com.fr.van.chart.box.data.table; + +import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.mainframe.chart.gui.UIEditLabel; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ItemListener; + +public abstract class UIComboBoxWithEditLabel extends JPanel implements UIObserver { + + private UIEditLabel editLabel; + private UIComboBox comboBox; + + protected UIObserverListener listener; + + public UIComboBoxWithEditLabel(String text) { + editLabel = new UIEditLabel(text, SwingConstants.LEFT) { + protected void doAfterMousePress() { + clearAllBackground(); + } + + protected boolean appendOriginalLabel() { + return false; + } + }; + + editLabel.setPreferredSize(new Dimension(75, 20)); + comboBox = new UIComboBox(); + + this.setLayout(new BorderLayout(4, 0)); + this.add(editLabel, BorderLayout.WEST); + this.add(comboBox, BorderLayout.CENTER); + } + + public UIComboBox getComboBox() { + return comboBox; + } + + public void setComboBox(UIComboBox comboBox) { + this.comboBox = comboBox; + } + + protected void addItemListener(ItemListener aListener) { + comboBox.addItemListener(aListener); + } + + protected abstract void clearAllBackground(); + + public void clearBackGround() { + editLabel.resetNomalrBackground(); + } + + public boolean shouldResponseChangeListener() { + return true; + } + + public void registerChangeListener(UIObserverListener listener) { + this.listener = listener; + editLabel.registerChangeListener(listener); + } + + public void populateComboBox(String value) { + if (comboBox != null) { + comboBox.setEditable(true); + comboBox.setSelectedItem(value); + comboBox.setEditable(false); + } + } + + public Object updateComboBox() { + return comboBox.getSelectedItem(); + } + + public String getHeaderName() { + return editLabel.getText(); + } + + public void setHeaderName(String text) { + editLabel.setText(text); + } +} From c1b0d6e9b678e90353456a3b8c6248b1eea5533f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Mon, 3 Aug 2020 10:01:53 +0800 Subject: [PATCH 7/9] =?UTF-8?q?CHART-9760=20=20=E7=B3=BB=E5=88=97=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/gui/data/table/SeriesNameUseFieldValuePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java index 0fb700f345..8511430b34 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java @@ -40,6 +40,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane Date: Mon, 3 Aug 2020 10:04:44 +0800 Subject: [PATCH 8/9] =?UTF-8?q?CHART-11708=20=E6=8F=92=E5=85=A5=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chart/AutoChartIcon.java | 66 ++------------ .../java/com/fr/design/chart/ChartIcon.java | 89 ++++++++++++------- .../com/fr/design/chart/ChartTypePane.java | 22 +++-- 3 files changed, 78 insertions(+), 99 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java b/designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java index 6e347d34b0..a9dbb0b132 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java +++ b/designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java @@ -1,85 +1,29 @@ package com.fr.design.chart; import com.fr.base.chart.BaseChartPainter; -import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.result.WebChartIDInfo; -import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.ChartTypeInterfaceManager; -import com.fr.design.file.HistoryTemplateListCache; import com.fr.script.Calculator; -import javax.swing.Icon; -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Paint; - /** * @author Bjorn * @version 10.0 * Created by Bjorn on 2020-05-29 */ -public class AutoChartIcon implements Icon { +public class AutoChartIcon extends ChartIcon { private static final int WIDTH = 500; private static final int HEIGHT = 281; - private ChartCollection chartCollection; - private CallbackEvent callbackEvent; - - private String chartName; - public AutoChartIcon(ChartCollection chartCollection) { - this.chartCollection = chartCollection; - initChartName(); - } - - public ChartCollection getChartCollection() { - return chartCollection; + super(chartCollection); } - public String getChartName() { - return chartName; - } - - private void initChartName() { - Chart chart = chartCollection.getSelectedChart(Chart.class); - String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getPlot().getPlotID()); - chartName = subName[0]; - } - - public void registerCallBackEvent(CallbackEvent callbackEvent) { - this.callbackEvent = callbackEvent; - } - - /** - * 画出缩略图Icon - * - * @param g 图形的上下文 - * @param c 所在的Component - * @param x 缩略图的起始坐标x - * @param y 缩略图的起始坐标y - */ @Override - public void paintIcon(Component c, Graphics g, int x, int y) { - - BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), + protected BaseChartPainter getChartPainter() { + BaseChartPainter painter = getChartCollection().createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), WebChartIDInfo.createAutoTypeInfo(), getIconWidth(), getIconHeight()); - - int resolution = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getJTemplateResolution(); - - Graphics2D g2d = (Graphics2D) g; - Paint oldPaint = g2d.getPaint(); - g.translate(x, y); - g2d.setPaint(Color.white); - g2d.fillRect(0, 0, getIconWidth(), getIconHeight()); - - painter.paint(g2d, getIconWidth(), getIconHeight(), resolution, null, callbackEvent); - - g.translate(-x, -y); - g2d.setPaint(oldPaint); + return painter; } /** diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java index 854505d630..4d4a6ed434 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java @@ -1,8 +1,13 @@ package com.fr.design.chart; -import com.fr.base.GraphHelper; -import com.fr.general.IOUtils; -import com.fr.stable.Constants; +import com.fr.base.chart.BaseChartPainter; +import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.base.chart.result.WebChartIDInfo; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.ChartTypeInterfaceManager; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.script.Calculator; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLableReader; @@ -13,7 +18,6 @@ import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Paint; -import java.awt.image.BufferedImage; /** * 图表的缩略图Icon, 在选择图表类型界面 用到. @@ -21,21 +25,47 @@ import java.awt.image.BufferedImage; public class ChartIcon implements Icon, XMLable { private static final int WIDTH = 400; private static final int HEIGHT = 225; - /** - * 缩略图中的图片路径 - */ - private String imagePath; + + + private ChartCollection chartCollection; + private CallbackEvent callbackEvent; private String chartName; /** * 构造Chart的缩略图Icon */ - public ChartIcon(String imagePath, String chartName) { - this.imagePath = imagePath; + public ChartIcon(ChartCollection chartCollection) { + this.chartCollection = chartCollection; + initChartName(); + } + + public ChartCollection getChartCollection() { + return chartCollection; + } + + public String getChartName() { + return chartName; + } + + public void setChartCollection(ChartCollection chartCollection) { + this.chartCollection = chartCollection; + } + + public void setChartName(String chartName) { this.chartName = chartName; } + private void initChartName() { + Chart chart = chartCollection.getSelectedChart(Chart.class); + String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getPlot().getPlotID()); + chartName = subName[0]; + } + + public void registerCallBackEvent(CallbackEvent callbackEvent) { + this.callbackEvent = callbackEvent; + } + /** * 画出缩略图Icon * @@ -47,21 +77,29 @@ public class ChartIcon implements Icon, XMLable { @Override public void paintIcon(Component c, Graphics g, int x, int y) { - Graphics2D g2d = (Graphics2D) g; + BaseChartPainter chartPainter = getChartPainter(); - Paint oldPaint = g2d.getPaint(); + int resolution = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getJTemplateResolution(); + Graphics2D g2d = (Graphics2D) g; + Paint oldPaint = g2d.getPaint(); g.translate(x, y); g2d.setPaint(Color.white); - g2d.fillRect(0, 0, getIconWidth(), getIconHeight()); - BufferedImage demoImage = IOUtils.readImageWithCache(imagePath); - GraphHelper.paintImage(g, getIconWidth(), getIconHeight(), demoImage, Constants.IMAGE_ADJUST, Constants.NULL, Constants.NULL, -1, -1); + + chartPainter.paint(g2d, getIconWidth(), getIconHeight(), resolution, null, callbackEvent); g.translate(-x, -y); g2d.setPaint(oldPaint); } + protected BaseChartPainter getChartPainter() { + BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(), + WebChartIDInfo.createEmptyDesignerInfo(), getIconWidth(), getIconHeight()); + return painter; + } + + /** * 返回缩略图的宽度 * @@ -83,20 +121,6 @@ public class ChartIcon implements Icon, XMLable { } - /** - * 返回缩略图中的图片路径 - * - * @return 缩略图中的图片路径 - */ - public String getImagePath() { - return imagePath; - } - - public String getChartName() { - return chartName; - } - - @Override public void readXML(XMLableReader reader) { //do nothing @@ -114,8 +138,11 @@ public class ChartIcon implements Icon, XMLable { @Override public Object clone() throws CloneNotSupportedException { ChartIcon cloned = (ChartIcon) super.clone(); - cloned.imagePath = this.imagePath; - cloned.chartName = this.chartName; + if (getChartCollection() != null) { + cloned.setChartCollection(this.getChartCollection()); + } + cloned.setChartName(this.getChartName()); + ; return cloned; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index 2bb9a99f22..aab17780e2 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -3,6 +3,7 @@ package com.fr.design.chart; * the Pane of the Chart */ +import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; @@ -12,7 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; -import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; @@ -26,7 +26,7 @@ import javax.swing.event.ListSelectionListener; import java.awt.Color; import java.awt.Component; -public class ChartTypePane extends ChartCommonWizardPane { +public class ChartTypePane extends ChartCommonWizardPane implements CallbackEvent { private static final long serialVersionUID = -1175602484968520546L; private String[] chartIDs = ChartTypeManager.getInstanceWithCheck().getAllChartIDs(); @@ -96,14 +96,17 @@ public class ChartTypePane extends ChartCommonWizardPane { int main_index = mainTypeList.getSelectedIndex(); String id = ChartTypePane.this.chartIDs[main_index]; - String[] demoImagePath = ChartTypeInterfaceManager.getInstance().getDemoImagePath(id); + ChartProvider[] charts = ChartTypeManager.getInstance().getCharts(id); String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(id); ChartTypePane.this.iconListModel.clear(); - for (int i = 0, len = subName.length; i < len; i++) { - String ImagePath = demoImagePath.length > i ? demoImagePath[i] : StringUtils.EMPTY; - String chartName = subName[i]; - ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName)); + for (int i = 0, len = charts.length; i < len; i++) { + ChartProvider chart = charts[i]; + ChartCollection chartCollection = new ChartCollection(chart); + ChartIcon chartIcon = new ChartIcon(chartCollection); + chartIcon.setChartName(subName[i]); + chartIcon.registerCallBackEvent(ChartTypePane.this); + ChartTypePane.this.iconListModel.addElement(chartIcon); } iconViewList.setSelectedIndex(0); } @@ -144,4 +147,9 @@ public class ChartTypePane extends ChartCommonWizardPane { update(chart4Update); } + + @Override + public void callback() { + this.repaint(); + } } \ No newline at end of file From 957d89eed51dea2b993f25cb93c8ea087a519eb8 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 3 Aug 2020 11:06:25 +0800 Subject: [PATCH 9/9] =?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 --- .../form/parameter/FormParaDesigner.java | 39 ++++--------------- .../parameter/ParameterDefinitePane.java | 10 +++-- 2 files changed, 15 insertions(+), 34 deletions(-) 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 a91342d4af..c72aa45128 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 @@ -83,7 +83,6 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP private static final int SUBMIT_BUTTON_H_LOCATION = 270; private static final int PARA_IMAGE_SHIFT_X = -4; private static final int FORM_AREA_PADDING_LEFT = 13; - private int addableRegionY; private static Image paraImage = BaseUtils.readImage("/com/fr/design/images/form/parameter.png"); @@ -413,30 +412,10 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP if (layoutContainer == null) { layoutContainer = new XWParameterLayout(); } - refreshAddableRegion(layoutContainer); layoutContainer.setSize(LARGE_PREFERRED_SIZE); setRootComponent(layoutContainer); } - /** - * @param layoutContainer - * @Description: 为了不覆盖以前的组件,所以要计算可以添加组件的区域 - * @return: - * @Author: Henry.Wang - * @date: 2020/7/15 15:12 - */ - public void refreshAddableRegion(XLayoutContainer layoutContainer) { - addableRegionY = 0; - for (int i = 0; i < layoutContainer.getComponentCount(); i++) { - Rectangle rectangle = layoutContainer.getComponent(i).getBounds(); - if (addableRegionY < rectangle.y + rectangle.height) { - addableRegionY = rectangle.y + rectangle.height; - } - } - int vGap = V_COMPONENT_GAP - (int) XCreator.SMALL_PREFERRED_SIZE.getHeight(); - addableRegionY = Math.max(0, addableRegionY - FIRST_V_LOCATION + (int) (XCreator.SMALL_PREFERRED_SIZE.getHeight() / 2) + vGap); - } - /** * 是否是报表的参数面板 * @@ -604,15 +583,14 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP label.setWidgetName("Label" + name); label.setWidgetValue(new WidgetValue(name + ":")); XCreator xCreator = XCreatorUtils.createXCreator(label); - int x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + FIRST_H_LOCATION; - int y = addableRegionY + FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE); - if (!(this.autoAddComponent(xCreator, x, y))) { + 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)))) { return false; } EditorHolder editor = new EditorHolder(parameter); xCreator = XCreatorUtils.createXCreator(editor); - x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + SECOND_H_LOCATION; - if (!(this.autoAddComponent(xCreator, x, y))) { + 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)))) { return false; } return true; @@ -668,17 +646,16 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP label.setWidgetValue(new WidgetValue(parameterArray[i].getName() + ":")); XCreator xCreator = XCreatorUtils.createXCreator(label); - int x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + FIRST_H_LOCATION; - int y = addableRegionY + FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE); - if (!(this.autoAddComponent(xCreator, x, y))) { + 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); - x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + SECOND_H_LOCATION; - if (!(this.autoAddComponent(xCreator, x, y))) { + 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++; 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 ea78f568f5..13d53b5b25 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 @@ -212,12 +212,13 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus return parameterArray; } - public int getToolBarHeight(){ + public int getToolBarHeight() { return TOOLBARPANEDIMHEIGHT; } /** * 导出菜单项,用于图表设计器 + * * @return 菜单项 */ public ShortCut[] shortcut4ExportMenu() { @@ -267,6 +268,8 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus bridge.setBackground(reportParameterAttr.getBackground()); bridge.setUseParamsTemplate(reportParameterAttr.isUseParamsTemplate()); } + + currentIndex = reportParameterAttr.getCurrentIndex(); } @@ -376,8 +379,9 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus } //这里不用 parameterUI 的原因是考虑到没有控件的时候设置宽度有效果但不保存,只有含有控件才保存属性 paraDesignEditor.getParaTarget().setDesignSize(new Dimension(bridge.getDesignWidth(), - (int)paraDesignEditor.getParaTarget().getDesignSize().getHeight())); + (int) paraDesignEditor.getParaTarget().getDesignSize().getHeight())); reportParameterAttr.setParameterUI(parameterUI); + reportParameterAttr.setCurrentIndex(currentIndex); return reportParameterAttr; } @@ -489,7 +493,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus * @return 模板菜单 */ public MenuDef[] menus4Target() { - MenuDef tplMenu = new MenuDef(KeySetUtils.TEMPLATE.getMenuKeySetName(),KeySetUtils.TEMPLATE.getMnemonic()); + MenuDef tplMenu = new MenuDef(KeySetUtils.TEMPLATE.getMenuKeySetName(), KeySetUtils.TEMPLATE.getMnemonic()); if (!DesignerMode.isAuthorityEditing()) { tplMenu.addShortCut(new NameSeparator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_WorkBook"))); tplMenu.addShortCut(new ReportParameterAction(workBook));