From 37553746869ab93deddf4ce91a5a4bb713e4bc6b Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Wed, 22 Jul 2020 14:08:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=9D=A2=E6=9D=BF=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CategoryPlotTableDataContentPane.java | 53 +++----- .../chart/gui/data/table/DataPaneHelper.java | 25 ++++ .../table/SeriesNameUseFieldValuePane.java | 20 +-- .../box/data/BoxPlotDataContentPaneHelp.java | 123 ------------------ .../box/data/BoxPlotTableDataContentPane.java | 118 +++++++---------- .../BoxPlotTableResultDataSeriesPane.java | 42 ++++-- .../data/BoxPlotTableSeriesTypeUsePane.java | 96 +++++++++++++- .../MultiPiePlotTableDataContentPane.java | 38 ++---- 8 files changed, 222 insertions(+), 293 deletions(-) delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotDataContentPaneHelp.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java index 8c988ce29..7d12e3e52 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java @@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; +import com.fr.design.i18n.Toolkit; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; @@ -28,24 +29,24 @@ import java.util.List; */ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPane{ private static final long serialVersionUID = 7284078589672079657L; - + protected UIComboBox categoryCombox; protected SeriesTypeUseComboxPane seriesTypeComboxPane; - + public CategoryPlotTableDataContentPane() { - + } - + public CategoryPlotTableDataContentPane(ChartDataPane parent) { - + categoryCombox = new UIComboBox(); JPanel categoryPane = new JPanel(new BorderLayout(4,0)); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); - UILabel label1 = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ; + UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ; label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); categoryCombox.setPreferredSize(new Dimension(100,20)); - categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); + categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null})); categoryPane.setPreferredSize(new Dimension(246,30)); categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); @@ -56,7 +57,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa this.add(getJSeparator()); seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); this.add(seriesTypeComboxPane, BorderLayout.SOUTH); - + categoryCombox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { checkSeriseUse(categoryCombox.getSelectedItem() != null); @@ -64,7 +65,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa } }); } - + protected void makeToolTipUse(UIComboBox comBox) { if(comBox.getSelectedItem() != null) { comBox.setToolTipText(comBox.getSelectedItem().toString()); @@ -72,7 +73,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa comBox.setToolTipText(null); } } - + /** * 检查 某些Box是否可用 * @param hasUse 是否使用. @@ -81,16 +82,16 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa categoryCombox.setEnabled(hasUse); checkSeriseUse(hasUse); } - + protected void checkSeriseUse(boolean hasUse) { if(seriesTypeComboxPane != null) { seriesTypeComboxPane.checkUseBox(hasUse && categoryCombox.getSelectedItem() != null); } } - + protected void refreshBoxListWithSelectTableData(List list) { refreshBoxItems(categoryCombox, list); - categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); + categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); seriesTypeComboxPane.refreshBoxListWithSelectTableData(list); } @@ -100,10 +101,10 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa */ public void clearAllBoxList(){ clearBoxItems(categoryCombox); - categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); + categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); seriesTypeComboxPane.clearAllBoxList(); } - + /** * 保存界面内容到ChartCollection */ @@ -129,15 +130,15 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa public void populateBean(ChartCollection collection) { super.populateBean(collection); TopDefinition top = (TopDefinition)collection.getSelectedChart().getFilterDefinition(); - + if(!(top instanceof NormalTableDataDefinition)) { return; } NormalTableDataDefinition data = (NormalTableDataDefinition)top; - if(data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) { - categoryCombox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")); - } else if(data!= null && !this.boxItemsContainsObject(categoryCombox,data.getCategoryName())){ + if(ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) { + categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); + } else if(!DataPaneHelper.boxItemsContainsObject(categoryCombox,data.getCategoryName())){ categoryCombox.setSelectedItem(null); }else { combineCustomEditValue(categoryCombox, data.getCategoryName()); @@ -146,20 +147,6 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa seriesTypeComboxPane.populateBean(collection,this.isNeedSummaryCaculateMethod()); } - private boolean boxItemsContainsObject(UIComboBox box,Object item){ - if(box == null){ - return false; - } - - ComboBoxModel dataModel = box.getModel(); - for (int i = 0; i < dataModel.getSize(); i++) { - if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){ - return true; - } - } - return false; - } - /** * 重新布局整个面板 */ diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java index 69cf88286..7f5373c66 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java @@ -7,6 +7,7 @@ import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import javax.swing.ComboBoxModel; import java.util.List; /** @@ -24,6 +25,30 @@ public class DataPaneHelper { box.refreshBoxItems(list); } + public static boolean boxItemsContainsObject(UIComboBox box, Object item) { + if (box == null) { + return false; + } + + ComboBoxModel dataModel = box.getModel(); + + for (int i = 0; i < dataModel.getSize(); i++) { + if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) { + return true; + } + } + + return false; + } + + public static void combineCustomEditValue(UIComboBox comBox, String value) { + if(comBox != null) { + comBox.setEditable(true); + comBox.setSelectedItem(value); + comBox.setEditable(false); + } + } + /** * 清空box里所有东西 * 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 bef72ca3d..aab267c54 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 @@ -14,10 +14,8 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.ComparatorUtils; import javax.swing.BorderFactory; -import javax.swing.ComboBoxModel; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -171,20 +169,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane