From 43528c866fd0f3777056624a418f5fbc723c4818 Mon Sep 17 00:00:00 2001 From: zheng Date: Wed, 11 Apr 2018 15:45:58 +0800 Subject: [PATCH] CHART-2109 --- .../fr/design/ChartTypeInterfaceManager.java | 76 ++++++++----------- .../AreaIndependentChartInterface.java | 4 + .../BarIndependentChartInterface.java | 5 ++ .../BubbleIndependentChartInterface.java | 5 ++ .../ColumnIndependentChartInterface.java | 5 ++ .../CustomIndependentChartInterface.java | 5 ++ .../DonutIndependentChartInterface.java | 5 ++ .../FunnelIndependentChartInterface.java | 5 ++ .../GanttIndependentChartInterface.java | 5 ++ .../GisMapIndependentChartInterface.java | 5 ++ .../LineIndependentChartInterface.java | 5 ++ .../MapIndependentChartInterface.java | 5 ++ .../MeterIndependentChartInterface.java | 5 ++ .../PieIndependentChartInterface.java | 5 ++ .../RadarIndependentChartInterface.java | 5 ++ .../RangeIndependentChartInterface.java | 5 ++ .../StockIndependentChartInterface.java | 5 ++ .../XYScatterIndependentChartInterface.java | 5 ++ .../mainframe/chart/gui/ChartTypePane.java | 23 +++--- 19 files changed, 131 insertions(+), 52 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 55eba57f36..e28e2fcca9 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -100,13 +100,14 @@ import java.util.Map; import static com.fr.chart.charttypes.ChartTypeManager.CHART_PRIORITY; import static com.fr.chart.charttypes.ChartTypeManager.VAN_CHART_PRIORITY; +import static com.fr.chart.charttypes.ChartTypeManager.enabledChart; /** * Created by eason on 14/12/29. */ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerProvider { - - + + private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager(); private static LinkedHashMap> chartTypeInterfaces = @@ -139,7 +140,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } private static WidgetOption[] initWidgetOption() { - + ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; final Chart[][] allCharts = new Chart[typeName.length][]; @@ -297,24 +298,42 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } return name; } - - public String[] getTitle4PopupWindow(String priority) { - - if (StringUtils.isEmpty(priority)) { - return getTitle4PopupWindow(); - } - String[] names = new String[getChartSize(priority)]; + + private void addTitles(String priority, List list) { if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { + Map chartUIList = chartTypeInterfaces.get(priority); + Iterator> iterator = chartUIList.entrySet().iterator(); - int i = 0; while (iterator.hasNext()) { Map.Entry entry = iterator.next(); - names[i++] = getChartName(entry.getKey(), entry.getValue()); + String plotID = entry.getKey(); + + if (enabledChart(plotID)) { + list.add(getChartName(plotID, entry.getValue())); + } } - return names; } - return new String[0]; + } + + public String[] getTitle4PopupWindow() { + List priorityList = getPriorityInOrder(); + + List result = new ArrayList(); + + for (Integer priority : priorityList) { + addTitles(String.valueOf(priority), result); + } + + return result.toArray(new String[result.size()]); + } + + public String[] getTitle4PopupWindow(String priority) { + List list = new ArrayList(); + + addTitles(priority, list); + + return list.toArray(new String[list.size()]); } /** @@ -341,35 +360,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return StringUtils.EMPTY; } - private String[] getTitle4PopupWindow() { - - List priorityList = getPriorityInOrder(); - - if (priorityList.size() == 0) { - return new String[0]; - } - - int size = 0; - //获取总得图表格式 - for (Integer aPriorityList : priorityList) { - size += getChartSize(String.valueOf(aPriorityList)); - } - String[] names = new String[size]; - - int index = 0; - for (Integer aPriorityList : priorityList) { - String priority = String.valueOf(aPriorityList); - Iterator> chartUI = chartTypeInterfaces.get(priority).entrySet().iterator(); - while (chartUI.hasNext()) { - Map.Entry chartUIEntry = chartUI.next(); - - names[index++] = getChartName(chartUIEntry.getKey(), chartUIEntry.getValue()); - } - } - - return names; - } - private List getPriorityInOrder() { List priorityList = new ArrayList(); diff --git a/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java index ff8a06ac76..f17d2a57e7 100644 --- a/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java @@ -21,6 +21,10 @@ import com.fr.design.mainframe.chart.gui.type.AreaPlotPane; * Created by eason on 15/4/21. */ public class AreaIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } public AbstractChartTypePane getPlotTypePane(){ return new AreaPlotPane(); diff --git a/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java index de1160b102..0fcff5de5b 100644 --- a/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java @@ -23,6 +23,11 @@ import com.fr.design.mainframe.chart.gui.type.BarPlotPane; */ public class BarIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new BarPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java index b9d0b232ce..9cee004846 100644 --- a/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java @@ -20,6 +20,11 @@ import com.fr.design.mainframe.chart.gui.type.BubblePlotPane; */ public class BubbleIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new BubblePlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java index fcbfbc6b2f..a07115530a 100644 --- a/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java @@ -22,6 +22,11 @@ import com.fr.design.mainframe.chart.gui.type.ColumnPlotPane; * Created by eason on 15/4/21. */ public class ColumnIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new ColumnPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java index 3d2af68125..6b9698698d 100644 --- a/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java @@ -20,6 +20,11 @@ import com.fr.design.mainframe.chart.gui.type.CustomPlotPane; */ public class CustomIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new CustomPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java index 96235ed20f..e24510c1f5 100644 --- a/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java @@ -22,6 +22,11 @@ import com.fr.design.mainframe.chart.gui.type.DonutPlotPane; */ public class DonutIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new DonutPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java index 00891e628c..a1a93a7936 100644 --- a/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java @@ -20,6 +20,11 @@ import com.fr.design.mainframe.chart.gui.type.FunnelPlotPane; */ public class FunnelIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new FunnelPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java index 5c8c6f6d5b..bd1e1d710d 100644 --- a/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java @@ -17,6 +17,11 @@ import com.fr.design.mainframe.chart.gui.type.GanttPlotPane; */ public class GanttIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new GanttPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java index 1e172750a8..db137569a5 100644 --- a/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java @@ -13,6 +13,11 @@ import com.fr.design.mainframe.chart.gui.type.GisMapPlotPane; */ public class GisMapIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new GisMapPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java index 413ed6b52c..80f303e7f5 100644 --- a/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java @@ -21,6 +21,11 @@ import com.fr.design.mainframe.chart.gui.type.LinePlotPane; */ public class LineIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new LinePlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java index a1f933a1c4..81425de939 100644 --- a/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java @@ -18,6 +18,11 @@ import com.fr.design.mainframe.chart.gui.type.MapPlotPane; */ public class MapIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new MapPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java index 5131075565..eac3e79137 100644 --- a/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java @@ -18,6 +18,11 @@ import com.fr.design.mainframe.chart.gui.type.MeterPlotPane; */ public class MeterIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new MeterPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java index fabd3f265f..0a63505077 100644 --- a/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java @@ -22,6 +22,11 @@ import com.fr.design.mainframe.chart.gui.type.PiePlotPane; */ public class PieIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new PiePlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java index d0320f8fd3..487c4705d6 100644 --- a/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java @@ -20,6 +20,11 @@ import com.fr.design.mainframe.chart.gui.type.RadarPlotPane; */ public class RadarIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new RadarPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java index 04f238192b..c62b84ea73 100644 --- a/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java @@ -18,6 +18,11 @@ import com.fr.design.mainframe.chart.gui.type.RangePlotPane; */ public class RangeIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new RangePlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java index 647c11a919..456fa86449 100644 --- a/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java @@ -21,6 +21,11 @@ import com.fr.design.mainframe.chart.gui.type.StockPlotPane; */ public class StockIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new StockPlotPane(); } diff --git a/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java b/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java index 23f3630837..dd1ee6a619 100644 --- a/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java +++ b/designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java @@ -21,6 +21,11 @@ import com.fr.design.mainframe.chart.gui.type.XYScatterPlotPane; */ public class XYScatterIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { + @Override + public boolean needChartChangePane() { + return false; + } + public AbstractChartTypePane getPlotTypePane(){ return new XYScatterPlotPane(); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java index b2f3141831..0c1e426844 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -17,7 +17,6 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; -import com.fr.extended.chart.AbstractChart; import com.fr.general.ComparatorUtils; import com.fr.stable.StringUtils; @@ -202,21 +201,27 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void relayout(ChartCollection collection){ //重构需要重构下拉框选项和cardNames Chart chart = collection.getSelectedChart(); - String chartID = chart.getPriority(); - if (collection.getState() == SwitchState.DEFAULT){ - chartID = StringUtils.EMPTY; - } + String priority = chart.getPriority(); + String plotID = chart.getPlot().getPlotID(); + boolean enabledChart = ChartTypeManager.enabledChart(plotID); + String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID); + //第一步就是重构cardNames - cardNames = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID); + if (enabledChart) { + cardNames = collection.getState() == SwitchState.DEFAULT + ? ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow() + : ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority); + } else { + cardNames = new String[]{item}; + } + //下拉框重构开始。为了防止重构是触发update ((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.REACTOR); //重构下拉框选项 reactorComboBox(); //重新选择选中的下拉项 - chartID = chart.getPriority(); - String plotID = chart.getPlot().getPlotID(); - Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); jcb.setSelectedItem(item); + jcb.setEnabled(enabledChart); //下拉框重构结束 ((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.DEFAULT); //重新选中