From b7ca742217b97eaef5e27a24072405792b5c3c53 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Mon, 10 Jul 2017 14:44:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=88=86=E7=B1=BB=E8=BD=B4=E6=95=B4?= =?UTF-8?q?=E4=BD=93=E4=BB=A3=E7=A0=81=EF=BC=8C=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...goryPlotMoreCateReportDataContentPane.java | 38 ++++++++++----- ...egoryPlotMoreCateTableDataContentPane.java | 47 ++++++++++++------- 2 files changed, 57 insertions(+), 28 deletions(-) diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index 07d699dae3..1cd4b8c091 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.data.report; import com.fr.base.BaseUtils; import com.fr.base.Utils; import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartdata.NormalReportDataDefinition; @@ -37,6 +38,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor private ArrayList formualList = new ArrayList(); private UIObserverListener uiobListener = null; + public ArrayList getFormualList() { + return formualList; + } + public CategoryPlotMoreCateReportDataContentPane() { } @@ -105,13 +110,13 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor public void actionPerformed(ActionEvent e) { boxPane.remove(newButtonPane); formualList.remove(pane); - checkAddButton(); + checkComponent(); relayoutPane(); } }); delButton.registerChangeListener(uiobListener); - - checkAddButton(); + + checkComponent(); relayoutPane(); return pane; @@ -121,7 +126,11 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor int size = formualList.size(); addButton.setEnabled(size < 2); } - + + protected void checkComponent() { + checkAddButton(); + } + private void relayoutPane() { this.revalidate(); } @@ -163,20 +172,25 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor checkAddButton(); } - + public void updateBean(ChartCollection collection) { super.updateBean(collection); - + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + Axis axis = collection.getSelectedChart().getPlot().getxAxis(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - + reportDefinition.clearMoreCate(); - - for(int i = 0, size = formualList.size(); i < size; i++) { - TinyFormulaPane pane = formualList.get(i); - reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); - } + updateMoreCate(reportDefinition, axis); + + } + } + + protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Axis axis) { + for (int i = 0, size = formualList.size(); i < size; i++) { + TinyFormulaPane pane = formualList.get(i); + reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); } } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 9ae7696d96..f37fc93563 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -41,7 +42,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD private UIButton addButton; private UIObserverListener uiobListener = null; - + + public ArrayList getBoxList() { + return boxList; + } + public CategoryPlotMoreCateTableDataContentPane() { // do nothing } @@ -86,8 +91,8 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD public void itemStateChanged(ItemEvent e) { checkSeriseUse(categoryCombox.getSelectedItem() != null); makeToolTipUse(categoryCombox); - - checkAddButton(); + + checkComponent(); } }); } @@ -126,15 +131,15 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD buttonPane.add(delButton); boxPane.add(buttonPane); boxList.add(combox); - - checkAddButton(); + + checkComponent(); delButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boxPane.remove(buttonPane); boxList.remove(combox); - checkAddButton(); + checkComponent(); relayoutPane(); } }); @@ -147,6 +152,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD int size = boxList.size(); addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); } + + protected void checkComponent() { + checkAddButton(); + } private void relayoutPane() { this.revalidate(); @@ -159,8 +168,8 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD */ public void checkBoxUse(boolean hasUse) { super.checkBoxUse(hasUse); - - checkAddButton(); + + checkComponent(); } protected void refreshBoxListWithSelectTableData(List list) { @@ -218,17 +227,23 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD */ public void updateBean(ChartCollection collection) { super.updateBean(collection); - + TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); - if(top instanceof NormalTableDataDefinition) { - NormalTableDataDefinition normal = (NormalTableDataDefinition)top; + Plot plot = collection.getSelectedChart().getPlot(); + if (top instanceof NormalTableDataDefinition) { + NormalTableDataDefinition normal = (NormalTableDataDefinition) top; normal.clearMoreCate(); - for(int i = 0, size = boxList.size(); i < size; i++) { - UIComboBox box = boxList.get(i); - if(box.getSelectedItem() != null) { - normal.addMoreCate(box.getSelectedItem().toString()); - } + updateMoreCate(normal, plot); + } + } + + protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { + for (int i = 0, size = boxList.size(); i < size; i++) { + UIComboBox box = boxList.get(i); + if (box.getSelectedItem() != null) { + normal.addMoreCate(box.getSelectedItem().toString()); } } } + } \ No newline at end of file