From a4bff1b769c788264855fb619a1562fb2c71a39f Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 19 Jun 2019 13:29:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A4=9A=E5=B1=82=E9=A5=BC=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chartx/MultiPieChartDataPane.java | 21 +++ .../component/AbstractMultiComponentPane.java | 2 +- ...stractMultiComponentPaneWithUISpinner.java | 150 ++++++++++++++++++ .../chartx/component/MultiComboBoxPane.java | 10 +- .../MultiComboBoxPaneWithUISpinner.java | 40 +++++ .../MultiTinyFormulaPaneWithUISpinner.java | 25 +++ .../diff/MultiCategoryDataSetFieldsPane.java | 6 + .../diff/MultiPieCellDataFieldsPane.java | 67 ++++++++ .../diff/MultiPieDataSetFieldsPane.java | 94 +++++++++++ .../MultiPieIndependentVanChartInterface.java | 15 +- 10 files changed, 417 insertions(+), 13 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPaneWithUISpinner.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java create mode 100644 designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java new file mode 100644 index 0000000000..952bca3cdc --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java @@ -0,0 +1,21 @@ +package com.fr.design.chartx; + +import com.fr.design.chartx.fields.diff.MultiPieCellDataFieldsPane; +import com.fr.design.chartx.fields.diff.MultiPieDataSetFieldsPane; +import com.fr.design.chartx.single.SingleDataPane; +import com.fr.design.gui.frpane.AttributeChangeListener; + +/** + * Created by shine on 2019/6/18. + */ +public class MultiPieChartDataPane extends MultiCategoryChartDataPane { + + public MultiPieChartDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected SingleDataPane createSingleDataPane() { + return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java index 008a7d91cb..2a8154d7bb 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java @@ -21,7 +21,7 @@ import java.util.List; /** * Created by shine on 2019/4/10. - * 一列组件 可增可删 + * 一列组件 可增可删,通过JComponent后面的加减button增删。 */ public abstract class AbstractMultiComponentPane extends JPanel { private static final int COM_W = 96; diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java new file mode 100644 index 0000000000..b24743c762 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java @@ -0,0 +1,150 @@ +package com.fr.design.chartx.component; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +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.ChartDataPane; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by shine on 2019/6/18. + * 一列组件 可增可删,通过UISpinner增删。 + */ +public abstract class AbstractMultiComponentPaneWithUISpinner extends JPanel { + + private UISpinner levelNumSpinner; + + private List levelComponentList = new ArrayList(); + + private JPanel levelPane; + + private int currentNum = 3; + + public AbstractMultiComponentPaneWithUISpinner() { + initComps(); + } + + public List getComponentList() { + return levelComponentList; + } + + protected abstract T createJComponent(); + + protected abstract void populateField(T component, ColumnField field); + + protected abstract void updateField(T component, ColumnField field); + + protected void initComps() { + + this.setLayout(new BorderLayout(0, 6)); + + levelNumSpinner = new UISpinner(1, 15, 1, currentNum) { + @Override + protected void fireStateChanged() { + //先处理自身的空间布局 + refreshLevelPane(); + //然后更新数据 + super.fireStateChanged(); + } + + @Override + public void setTextFieldValue(double value) { + //如果为0,则没有改变值 + if (value == 0) { + return; + } + super.setTextFieldValue(value); + } + }; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level_Number")), levelNumSpinner}, + }; + + JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(components, new double[]{TableLayout.PREFERRED}, new double[]{ChartDataPane.LABEL_WIDTH, 122}, 0, 6); + + this.add(northPane, BorderLayout.NORTH); + + initLevelPane(); + } + + private void initLevelPane() { + double[] rows = new double[currentNum]; + + Component[][] components = new Component[currentNum][2]; + + List newList = new ArrayList(); + + int maxSize = levelComponentList.size(); + for (int i = 0; i < currentNum; i++) { + rows[i] = TableLayout.PREFERRED; + T component = i < maxSize ? levelComponentList.get(i) : createJComponent(); + newList.add(component); + + components[i] = new Component[]{ + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level") + String.valueOf(i + 1)), + component + }; + } + + levelComponentList = newList; + + levelPane = TableLayoutHelper.createGapTableLayoutPane(components, rows, new double[]{ChartDataPane.LABEL_WIDTH, 122}, 0, 6); + + this.add(levelPane, BorderLayout.CENTER); + } + + private void refreshLevelPane() { + if (levelNumSpinner == null) { + return; + } + + int newNum = (int) levelNumSpinner.getValue(); + + if (newNum != currentNum) { + currentNum = newNum; + this.remove(levelPane); + this.initLevelPane(); + } + + refreshPane(); + } + + private void refreshPane() { + this.validate(); + this.repaint(); + this.revalidate(); + } + + public void populate(List categoryList) { + int len = categoryList.size(); + levelNumSpinner.setValue(len); + + refreshLevelPane(); + + for (int i = 0; i < len; i++) { + ColumnField columnField = categoryList.get(i); + T component = levelComponentList.get(i); + populateField(component, columnField); + } + } + + public void update(List categoryList) { + categoryList.clear(); + + for (T comboBox : levelComponentList) { + ColumnField temp = new ColumnField(); + categoryList.add(temp); + updateField(comboBox, temp); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java index 37a110b7d4..f1716a0ae0 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java @@ -5,10 +5,18 @@ import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.extended.chart.UIComboBoxWithNone; +import java.util.ArrayList; +import java.util.List; + /** * Created by shine on 2019/4/12. */ public class MultiComboBoxPane extends AbstractMultiComponentPane { + private List currentBoxItems = new ArrayList(); + + public void setCurrentBoxItems(List currentBoxItems) { + this.currentBoxItems = currentBoxItems; + } @Override protected UIComboBox createFirstFieldComponent() { @@ -17,7 +25,7 @@ public class MultiComboBoxPane extends AbstractMultiComponentPane { @Override protected UIComboBox createOtherFieldComponent() { - return new UIComboBox(); + return new UIComboBox(currentBoxItems.toArray(new Object[currentBoxItems.size()])); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java new file mode 100644 index 0000000000..8b20768e2d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java @@ -0,0 +1,40 @@ +package com.fr.design.chartx.component; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by shine on 2019/6/18. + */ +public class MultiComboBoxPaneWithUISpinner extends AbstractMultiComponentPaneWithUISpinner { + private List currentBoxList = new ArrayList(); + + @Override + protected void initComps() { + currentBoxList = new ArrayList(); + super.initComps(); + } + + public void setCurrentBoxList(List currentBoxList) { + this.currentBoxList = currentBoxList; + } + + @Override + protected UIComboBox createJComponent() { + return new UIComboBox(currentBoxList.toArray(new Object[currentBoxList.size()])); + } + + @Override + protected void populateField(UIComboBox component, ColumnField field) { + AbstractDataSetFieldsPane.populateField(component, field); + } + + @Override + protected void updateField(UIComboBox component, ColumnField field) { + AbstractDataSetFieldsPane.updateField(component, field); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPaneWithUISpinner.java new file mode 100644 index 0000000000..e3bbf4b848 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPaneWithUISpinner.java @@ -0,0 +1,25 @@ +package com.fr.design.chartx.component; + +import com.fr.chartx.data.field.ColumnField; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; + +/** + * Created by shine on 2019/6/19. + */ +public class MultiTinyFormulaPaneWithUISpinner extends AbstractMultiComponentPaneWithUISpinner { + @Override + protected TinyFormulaPane createJComponent() { + return new TinyFormulaPane(); + } + + @Override + protected void populateField(TinyFormulaPane component, ColumnField field) { + AbstractCellDataFieldsPane.populateField(component, field); + } + + @Override + protected void updateField(TinyFormulaPane component, ColumnField field) { + AbstractCellDataFieldsPane.updateField(component, field); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java index 17fcfb2ba3..1abe2b1849 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java @@ -39,6 +39,12 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer return initMultiCategoryPane(); } + @Override + public void refreshBoxListWithSelectTableData(List columnNameList) { + super.refreshBoxListWithSelectTableData(columnNameList); + multiCategoryPane.setCurrentBoxItems(columnNameList); + } + @Override public void populateBean(MultiCategoryColumnFieldCollection multiCategoryColumnFieldCollection) { List categoryList = multiCategoryColumnFieldCollection.getCategoryList(); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java new file mode 100644 index 0000000000..950f49401a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieCellDataFieldsPane.java @@ -0,0 +1,67 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection; +import com.fr.design.chartx.component.MultiTinyFormulaPaneWithUISpinner; +import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; + +import javax.swing.JPanel; + +/** + * Created by shine on 2019/6/18. + */ +public class MultiPieCellDataFieldsPane extends AbstractCellDataFieldsPane { + + private UITextField nameField;//指标名称 + + private MultiTinyFormulaPaneWithUISpinner levelPane; + + private TinyFormulaPane value; + + @Override + protected void initComponents() { + nameField = new UITextField(); + levelPane = new MultiTinyFormulaPaneWithUISpinner(); + value = new TinyFormulaPane(); + super.initComponents(); + } + + @Override + protected JPanel createNorthPane() { + return levelPane; + } + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + }; + } + + @Override + protected TinyFormulaPane[] formulaPanes() { + return new TinyFormulaPane[]{ + value + }; + } + + @Override + public void populateBean(MultiPieColumnFieldCollection ob) { + nameField.setText(ob.getTargetName()); + levelPane.populate(ob.getLevels()); + populateField(value, ob.getValue()); + } + + @Override + public MultiPieColumnFieldCollection updateBean() { + MultiPieColumnFieldCollection result = new MultiPieColumnFieldCollection(); + + result.setTargetName(nameField.getText()); + levelPane.update(result.getLevels()); + updateField(value, result.getValue()); + + return result; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java new file mode 100644 index 0000000000..2a299ba6e9 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java @@ -0,0 +1,94 @@ +package com.fr.design.chartx.fields.diff; + +import com.fr.chartx.data.field.diff.MultiPieColumnFieldCollection; +import com.fr.design.chartx.component.MultiComboBoxPaneWithUISpinner; +import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; + +import javax.swing.JPanel; +import java.awt.Component; +import java.util.List; + +/** + * Created by shine on 2019/6/18. + */ +public class MultiPieDataSetFieldsPane extends AbstractDataSetFieldsPane { + private UITextField nameField; + + private MultiComboBoxPaneWithUISpinner levelComboBoxPane; + + private UIComboBox value; + + private CalculateComboBox function; + + @Override + protected void initComponents() { + nameField = new UITextField(); + levelComboBoxPane = new MultiComboBoxPaneWithUISpinner(); + value = new UIComboBox(); + function = new CalculateComboBox(); + super.initComponents(); + } + + @Override + protected JPanel createNorthPane() { + return levelComboBoxPane; + } + + + @Override + protected String[] fieldLabels() { + return new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Use_Value"), + Toolkit.i18nText("Fine-Design_Chart_Summary_Method") + }; + } + + @Override + protected Component[] fieldComponents() { + return new UIComboBox[]{ + value, + function + }; + } + + @Override + protected UIComboBox[] filedComboBoxes() { + List list = levelComboBoxPane.getComponentList(); + + int len = list.size(); + UIComboBox[] result = new UIComboBox[len + 1]; + for (int i = 0; i < len; i++) { + result[i] = list.get(i); + } + result[len] = value; + + return result; + } + + @Override + public void refreshBoxListWithSelectTableData(List columnNameList) { + super.refreshBoxListWithSelectTableData(columnNameList); + levelComboBoxPane.setCurrentBoxList(columnNameList); + } + + @Override + public void populateBean(MultiPieColumnFieldCollection ob) { + levelComboBoxPane.populate(ob.getLevels()); + populateFunctionField(value, function, ob.getValue()); + } + + @Override + public MultiPieColumnFieldCollection updateBean() { + MultiPieColumnFieldCollection result = new MultiPieColumnFieldCollection(); + + levelComboBoxPane.update(result.getLevels()); + + updateFunctionField(value, function, result.getValue()); + + return result; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java index e25e55b064..06f0b0f75f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java +++ b/designer-chart/src/main/java/com/fr/van/chart/multilayer/MultiPieIndependentVanChartInterface.java @@ -2,14 +2,12 @@ package com.fr.van.chart.multilayer; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.chartx.MultiPieChartDataPane; import com.fr.design.condition.ConditionAttributesPane; +import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.mainframe.chart.gui.ChartDataPane; 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.multilayer.data.MultiPiePlotReportDataContentPane; -import com.fr.van.chart.multilayer.data.MultiPiePlotTableDataContentPane; import com.fr.van.chart.multilayer.other.VanChartMultiPieConditionPane; import com.fr.van.chart.multilayer.style.VanChartMultiPieSeriesPane; import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI; @@ -29,13 +27,8 @@ public class MultiPieIndependentVanChartInterface extends AbstractIndependentVan } @Override - public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ - return new MultiPiePlotTableDataContentPane(parent); - } - - @Override - public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ - return new MultiPiePlotReportDataContentPane(parent); + public ChartDataPane getChartDataPane(AttributeChangeListener listener) { + return new MultiPieChartDataPane(listener); } public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot){ From bbe4791fae69aeba83d72c93cd382bde27a8b48b Mon Sep 17 00:00:00 2001 From: zheng Date: Tue, 25 Jun 2019 15:29:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?CHART-9141=20se.cellCC=20&&=20floatCC=20?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=9B=BE=E8=A1=A8=E7=BB=9F=E4=B8=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E5=88=A0=E9=99=A4BaseChart=20=E5=90=84resultProces?= =?UTF-8?q?sor=20=E5=88=9D=E6=AD=A5=E7=9A=84=E6=B5=81=E7=A8=8B=E8=B5=B0?= =?UTF-8?q?=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/chart/MiddleChartComponent.java | 15 +- .../fr/design/ChartTypeInterfaceManager.java | 3 +- .../com/fr/design/chart/ChartTypePane.java | 12 +- .../fr/design/chart/gui/ChartComponent.java | 4 +- .../design/chart/gui/ChartWidgetOption.java | 6 +- .../active/action/ChartComponentAction.java | 7 +- .../impl/ChartHyperPoplinkPane.java | 5 +- .../chart/gui/ChartTypeButtonPane.java | 6 +- .../mainframe/chart/gui/ChartTypePane.java | 41 +----- .../chart/gui/type/AbstractChartTypePane.java | 3 +- .../fr/design/module/ChartPreStylePane.java | 13 +- .../fr/extended/chart/ExtendedTypePane.java | 3 +- .../java/com/fr/poly/PolyComponentsBar.java | 9 +- .../src/main/java/com/fr/poly/PolyUtils.java | 24 +--- .../com/fr/poly/creator/ChartBlockEditor.java | 133 ------------------ .../poly/hanlder/PolyDesignerDropTarget.java | 6 +- 16 files changed, 50 insertions(+), 240 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java b/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java index 9d16d6787a..025c669bc5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java +++ b/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java @@ -1,12 +1,11 @@ package com.fr.design.gui.chart; -import javax.swing.JComponent; - -import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; -import com.fr.stable.core.PropertyChangeAdapter; +import com.fr.chartx.attr.XChart; import com.fr.stable.core.PropertyChangeListener; +import javax.swing.JComponent; + /** * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2013-7-10 上午09:19:36 @@ -18,8 +17,8 @@ public abstract class MiddleChartComponent extends JComponent { public abstract BaseChartCollection update(); public abstract void reset(); - - public abstract BaseChart getEditingChart(); - - public abstract void addStopEditingListener(PropertyChangeListener list); + + public abstract XChart getEditingChart(); + + public abstract void addStopEditingListener(PropertyChangeListener list); } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 1255d87d5a..a188737c0a 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -5,6 +5,7 @@ import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chartx.attr.XChart; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; @@ -161,7 +162,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr int index = 0; for (ChartInternationalNameContentBean bean : typeName) { String plotID = bean.getPlotID(); - Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + XChart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) { continue; } 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 d914a81e8b..ed1e2656e0 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 @@ -11,6 +11,7 @@ import com.fr.chart.chartattr.ChartIcon; import com.fr.chart.chartattr.MapPlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chartx.attr.XChart; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; @@ -36,12 +37,13 @@ public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames(); + //todo@shinerefactor 这个页面所有强转Chart的地方都要处理一下 private Chart[][] charts4Icon = null; { charts4Icon = new Chart[this.typeName.length][]; for (int i = 0; i < this.typeName.length; i++) { - Chart[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); + XChart[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); int rowChartsCount = rowCharts.length; charts4Icon[i] = new Chart[rowChartsCount]; for (int j = 0; j < rowChartsCount; j++) { @@ -145,9 +147,9 @@ public class ChartTypePane extends ChartCommonWizardPane { int subIndex = 0; for (int i = 0; i < typeName.length; i++) { - Chart[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID()); + XChart[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID()); for (int j = 0; j < charts.length; j++) { - if (charts[j].getPlot().match4GUI(plot)) { + if (((Chart) charts[j]).getPlot().match4GUI(plot)) { mainIndex = i; subIndex = j; // 一旦匹配 立马中断 @@ -162,7 +164,7 @@ public class ChartTypePane extends ChartCommonWizardPane { public void update(Chart oldChart) { String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); - Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + Chart chart = (Chart) ChartTypeManager.getInstanceWithCheck().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; if(chart.getPlot() != null){ if(chart.getPlot() instanceof MapPlot && !supportMap()){ JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Not_Supported")); @@ -191,7 +193,7 @@ public class ChartTypePane extends ChartCommonWizardPane { Chart chart4Update = cc.getSelectedChart(); if (chart4Update == null) { String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); - Chart chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + Chart chart = (Chart) ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; try{ chart4Update = (Chart)chart.clone(); cc.addChart(chart4Update); diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index 769218c7fa..85fcaaeff4 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -1,7 +1,6 @@ package com.fr.design.chart.gui; import com.fr.base.ScreenResolution; -import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartGlyph; import com.fr.base.chart.chartdata.CallbackEvent; @@ -10,6 +9,7 @@ import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartglyph.AxisGlyph; +import com.fr.chartx.attr.XChart; import com.fr.design.chart.gui.active.ActiveGlyph; import com.fr.design.chart.gui.active.ChartActiveGlyph; import com.fr.design.file.HistoryTemplateListPane; @@ -162,7 +162,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene return (this.chartCollection4Design == null) ? 0 : this.chartCollection4Design.getChartCount(); } - public BaseChart getEditingChart() { + public XChart getEditingChart() { return editingChart; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index f621c545f5..d52dcbfde9 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -1,7 +1,7 @@ package com.fr.design.chart.gui; -import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chartx.attr.XChart; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; @@ -38,8 +38,8 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); - Chart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; - widget.addChart((Chart) chart.clone()); + XChart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; + widget.addChart((XChart) chart.clone()); return widget; } catch (InstantiationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java b/designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java index a27d2387a1..9bedc637d3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/active/action/ChartComponentAction.java @@ -1,11 +1,10 @@ package com.fr.design.chart.gui.active.action; -import com.fr.base.chart.BaseChart; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartglyph.AxisGlyph; -import com.fr.design.chart.gui.ChartComponent; import com.fr.design.actions.UpdateAction; +import com.fr.design.chart.gui.ChartComponent; /** * Created by IntelliJ IDEA. @@ -29,10 +28,6 @@ public abstract class ChartComponentAction extends UpdateAction { chartComponent.repaint(); } - public BaseChart getEditingChart() { - return chartComponent.getEditingChart(); - } - public ChartCollection getChartCollection() { return chartComponent.getChartCollection(); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index c3db9b7ef3..01c5a156e5 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -6,6 +6,7 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.web.ChartHyperPoplink; +import com.fr.chartx.attr.XChart; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.hyperlink.AbstractHyperLinkPane; @@ -66,10 +67,10 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane implemen if (editingCollection != null) { //点击添加按钮,则会触发切换状态 - Chart chart = editingCollection.getChangeStateNewChart(); + XChart chart = editingCollection.getChangeStateNewChart(); try { - Chart newChart = (Chart) chart.clone(); + XChart newChart = (XChart) chart.clone(); editingCollection.addNamedChart(name, newChart); } catch (CloneNotSupportedException e1) { FineLoggerFactory.getLogger().error("Error in Clone"); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 33c9a41dcc..56547842cf 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -41,30 +41,6 @@ public class ChartTypePane extends AbstractChartAttrPane{ private ChartTypeButtonPane buttonPane; private ChartEditPane editPane; private ChartCollection editingCollection; - private PaneState paneState = new PaneState(); - - private class PaneState{ - //记录面板所处状态 - private SwitchState paneState = SwitchState.DEFAULT; - //记录当前面板是谁在使用切换状态 - private String chartID = StringUtils.EMPTY; - - public SwitchState getPaneState() { - return paneState; - } - - public void setPaneState(SwitchState paneState) { - this.paneState = paneState; - } - - public String getChartID() { - return chartID; - } - - public void setChartID(String chartID) { - this.chartID = chartID; - } - } @Override protected JPanel createContentPane() { @@ -337,22 +313,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void relayoutChartTypePane(ChartCollection collection){ - if (needRelayout(collection)) { - chartTypeComBox.relayout(collection); - //设置面板切换状态 - updatePaneState(collection); - } - } - - private void updatePaneState(ChartCollection collection) { - paneState.setChartID(collection.getRepresentChartID()); - paneState.setPaneState(collection.getState()); - } - - // TODO: 2016/11/17 因为现在populate面板时会重新构造面板,所以每次都需要重构 - private boolean needRelayout(ChartCollection collection) { - /*return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();*/ - return true; + chartTypeComBox.relayout(collection); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 27f4266820..46447495d8 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -17,6 +17,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Title; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.charttypes.BarIndependentChart; +import com.fr.chartx.attr.XChart; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.gui.ilable.BoldFontTextLabel; @@ -616,7 +617,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ return typePane; } - public Chart getDefaultChart() { + public XChart getDefaultChart() { return BarIndependentChart.barChartTypes[0]; } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java index 2b8f6ea321..5bd4c38978 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java @@ -5,7 +5,6 @@ import com.fr.chart.base.ChartUtils; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.event.UIObserver; @@ -13,7 +12,6 @@ import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.FRGUIPaneFactory; - import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; @@ -30,7 +28,8 @@ public class ChartPreStylePane extends BasicBeanPane { private ChartPreFillStylePane fillStylePane; private ChartComponent chartComponent; - + private Bar2DPlot demoPlot; + public ChartPreStylePane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -50,8 +49,9 @@ public class ChartPreStylePane extends BasicBeanPane { this.add(boxPane, BorderLayout.CENTER); ChartCollection cc = new ChartCollection(); - cc.addChart(new Chart(new Bar2DPlot())); - + demoPlot = new Bar2DPlot(); + cc.addChart(new Chart(demoPlot)); + chartComponent = new ChartComponent(); chartComponent.populate(cc); chartComponent.setPreferredSize(new Dimension(400, 300)); @@ -82,8 +82,7 @@ public class ChartPreStylePane extends BasicBeanPane { private void refreshWhenStyleChange(ChartColorMatching preStyle) { if(chartComponent != null) { - Plot plot = (Plot) chartComponent.getEditingChart().getBasePlot(); - plot.setPlotFillStyle(ChartUtils.chartColorMatching2AttrFillStyle(preStyle)); + demoPlot.setPlotFillStyle(ChartUtils.chartColorMatching2AttrFillStyle(preStyle)); chartComponent.reset(); } } diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java index 9e5ddd7b48..331e511640 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java @@ -2,6 +2,7 @@ package com.fr.extended.chart; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chartx.attr.XChart; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; @@ -65,7 +66,7 @@ public class ExtendedTypePane extends AbstractChartType } @Override - public Chart getDefaultChart() { + public XChart getDefaultChart() { return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0]; } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java index 564a3ae6a2..097528c685 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -1,7 +1,7 @@ package com.fr.poly; import com.fr.base.BaseUtils; -import com.fr.base.chart.BaseChart; +import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartGetter; import com.fr.base.chart.BaseChartNameID; import com.fr.base.vcs.DesignerMode; @@ -64,9 +64,10 @@ public class PolyComponentsBar extends JToolBar { ); this.add(serIcons[0]); for (int i = 0; i < typeLen; i++) { - BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); - String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(typeName[i].getPlotID()); - serIcons[i + 1] = new SerIcon(rowChart[0], InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath); + String chartID = typeName[i].getPlotID(); + String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID); + BaseChartCollection chartCollection = BaseChartGetter.getStaticChartCollection(chartID); + serIcons[i + 1] = new SerIcon(chartCollection, InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath); this.add(serIcons[i + 1]); } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyUtils.java b/designer-realize/src/main/java/com/fr/poly/PolyUtils.java index 330949fb34..e297a69ad4 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyUtils.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyUtils.java @@ -4,9 +4,7 @@ package com.fr.poly; import com.fr.base.ScreenResolution; -import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; -import com.fr.base.chart.BasePlot; import com.fr.log.FineLoggerFactory; import com.fr.poly.creator.BlockCreator; import com.fr.poly.creator.ChartBlockCreator; @@ -15,7 +13,6 @@ import com.fr.poly.model.AddedData; import com.fr.report.poly.PolyChartBlock; import com.fr.report.poly.PolyECBlock; import com.fr.report.poly.TemplateBlock; -import com.fr.stable.bridge.StableFactory; import java.awt.Point; import java.lang.reflect.Constructor; @@ -53,10 +50,8 @@ public class PolyUtils { public static BlockCreator createCreator(Class clazz) { return createCreator(blockGenerate(clazz)); } - - public static BlockCreator createCreator(BaseChart chart) { - BaseChartCollection cc = (BaseChartCollection)StableFactory.createXmlObject(BaseChartCollection.XML_TAG); - cc.addChart(chart); + + public static BlockCreator createCreator(BaseChartCollection cc) { TemplateBlock block = new PolyChartBlock(cc); return createCreator(block); } @@ -66,20 +61,7 @@ public class PolyUtils { try { block = (TemplateBlock) clazz.newInstance(); } catch (Exception e) { - try { - BasePlot plot = (BasePlot)clazz.newInstance(); - BaseChartCollection cc = (BaseChartCollection)StableFactory.createXmlObject(BaseChartCollection.XML_TAG); - - BaseChart chart = (BaseChart)StableFactory.createXmlObject(BaseChart.XML_TAG); - chart.initChart(plot); - cc.addChart(chart); - - block = new PolyChartBlock(cc); - } catch (InstantiationException e1) { - FineLoggerFactory.getLogger().error(e1.getMessage(), e1); - } catch (IllegalAccessException e1) { - FineLoggerFactory.getLogger().error(e1.getMessage(), e1); - } + FineLoggerFactory.getLogger().error(e.getMessage(), e); } return block; } diff --git a/designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java b/designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java index 006c7e48db..bf72884bcb 100644 --- a/designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java +++ b/designer-realize/src/main/java/com/fr/poly/creator/ChartBlockEditor.java @@ -3,25 +3,15 @@ */ package com.fr.poly.creator; -import com.fr.base.BaseUtils; -import com.fr.base.ScreenResolution; -import com.fr.base.chart.BaseChart; import com.fr.base.chart.BaseChartCollection; -import com.fr.base.chart.BaseChartGetter; -import com.fr.base.chart.BaseChartNameID; import com.fr.base.vcs.DesignerMode; -import com.fr.design.border.UIRoundedBorder; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.mainframe.EastRegionContainerPane; -import com.fr.design.mainframe.JSliderPane; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.NoSupportAuthorityEdit; import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.module.DesignModuleFactory; -import com.fr.design.utils.gui.LayoutUtils; -import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.poly.PolyConstants; import com.fr.poly.PolyDesigner; import com.fr.poly.PolyDesigner.SelectionType; @@ -31,13 +21,8 @@ import com.fr.report.poly.PolyChartBlock; import com.fr.stable.core.PropertyChangeAdapter; import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JPanel; -import javax.swing.JToggleButton; -import javax.swing.border.Border; import java.awt.Color; import java.awt.Dimension; -import java.awt.FlowLayout; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -48,31 +33,10 @@ import java.awt.event.MouseEvent; */ // 图片的命名必须符合下面的代码规范(chart类别+序号的方式) 不然读取不到指定图片 public class ChartBlockEditor extends BlockEditor { - private static final int BOUND_OFF = 21; - private static Border buttonBorder; - private static String[][] chartsNames; - private static BaseChartNameID[] typeName = BaseChartGetter.getStaticAllChartBaseNames(); - private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes); - - static { - buttonBorder = new UIRoundedBorder(new Color(149, 149, 149), 1, 5); - chartsNames = new String[typeName.length][]; - for (int i = 0; i < typeName.length; i++) { - BaseChart[] rowCharts = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); - chartsNames[i] = new String[rowCharts.length]; - for (int j = 0; j < rowCharts.length; j++) { - chartsNames[i][j] = rowCharts[j].getChartName(); - } - } - } - - private ChartButton[] chartButtons = null; public ChartBlockEditor(PolyDesigner designer, ChartBlockCreator creator) { super(designer, creator); this.resolution = creator.resolution; - //shine:和产品商量后决定把最上面一排切换按钮去掉 -// this.initNorthBarComponent(); } @@ -80,33 +44,6 @@ public class ChartBlockEditor extends BlockEditor Date: Tue, 25 Jun 2019 19:42:41 +0800 Subject: [PATCH 3/4] xchart rename to chartProvider --- .../java/com/fr/design/gui/chart/MiddleChartComponent.java | 4 ++-- .../main/java/com/fr/design/ChartTypeInterfaceManager.java | 4 ++-- .../src/main/java/com/fr/design/chart/ChartTypePane.java | 6 +++--- .../main/java/com/fr/design/chart/gui/ChartComponent.java | 4 ++-- .../java/com/fr/design/chart/gui/ChartWidgetOption.java | 6 +++--- .../series/SeriesCondition/impl/ChartHyperPoplinkPane.java | 6 +++--- .../fr/design/mainframe/chart/gui/ChartTypeButtonPane.java | 6 +++--- .../mainframe/chart/gui/type/AbstractChartTypePane.java | 4 ++-- .../main/java/com/fr/extended/chart/ExtendedTypePane.java | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java b/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java index 025c669bc5..01d9e7dd32 100644 --- a/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java +++ b/designer-base/src/main/java/com/fr/design/gui/chart/MiddleChartComponent.java @@ -1,7 +1,7 @@ package com.fr.design.gui.chart; import com.fr.base.chart.BaseChartCollection; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.stable.core.PropertyChangeListener; import javax.swing.JComponent; @@ -18,7 +18,7 @@ public abstract class MiddleChartComponent extends JComponent { public abstract void reset(); - public abstract XChart getEditingChart(); + public abstract ChartProvider getEditingChart(); public abstract void addStopEditingListener(PropertyChangeListener list); } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index a188737c0a..72585ade8e 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -5,7 +5,7 @@ import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.fun.IndependentChartUIProvider; @@ -162,7 +162,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr int index = 0; for (ChartInternationalNameContentBean bean : typeName) { String plotID = bean.getPlotID(); - XChart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) { continue; } 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 ed1e2656e0..2a19072e08 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 @@ -11,7 +11,7 @@ import com.fr.chart.chartattr.ChartIcon; import com.fr.chart.chartattr.MapPlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; @@ -43,7 +43,7 @@ public class ChartTypePane extends ChartCommonWizardPane { { charts4Icon = new Chart[this.typeName.length][]; for (int i = 0; i < this.typeName.length; i++) { - XChart[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); + ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); int rowChartsCount = rowCharts.length; charts4Icon[i] = new Chart[rowChartsCount]; for (int j = 0; j < rowChartsCount; j++) { @@ -147,7 +147,7 @@ public class ChartTypePane extends ChartCommonWizardPane { int subIndex = 0; for (int i = 0; i < typeName.length; i++) { - XChart[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID()); + ChartProvider[] charts = ChartTypeManager.getInstanceWithCheck().getChartTypes(typeName[i].getPlotID()); for (int j = 0; j < charts.length; j++) { if (((Chart) charts[j]).getPlot().match4GUI(plot)) { mainIndex = i; diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java index 85fcaaeff4..31baca0715 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java @@ -9,7 +9,7 @@ import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartglyph.AxisGlyph; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.chart.gui.active.ActiveGlyph; import com.fr.design.chart.gui.active.ChartActiveGlyph; import com.fr.design.file.HistoryTemplateListPane; @@ -162,7 +162,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene return (this.chartCollection4Design == null) ? 0 : this.chartCollection4Design.getChartCount(); } - public XChart getEditingChart() { + public ChartProvider getEditingChart() { return editingChart; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java index d52dcbfde9..eb36aadea1 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java +++ b/designer-chart/src/main/java/com/fr/design/chart/gui/ChartWidgetOption.java @@ -1,7 +1,7 @@ package com.fr.design.chart.gui; import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; @@ -38,8 +38,8 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); - XChart chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; - widget.addChart((XChart) chart.clone()); + ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; + widget.addChart((ChartProvider) chart.clone()); return widget; } catch (InstantiationException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index 01c5a156e5..74c78ff2d8 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java @@ -6,7 +6,7 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.web.ChartHyperPoplink; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.hyperlink.AbstractHyperLinkPane; @@ -67,10 +67,10 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane implemen if (editingCollection != null) { //点击添加按钮,则会触发切换状态 - XChart chart = editingCollection.getChangeStateNewChart(); + ChartProvider chart = editingCollection.getChangeStateNewChart(); try { - XChart newChart = (XChart) chart.clone(); + ChartProvider newChart = (ChartProvider) chart.clone(); editingCollection.addNamedChart(name, newChart); } catch (CloneNotSupportedException e1) { FineLoggerFactory.getLogger().error("Error in Clone"); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java index 46447495d8..47de03b569 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java @@ -17,7 +17,7 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Title; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.charttypes.BarIndependentChart; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.gui.ilable.BoldFontTextLabel; @@ -617,7 +617,7 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ return typePane; } - public XChart getDefaultChart() { + public ChartProvider getDefaultChart() { return BarIndependentChart.barChartTypes[0]; } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java index 331e511640..ccc39b525e 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedTypePane.java @@ -2,7 +2,7 @@ package com.fr.extended.chart; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chartx.attr.XChart; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; @@ -66,7 +66,7 @@ public class ExtendedTypePane extends AbstractChartType } @Override - public XChart getDefaultChart() { + public ChartProvider getDefaultChart() { return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0]; } From eba5d13d8fc2410224e9b3e6856c1856d29f4efb Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 27 Jun 2019 13:50:02 +0800 Subject: [PATCH 4/4] =?UTF-8?q?CHART-9141=20ChartRequestService=E6=96=B0?= =?UTF-8?q?=E5=A2=9E+chart=20service=20move=20to=20chart=20module+chartdat?= =?UTF-8?q?a=20remove=20from=20engine-cross?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chart/ChartControlPane.java | 128 ------------------ .../chart/gui/other/ChartSwitchPane.java | 94 ------------- 2 files changed, 222 deletions(-) delete mode 100644 designer-chart/src/main/java/com/fr/design/chart/ChartControlPane.java delete mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartControlPane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartControlPane.java deleted file mode 100644 index e0493cc70d..0000000000 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartControlPane.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.fr.design.chart; - -import com.fr.chart.chartattr.Chart; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.gui.controlpane.JListControlPane; -import com.fr.design.gui.controlpane.NameObjectCreator; -import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.design.layout.FRGUIPaneFactory; - -import com.fr.general.NameObject; -import com.fr.stable.Nameable; - -import java.awt.*; -import java.util.HashMap; - -/** - * 管理图表类型Pane - * @author kunsnat: ChartComponent移出. - */ -public class ChartControlPane extends JListControlPane { - private static final long serialVersionUID = 7336270815128413184L; - - public ChartControlPane() { - super(); - // 重新设定大小. 因为JControlPane默认的(450,450) 不适合图表这边 @ChartSize -// this.setPreferredSize(new Dimension(770, 520)); - } - - @Override - public NameableCreator[] createNameableCreators() { - return new NameableCreator[] { - new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Chart"), Chart.class, ChartTypeUpdatePane.class) - }; - } - - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Manage_Chart_Type"); - } - - public void populate(ChartCollection cc) { - if(cc == null)return; - - NameObject[] nameObjects = new NameObject[cc.getChartCount()]; - for (int i = 0; i < nameObjects.length; i++) { - nameObjects[i] = new NameObject(cc.getChartName(i), cc.getChart(i)); - } - - populate(nameObjects); - // kunsnat: 选中当前图表选中的name - String chartSelectedName = cc.getChartName(cc.getSelectedIndex() < cc.getChartCount() ? cc.getSelectedIndex() : 0); - setSelectedName(chartSelectedName); - } - - public void update(ChartCollection cc) { - HashMap namesChart = new HashMap();// 暂存判断是否有必要更新 - for(int i = 0; i < cc.getChartCount(); i++) { - try { - namesChart.put(cc.getChartName(i), cc.getChart(i).clone()); - } catch (CloneNotSupportedException e) { - - } - } - - Nameable[] nameables = update(); - if (nameables.length == 0 || cc == null) { - return; - } - - cc.removeAllNameObject(); - String select = getSelectedName(); - for (int i = 0; i < nameables.length; i++) { - if (nameables[i] instanceof NameObject && ((NameObject)nameables[i]).getObject() instanceof Chart) { - NameObject no = (NameObject)nameables[i]; - - String name = no.getName(); - Chart chart = (Chart)no.getObject(); - if(namesChart.containsKey(name)) { - Chart tmpChart = (Chart)namesChart.get(name); - if(chart.getPlot() != null && tmpChart.getPlot() != null - && chart.getPlot().match4GUI(tmpChart.getPlot())) { - chart = tmpChart;// 代替之前做过编辑的Chart - } - } - cc.addNamedChart(name, chart); - if(no.getName().equals(select)) { - cc.setSelectedIndex(i); - } - } - } - } - - /* - * alex:继承UpdatePane的ChartTypePane - */ - public static class ChartTypeUpdatePane extends BasicBeanPane { - private static final long serialVersionUID = -7058348930816218415L; - private Chart editing; - - private ChartTypePane typePane; - - public ChartTypeUpdatePane() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - typePane = new ChartTypePane(); - this.add(typePane, BorderLayout.CENTER); - } - - @Override - protected String title4PopupWindow() { - return "Chart Type"; - } - - @Override - public void populateBean(Chart ob) { - editing = ob; - typePane.populate(ob); - } - - @Override - public Chart updateBean() { - typePane.update(editing); - - return editing; - } - } -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java deleted file mode 100644 index 6288b7ecf4..0000000000 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/other/ChartSwitchPane.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.fr.design.mainframe.chart.gui.other; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - -import com.fr.design.chart.ChartControlPane; -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.mainframe.chart.ChartEditPane; -import com.fr.design.mainframe.chart.PaneTitleConstants; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.DialogActionAdapter; - - -public class ChartSwitchPane extends AbstractAttrNoScrollPane{ - - private UIButton changeButton; - - private ChartCollection editingChartCollection; - - private ChartEditPane currentChartEditPane; - - public ChartSwitchPane() { - - } - - @Override - protected JPanel createContentPane() { - JPanel pane = new JPanel(); - pane.setLayout(new BorderLayout()); - - changeButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Switch")); - - pane.add(changeButton, BorderLayout.NORTH); - - changeButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - final ChartControlPane chartTypeManager = new ChartControlPane(); - chartTypeManager.populate(editingChartCollection); - - BasicDialog dlg = chartTypeManager.showWindow4ChartType(SwingUtilities.getWindowAncestor(new JPanel()), new DialogActionAdapter() { - public void doOk() { - chartTypeManager.update(editingChartCollection);//kunsnat: 确定刷新"chartSelectIndex" - - if(currentChartEditPane != null) { - currentChartEditPane.populate(editingChartCollection);// 选中新Plot之后 刷新对应界面, 比如超级链接等, 然后才能update. - currentChartEditPane.gotoPane(PaneTitleConstants.CHART_TYPE_TITLE); - currentChartEditPane.gotoPane(PaneTitleConstants.CHART_OTHER_TITLE, PaneTitleConstants.CHART_OTHER_TITLE_CHANGE); - currentChartEditPane.fire(); - } - } - }); - - dlg.setVisible(true); - } - }); - - return pane; - } - - /** - * 注册 切换事件的改变 和超链不同. - * @param listener - */ - public void registerChartEditPane(ChartEditPane currentChartEditPane) { - this.currentChartEditPane = currentChartEditPane; - } - - public void populateBean(ChartCollection c) { - this.editingChartCollection = c; - } - - public void updateBean(ChartCollection c) { - - } - - /** - * 界面标题 - * @param 返回标题 - */ - public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Switch_Chart"); - } - - @Override - public String getIconPath() { - return null; - } -} \ No newline at end of file