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 72585ade8..8c3f56ae0 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -2,7 +2,6 @@ package com.fr.design; import com.fr.chart.base.ChartConstants; 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.ChartProvider; @@ -161,7 +160,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; int index = 0; for (ChartInternationalNameContentBean bean : typeName) { - String plotID = bean.getPlotID(); + String plotID = bean.getChartID(); ChartProvider[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(plotID)) { continue; @@ -254,7 +253,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr * * @param paneList pane容器 */ - public void addPlotTypePaneList(List> paneList, Map>> allChartTypePane) { + public void addPlotTypePaneList(List> paneList, Map>> allChartTypePane) { List priorityList = getPriorityInOrder(); for (Integer aPriorityList : priorityList) { @@ -264,7 +263,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } - public void addPlotTypePaneList(String priority, List> paneList, Map>> allChartTypePane) { + public void addPlotTypePaneList(String priority, List> paneList, Map>> allChartTypePane) { if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { @@ -283,7 +282,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr paneList.add(pane); if (allChartTypePane.get(priority) == null) { - allChartTypePane.put(priority, new LinkedHashMap>()); + allChartTypePane.put(priority, new LinkedHashMap>()); } allChartTypePane.get(priority).put(plotID, pane); } @@ -450,9 +449,10 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return true; } - public boolean needChartChangePane(Chart chart) { - if (chart != null && chart.getPlot() != null) { - IndependentChartUIProvider provider = getChartTypeInterface(chart.getPlot().getPlotID()); + public boolean needChartChangePane(ChartProvider chart) { + if (chart != null) { + String chartID = chart.getID(); + IndependentChartUIProvider provider = getChartTypeInterface(chartID); if (provider != null) { return provider.needChartChangePane(); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java index 7fefabd3e..6ff6e0639 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java @@ -1,7 +1,7 @@ package com.fr.design.chart; -import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.chartx.attr.ChartProvider; public abstract class ChartCommonWizardPane extends ChartWizardPane { private static final long serialVersionUID = 2467967841657570498L; @@ -11,12 +11,12 @@ public abstract class ChartCommonWizardPane extends ChartWizardPane { if (cc == null) { return; } - - populate(cc.getSelectedChart()); + + populate(cc.getSelectedChartProvider()); } - - public abstract void populate(Chart chart); - - public abstract void update(Chart oldChart); + + public abstract void populate(ChartProvider chart); + + public abstract void update(ChartProvider oldChart); } \ No newline at end of file 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 2a19072e0..257fb8826 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 @@ -5,18 +5,13 @@ package com.fr.design.chart; */ import com.fr.chart.base.ChartInternationalNameContentBean; -import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; 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.ChartProvider; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.license.exception.RegistEditionException; -import com.fr.license.function.VT4FR; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; @@ -24,7 +19,6 @@ import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JList; -import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.ListCellRenderer; @@ -37,22 +31,22 @@ public class ChartTypePane extends ChartCommonWizardPane { private static final long serialVersionUID = -1175602484968520546L; private ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstanceWithCheck().getAllChartBaseNames(); - //todo@shinerefactor 这个页面所有强转Chart的地方都要处理一下 - private Chart[][] charts4Icon = null; + private ChartProvider[][] charts4Icon = null; { - charts4Icon = new Chart[this.typeName.length][]; + charts4Icon = new ChartProvider[this.typeName.length][]; for (int i = 0; i < this.typeName.length; i++) { - ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getPlotID()); + ChartProvider[] rowCharts = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.typeName[i].getChartID()); int rowChartsCount = rowCharts.length; - charts4Icon[i] = new Chart[rowChartsCount]; + charts4Icon[i] = new ChartProvider[rowChartsCount]; for (int j = 0; j < rowChartsCount; j++) { try { - charts4Icon[i][j] = (Chart) rowCharts[j].clone(); - charts4Icon[i][j].setTitle(null); - if(charts4Icon[i][j].getPlot() != null){ - charts4Icon[i][j].getPlot().setLegend(null); - } + charts4Icon[i][j] = (ChartProvider) rowCharts[j].clone(); + //todo@shinerefactor 老图表也是提供一张图片 这边就不用setTitle(null) 然后实时去画 +// charts4Icon[i][j].setTitle(null); +// if(charts4Icon[i][j].getPlot() != null){ +// charts4Icon[i][j].getPlot().setLegend(null); +// } } catch (CloneNotSupportedException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -123,7 +117,7 @@ public class ChartTypePane extends ChartCommonWizardPane { protected ListSelectionListener listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int main_index = mainTypeList.getSelectedIndex(); - Chart[] sub_charts = ChartTypePane.this.charts4Icon[main_index]; + ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index]; ChartTypePane.this.iconListModel.clear(); for (int i = 0; i < sub_charts.length; i++) { ChartTypePane.this.iconListModel.addElement(new ChartIcon(sub_charts[i])); @@ -133,56 +127,14 @@ public class ChartTypePane extends ChartCommonWizardPane { }; public String getChartName(ChartIcon chartIcon) { - Chart chart = (Chart)chartIcon.getChart(); - return chart.getChartName(); + ChartProvider chart = chartIcon.getChart(); + return ChartTypeManager.getInstanceWithCheck().getChartName(chart.getID()); } - public void populate(Chart chart) { - if (chart == null) { - return; - } - Plot plot = chart.getPlot(); - - int mainIndex = 0; - int subIndex = 0; - - for (int i = 0; i < typeName.length; i++) { - 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; - subIndex = j; - // 一旦匹配 立马中断 - break; - } - } - } - - mainTypeList.setSelectedIndex(mainIndex); - iconViewList.setSelectedIndex(subIndex); - } - - public void update(Chart oldChart) { - String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); - 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")); - throw new RegistEditionException(VT4FR.ChartMap); - } - - if (chart.getPlot() != null) { - try { - oldChart.changePlotInNewType((Plot) chart.getPlot().clone()); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } + public void populate(ChartProvider chart) { } - private boolean supportMap() { - return VT4FR.ChartMap.isSupport(); + public void update(ChartProvider oldChart) { } public void update(ChartCollection cc) { @@ -190,12 +142,12 @@ public class ChartTypePane extends ChartCommonWizardPane { return; } - Chart chart4Update = cc.getSelectedChart(); + ChartProvider chart4Update = cc.getSelectedChartProvider(); if (chart4Update == null) { - String plotID = typeName[mainTypeList.getSelectedIndex()].getPlotID(); - Chart chart = (Chart) ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; + String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID(); + ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; try{ - chart4Update = (Chart)chart.clone(); + chart4Update = (ChartProvider) chart.clone(); cc.addChart(chart4Update); }catch (CloneNotSupportedException ex){ FineLoggerFactory.getLogger().error(ex.getMessage(), ex); 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 eb36aadea..753bb47cd 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,6 @@ package com.fr.design.chart.gui; -import com.fr.chart.charttypes.ChartTypeManager; -import com.fr.chartx.attr.ChartProvider; +import com.fr.base.chart.BaseChartGetter; import com.fr.design.gui.core.WidgetOption; import com.fr.form.ui.ChartEditor; import com.fr.form.ui.Widget; @@ -38,14 +37,11 @@ public class ChartWidgetOption extends WidgetOption { Class clz = widgetClass(); try { ChartEditor widget = clz.newInstance(); - ChartProvider chart = ChartTypeManager.getInstanceWithCheck().getChartTypes(this.chartID)[0]; - widget.addChart((ChartProvider) chart.clone()); + widget.setChartCollection(BaseChartGetter.createChartCollection(this.chartID)); return widget; } catch (InstantiationException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); + FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IllegalAccessException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } catch (CloneNotSupportedException 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 9bedc637d..83d471068 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,6 +1,5 @@ package com.fr.design.chart.gui.active.action; -import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartglyph.AxisGlyph; import com.fr.design.actions.UpdateAction; @@ -32,10 +31,6 @@ public abstract class ChartComponentAction extends UpdateAction { return chartComponent.getChartCollection(); } - public Axis getActiveAxis() { - return chartComponent.getActiveAxis(); - } - public AxisGlyph getActiveAxisGlyph() { return chartComponent.getActiveAxisGlyph(); } 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 74c78ff2d..7083da681 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 @@ -1,6 +1,5 @@ package com.fr.design.chart.series.SeriesCondition.impl; -import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; @@ -92,7 +91,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane(); addTypePane(); - boolean isDefault = true; - String plotID = ""; - if(currentChart.getPlot() != null){ - plotID = currentChart.getPlot().getPlotID(); - isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - } + String chartID = currentChart.getID(); + boolean isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); if(isDefault){ paneList.add(dataPane4SupportCell); @@ -152,11 +151,11 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 paneList.add(otherPane); this.isDefaultPane = true; }else{ - ChartDataPane chartDataPane = createChartDataPane(plotID); + ChartDataPane chartDataPane = createChartDataPane(chartID); if (chartDataPane != null) { paneList.add(chartDataPane); } - AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener); + AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(chartID, listener); for(int i = 0; i < otherPaneList.length; i++){ otherPaneList[i].addAttributeChangeListener(listener); paneList.add(otherPaneList[i]); @@ -226,8 +225,8 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 return; } - if(checkNeedsReLayout(collection.getSelectedChart())){ - reLayout(collection.getSelectedChart()); + if (checkNeedsReLayout(collection.getSelectedChartProvider())) { + reLayout(collection.getSelectedChartProvider()); } this.collection = collection; @@ -253,7 +252,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } } - public int getSelectedChartIndex(Chart chart){ + public int getSelectedChartIndex(ChartProvider chart) { int index = 0; if(typePane != null){ FurtherBasicBeanPane[] paneList = typePane.getPaneList(); @@ -267,15 +266,13 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 } //populate的时候看看要不要重构面板 - private boolean checkNeedsReLayout(Chart chart){ + private boolean checkNeedsReLayout(ChartProvider chart) { if(chart != null){ int lastIndex = typePane.getSelectedIndex(); int currentIndex = getSelectedChartIndex(chart); - boolean currentPane = true; - if(chart.getPlot() != null){ - String plotID = chart.getPlot().getPlotID(); - currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); - } + String chartID = chart.getID(); + boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); + return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex); } return false; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index ef5f8e1d4..4d7221113 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -19,6 +19,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -42,6 +43,8 @@ import java.awt.event.MouseListener; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; /** * 图表 类型 增删 控制按钮界面. @@ -56,6 +59,12 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private static final int P_W = 300; private static final int P_H = 400; + private static Set> supportChangeConfigChartClassSet = new HashSet>(); + + static { + registerSupportChangeConfigChartClass(VanChart.class); + } + private UIButton addButton; private UIButton configButton; private ArrayList indexList = new ArrayList(); @@ -109,6 +118,10 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen // Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); } + public static void registerSupportChangeConfigChartClass(Class cls) { + supportChangeConfigChartClassSet.add(cls); + } + private void initConfigCreator() { configCreator = new UIMenuNameableCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Change_Config_Attributes"), new AttrChangeConfig(), ChangeConfigPane.class); } @@ -135,7 +148,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (editingCollection != null) { //点击添加按钮,则会触发切换状态 - ChartProvider chart = editingCollection.getChangeStateNewChart(); + ChartProvider chart = getChangeStateNewChart(); try { ChartProvider newChart = (ChartProvider) chart.clone(); editingCollection.addNamedChart(name, newChart); @@ -150,12 +163,51 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //获取图表收集器的状态 private void checkoutChange(){ - editingCollection.calculateMultiChartMode(); + calculateMultiChartMode(); if (parent != null){ parent.relayoutChartTypePane(editingCollection); } //检查是否可以配置切换 - configButton.setEnabled(editingCollection.changeEnable()); + configButton.setEnabled(changeEnable()); + } + + /** + * 获取切花状态下的图表 + * + * @return + */ + public ChartProvider getChangeStateNewChart() { + ChartProvider chart = editingCollection.getSelectedChartProvider(); + String priority = ChartTypeManager.VAN_CHART_PRIORITY; + //todo@shinerefactor + // chart.getPriority(); + return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority); + } + + //图表收集器模式状态改变 + private void calculateMultiChartMode() { + //设置切换功能是否可用 + editingCollection.getChangeConfigAttr().setEnable(changeEnable()); + //多图表切换模式 + if (editingCollection.getChartCount() > 1) { + editingCollection.setState(SwitchState.CHANGE); + } else { + editingCollection.setState(SwitchState.DEFAULT); + } + } + + /** + * 是否支持图表切换的配置 + * + * @return + */ + private boolean changeEnable() { + return editingCollection.getChartCount() > 1 + && supportChange(); + } + + private boolean supportChange() { + return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider().getClass()); } ActionListener configListener = new ActionListener() { @@ -310,11 +362,11 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen } private void checkConfigButtonVisible() { - addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChart().getPlot().getPlotID())); + addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChartProvider().getID())); //新建一个collection - if(editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChart() != null){ + if (editingCollection.getState() == SwitchState.DEFAULT && editingCollection.getSelectedChartProvider() != null) { //Chart 不支持图表切换 - configButton.setVisible(editingCollection.getSelectedChart().supportChange()); + configButton.setVisible(supportChange()); } } @@ -440,7 +492,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen private void deleteAButton() { //先重构属性,在重构面板,否则面板在重构过程中,会重新将属性中的切换图表加到indexList中,导致面板无法删除 //记录改变前的plotID - String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID(); + String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID(); if (editingCollection != null) { int count = editingCollection.getChartCount(); for (int i = 0; i < count; i++) { @@ -520,7 +572,7 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen if (isEnabled()) { noSelected(); //记录改变前的plotID - String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChart().getPlot().getPlotID(); + String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID(); changeCollectionSelected(getButtonName()); setSelectedWithFireListener(true); fireSelectedChanged(); 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 56547842c..8ac031f75 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 @@ -2,9 +2,9 @@ package com.fr.design.mainframe.chart.gui; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; -import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.SwitchState; import com.fr.chart.charttypes.ChartTypeManager; +import com.fr.chartx.attr.ChartProvider; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.dialog.BasicScrollPane; @@ -98,14 +98,14 @@ public class ChartTypePane extends AbstractChartAttrPane{ public String title4PopupWindow() { return PaneTitleConstants.CHART_TYPE_TITLE; } - - class ComboBoxPane extends UIComboBoxPane{ - private Map>> allChartTypePane; + + class ComboBoxPane extends UIComboBoxPane { + private Map>> allChartTypePane; @Override - protected List> initPaneList() { - List> paneList = new ArrayList>(); - allChartTypePane = new LinkedHashMap>>(); + protected List> initPaneList() { + List> paneList = new ArrayList>(); + allChartTypePane = new LinkedHashMap>>(); ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane); return paneList; } @@ -121,13 +121,12 @@ public class ChartTypePane extends AbstractChartAttrPane{ * 如果是切换图表的不同图表之间切换,则collection的选择下标会改变 * @param chart */ - public void updateBean(Chart chart) { + public void updateBean(ChartProvider chart) { - Plot oldPlot = chart.getPlot(); - String lastPlotID = oldPlot == null ? StringUtils.EMPTY : oldPlot.getPlotID(); + String lastPlotID = chart.getID(); try{ - Chart newDefaultChart = (Chart)((AbstractChartTypePane)getSelectedPane()).getDefaultChart().clone(); + ChartProvider newDefaultChart = (ChartProvider) ((AbstractChartTypePane) getSelectedPane()).getDefaultChart().clone(); if (!ComparatorUtils.equals(chart.getClass(), newDefaultChart.getClass())) { //vanChart 和 chart 之间切换 //不同chart之间切换 @@ -142,20 +141,20 @@ public class ChartTypePane extends AbstractChartAttrPane{ //这一步会替换plot ((AbstractChartTypePane)getSelectedPane()).updateBean(chart); - Plot plot = chart.getPlot(); - - if(plot != null){ - String plotID = plot.getPlotID(); + String chartID = chart.getID(); - //plot改变的话图表类型就算改变了 + //chartID改变的话图表类型就算改变了 + if (StringUtils.isNotEmpty(chartID)) { - chart.setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(plotID)); - - chart.setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(plotID)); + if (chart instanceof Chart) { + //todo@shinerefactor: 这边看下是否可以删除 + ((Chart) chart).setWrapperName(ChartTypeManager.getInstanceWithCheck().getWrapperName(chartID)); + ((Chart) chart).setChartImagePath(ChartTypeManager.getInstanceWithCheck().getChartImagePath(chartID)); + } - boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); + boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); - if(editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ + if (editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, chartID))) { editPane.reLayout(chart); } } @@ -195,12 +194,12 @@ public class ChartTypePane extends AbstractChartAttrPane{ private void addOnePriorityCards(String priority, boolean ignore) { - Map> map = allChartTypePane.get(priority); + Map> map = allChartTypePane.get(priority); - Iterator>> iterator = map.entrySet().iterator(); + Iterator>> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { - Map.Entry> entry = iterator.next(); + Map.Entry> entry = iterator.next(); String plotID = entry.getKey(); if (ignore || ChartTypeManager.enabledChart(plotID)) { cards.add(entry.getValue()); @@ -217,9 +216,11 @@ public class ChartTypePane extends AbstractChartAttrPane{ //处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了) private void relayout(ChartCollection collection){ //重构需要重构下拉框选项和cardNames - Chart chart = collection.getSelectedChart(); - String priority = chart.getPriority(); - String plotID = chart.getPlot().getPlotID(); + ChartProvider chart = collection.getSelectedChartProvider(); + String priority = ChartTypeManager.VAN_CHART_PRIORITY; + //TODO@shinerefactor + // chart.getPriority(); + String plotID = chart.getID(); boolean enabledChart = ChartTypeManager.enabledChart(plotID); String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID); @@ -262,7 +263,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ } @Override - public void populateBean(Chart ob) { + public void populateBean(ChartProvider ob) { for (int i = 0; i < this.cards.size(); i++) { FurtherBasicBeanPane pane = cards.get(i); if (pane.accept(ob)) { @@ -279,12 +280,12 @@ public class ChartTypePane extends AbstractChartAttrPane{ } @Override - public Chart updateBean() { + public ChartProvider updateBean() { return getSelectedPane().updateBean(); } @Override - public FurtherBasicBeanPane getSelectedPane(){ + public FurtherBasicBeanPane getSelectedPane() { Object item = jcb.getSelectedItem(); for (int i = 0; i < cards.size(); i++){ if (ComparatorUtils.equals(item, cards.get(i).title4PopupWindow())){ @@ -303,8 +304,8 @@ public class ChartTypePane extends AbstractChartAttrPane{ * @param collection */ public void reLayoutEditPane(String lastPlotID, ChartCollection collection){ - Chart chart = collection.getSelectedChart(); - String plotID = chart.getPlot().getPlotID(); + ChartProvider chart = collection.getSelectedChartProvider(); + String plotID = chart.getID(); boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID); if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){ editPane.reLayout(chart); @@ -322,7 +323,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void populate(ChartCollection collection) { editingCollection = collection; - Chart chart = collection.getSelectedChart(); + ChartProvider chart = collection.getSelectedChartProvider(); this.remove(leftContentPane); initContentPane(); @@ -340,7 +341,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void update(ChartCollection collection) { editingCollection = collection; buttonPane.update(collection);// 内部操作时 已经做过处理. - Chart chart = collection.getSelectedChart(); + ChartProvider chart = collection.getSelectedChartProvider(); chartTypeComBox.updateBean(chart); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java deleted file mode 100644 index 9ce3afd91..000000000 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/StylePane4Chart.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fr.design.mainframe.chart.gui; - -import com.fr.chart.chartattr.ChartCollection; -import com.fr.design.gui.frpane.AttributeChangeListener; -import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; -import com.fr.design.mainframe.chart.gui.style.series.SeriesPane4ChartDesigner; - -/** - * 图表设计器的样式面板 - * Created by IntelliJ IDEA. - * Author : daisy - * Version: 6.5.6 - * Date: 14-10-25 - * Time: 下午6:56 - */ -public class StylePane4Chart extends ChartStylePane { - - public StylePane4Chart(AttributeChangeListener listener, boolean isNeedFormula) { - super(listener, isNeedFormula); - } - - public void update(ChartCollection collection) { - int selectIndex = collection.getSelectedIndex(); - super.update(collection); - collection.getSelectedChart().setStyleGlobal(false); - collection.setChartName(selectIndex, collection.getSelectedChart().getTitle().getTextObject().toString()); - } - - protected ChartSeriesPane createChartSeriesPane(){ - return new SeriesPane4ChartDesigner(StylePane4Chart.this); - } - -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java index 4561549d4..639a41e42 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractBarPane.java @@ -9,9 +9,9 @@ import com.fr.chart.chartattr.Chart; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-25 下午04:55:05 */ -public abstract class AbstractBarPane extends AbstractChartTypePane { - - protected static final int COLOMN_CHART = 0; +public abstract class AbstractBarPane extends AbstractDeprecatedChartTypePane { + + protected static final int COLOMN_CHART = 0; protected static final int STACK_COLOMN_CHART = 1; protected static final int PERCENT_STACK_COLOMN_CHART = 2; protected static final int THREE_D_COLOMN_CHART = 3; 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 47de03b56..263424762 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 @@ -1,21 +1,9 @@ package com.fr.design.mainframe.chart.gui.type; -import com.fr.base.ChartColorMatching; -import com.fr.base.ChartPreStyleConfig; -import com.fr.base.background.ColorBackground; -import com.fr.chart.base.AttrContents; -import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.ChartConstants; -import com.fr.chart.base.ChartUtils; -import com.fr.chart.base.DataSeriesCondition; -import com.fr.chart.base.TextAttr; -import com.fr.chart.chartattr.Axis; -import com.fr.chart.chartattr.CategoryPlot; import com.fr.chart.chartattr.Chart; -import com.fr.chart.chartattr.Legend; 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.ChartProvider; import com.fr.design.beans.FurtherBasicBeanPane; @@ -25,9 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.ComparatorUtils; -import com.fr.general.FRFont; -import com.fr.js.NameJavaScriptGroup; -import com.fr.log.FineLoggerFactory; import com.fr.stable.Constants; import javax.swing.JPanel; @@ -35,12 +20,11 @@ import javax.swing.JSeparator; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -import java.awt.Font; import java.util.ArrayList; import java.util.List; -public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ +public abstract class AbstractChartTypePane extends FurtherBasicBeanPane { private static final int ONE_LINE_NUM = 4; @@ -163,50 +147,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ } } } - /** - * 更新界面属性 - */ - public void populateBean(Chart chart) { - for(ChartImagePane imagePane : typeDemo) { - imagePane.isPressing = false; - } - for(ChartImagePane imagePane : styleList) { - imagePane.isPressing = false; - } - - if(styleList != null && !styleList.isEmpty()){ - int plotStyle = chart.getPlot().getPlotStyle(); - String styleName = chart.getPlot().getPlotFillStyle().getFillStyleName(); - - switch (plotStyle){ - case ChartConstants.STYLE_SHADE: if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"), styleName)){ - styleList.get(STYLE_SHADE).isPressing = true; - lastStyleIndex = STYLE_SHADE; - } - break; - case ChartConstants.STYLE_TRANSPARENT:if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"), styleName)){ - styleList.get(STYLE_TRANSPARENT).isPressing = true; - lastStyleIndex = STYLE_TRANSPARENT; - } - break; - case ChartConstants.STYLE_3D: if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)){ - styleList.get(STYLE_PLANE3D).isPressing = true; - lastStyleIndex = STYLE_PLANE3D; - } - break; - case ChartConstants.STYLE_OUTER:if(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)){ - styleList.get(STYLE_HIGHLIGHT).isPressing = true; - lastStyleIndex = STYLE_HIGHLIGHT; - } - break; - default: - lastStyleIndex = -1; - break; - } - stylePane.setVisible(!(chart.getPlot().isSupport3D())); - this.repaint(); - } - } protected void checkDemosBackground() { if(this.styleList != null && !styleList.isEmpty()){ @@ -222,119 +162,10 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ } } - private void setPlotFillStyle(Chart chart){ - ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); - Plot plot = chart.getPlot(); - Object preStyle = null; - String name = ""; - if(styleList.get(STYLE_SHADE).isPressing){ - name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"); - preStyle = manager.getPreStyle(name); - }else if(styleList.get(STYLE_TRANSPARENT).isPressing){ - name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"); - preStyle = manager.getPreStyle(name); - }else if(styleList.get(STYLE_PLANE3D).isPressing){ - name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"); - preStyle = manager.getPreStyle(name); - }else if(styleList.get(STYLE_HIGHLIGHT).isPressing){ - name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"); - preStyle = manager.getPreStyle(name); - } - if(preStyle == null){ - plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT); - }else{ - AttrFillStyle fillStyle = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); - fillStyle.setFillStyleName(name); - plot.setPlotFillStyle(fillStyle); - } - } - - /** - * 保存风格,对选中的风格做设置 - */ - public void updateBean(Chart chart) { - Plot oldPlot = chart.getPlot(); - Plot newPlot = this.setSelectedClonedPlotWithCondition(oldPlot); - checkTypeChange(oldPlot);//判断图表的类型是否发生变化 - if(styleList != null && !styleList.isEmpty()){ - if(styleList.get(STYLE_SHADE).isPressing && lastStyleIndex != STYLE_SHADE){ - lastStyleIndex = STYLE_SHADE; - chart.setPlot(newPlot); - chart.getPlot().setPlotStyle(ChartConstants.STYLE_SHADE); - resetChart(chart); - createCondition4Shade(chart); - setPlotFillStyle(chart); - }else if(styleList.get(STYLE_TRANSPARENT).isPressing && lastStyleIndex != STYLE_TRANSPARENT){ - lastStyleIndex = STYLE_TRANSPARENT; - chart.setPlot(newPlot); - chart.getPlot().setPlotStyle(ChartConstants.STYLE_TRANSPARENT); - resetChart(chart); - createCondition4Transparent(chart); - setPlotFillStyle(chart); - }else if(styleList.get(STYLE_PLANE3D).isPressing && lastStyleIndex != STYLE_PLANE3D){ - lastStyleIndex = STYLE_PLANE3D; - chart.setPlot(newPlot); - chart.getPlot().setPlotStyle(ChartConstants.STYLE_3D); - resetChart(chart); - createCondition4Plane3D(chart); - setPlotFillStyle(chart); - }else if(styleList.get(STYLE_HIGHLIGHT).isPressing && lastStyleIndex != STYLE_HIGHLIGHT){ - lastStyleIndex = STYLE_HIGHLIGHT; - chart.setPlot(newPlot); - chart.getPlot().setPlotStyle(ChartConstants.STYLE_OUTER); - resetChart(chart); - createCondition4HighLight(chart); - setPlotFillStyle(chart); - }else if(lastStyleIndex >= STYLE_SHADE && lastStyleIndex <= STYLE_HIGHLIGHT){ - if(styleList.get(lastStyleIndex).isDoubleClicked || typeChanged){ - chart.setPlot(newPlot); - resetChart(chart); - styleList.get(lastStyleIndex).isPressing = false; - checkDemosBackground(); - lastStyleIndex = -1; - } - } - - stylePane.setVisible(!(chart.getPlot().isSupport3D())); - this.repaint(); - } - } - - private Plot setSelectedClonedPlotWithCondition(Plot oldPlot){ - Plot newPlot = getSelectedClonedPlot(); - if(oldPlot != null && ComparatorUtils.equals(newPlot.getClass(), oldPlot.getClass())){ - if(oldPlot.getHotHyperLink() != null){ - NameJavaScriptGroup hotHyper = oldPlot.getHotHyperLink(); - try { - newPlot.setHotHyperLink((NameJavaScriptGroup)hotHyper.clone()); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error("Error in Hyperlink, Please Check it.", e); - } - } - newPlot.setConditionCollection(oldPlot.getConditionCollection()); - newPlot.setSeriesDragEnable(oldPlot.isSeriesDragEnable()); - if(newPlot.isSupportZoomCategoryAxis() && newPlot.getxAxis() != null) { - newPlot.getxAxis().setZoom(oldPlot.getxAxis().isZoom()); - } - if(newPlot.isSupportTooltipInInteractivePane()) { - newPlot.setHotTooltipStyle(oldPlot.getHotTooltipStyle()); - } - - if(newPlot.isSupportAutoRefresh()) { - newPlot.setAutoRefreshPerSecond(oldPlot.getAutoRefreshPerSecond()); - } - - if (newPlot.isSupportAxisTip()) { - newPlot.setInteractiveAxisTooltip(oldPlot.isInteractiveAxisTooltip()); - } - } - return newPlot; - } - /** * 更新整个新的Chart类型 */ - public Chart updateBean() { + public T updateBean() { return null; } @@ -346,14 +177,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ chart.setBackground(null); } - protected void changePlotWithClone(Chart chart, Plot plot) { - try { - chart.switchPlot((Plot)plot.clone()); - } catch (CloneNotSupportedException e) { - FineLoggerFactory.getLogger().error("Error in change plot"); - } - } - /** * 重置 */ @@ -394,219 +217,6 @@ public abstract class AbstractChartTypePane extends FurtherBasicBeanPane{ return false; } - //高光渐变的默认属性设置 - private void createCondition4HighLight(Chart chart){ - if(chart != null){ - //标题 - Title title = new Title(chart.getTitle().getTextObject()); - chart.setTitle(title); - title.setTitleVisible(true); - TextAttr textAttr = title.getTextAttr(); - if (textAttr == null) { - textAttr = new TextAttr(); - title.setTextAttr(textAttr); - } - title.setPosition(Constants.LEFT); - textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(51, 51, 51))); - - //图例 - Legend legend = new Legend(); - legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138,140,139))); - legend.setPosition(Constants.RIGHT_TOP); - chart.getPlot().setLegend(legend); - - //分类轴,现在只有柱形图,条形图,面积图 - if(chart.getPlot() instanceof CategoryPlot){ - CategoryPlot plot = (CategoryPlot)chart.getPlot(); - - //分类轴设置 - Axis cateAxis = plot.getxAxis(); - cateAxis.setAxisStyle(Constants.LINE_THICK); - cateAxis.setAxisColor(new Color(204, 220, 228)); - cateAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); - cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setShowAxisLabel(true); - cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(138,140,139))); - - //值轴 - Axis valueAxis = plot.getyAxis(); - valueAxis.setAxisStyle(Constants.NONE); - valueAxis.setAxisColor(null); - valueAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); - valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); - valueAxis.setShowAxisLabel(true); - valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(138,140,139))); - - //绘图区 - plot.setBorderStyle(Constants.LINE_THIN); - plot.setBorderColor(new Color(204, 220, 228)); - plot.setBackground(ColorBackground.getInstance(new Color(248, 247, 245))); - plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); - plot.getyAxis().setMainGridColor(new Color(192,192,192)); - } - - } - } - - //平面3D的默认属性设置 - private void createCondition4Plane3D(Chart chart){ - if(chart != null){ - //标题 - Title title = new Title(chart.getTitle().getTextObject()); - chart.setTitle(title); - title.setTitleVisible(true); - TextAttr textAttr = title.getTextAttr(); - if (textAttr == null) { - textAttr = new TextAttr(); - title.setTextAttr(textAttr); - } - title.setPosition(Constants.CENTER); - textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 16f, new Color(51,51,51))); - - //图例 - Legend legend = new Legend(); - legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128,128,128))); - legend.setPosition(Constants.TOP); - chart.getPlot().setLegend(legend); - - //分类轴,现在只有柱形图,条形图,面积图 - if(chart.getPlot() instanceof CategoryPlot){ - CategoryPlot plot = (CategoryPlot)chart.getPlot(); - //分类轴设置 - Axis cateAxis = plot.getxAxis(); - cateAxis.setAxisStyle(Constants.LINE_THICK); - cateAxis.setAxisColor(new Color(57, 57, 57)); - cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setShowAxisLabel(true); - cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(57,57,57))); - - //值轴设置 - Axis valueAxis = plot.getyAxis(); - valueAxis.setAxisStyle(Constants.LINE_NONE); - valueAxis.setTickMarkType(Constants.TICK_MARK_NONE); - valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); - valueAxis.setShowAxisLabel(false); - - //绘图区 - plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); - plot.getyAxis().setMainGridColor(new Color(192,192,192)); - chart.setBorderStyle(Constants.LINE_NONE); - - //数据标签 - ConditionAttr attrList = plot.getConditionCollection().getDefaultAttr(); - DataSeriesCondition attr = attrList.getExisted(AttrContents.class); - if(attr != null) { - attrList.remove(attr); - } - AttrContents attrContents = new AttrContents(); - attrContents.setPosition(Constants.OUTSIDE); - attrContents.setSeriesLabel(ChartConstants.VALUE_PARA); - attrContents.setTextAttr(new TextAttr(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(51,51,51)))); - attrList.addDataSeriesCondition(attrContents); - } - } - } - - //透明风格的默认属性设置 - private void createCondition4Transparent(Chart chart){ - if(chart != null){ - //标题 - Title title = new Title(chart.getTitle().getTextObject()); - chart.setTitle(title); - title.setTitleVisible(true); - TextAttr textAttr = title.getTextAttr(); - if (textAttr == null) { - textAttr = new TextAttr(); - title.setTextAttr(textAttr); - } - title.setPosition(Constants.LEFT); - textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(192,192,192))); - - //图例 - Legend legend = new Legend(); - legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138,140,139))); - legend.setPosition(Constants.RIGHT_TOP); - chart.getPlot().setLegend(legend); - - Plot plot = chart.getPlot(); - //绘图区 - chart.setBackground(ColorBackground.getInstance(new Color(51,51,51))); - - //分类轴,现在只有柱形图,条形图,面积图 - if(plot instanceof CategoryPlot){ - //边框 - plot.setBorderStyle(Constants.LINE_THIN); - plot.setBorderColor(new Color(65,65,65)); - - //分类轴设置 - Axis cateAxis = plot.getxAxis(); - cateAxis.setAxisStyle(Constants.LINE_THICK); - cateAxis.setAxisColor(new Color(192,192,192)); - cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setShowAxisLabel(true); - cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(150,150,150))); - - //值轴 - Axis valueAxis = plot.getyAxis(); - valueAxis.setShowAxisLabel(true); - valueAxis.setAxisStyle(Constants.LINE_NONE); - valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(150,150,150))); - valueAxis.setMainGridStyle(Constants.LINE_THIN); - valueAxis.setMainGridColor(new Color(63, 62, 62)); - } - } - } - - //渐变的默认属性设置 - private void createCondition4Shade(Chart chart){ - if(chart != null){ - //标题 - Title title = new Title(chart.getTitle().getTextObject()); - chart.setTitle(title); - title.setTitleVisible(true); - TextAttr textAttr = title.getTextAttr(); - if (textAttr == null) { - textAttr = new TextAttr(); - title.setTextAttr(textAttr); - } - title.setPosition(Constants.CENTER); - textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(0,51,102))); - - //图例 - Legend legend = new Legend(); - legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128,128,128))); - legend.setPosition(Constants.BOTTOM); - chart.getPlot().setLegend(legend); - - //分类轴,现在只有柱形图,条形图,面积图 - if(chart.getPlot() instanceof CategoryPlot){ - CategoryPlot plot = (CategoryPlot)chart.getPlot(); - - //分类轴设置 - Axis cateAxis = plot.getxAxis(); - cateAxis.setAxisStyle(Constants.LINE_THICK); - cateAxis.setAxisColor(new Color(73, 100, 117)); - cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); - cateAxis.setShowAxisLabel(true); - cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(128,128,128))); - - //值轴 - Axis valueAxis = plot.getyAxis(); - valueAxis.setShowAxisLabel(true); - valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(128,128,128))); - valueAxis.setAxisStyle(Constants.LINE_NONE); - - //绘图区 - plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); - plot.getyAxis().setMainGridColor(new Color(192,192,192)); - plot.setHorizontalIntervalBackgroundColor(new Color(243,243,243)); - } - } - } - protected boolean needsResetChart(Chart chart){ return chart != null &&chart.getPlot() != null diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java new file mode 100644 index 000000000..81578ded5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractDeprecatedChartTypePane.java @@ -0,0 +1,409 @@ +package com.fr.design.mainframe.chart.gui.type; + +import com.fr.base.ChartColorMatching; +import com.fr.base.ChartPreStyleConfig; +import com.fr.base.background.ColorBackground; +import com.fr.chart.base.AttrContents; +import com.fr.chart.base.AttrFillStyle; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.ChartUtils; +import com.fr.chart.base.DataSeriesCondition; +import com.fr.chart.base.TextAttr; +import com.fr.chart.chartattr.Axis; +import com.fr.chart.chartattr.CategoryPlot; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Legend; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartattr.Title; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRFont; +import com.fr.js.NameJavaScriptGroup; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.Constants; + +import java.awt.Color; +import java.awt.Font; + +/** + * Created by shine on 2019/7/1. + */ +public abstract class AbstractDeprecatedChartTypePane extends AbstractChartTypePane { + + protected void changePlotWithClone(Chart chart, Plot plot) { + try { + chart.switchPlot((Plot) plot.clone()); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error("Error in change plot"); + } + } + + /** + * 更新界面属性 + */ + public void populateBean(Chart chart) { + for (ChartImagePane imagePane : typeDemo) { + imagePane.isPressing = false; + } + for (ChartImagePane imagePane : styleList) { + imagePane.isPressing = false; + } + + if (styleList != null && !styleList.isEmpty()) { + int plotStyle = chart.getPlot().getPlotStyle(); + String styleName = chart.getPlot().getPlotFillStyle().getFillStyleName(); + + switch (plotStyle) { + case ChartConstants.STYLE_SHADE: + if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"), styleName)) { + styleList.get(STYLE_SHADE).isPressing = true; + lastStyleIndex = STYLE_SHADE; + } + break; + case ChartConstants.STYLE_TRANSPARENT: + if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"), styleName)) { + styleList.get(STYLE_TRANSPARENT).isPressing = true; + lastStyleIndex = STYLE_TRANSPARENT; + } + break; + case ChartConstants.STYLE_3D: + if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)) { + styleList.get(STYLE_PLANE3D).isPressing = true; + lastStyleIndex = STYLE_PLANE3D; + } + break; + case ChartConstants.STYLE_OUTER: + if (ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"), styleName)) { + styleList.get(STYLE_HIGHLIGHT).isPressing = true; + lastStyleIndex = STYLE_HIGHLIGHT; + } + break; + default: + lastStyleIndex = -1; + break; + } + stylePane.setVisible(!(chart.getPlot().isSupport3D())); + this.repaint(); + } + } + + public void updateBean(Chart chart) { + Plot oldPlot = chart.getPlot(); + Plot newPlot = this.setSelectedClonedPlotWithCondition(oldPlot); + checkTypeChange(oldPlot);//判断图表的类型是否发生变化 + if (styleList != null && !styleList.isEmpty()) { + if (styleList.get(STYLE_SHADE).isPressing && lastStyleIndex != STYLE_SHADE) { + lastStyleIndex = STYLE_SHADE; + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_SHADE); + resetChart(chart); + createCondition4Shade(chart); + setPlotFillStyle(chart); + } else if (styleList.get(STYLE_TRANSPARENT).isPressing && lastStyleIndex != STYLE_TRANSPARENT) { + lastStyleIndex = STYLE_TRANSPARENT; + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_TRANSPARENT); + resetChart(chart); + createCondition4Transparent(chart); + setPlotFillStyle(chart); + } else if (styleList.get(STYLE_PLANE3D).isPressing && lastStyleIndex != STYLE_PLANE3D) { + lastStyleIndex = STYLE_PLANE3D; + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_3D); + resetChart(chart); + createCondition4Plane3D(chart); + setPlotFillStyle(chart); + } else if (styleList.get(STYLE_HIGHLIGHT).isPressing && lastStyleIndex != STYLE_HIGHLIGHT) { + lastStyleIndex = STYLE_HIGHLIGHT; + chart.setPlot(newPlot); + chart.getPlot().setPlotStyle(ChartConstants.STYLE_OUTER); + resetChart(chart); + createCondition4HighLight(chart); + setPlotFillStyle(chart); + } else if (lastStyleIndex >= STYLE_SHADE && lastStyleIndex <= STYLE_HIGHLIGHT) { + if (styleList.get(lastStyleIndex).isDoubleClicked || typeChanged) { + chart.setPlot(newPlot); + resetChart(chart); + styleList.get(lastStyleIndex).isPressing = false; + checkDemosBackground(); + lastStyleIndex = -1; + } + } + + stylePane.setVisible(!(chart.getPlot().isSupport3D())); + this.repaint(); + } + } + + private Plot setSelectedClonedPlotWithCondition(Plot oldPlot) { + Plot newPlot = getSelectedClonedPlot(); + if (oldPlot != null && ComparatorUtils.equals(newPlot.getClass(), oldPlot.getClass())) { + if (oldPlot.getHotHyperLink() != null) { + NameJavaScriptGroup hotHyper = oldPlot.getHotHyperLink(); + try { + newPlot.setHotHyperLink((NameJavaScriptGroup) hotHyper.clone()); + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error("Error in Hyperlink, Please Check it.", e); + } + } + newPlot.setConditionCollection(oldPlot.getConditionCollection()); + newPlot.setSeriesDragEnable(oldPlot.isSeriesDragEnable()); + if (newPlot.isSupportZoomCategoryAxis() && newPlot.getxAxis() != null) { + newPlot.getxAxis().setZoom(oldPlot.getxAxis().isZoom()); + } + if (newPlot.isSupportTooltipInInteractivePane()) { + newPlot.setHotTooltipStyle(oldPlot.getHotTooltipStyle()); + } + + if (newPlot.isSupportAutoRefresh()) { + newPlot.setAutoRefreshPerSecond(oldPlot.getAutoRefreshPerSecond()); + } + + if (newPlot.isSupportAxisTip()) { + newPlot.setInteractiveAxisTooltip(oldPlot.isInteractiveAxisTooltip()); + } + } + return newPlot; + } + + //平面3D的默认属性设置 + private void createCondition4Plane3D(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.CENTER); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 16f, new Color(51, 51, 51))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128))); + legend.setPosition(Constants.TOP); + chart.getPlot().setLegend(legend); + + //分类轴,现在只有柱形图,条形图,面积图 + if (chart.getPlot() instanceof CategoryPlot) { + CategoryPlot plot = (CategoryPlot) chart.getPlot(); + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(57, 57, 57)); + cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(57, 57, 57))); + + //值轴设置 + Axis valueAxis = plot.getyAxis(); + valueAxis.setAxisStyle(Constants.LINE_NONE); + valueAxis.setTickMarkType(Constants.TICK_MARK_NONE); + valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + valueAxis.setShowAxisLabel(false); + + //绘图区 + plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); + plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); + chart.setBorderStyle(Constants.LINE_NONE); + + //数据标签 + ConditionAttr attrList = plot.getConditionCollection().getDefaultAttr(); + DataSeriesCondition attr = attrList.getExisted(AttrContents.class); + if (attr != null) { + attrList.remove(attr); + } + AttrContents attrContents = new AttrContents(); + attrContents.setPosition(Constants.OUTSIDE); + attrContents.setSeriesLabel(ChartConstants.VALUE_PARA); + attrContents.setTextAttr(new TextAttr(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(51, 51, 51)))); + attrList.addDataSeriesCondition(attrContents); + } + } + } + + //透明风格的默认属性设置 + private void createCondition4Transparent(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.LEFT); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(192, 192, 192))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139))); + legend.setPosition(Constants.RIGHT_TOP); + chart.getPlot().setLegend(legend); + + Plot plot = chart.getPlot(); + //绘图区 + chart.setBackground(ColorBackground.getInstance(new Color(51, 51, 51))); + + //分类轴,现在只有柱形图,条形图,面积图 + if (plot instanceof CategoryPlot) { + //边框 + plot.setBorderStyle(Constants.LINE_THIN); + plot.setBorderColor(new Color(65, 65, 65)); + + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(192, 192, 192)); + cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(150, 150, 150))); + + //值轴 + Axis valueAxis = plot.getyAxis(); + valueAxis.setShowAxisLabel(true); + valueAxis.setAxisStyle(Constants.LINE_NONE); + valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(150, 150, 150))); + valueAxis.setMainGridStyle(Constants.LINE_THIN); + valueAxis.setMainGridColor(new Color(63, 62, 62)); + } + } + } + + //渐变的默认属性设置 + private void createCondition4Shade(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.CENTER); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(0, 51, 102))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(128, 128, 128))); + legend.setPosition(Constants.BOTTOM); + chart.getPlot().setLegend(legend); + + //分类轴,现在只有柱形图,条形图,面积图 + if (chart.getPlot() instanceof CategoryPlot) { + CategoryPlot plot = (CategoryPlot) chart.getPlot(); + + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(73, 100, 117)); + cateAxis.setTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(128, 128, 128))); + + //值轴 + Axis valueAxis = plot.getyAxis(); + valueAxis.setShowAxisLabel(true); + valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(128, 128, 128))); + valueAxis.setAxisStyle(Constants.LINE_NONE); + + //绘图区 + plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); + plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); + plot.setHorizontalIntervalBackgroundColor(new Color(243, 243, 243)); + } + } + } + + //高光渐变的默认属性设置 + private void createCondition4HighLight(Chart chart) { + if (chart != null) { + //标题 + Title title = new Title(chart.getTitle().getTextObject()); + chart.setTitle(title); + title.setTitleVisible(true); + TextAttr textAttr = title.getTextAttr(); + if (textAttr == null) { + textAttr = new TextAttr(); + title.setTextAttr(textAttr); + } + title.setPosition(Constants.LEFT); + textAttr.setFRFont(FRFont.getInstance("Microsoft YaHei", Font.BOLD, 16f, new Color(51, 51, 51))); + + //图例 + Legend legend = new Legend(); + legend.setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 9f, new Color(138, 140, 139))); + legend.setPosition(Constants.RIGHT_TOP); + chart.getPlot().setLegend(legend); + + //分类轴,现在只有柱形图,条形图,面积图 + if (chart.getPlot() instanceof CategoryPlot) { + CategoryPlot plot = (CategoryPlot) chart.getPlot(); + + //分类轴设置 + Axis cateAxis = plot.getxAxis(); + cateAxis.setAxisStyle(Constants.LINE_THICK); + cateAxis.setAxisColor(new Color(204, 220, 228)); + cateAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); + cateAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + cateAxis.setShowAxisLabel(true); + cateAxis.getTextAttr().setFRFont(FRFont.getInstance("Microsoft YaHei", Font.PLAIN, 10f, new Color(138, 140, 139))); + + //值轴 + Axis valueAxis = plot.getyAxis(); + valueAxis.setAxisStyle(Constants.NONE); + valueAxis.setAxisColor(null); + valueAxis.setTickMarkType(Constants.TICK_MARK_INSIDE); + valueAxis.setSecTickMarkType(Constants.TICK_MARK_NONE); + valueAxis.setShowAxisLabel(true); + valueAxis.getTextAttr().setFRFont(FRFont.getInstance("SimSun", Font.PLAIN, 10f, new Color(138, 140, 139))); + + //绘图区 + plot.setBorderStyle(Constants.LINE_THIN); + plot.setBorderColor(new Color(204, 220, 228)); + plot.setBackground(ColorBackground.getInstance(new Color(248, 247, 245))); + plot.getyAxis().setMainGridStyle(Constants.LINE_THIN); + plot.getyAxis().setMainGridColor(new Color(192, 192, 192)); + } + + } + } + + private void setPlotFillStyle(Chart chart) { + ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); + Plot plot = chart.getPlot(); + Object preStyle = null; + String name = ""; + if (styleList.get(STYLE_SHADE).isPressing) { + name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Retro"); + preStyle = manager.getPreStyle(name); + } else if (styleList.get(STYLE_TRANSPARENT).isPressing) { + name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Fresh"); + preStyle = manager.getPreStyle(name); + } else if (styleList.get(STYLE_PLANE3D).isPressing) { + name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"); + preStyle = manager.getPreStyle(name); + } else if (styleList.get(STYLE_HIGHLIGHT).isPressing) { + name = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Bright"); + preStyle = manager.getPreStyle(name); + } + if (preStyle == null) { + plot.getPlotFillStyle().setColorStyle(ChartConstants.COLOR_DEFAULT); + } else { + AttrFillStyle fillStyle = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle); + fillStyle.setFillStyleName(name); + plot.setPlotFillStyle(fillStyle); + } + } + +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java index 425f50807..a50bc52b5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java @@ -17,7 +17,7 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-25 下午06:57:36 */ -public class AreaPlotPane extends AbstractChartTypePane{ +public class AreaPlotPane extends AbstractDeprecatedChartTypePane { private static final int STACK_AREA_CHART = 0; private static final int PERCENT_AREA_LINE_CHART = 1; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java index b3e7cd34a..551a97523 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java @@ -13,8 +13,8 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-25 下午06:56:47 */ -public class BubblePlotPane extends AbstractChartTypePane { - private static final long serialVersionUID = -601566194238908115L; +public class BubblePlotPane extends AbstractDeprecatedChartTypePane { + private static final long serialVersionUID = -601566194238908115L; private static final int BUBBLE_CHART = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java index 8e367444f..f81b1168c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java @@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-21 下午06:17:40 */ -public class CustomPlotPane extends AbstractChartTypePane { +public class CustomPlotPane extends AbstractDeprecatedChartTypePane { @Override protected String getPlotTypeID() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java index c1cd47d78..0b57d225d 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java @@ -22,10 +22,10 @@ import java.text.DecimalFormat; * @author eason * */ -public class DonutPlotPane extends AbstractChartTypePane{ - private static final long serialVersionUID = -7084314809934346710L; - private static final int DONUT_CHART = 0; //2d圆环图 - private static final int THREE_D_DONUT_CHART = 1; //3D圆环图 +public class DonutPlotPane extends AbstractDeprecatedChartTypePane { + private static final long serialVersionUID = -7084314809934346710L; + private static final int DONUT_CHART = 0; //2d圆环图 + private static final int THREE_D_DONUT_CHART = 1; //3D圆环图 @Override protected String[] getTypeIconPath() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java index 2de685cb8..1b00f7a2a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java @@ -18,7 +18,7 @@ import java.text.DecimalFormat; * Time: 下午2:50 * To change this template use File | Settings | File Templates. */ -public class FunnelPlotPane extends AbstractChartTypePane{ +public class FunnelPlotPane extends AbstractDeprecatedChartTypePane { private static final int FUNNEL_CHART = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java index b1845bfe4..1bae398b5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java @@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-26 上午10:38:18 */ -public class GanttPlotPane extends AbstractChartTypePane{ +public class GanttPlotPane extends AbstractDeprecatedChartTypePane { private static final long serialVersionUID = -601566194238908115L; private static final int GANTT = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java index 9911ce4fb..e62f2e5c5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java @@ -19,10 +19,10 @@ import java.awt.BorderLayout; import java.awt.Component; -public class GisMapPlotPane extends AbstractChartTypePane{ - +public class GisMapPlotPane extends AbstractDeprecatedChartTypePane { + private static final long serialVersionUID = 2595221900000305396L; - + private static final int GISMAP = 0; private UITextField keyInput; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java index 0f93938bb..e5e23d2bc 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java @@ -9,7 +9,7 @@ import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; -public class LinePlotPane extends AbstractChartTypePane{ +public class LinePlotPane extends AbstractDeprecatedChartTypePane { private static final int LINE_CHART = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java index d761be371..2b606fc06 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java @@ -16,7 +16,7 @@ import com.fr.log.FineLoggerFactory; import javax.swing.JPanel; import java.awt.BorderLayout; -public class MapPlotPane extends AbstractChartTypePane { +public class MapPlotPane extends AbstractDeprecatedChartTypePane { private boolean isSvgMap = true; // 默认是svg地图 diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java index 10293b68c..a02bcf5d1 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java @@ -16,9 +16,9 @@ import com.fr.log.FineLoggerFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-26 上午10:48:57 */ -public class MeterPlotPane extends AbstractChartTypePane { - - private static final int METER = 0; +public class MeterPlotPane extends AbstractDeprecatedChartTypePane { + + private static final int METER = 0; private static final int BLUE_METER =1; private static final int SIMPLE_METER = 2; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java index eeccd2246..4212d76c4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java @@ -21,8 +21,8 @@ import java.text.DecimalFormat; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-25 下午06:55:33 */ -public class PiePlotPane extends AbstractChartTypePane{ - private static final long serialVersionUID = -601566194238908115L; +public class PiePlotPane extends AbstractDeprecatedChartTypePane { + private static final long serialVersionUID = -601566194238908115L; private static final int PIE_CHART = 0; private static final int THREE_D_PIE_CHART = 1; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java index 50e4a756e..e3e55cb85 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java @@ -11,7 +11,7 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-26 上午09:55:01 */ -public class RadarPlotPane extends AbstractChartTypePane{ +public class RadarPlotPane extends AbstractDeprecatedChartTypePane { private static final long serialVersionUID = -601566194238908115L; private static final int RADAR = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java index f87c6074d..c685b4c3b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java @@ -12,7 +12,7 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-26 上午10:43:50 */ -public class RangePlotPane extends AbstractChartTypePane{ +public class RangePlotPane extends AbstractDeprecatedChartTypePane { private static final long serialVersionUID = -601566194238908115L; private static final int RANGE = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java index 63f4ead33..c8c88fae1 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java @@ -11,8 +11,8 @@ import com.fr.locale.InterProviderFactory; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-26 上午10:52:36 */ -public class StockPlotPane extends AbstractChartTypePane { - +public class StockPlotPane extends AbstractDeprecatedChartTypePane { + private static final int STOCK = 0; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java index 1f40de8be..473c16c37 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/UserDefinedChartTypePane.java @@ -1,12 +1,14 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.chart.chartattr.Chart; +import com.fr.common.annotations.Compatible; /** * Created by mengao on 2017/8/30. * 不能删掉这个类,echarts插件中用到 */ -public abstract class UserDefinedChartTypePane extends AbstractChartTypePane { +@Compatible +public abstract class UserDefinedChartTypePane extends AbstractDeprecatedChartTypePane { protected String[] getTypeLayoutPath() { return new String[0]; } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java index 46a5b13c0..eab3a9837 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java @@ -14,7 +14,7 @@ import com.fr.stable.Constants; * @author kunsnat E-mail:kunsnat@gmail.com * @version 创建时间:2012-12-25 下午08:33:55 */ -public class XYScatterPlotPane extends AbstractChartTypePane{ +public class XYScatterPlotPane extends AbstractDeprecatedChartTypePane { private static final long serialVersionUID = -601566194238908115L; private static final int XYSCATTER_CHART = 0; 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 ccc39b525..affc3a611 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 @@ -1,6 +1,5 @@ package com.fr.extended.chart; -import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; @@ -9,7 +8,7 @@ import com.fr.design.mainframe.chart.gui.type.ChartImagePane; /** * Created by shine on 2018/3/5. */ -public class ExtendedTypePane extends AbstractChartTypePane { +public class ExtendedTypePane extends AbstractChartTypePane { @Override protected String[] getTypeIconPath() { @@ -35,7 +34,7 @@ public class ExtendedTypePane extends AbstractChartType } @Override - public void populateBean(Chart chart) { + public void populateBean(AbstractChart chart) { if (getTypeIconPath().length > 0) { for (ChartImagePane imagePane : typeDemo) { imagePane.isPressing = false; @@ -47,7 +46,7 @@ public class ExtendedTypePane extends AbstractChartType } @Override - public void updateBean(Chart chart) { + public void updateBean(AbstractChart chart) { update((T) chart); if (getTypeIconPath().length > 0) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java index b16c9237e..9ae650d97 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java @@ -12,9 +12,8 @@ import com.fr.design.gui.ilable.MultilineLabel; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.ChartImagePane; import com.fr.general.Background; -import com.fr.log.FineLoggerFactory; - import com.fr.js.NameJavaScriptGroup; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartZoom; @@ -25,7 +24,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; -public abstract class AbstractVanChartTypePane extends AbstractChartTypePane{ +public abstract class AbstractVanChartTypePane extends AbstractChartTypePane { private static final long serialVersionUID = 7743244512351499265L; private UICheckBox largeModelCheckBox; 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 097528c68..d06f77af4 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -64,9 +64,9 @@ public class PolyComponentsBar extends JToolBar { ); this.add(serIcons[0]); for (int i = 0; i < typeLen; i++) { - String chartID = typeName[i].getPlotID(); + String chartID = typeName[i].getChartID(); String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(chartID); - BaseChartCollection chartCollection = BaseChartGetter.getStaticChartCollection(chartID); + BaseChartCollection chartCollection = BaseChartGetter.createChartCollection(chartID); serIcons[i + 1] = new SerIcon(chartCollection, InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath); this.add(serIcons[i + 1]); }