Browse Source

CHART-2109

master
zheng 7 years ago
parent
commit
43528c866f
  1. 76
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  2. 4
      designer_chart/src/com/fr/design/chartinterface/AreaIndependentChartInterface.java
  3. 5
      designer_chart/src/com/fr/design/chartinterface/BarIndependentChartInterface.java
  4. 5
      designer_chart/src/com/fr/design/chartinterface/BubbleIndependentChartInterface.java
  5. 5
      designer_chart/src/com/fr/design/chartinterface/ColumnIndependentChartInterface.java
  6. 5
      designer_chart/src/com/fr/design/chartinterface/CustomIndependentChartInterface.java
  7. 5
      designer_chart/src/com/fr/design/chartinterface/DonutIndependentChartInterface.java
  8. 5
      designer_chart/src/com/fr/design/chartinterface/FunnelIndependentChartInterface.java
  9. 5
      designer_chart/src/com/fr/design/chartinterface/GanttIndependentChartInterface.java
  10. 5
      designer_chart/src/com/fr/design/chartinterface/GisMapIndependentChartInterface.java
  11. 5
      designer_chart/src/com/fr/design/chartinterface/LineIndependentChartInterface.java
  12. 5
      designer_chart/src/com/fr/design/chartinterface/MapIndependentChartInterface.java
  13. 5
      designer_chart/src/com/fr/design/chartinterface/MeterIndependentChartInterface.java
  14. 5
      designer_chart/src/com/fr/design/chartinterface/PieIndependentChartInterface.java
  15. 5
      designer_chart/src/com/fr/design/chartinterface/RadarIndependentChartInterface.java
  16. 5
      designer_chart/src/com/fr/design/chartinterface/RangeIndependentChartInterface.java
  17. 5
      designer_chart/src/com/fr/design/chartinterface/StockIndependentChartInterface.java
  18. 5
      designer_chart/src/com/fr/design/chartinterface/XYScatterIndependentChartInterface.java
  19. 23
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

76
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.CHART_PRIORITY;
import static com.fr.chart.charttypes.ChartTypeManager.VAN_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. * Created by eason on 14/12/29.
*/ */
public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerProvider { public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerProvider {
private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager(); private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager();
private static LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> chartTypeInterfaces = private static LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> chartTypeInterfaces =
@ -139,7 +140,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
private static WidgetOption[] initWidgetOption() { private static WidgetOption[] initWidgetOption() {
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
final Chart[][] allCharts = new Chart[typeName.length][]; final Chart[][] allCharts = new Chart[typeName.length][];
@ -297,24 +298,42 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
} }
return name; return name;
} }
public String[] getTitle4PopupWindow(String priority) { private void addTitles(String priority, List<String> list) {
if (StringUtils.isEmpty(priority)) {
return getTitle4PopupWindow();
}
String[] names = new String[getChartSize(priority)];
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) { if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority); Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority);
Iterator<Map.Entry<String, IndependentChartUIProvider>> iterator = chartUIList.entrySet().iterator(); Iterator<Map.Entry<String, IndependentChartUIProvider>> iterator = chartUIList.entrySet().iterator();
int i = 0;
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry<String, IndependentChartUIProvider> entry = iterator.next(); Map.Entry<String, IndependentChartUIProvider> 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<Integer> priorityList = getPriorityInOrder();
List<String> result = new ArrayList<String>();
for (Integer priority : priorityList) {
addTitles(String.valueOf(priority), result);
}
return result.toArray(new String[result.size()]);
}
public String[] getTitle4PopupWindow(String priority) {
List<String> list = new ArrayList<String>();
addTitles(priority, list);
return list.toArray(new String[list.size()]);
} }
/** /**
@ -341,35 +360,6 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
private String[] getTitle4PopupWindow() {
List<Integer> 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<Map.Entry<String, IndependentChartUIProvider>> chartUI = chartTypeInterfaces.get(priority).entrySet().iterator();
while (chartUI.hasNext()) {
Map.Entry<String, IndependentChartUIProvider> chartUIEntry = chartUI.next();
names[index++] = getChartName(chartUIEntry.getKey(), chartUIEntry.getValue());
}
}
return names;
}
private List<Integer> getPriorityInOrder() { private List<Integer> getPriorityInOrder() {
List<Integer> priorityList = new ArrayList<Integer>(); List<Integer> priorityList = new ArrayList<Integer>();

4
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. * Created by eason on 15/4/21.
*/ */
public class AreaIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { public class AreaIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new AreaPlotPane(); return new AreaPlotPane();

5
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 { public class BarIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new BarPlotPane(); return new BarPlotPane();
} }

5
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 { public class BubbleIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new BubblePlotPane(); return new BubblePlotPane();
} }

5
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. * Created by eason on 15/4/21.
*/ */
public class ColumnIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel { public class ColumnIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new ColumnPlotPane(); return new ColumnPlotPane();
} }

5
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 { public class CustomIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new CustomPlotPane(); return new CustomPlotPane();
} }

5
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 { public class DonutIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new DonutPlotPane(); return new DonutPlotPane();
} }

5
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 { public class FunnelIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new FunnelPlotPane(); return new FunnelPlotPane();
} }

5
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 { public class GanttIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new GanttPlotPane(); return new GanttPlotPane();
} }

5
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 { public class GisMapIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new GisMapPlotPane(); return new GisMapPlotPane();
} }

5
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 { public class LineIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new LinePlotPane(); return new LinePlotPane();
} }

5
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 { public class MapIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new MapPlotPane(); return new MapPlotPane();
} }

5
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 { public class MeterIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new MeterPlotPane(); return new MeterPlotPane();
} }

5
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 { public class PieIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new PiePlotPane(); return new PiePlotPane();
} }

5
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 { public class RadarIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new RadarPlotPane(); return new RadarPlotPane();
} }

5
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 { public class RangeIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new RangePlotPane(); return new RangePlotPane();
} }

5
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 { public class StockIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new StockPlotPane(); return new StockPlotPane();
} }

5
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 { public class XYScatterIndependentChartInterface extends AbstractIndependentChartUIWithAPILevel {
@Override
public boolean needChartChangePane() {
return false;
}
public AbstractChartTypePane getPlotTypePane(){ public AbstractChartTypePane getPlotTypePane(){
return new XYScatterPlotPane(); return new XYScatterPlotPane();
} }

23
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.FlexibleComboBox;
import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.item.ItemEventType;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.extended.chart.AbstractChart;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -202,21 +201,27 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void relayout(ChartCollection collection){ public void relayout(ChartCollection collection){
//重构需要重构下拉框选项和cardNames //重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart(); Chart chart = collection.getSelectedChart();
String chartID = chart.getPriority(); String priority = chart.getPriority();
if (collection.getState() == SwitchState.DEFAULT){ String plotID = chart.getPlot().getPlotID();
chartID = StringUtils.EMPTY; boolean enabledChart = ChartTypeManager.enabledChart(plotID);
} String item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(priority, plotID);
//第一步就是重构cardNames //第一步就是重构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 //下拉框重构开始。为了防止重构是触发update
((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.REACTOR); ((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.REACTOR);
//重构下拉框选项 //重构下拉框选项
reactorComboBox(); reactorComboBox();
//重新选择选中的下拉项 //重新选择选中的下拉项
chartID = chart.getPriority();
String plotID = chart.getPlot().getPlotID();
Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID);
jcb.setSelectedItem(item); jcb.setSelectedItem(item);
jcb.setEnabled(enabledChart);
//下拉框重构结束 //下拉框重构结束
((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.DEFAULT); ((FlexibleComboBox)jcb).setItemEvenType(ItemEventType.DEFAULT);
//重新选中 //重新选中

Loading…
Cancel
Save