From 29cfb125c2bb99043ba808c4cc9c5f8a3cd846dc Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 19 Feb 2020 14:40:07 +0800 Subject: [PATCH] =?UTF-8?q?CHART-12733=20=E5=9B=BE=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=93=E6=9E=84=20=E5=9C=B0=E5=9B=BE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drillmap/VanDrillMapChartTypeUI.java | 7 +- .../data/VanChartDrillMapContentsPane.java | 52 ++++ .../data/VanChartDrillMapDataPane.java | 39 +++ .../data/VanChartMapLayerAndDataTabPane.java | 130 ++++++++++ .../designer/data/comp/DrillMapDataPane.java | 116 +++++++++ .../designer/data/comp/DrillMapLayerPane.java | 203 ++++++++++++++++ .../comp/EachLayerDataDefinitionPane.java | 170 +++++++++++++ .../comp/SingleLayerDataDefinitionPane.java | 93 ++++++++ .../designer/VanHeatMapChartTypeUI.java | 30 +-- .../fr/van/chart/map/VanMapChartTypeUI.java | 40 +++- .../data/CustomMapChartDataContentsPane.java | 84 +++++++ .../map/designer/data/MapDataPaneHelper.java | 177 ++++++++++++++ .../designer/data/VanChartMapDataPane.java | 121 ++++++++++ .../component/LongitudeLatitudeAndArea.java | 34 +++ ...riesNameUseFieldNamePaneWithOutFilter.java | 23 ++ ...iesNameUseFieldValuePaneWithOutFilter.java | 29 +++ .../SeriesTypeUseComboxPaneWithOutFilter.java | 40 ++++ .../report/AbstractLongLatAreaPane.java | 14 ++ .../data/component/report/AreaPane.java | 64 +++++ .../component/report/LineMapAreaPane.java | 71 ++++++ .../report/LineMapLongLatAreaPane.java | 36 +++ .../component/report/LongLatAreaPane.java | 77 ++++++ .../component/report/PointMapAreaPane.java | 48 ++++ .../report/PointMapLongLatAreaPane.java | 14 ++ .../table/AbstractLongLatAreaPane.java | 26 ++ .../data/component/table/AreaPane.java | 104 ++++++++ .../data/component/table/LineMapAreaPane.java | 100 ++++++++ .../table/LineMapLongLatAreaPane.java | 41 ++++ .../data/component/table/LongLatAreaPane.java | 122 ++++++++++ .../component/table/PointMapAreaPane.java | 69 ++++++ .../table/PointMapLongLatAreaPane.java | 18 ++ .../VanAreaMapPlotReportDataContentPane.java | 110 +++++++++ .../VanLineMapPlotReportDataContentPane.java | 24 ++ .../VanPointMapPlotReportDataContentPane.java | 170 +++++++++++++ .../VanAreaMapPlotTableDataContentPane.java | 176 ++++++++++++++ .../VanLineMapPlotTableDataContentPane.java | 25 ++ .../VanPointMapPlotTableDataContentPane.java | 224 ++++++++++++++++++ 37 files changed, 2903 insertions(+), 18 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapContentsPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/LongitudeLatitudeAndArea.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldNamePaneWithOutFilter.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldValuePaneWithOutFilter.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapLongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapLongLatAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanLineMapPlotReportDataContentPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/VanDrillMapChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/VanDrillMapChartTypeUI.java index 08ec91b22e..3fe95d109a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/VanDrillMapChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/VanDrillMapChartTypeUI.java @@ -1,6 +1,5 @@ package com.fr.van.chart.drillmap; -import com.fr.design.chartx.data.drillMap.DrillMapChartDataPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; @@ -8,6 +7,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.drillmap.designer.data.VanChartDrillMapDataPane; import com.fr.van.chart.drillmap.designer.other.VanChartDrillMapOtherPane; import com.fr.van.chart.drillmap.designer.type.VanChartDrillMapPlotPane; import com.fr.van.chart.map.VanMapChartTypeUI; @@ -61,7 +61,10 @@ public class VanDrillMapChartTypeUI extends VanMapChartTypeUI { @Override public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new DrillMapChartDataPane(listener); + //图表数据结构 恢复用注释。下面1行删除。 + return new VanChartDrillMapDataPane(listener); + //图表数据结构 恢复用注释。取消注释。 + //return new DrillMapChartDataPane(listener); } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapContentsPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapContentsPane.java new file mode 100644 index 0000000000..1ce0dc300d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapContentsPane.java @@ -0,0 +1,52 @@ +package com.fr.van.chart.drillmap.designer.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.DataContentsPane; + +import javax.swing.JPanel; + +/** + * Created by Mitisky on 16/6/20. + */ +public class VanChartDrillMapContentsPane extends DataContentsPane { + + private VanChartMapLayerAndDataTabPane layerAndDataTabPane; + + private AttributeChangeListener listener; + private ChartDataPane parent; + + public VanChartDrillMapContentsPane(AttributeChangeListener listener, ChartDataPane parent) { + this.listener = listener; + this.parent = parent; + initAll(); + } + + /** + * 设置是否关联单元格数据. + * + * @param supportCellData + */ + @Override + public void setSupportCellData(boolean supportCellData) { + layerAndDataTabPane.setSupportCellData(supportCellData); + } + + @Override + public void populate(ChartCollection collection) { + layerAndDataTabPane.populateBean(collection); + } + + @Override + public void update(ChartCollection collection) { + layerAndDataTabPane.updateBean(collection); + + } + + @Override + protected JPanel createContentPane() { + layerAndDataTabPane = new VanChartMapLayerAndDataTabPane(this.listener, this.parent); + return layerAndDataTabPane; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapDataPane.java new file mode 100644 index 0000000000..a65b9be219 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartDrillMapDataPane.java @@ -0,0 +1,39 @@ +package com.fr.van.chart.drillmap.designer.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Mitisky on 16/6/20. + */ +public class VanChartDrillMapDataPane extends ChartDataPane { + + public VanChartDrillMapDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected JPanel createContentPane() { + contentsPane = new VanChartDrillMapContentsPane(listener, VanChartDrillMapDataPane.this); + return contentsPane; + } + + //编辑内置数据集会stateChange,会调用这里 + @Override + protected void repeatLayout(ChartCollection collection) { + if (contentsPane != null) { + this.remove(contentsPane); + } + this.setLayout(new BorderLayout(0, 0)); + + contentsPane = new VanChartDrillMapContentsPane(listener, VanChartDrillMapDataPane.this); + contentsPane.setSupportCellData(isSupportCellData()); + + this.add(contentsPane, BorderLayout.CENTER); + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java new file mode 100644 index 0000000000..6f7e59ebcd --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/VanChartMapLayerAndDataTabPane.java @@ -0,0 +1,130 @@ +package com.fr.van.chart.drillmap.designer.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.MultiTabPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.ComparatorUtils; +import com.fr.van.chart.drillmap.designer.data.comp.DrillMapDataPane; +import com.fr.van.chart.drillmap.designer.data.comp.DrillMapLayerPane; +import com.fr.van.chart.map.designer.data.MapDataPaneHelper; + +import java.awt.CardLayout; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Mitisky on 16/6/20. + * 钻取层级和数据界面切换的界面 + */ +public class VanChartMapLayerAndDataTabPane extends MultiTabPane { + + private DrillMapLayerPane layerPane; + private DrillMapDataPane dataPane; + + private ChartCollection chartCollection; + + public VanChartMapLayerAndDataTabPane(AttributeChangeListener listener, ChartDataPane parent) { + cardLayout = new CardLayout(); + layerPane = new DrillMapLayerPane(); + dataPane = new DrillMapDataPane(listener, parent); + paneList = initPaneList(); + initComponents(); + } + + private void initComponents() { + super.relayoutWhenListChange(); + } + + protected void tabChanged() { + if (getSelectedIndex() == 0) { + return; + } + if (chartCollection == null) { + return; + } + if (!ComparatorUtils.equals(MapDataPaneHelper.getDrillMapLayerMapTypeList(chartCollection), dataPane.getCurrentMapTypeList())) { + dataPane.populateBean(chartCollection); + } + } + + /** + * 当List中的界面变化时, 重新布局 + */ + public void relayoutWhenListChange() { + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + if (layerPane != null) { + paneList.add(layerPane); + } + if (dataPane != null) { + paneList.add(dataPane); + } + + return paneList; + } + + @Override + public void populateBean(ChartCollection ob) { + chartCollection = ob; + layerPane.populateBean(ob); + dataPane.populateBean(ob); + } + + /** + * Update. + */ + @Override + public ChartCollection updateBean() { + return null; + } + + @Override + public void updateBean(ChartCollection ob) { + layerPane.updateBean(ob); + dataPane.updateBean(ob); + } + + /** + * 设置是否关联单元格数据. + * + * @param supportCellData + */ + public void setSupportCellData(boolean supportCellData) { + dataPane.setSupportCellData(supportCellData); + } + + /** + * 是否是指定类型 + * + * @param ob 对象 + * @return 是否是指定类型 + */ + @Override + public boolean accept(Object ob) { + return false; + } + + /** + * title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 + * + * @return 绥化狂标题 + */ + @Override + public String title4PopupWindow() { + return null; + } + + /** + * 重置 + */ + @Override + public void reset() { + + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java new file mode 100644 index 0000000000..5b441f7db4 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapDataPane.java @@ -0,0 +1,116 @@ +package com.fr.van.chart.drillmap.designer.data.comp; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.type.MapType; +import com.fr.van.chart.map.designer.data.MapDataPaneHelper; + +import java.awt.BorderLayout; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Mitisky on 16/6/20. + * 钻取地图数据配置界面中 和钻取层级平级的数据界面 + */ +public class DrillMapDataPane extends BasicBeanPane { + private UIComboBoxPane dataDefinitionType;//数据定义方式:底层数据汇总/各层级分别指定 + + private SingleLayerDataDefinitionPane bottomDataDefinitionPane;//底层数据汇总方式定义钻取地图数据 + private EachLayerDataDefinitionPane eachLayerDataDefinitionPane;//各层级分别指定 + + private ChartDataPane parent; + + public DrillMapDataPane(final AttributeChangeListener listener, final ChartDataPane parent) { + this.parent = parent; + bottomDataDefinitionPane = new SingleLayerDataDefinitionPane(listener, parent); + eachLayerDataDefinitionPane = new EachLayerDataDefinitionPane(listener, parent); + + dataDefinitionType = new UIComboBoxPane() { + @Override + protected List> initPaneList() { + + List> paneList = new ArrayList>(); + paneList.add(bottomDataDefinitionPane); + paneList.add(eachLayerDataDefinitionPane); + return paneList; + } + + @Override + protected String title4PopupWindow() { + return null; + } + }; + + this.setLayout(new BorderLayout()); + this.add(dataDefinitionType, BorderLayout.CENTER); + } + + public List getCurrentMapTypeList() { + return eachLayerDataDefinitionPane.getCurrentMapTypeList(); + } + + /** + * 设置是否关联单元格数据. + * + * @param supportCellData + */ + public void setSupportCellData(boolean supportCellData) { + bottomDataDefinitionPane.setSupportCellData(supportCellData); + eachLayerDataDefinitionPane.setSupportCellData(supportCellData); + } + + /** + * Populate. + * + * @param ob + */ + @Override + public void populateBean(ChartCollection ob) { + + dataDefinitionType.setSelectedIndex(MapDataPaneHelper.isFromBottomData(ob) ? 0 : 1); + + ChartCollection bottomDataChartCollection = MapDataPaneHelper.getBottomDataDrillMapChartCollection(ob); + bottomDataDefinitionPane.populateBean(bottomDataChartCollection); + eachLayerDataDefinitionPane.populateBean(ob); + + parent.initAllListeners(); + } + + /** + * Update. + */ + @Override + public ChartCollection updateBean() { + return null; + } + + @Override + public void updateBean(ChartCollection ob) { + DrillMapDefinition drillMapDefinition = MapDataPaneHelper.getDrillMapDefinition(ob); + if (drillMapDefinition == null) { + drillMapDefinition = new DrillMapDefinition(); + ob.getSelectedChart().setFilterDefinition(drillMapDefinition); + } + if (dataDefinitionType.getSelectedIndex() == 0) { + drillMapDefinition.setFromBottomData(true); + ChartCollection temp = new ChartCollection(new Chart()); + bottomDataDefinitionPane.updateBean(temp); + drillMapDefinition.setBottomDataDefinition(temp.getSelectedChart().getFilterDefinition()); + } else { + drillMapDefinition.setFromBottomData(false); + eachLayerDataDefinitionPane.updateBean(ob); + } + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Data"); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java new file mode 100644 index 0000000000..6fd6ecabbc --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/DrillMapLayerPane.java @@ -0,0 +1,203 @@ +package com.fr.van.chart.drillmap.designer.data.comp; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.dialog.BasicScrollPane; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.ComparatorUtils; + +import com.fr.plugin.chart.drillmap.DrillMapHelper; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; +import com.fr.plugin.chart.type.MapType; +import com.fr.plugin.chart.type.ZoomLevel; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.map.designer.type.VanChartMapSourceChoosePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.tree.DefaultMutableTreeNode; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.ArrayList; +import java.util.HashMap; + +/** + * Created by Mitisky on 16/6/20. + * 钻取地图数据配置界面--钻取层级界面 + */ +public class DrillMapLayerPane extends BasicScrollPane { + private static final String[] CUSTOM_MAP_TYPES = new String[]{MapType.AREA.getLocaleString(), MapType.POINT.getLocaleString()}; + private static final String[] AREA_MAP_TYPES = new String[]{MapType.AREA.getLocaleString()}; + private static final String[] POINT_MAP_TYPES = new String[]{MapType.POINT.getLocaleString()}; + + private static final java.util.Map TEMP = new HashMap(); + + static { + TEMP.put(MapType.AREA, AREA_MAP_TYPES); + TEMP.put(MapType.POINT, POINT_MAP_TYPES); + TEMP.put(MapType.CUSTOM, CUSTOM_MAP_TYPES); + } + + private MapDataTree mapDataTree; + private Component[][] detailComps; + + private int depth; + private MapType oldMapType; + private String oldGeoUrl; + + @Override + protected void layoutContentPane() { + leftcontentPane = createContentPane(); + leftcontentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + this.add(leftcontentPane); + } + + @Override + protected JPanel createContentPane() { + + if (mapDataTree == null) { + mapDataTree = new MapDataTree(CompatibleGeoJSONTreeHelper.getRootNodeWithoutPara(oldGeoUrl)); + mapDataTree.setRootVisible(true); + } + + JPanel mapDataTreePanel = new JPanel(new BorderLayout()); + mapDataTreePanel.add(mapDataTree); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Tree"), mapDataTreePanel)}, + new Component[]{createTitlePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Detail"), createLayerDetailPane())} + }; + + JPanel contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + JPanel panel = new JPanel(new BorderLayout()); + panel.add(contentPane, BorderLayout.CENTER); + return panel; + } + + private JPanel createTitlePane (String title, JPanel panel) { + JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); + panel.setBorder(BorderFactory.createEmptyBorder(10,5,0,0)); + jPanel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); + return jPanel; + } + + private JPanel createLayerDetailPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, p, p}; + double[] rowSize = new double[depth + 1]; + detailComps = new Component[depth + 1][3]; + rowSize[0] = p; + detailComps[0] = new Component[]{ + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Descriptor")), + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Zoom_Layer")), + new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layer_Map_Type")) + }; + for (int i = 0; i < depth; i++) { + rowSize[i + 1] = p; + int d = i + 1; + UILabel label = new UILabel(String.format("%s%d%s", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Article"), d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Layer"))); + UIComboBox level = new UIComboBox(VanChartMapSourceChoosePane.ZOOM_LEVELS); + level.setEnabled(i != 0); + UIComboBox type = new UIComboBox(TEMP.get(oldMapType)); + detailComps[i + 1] = new Component[]{label, level, type}; + } + + return TableLayoutHelper.createGapTableLayoutPane(detailComps, rowSize, columnSize, 10, 6); + } + + /** + * Populate. + * + * @param ob + */ + @Override + public void populateBean(ChartCollection ob) { + VanChartDrillMapPlot drillMapPlot = DrillMapHelper.getDrillMapPlot(ob); + + if (drillMapPlot != null) { + java.util.List levelList = drillMapPlot.getLayerLevelList(); + java.util.List mapTypeList = drillMapPlot.getLayerMapTypeList(); + + if (detailComps == null || drillMapPlot.getMapType() != oldMapType || !ComparatorUtils.equals(drillMapPlot.getGeoUrl(), oldGeoUrl)) { + oldMapType = drillMapPlot.getMapType(); + oldGeoUrl = drillMapPlot.getGeoUrl(); + + DefaultMutableTreeNode root = CompatibleGeoJSONTreeHelper.getNodeByJSONPath(oldGeoUrl); + if (root != null) { + mapDataTree.changeRootNode(root); + depth = root.getDepth() + 1;//根节点也算一层 + } + + this.remove(leftcontentPane); + layoutContentPane(); + } + + //根据层级初始属性,一切以json那边读到的层级为准 + int levelSize = levelList.size(); + for (int i = levelSize; i < depth; i++) { + levelList.add(ZoomLevel.AUTO); + } + MapType mapType = drillMapPlot.getMapType() == MapType.POINT ? MapType.POINT : MapType.AREA; + int typeSize = mapTypeList.size(); + for (int j = typeSize; j < depth; j++) { + mapTypeList.add(mapType); + } + + for (int i = 0; i < depth; i++) { + Component[] components = detailComps[i + 1]; + if (components != null) { + UIComboBox level = (UIComboBox) components[1]; + UIComboBox type = (UIComboBox) components[2]; + if (level != null) { + level.setSelectedItem(levelList.get(i)); + } + if (type != null) { + type.setSelectedItem(mapTypeList.get(i).getLocaleString()); + } + } + } + } + } + + /** + * Update. + */ + @Override + public ChartCollection updateBean() { + return null; + } + + @Override + public void updateBean(ChartCollection ob) { + VanChartDrillMapPlot drillMapPlot = DrillMapHelper.getDrillMapPlot(ob); + if (drillMapPlot != null && detailComps != null) { + java.util.List levelList = new ArrayList(); + java.util.List mapTypeList = new ArrayList(); + for (Component[] com : detailComps) { + if (com[1] instanceof UIComboBox && com[2] instanceof UIComboBox) { + UIComboBox level = (UIComboBox) com[1]; + UIComboBox type = (UIComboBox) com[2]; + levelList.add((ZoomLevel) level.getSelectedItem()); + if (type.getSelectedItem() != null) { + mapTypeList.add(MapType.parseLocale(type.getSelectedItem().toString())); + } + } + } + drillMapPlot.setLayerLevelList(levelList); + drillMapPlot.setLayerMapTypeList(mapTypeList); + } + } + + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Drill_Level"); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java new file mode 100644 index 0000000000..26f8c42c3c --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/EachLayerDataDefinitionPane.java @@ -0,0 +1,170 @@ +package com.fr.van.chart.drillmap.designer.data.comp; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.MultiTabPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.chart.drillmap.DrillMapHelper; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.server.CompatibleGeoJSONTreeHelper; +import com.fr.plugin.chart.type.MapType; +import com.fr.van.chart.map.designer.data.MapDataPaneHelper; + +import javax.swing.tree.DefaultMutableTreeNode; +import java.awt.CardLayout; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Mitisky on 16/6/20. + * 各层级分别指定的界面 + */ +public class EachLayerDataDefinitionPane extends MultiTabPane { + private AttributeChangeListener listener; + private ChartDataPane parent; + private int depth; + private String oldGeoUrl; + private List oldMapList; + + public EachLayerDataDefinitionPane(AttributeChangeListener listener, ChartDataPane parent) { + this.listener = listener; + this.parent = parent; + cardLayout = new CardLayout(); + } + + private void initComponents() { + super.relayoutWhenListChange(); + } + + /** + * 当List中的界面变化时, 重新布局 + */ + public void relayoutWhenListChange() { + } + + public List getCurrentMapTypeList() { + return oldMapList; + } + + @Override + protected List initPaneList() { + List paneList = new ArrayList(); + + for (int i = 1; i < depth + 1; i++) { + String tile = String.format("%s%d%s", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Article"), i, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Index_Layer")); + + SingleLayerDataDefinitionPane pane = new SingleLayerDataDefinitionPane(tile, this.listener, this.parent); + pane.setSupportCellData(parent.isSupportCellData()); + paneList.add(pane); + } + + return paneList; + } + + @Override + public void populateBean(ChartCollection ob) { + VanChartDrillMapPlot drillMapPlot = DrillMapHelper.getDrillMapPlot(ob); + if (drillMapPlot == null) { + return; + } + if (!ComparatorUtils.equals(oldGeoUrl, drillMapPlot.getGeoUrl())) { + oldGeoUrl = drillMapPlot.getGeoUrl(); + DefaultMutableTreeNode root = CompatibleGeoJSONTreeHelper.getNodeByJSONPath(oldGeoUrl); + if (root == null) { + return; + } + + depth = root.getDepth() + 1;//根节点也算一层 + paneList = initPaneList(); + this.removeAll(); + initComponents(); + } + + oldMapList = drillMapPlot.getLayerMapTypeList(); + populatePaneList(ob); + } + + private void populatePaneList(ChartCollection chartCollection) { + for (int i = 0, len = paneList.size(); i < len; i++) { + BasicPane basicPane = paneList.get(i); + MapType mapType = oldMapList.get(i); + if (basicPane instanceof SingleLayerDataDefinitionPane) { + ChartCollection clone = MapDataPaneHelper.getLayerChartCollection(chartCollection, i, mapType); + ((SingleLayerDataDefinitionPane) basicPane).populateBean(clone); + } + } + } + + /** + * Update. + */ + @Override + public ChartCollection updateBean() { + return null; + } + + @Override + public void updateBean(ChartCollection ob) { + DrillMapDefinition drillMapDefinition = MapDataPaneHelper.getDrillMapDefinition(ob); + List eachLayerDataDefinitionList = new ArrayList(); + for (BasicPane basicPane : paneList) { + if (basicPane instanceof SingleLayerDataDefinitionPane) { + ChartCollection temp = new ChartCollection(new Chart()); + ((SingleLayerDataDefinitionPane) basicPane).updateBean(temp); + eachLayerDataDefinitionList.add(temp.getSelectedChart().getFilterDefinition()); + } + } + drillMapDefinition.setEachLayerDataDefinitionList(eachLayerDataDefinitionList); + } + + /** + * 是否是指定类型 + * + * @param ob 对象 + * @return 是否是指定类型 + */ + @Override + public boolean accept(Object ob) { + return false; + } + + /** + * title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 + * + * @return 绥化狂标题 + */ + @Override + public String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Each_Layer_Data_Special"); + } + + /** + * 重置 + */ + @Override + public void reset() { + + } + + + /** + * 设置是否关联单元格数据. + * + * @param supportCellData + */ + public void setSupportCellData(boolean supportCellData) { + if (paneList == null) { + return; + } + for (BasicPane basicPane : paneList) { + if (basicPane instanceof SingleLayerDataDefinitionPane) { + ((SingleLayerDataDefinitionPane) basicPane).setSupportCellData(supportCellData); + } + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java new file mode 100644 index 0000000000..1aca1a32db --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/SingleLayerDataDefinitionPane.java @@ -0,0 +1,93 @@ +package com.fr.van.chart.drillmap.designer.data.comp; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; + +import java.awt.BorderLayout; + +/** + * Created by Mitisky on 16/6/21. + * 各层级分别指定中 单层区域地图数据配置 以及 底层数据汇总方式的界面 + */ +public class SingleLayerDataDefinitionPane extends FurtherBasicBeanPane { + private String title; + private NormalChartDataPane normalChartDataPane; + + //底层数据汇总 + public SingleLayerDataDefinitionPane(AttributeChangeListener listener, ChartDataPane parent) { + this(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bottom_Data_Sum"), listener, parent); + } + + public SingleLayerDataDefinitionPane(String title, AttributeChangeListener listener, ChartDataPane parent) { + this.title = title; + normalChartDataPane = new NormalChartDataPane(listener, parent); + + this.setLayout(new BorderLayout()); + this.add(normalChartDataPane, BorderLayout.CENTER); + } + + /** + * 设置是否关联单元格数据. + * + * @param supportCellData + */ + public void setSupportCellData(boolean supportCellData) { + normalChartDataPane.setSupportCellData(supportCellData); + } + + /** + * 是否是指定类型 + * + * @param ob 对象 + * @return 是否是指定类型 + */ + @Override + public boolean accept(Object ob) { + return false; + } + + /** + * title应该是一个属性,不只是对话框的标题时用到,与其他组件结合时,也会用得到 + * + * @return 绥化狂标题 + */ + @Override + public String title4PopupWindow() { + return title; + } + + /** + * 重置 + */ + @Override + public void reset() { + + } + + /** + * Populate. + * + * @param ob + */ + @Override + public void populateBean(ChartCollection ob) { + normalChartDataPane.populate(ob); + + } + + @Override + public void updateBean(ChartCollection ob) { + normalChartDataPane.update(ob); + } + + /** + * Update. + */ + @Override + public ChartCollection updateBean() { + return null; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java index f3ad4e22d0..712d3a3b76 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/VanHeatMapChartTypeUI.java @@ -3,15 +3,10 @@ package com.fr.van.chart.heatmap.designer; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chartx.AbstractVanSingleDataPane; -import com.fr.design.chartx.fields.diff.PointMapCellDataFieldsPane; -import com.fr.design.chartx.fields.diff.PointMapDataSetFieldsPane; -import com.fr.design.chartx.single.SingleDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; -import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithMapZoom; @@ -61,18 +56,25 @@ public class VanHeatMapChartTypeUI extends VanMapChartTypeUI { return new VanChartHeatMapTypePane(); } + //图表数据结构 恢复用注释。删除下面方法。 @Override - public ChartDataPane getChartDataPane(AttributeChangeListener listener) { - return new AbstractVanSingleDataPane(listener) { - @Override - protected SingleDataPane createSingleDataPane() { - PointMapDataSetFieldsPane pointMapDataSetFieldsPane = new PointMapDataSetFieldsPane(); - pointMapDataSetFieldsPane.setChart(getVanChart()); - return new SingleDataPane(pointMapDataSetFieldsPane, new PointMapCellDataFieldsPane()); - } - }; + protected boolean areaPlot(Plot plot) { + return false; } + //图表数据结构 恢复用注释。取消注释。 +// @Override +// public ChartDataPane getChartDataPane(AttributeChangeListener listener) { +// return new AbstractVanSingleDataPane(listener) { +// @Override +// protected SingleDataPane createSingleDataPane() { +// PointMapDataSetFieldsPane pointMapDataSetFieldsPane = new PointMapDataSetFieldsPane(); +// pointMapDataSetFieldsPane.setChart(getVanChart()); +// return new SingleDataPane(pointMapDataSetFieldsPane, new PointMapCellDataFieldsPane()); +// } +// }; +// } + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { return new VanChartHeatMapSeriesPane(parent, plot); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java index 2981e6e4ee..07cb2cbd68 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/VanMapChartTypeUI.java @@ -2,16 +2,26 @@ package com.fr.van.chart.map; import com.fr.chart.chartattr.Plot; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.chartx.data.map.MapChartDataPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.map.designer.data.VanChartMapDataPane; +import com.fr.van.chart.map.designer.data.contentpane.report.VanAreaMapPlotReportDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.report.VanLineMapPlotReportDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.report.VanPointMapPlotReportDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.table.VanAreaMapPlotTableDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.table.VanLineMapPlotTableDataContentPane; +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; import com.fr.van.chart.map.designer.other.VanChartMapOtherPane; import com.fr.van.chart.map.designer.other.condition.pane.VanChartMapConditionPane; import com.fr.van.chart.map.designer.style.VanChartMapStylePane; @@ -60,8 +70,34 @@ public class VanMapChartTypeUI extends AbstractIndependentVanChartUI { return new VanChartMapPlotPane(); } +//图表数据结构 恢复用注释。取消注释。 +// public ChartDataPane getChartDataPane(AttributeChangeListener listener){ +// return new MapChartDataPane(listener); +// } + + //图表数据结构 恢复用注释。删除下面5个方法 getTableDataSourcePane getReportDataSourcePane getChartDataPane areaPlot linePlot。 + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { + return areaPlot(plot) ? new VanAreaMapPlotTableDataContentPane(parent) + : linePlot(plot) ? new VanLineMapPlotTableDataContentPane(parent) + : new VanPointMapPlotTableDataContentPane(parent); + } + + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { + return areaPlot(plot) ? new VanAreaMapPlotReportDataContentPane(parent) + : linePlot(plot) ? new VanLineMapPlotReportDataContentPane(parent) + : new VanPointMapPlotReportDataContentPane(parent); + } + public ChartDataPane getChartDataPane(AttributeChangeListener listener){ - return new MapChartDataPane(listener); + return new VanChartMapDataPane(listener); + } + + protected boolean areaPlot(Plot plot) { + return plot != null && plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getMapType() == MapType.AREA; + } + + protected boolean linePlot(Plot plot) { + return plot != null && plot instanceof VanChartMapPlot && ((VanChartMapPlot) plot).getMapType() == MapType.LINE; } /** diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java new file mode 100644 index 0000000000..ef9dd00d51 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/CustomMapChartDataContentsPane.java @@ -0,0 +1,84 @@ +package com.fr.van.chart.map.designer.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.DataContentsPane; +import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; +import com.fr.van.chart.map.designer.VanMapAreaPointAndLineGroupPane; + +import javax.swing.JPanel; + +/** + * Created by Mitisky on 16/5/17. + */ +public class CustomMapChartDataContentsPane extends DataContentsPane { + private NormalChartDataPane areaMapChartDataPane; + private NormalChartDataPane pointMapChartDataPane; + private NormalChartDataPane lineMapChartDataPane; + + private AttributeChangeListener listener; + private ChartDataPane parent; + + public CustomMapChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent) { + this.listener = listener; + this.parent = parent; + initAll(); + } + + @Override + public void setSupportCellData(boolean supportCellData) { + areaMapChartDataPane.setSupportCellData(supportCellData); + pointMapChartDataPane.setSupportCellData(supportCellData); + lineMapChartDataPane.setSupportCellData(supportCellData); + } + + @Override + public void populate(ChartCollection collection) { + populateAreaMap(collection); + populatePointMap(collection); + populateLineMap(collection); + } + + @Override + public void update(ChartCollection collection) { + updatePointMap(collection); + updateAreaMap(collection); + updateLineMap(collection); + } + + public void populatePointMap(ChartCollection collection) { + pointMapChartDataPane.populate(collection); + } + + public void populateLineMap(ChartCollection collection) { + lineMapChartDataPane.populate(collection); + } + + public void updatePointMap(ChartCollection collection) { + pointMapChartDataPane.update(collection); + } + + public void populateAreaMap(ChartCollection collection) { + areaMapChartDataPane.populate(collection); + } + + public void updateAreaMap(ChartCollection collection) { + areaMapChartDataPane.update(collection); + } + + public void updateLineMap(ChartCollection collection) { + lineMapChartDataPane.update(collection); + } + + @Override + protected JPanel createContentPane() { + areaMapChartDataPane = new NormalChartDataPane(listener, parent); + pointMapChartDataPane = new NormalChartDataPane(listener, parent); + lineMapChartDataPane = new NormalChartDataPane(listener, parent); + + return new VanMapAreaPointAndLineGroupPane(areaMapChartDataPane, pointMapChartDataPane, lineMapChartDataPane); + } + + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java new file mode 100644 index 0000000000..3c4f6f976a --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/MapDataPaneHelper.java @@ -0,0 +1,177 @@ +package com.fr.van.chart.map.designer.data; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; +import com.fr.plugin.chart.drillmap.data.DrillMapDefinition; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.data.VanMapDefinition; +import com.fr.plugin.chart.type.MapType; + +import java.util.List; + +/** + * Created by shine on 2017/8/8. + */ +public class MapDataPaneHelper { + public static ChartCollection getPointMapChartCollection(ChartCollection chartCollection) { + try { + ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); + Chart chart = cloneCollection.getSelectedChart(); + + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition != null && definition instanceof VanMapDefinition) { + chart.setFilterDefinition(((VanMapDefinition) definition).getPointDefinition()); + } + + Plot plot = chart.getPlot(); + if (plot != null && plot instanceof VanChartMapPlot) { + ((VanChartMapPlot) plot).setMapType(MapType.POINT); + } + return cloneCollection; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return chartCollection; + } + } + + public static ChartCollection getLineMapChartCollection(ChartCollection chartCollection) { + try { + ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); + Chart chart = cloneCollection.getSelectedChart(); + + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition != null && definition instanceof VanMapDefinition) { + chart.setFilterDefinition(((VanMapDefinition) definition).getLineDefinition()); + } + + Plot plot = chart.getPlot(); + if (plot != null && plot instanceof VanChartMapPlot) { + ((VanChartMapPlot) plot).setMapType(MapType.LINE); + } + return cloneCollection; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return chartCollection; + } + } + + + public static ChartCollection getAreaMapChartCollection(ChartCollection chartCollection) { + try { + ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); + Chart chart = cloneCollection.getSelectedChart(); + + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition != null && definition instanceof VanMapDefinition) { + chart.setFilterDefinition(((VanMapDefinition) definition).getAreaDefinition()); + } + + Plot plot = chart.getPlot(); + if (plot != null && plot instanceof VanChartMapPlot) { + ((VanChartMapPlot) plot).setMapType(MapType.AREA); + } + return cloneCollection; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return chartCollection; + } + } + + public static ChartCollection getBottomDataDrillMapChartCollection(ChartCollection chartCollection) { + try { + ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); + Chart chart = cloneCollection.getSelectedChart(); + + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition != null && definition instanceof DrillMapDefinition) { + chart.setFilterDefinition(((DrillMapDefinition) definition).getBottomDataDefinition()); + } + + Plot plot = chart.getPlot(); + if (plot != null && plot instanceof VanChartDrillMapPlot) { + List list = ((VanChartDrillMapPlot) plot).getLayerMapTypeList(); + MapType mapType = (list != null && list.size() > 0) ? list.get(list.size() - 1) : MapType.AREA; + ((VanChartMapPlot) plot).setMapType(mapType); + } + return cloneCollection; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return chartCollection; + } + } + + public static ChartCollection getLayerChartCollection(ChartCollection chartCollection, int level, MapType mapType) { + if (mapType == null) { + mapType = MapType.AREA; + } + try { + ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); + Chart chart = cloneCollection.getSelectedChart(); + + TopDefinitionProvider definition = chart.getFilterDefinition(); + if (definition != null && definition instanceof DrillMapDefinition) { + List list = ((DrillMapDefinition) definition).getEachLayerDataDefinitionList(); + if (list.size() > level) { + chart.setFilterDefinition(list.get(level)); + } + } + + Plot plot = chart.getPlot(); + if (plot != null && plot instanceof VanChartMapPlot) { + ((VanChartMapPlot) plot).setMapType(mapType); + } + return cloneCollection; + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + return chartCollection; + } + } + + + public static boolean isFromBottomData(ChartCollection chartCollection) { + DrillMapDefinition drillMapDefinition = getDrillMapDefinition(chartCollection); + return drillMapDefinition == null || drillMapDefinition.isFromBottomData(); + } + + public static DrillMapDefinition getDrillMapDefinition(ChartCollection chartCollection) { + if (chartCollection != null) { + Chart chart = chartCollection.getSelectedChart(); + if (chart != null) { + TopDefinitionProvider definitionProvider = chart.getFilterDefinition(); + if (definitionProvider instanceof DrillMapDefinition) { + return (DrillMapDefinition) definitionProvider; + } + } + } + return null; + } + + public static List getDrillMapLayerMapTypeList(ChartCollection chartCollection) { + if (chartCollection != null) { + Chart chart = chartCollection.getSelectedChart(); + if (chart != null) { + Plot plot = chart.getPlot(); + if (plot instanceof VanChartDrillMapPlot) { + return ((VanChartDrillMapPlot) plot).getLayerMapTypeList(); + } + } + } + return null; + } + + public static MapType getPlotMapType(ChartCollection chartCollection) { + Plot plot = chartCollection.getSelectedChart().getPlot(); + return getPlotMapType(plot); + } + + public static MapType getPlotMapType(Plot plot) { + if (plot != null && plot instanceof VanChartMapPlot) { + return ((VanChartMapPlot) plot).getMapType(); + } + return MapType.AREA; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java new file mode 100644 index 0000000000..a6fdd49ce6 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/VanChartMapDataPane.java @@ -0,0 +1,121 @@ +package com.fr.van.chart.map.designer.data; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; +import com.fr.plugin.chart.map.data.VanMapDefinition; +import com.fr.plugin.chart.type.MapType; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Mitisky on 16/5/16. + */ +public class VanChartMapDataPane extends ChartDataPane { + MapType mapType = MapType.AREA; + + public VanChartMapDataPane(AttributeChangeListener listener) { + super(listener); + } + + @Override + protected JPanel createContentPane() { + contentsPane = new NormalChartDataPane(listener, VanChartMapDataPane.this); + return contentsPane; + } + + protected void repeatLayout(ChartCollection collection) { + if (contentsPane != null) { + this.remove(contentsPane); + } + this.setLayout(new BorderLayout(0, 0)); + + switch (mapType) { + case CUSTOM: + contentsPane = new CustomMapChartDataContentsPane(listener, VanChartMapDataPane.this); + break; + default: + contentsPane = new NormalChartDataPane(listener, VanChartMapDataPane.this); + break; + } + + contentsPane.setSupportCellData(isSupportCellData()); + + this.add(contentsPane, BorderLayout.CENTER); + } + + /** + * 更新界面 数据内容 + */ + public void populate(ChartCollection collection) { + mapType = MapDataPaneHelper.getPlotMapType(collection); + + repeatLayout(collection); + + switch (mapType) { + case AREA: + ChartCollection areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); + contentsPane.populate(areaClone); + break; + case POINT: + ChartCollection pointClone = MapDataPaneHelper.getPointMapChartCollection(collection); + contentsPane.populate(pointClone); + break; + case LINE: + ChartCollection lineClone = MapDataPaneHelper.getLineMapChartCollection(collection); + contentsPane.populate(lineClone); + break; + case CUSTOM: + ChartCollection areaClone1 = MapDataPaneHelper.getAreaMapChartCollection(collection); + ChartCollection pointClone1 = MapDataPaneHelper.getPointMapChartCollection(collection); + ChartCollection lineClone1 = MapDataPaneHelper.getLineMapChartCollection(collection); + ((CustomMapChartDataContentsPane) contentsPane).populateAreaMap(areaClone1); + ((CustomMapChartDataContentsPane) contentsPane).populatePointMap(pointClone1); + ((CustomMapChartDataContentsPane) contentsPane).populateLineMap(lineClone1); + } + + } + + /** + * 保存 数据界面内容 + */ + public void update(ChartCollection collection) { + if (contentsPane != null) { + VanMapDefinition vanMapDefinition = new VanMapDefinition(); + + ChartCollection pointClone = MapDataPaneHelper.getPointMapChartCollection(collection); + ChartCollection areaClone = MapDataPaneHelper.getAreaMapChartCollection(collection); + ChartCollection lineClone = MapDataPaneHelper.getLineMapChartCollection(collection); + + switch (mapType) { + case AREA: + contentsPane.update(areaClone); + pointClone.getSelectedChart().setFilterDefinition(null); + lineClone.getSelectedChart().setFilterDefinition(null); + break; + case POINT: + contentsPane.update(pointClone); + areaClone.getSelectedChart().setFilterDefinition(null); + lineClone.getSelectedChart().setFilterDefinition(null); + break; + case LINE: + contentsPane.update(lineClone); + areaClone.getSelectedChart().setFilterDefinition(null); + pointClone.getSelectedChart().setFilterDefinition(null); + break; + case CUSTOM: + ((CustomMapChartDataContentsPane) contentsPane).updateAreaMap(areaClone); + ((CustomMapChartDataContentsPane) contentsPane).updatePointMap(pointClone); + ((CustomMapChartDataContentsPane) contentsPane).updateLineMap(lineClone); + break; + } + vanMapDefinition.setAreaDefinition(areaClone.getSelectedChart().getFilterDefinition()); + vanMapDefinition.setPointDefinition(pointClone.getSelectedChart().getFilterDefinition()); + vanMapDefinition.setLineDefinition(lineClone.getSelectedChart().getFilterDefinition()); + + collection.getSelectedChart().setFilterDefinition(vanMapDefinition); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/LongitudeLatitudeAndArea.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/LongitudeLatitudeAndArea.java new file mode 100644 index 0000000000..ac365cab5e --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/LongitudeLatitudeAndArea.java @@ -0,0 +1,34 @@ +package com.fr.van.chart.map.designer.data.component; + +/** + * Created by hufan on 2016/12/23. + */ +public class LongitudeLatitudeAndArea { + private Object longitude; + private Object latitude; + private Object area; + + public Object getLongitude() { + return longitude; + } + + public void setLongitude(Object longitude) { + this.longitude = longitude; + } + + public Object getLatitude() { + return latitude; + } + + public void setLatitude(Object latitude) { + this.latitude = latitude; + } + + public Object getArea() { + return area; + } + + public void setArea(Object area) { + this.area = area; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldNamePaneWithOutFilter.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldNamePaneWithOutFilter.java new file mode 100644 index 0000000000..99df746459 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldNamePaneWithOutFilter.java @@ -0,0 +1,23 @@ +package com.fr.van.chart.map.designer.data.component; + +import com.fr.chart.chartdata.MoreNameCDDefinition; +import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane; +import com.fr.plugin.chart.map.data.VanMapMoreNameCDDefinition; + +import java.awt.Component; + +/** + * Created by Mitisky on 16/5/17. + */ +public class SeriesNameUseFieldNamePaneWithOutFilter extends SeriesNameUseFieldNamePane { + + @Override + protected Component[][] getUseComponent() { + return getUseComponentWithOutFilter(); + } + + @Override + protected MoreNameCDDefinition createMoreNameCDDefinition() { + return new VanMapMoreNameCDDefinition(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldValuePaneWithOutFilter.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldValuePaneWithOutFilter.java new file mode 100644 index 0000000000..c1e1c97559 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesNameUseFieldValuePaneWithOutFilter.java @@ -0,0 +1,29 @@ +package com.fr.van.chart.map.designer.data.component; + +import com.fr.chart.chartdata.OneValueCDDefinition; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; +import com.fr.plugin.chart.map.data.VanMapOneValueCDDefinition; + +import java.awt.Component; + +/** + * Created by Mitisky on 16/5/16. + */ +public class SeriesNameUseFieldValuePaneWithOutFilter extends SeriesNameUseFieldValuePane { + + @Override + protected Component[][] getUseComponent(UILabel Label1, UILabel Label2, UILabel Label3) { + return getUseComponentWithOutFilter(Label1, Label2, Label3); + } + + @Override + protected Component[][] getUseComponentWithOutSummary(UILabel Label1, UILabel Label2, UILabel Label3) { + return getUseComponentWithOutFilterAndSummary(Label1, Label2, Label3); + } + + @Override + protected OneValueCDDefinition createOneValueCDDefinition() { + return new VanMapOneValueCDDefinition(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java new file mode 100644 index 0000000000..db545b9d45 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/SeriesTypeUseComboxPaneWithOutFilter.java @@ -0,0 +1,40 @@ +package com.fr.van.chart.map.designer.data.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane; +import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; +import com.fr.design.mainframe.chart.gui.data.table.SeriesTypeUseComboxPane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by Mitisky on 16/5/16. + */ +public class SeriesTypeUseComboxPaneWithOutFilter extends SeriesTypeUseComboxPane { + + public SeriesTypeUseComboxPaneWithOutFilter(ChartDataPane parent, Plot initplot) { + super(parent, initplot); + } + + protected void initLayout() { + super.initLayout(); + this.add(new JPanel(), BorderLayout.SOUTH); + } + + protected void initComponents() { + super.initComponents(); + this.setSelectedIndex(1); + } + + @Override + protected SeriesNameUseFieldValuePane createValuePane() { + return new SeriesNameUseFieldValuePaneWithOutFilter(); + } + + @Override + protected SeriesNameUseFieldNamePane createNamePane() { + return new SeriesNameUseFieldNamePaneWithOutFilter(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java new file mode 100644 index 0000000000..abf098dded --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AbstractLongLatAreaPane.java @@ -0,0 +1,14 @@ +package com.fr.van.chart.map.designer.data.component.report; + +import com.fr.plugin.chart.map.data.VanMapReportDefinition; + +import javax.swing.JPanel; + +/** + * Created by hufan on 2016/12/21. + */ +public abstract class AbstractLongLatAreaPane extends JPanel { + public abstract void populate(VanMapReportDefinition vanMapReportDefinition); + + public abstract void update(VanMapReportDefinition vanMapReportDefinition); +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java new file mode 100644 index 0000000000..dc5df28f30 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/AreaPane.java @@ -0,0 +1,64 @@ +package com.fr.van.chart.map.designer.data.component.report; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * Created by hufan on 2016/12/21. + */ +public class AreaPane extends AbstractReportDataContentPane { + protected TinyFormulaPane areaName; + + public AreaPane() { + JPanel panel = createContentPane(); + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.CENTER); + } + + protected JPanel createContentPane() { + areaName = new TinyFormulaPane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, COMPONENT_WIDTH}; + double[] rowSize = {p}; + Component[][] components = getComponent(); + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } + + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), areaName} + }; + } + + @Override + protected String[] columnNames() { + return new String[0]; + } + + public void populate(LongitudeLatitudeAndArea longLatArea) { + if (longLatArea.getArea() != null) { + areaName.getUITextField().setText(longLatArea.getArea().toString()); + } + } + + public LongitudeLatitudeAndArea update() { + LongitudeLatitudeAndArea longLatArea = new LongitudeLatitudeAndArea(); + longLatArea.setArea(canBeFormula(areaName.getUITextField().getText())); + return longLatArea; + } + + @Override + public void populateBean(ChartCollection ob) { + + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java new file mode 100644 index 0000000000..0f7e047e9b --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapAreaPane.java @@ -0,0 +1,71 @@ +package com.fr.van.chart.map.designer.data.component.report; + +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.plugin.chart.map.data.VanMapReportDefinition; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * Created by hufan on 2016/12/22. + */ +public class LineMapAreaPane extends PointMapAreaPane { + private static final int V_GAP = 10; + protected AreaPane endAreaPane; + + protected JPanel createContentPane() { + initAreaPane(); + initEndAreaPane(); + + JPanel content = new JPanel(new BorderLayout(0, V_GAP)); + content.add(areaPane, BorderLayout.NORTH); + content.add(endAreaPane, BorderLayout.CENTER); + return content; + } + + protected void initEndAreaPane() { + endAreaPane = new AreaPane() { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), areaName} + }; + } + }; + } + + @Override + protected void initAreaPane() { + areaPane = new AreaPane() { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), areaName} + }; + } + }; + } + + @Override + public void populate(VanMapReportDefinition vanMapReportDefinition) { + super.populate(vanMapReportDefinition); + + LongitudeLatitudeAndArea endLongLatArea = new LongitudeLatitudeAndArea(); + endLongLatArea.setArea(vanMapReportDefinition.getEndAreaName()); + endLongLatArea.setLongitude(vanMapReportDefinition.getEndLongitude()); + endLongLatArea.setLatitude(vanMapReportDefinition.getEndLatitude()); + + endAreaPane.populate(endLongLatArea); + } + + @Override + public void update(VanMapReportDefinition vanMapReportDefinition) { + super.update(vanMapReportDefinition); + + LongitudeLatitudeAndArea endLongLatArea = endAreaPane.update(); + vanMapReportDefinition.setEndAreaName(endLongLatArea.getArea() == null ? null : endLongLatArea.getArea().toString()); + vanMapReportDefinition.setEndLongitude(endLongLatArea.getLongitude() == null ? null : endLongLatArea.getLongitude().toString()); + vanMapReportDefinition.setEndLatitude(endLongLatArea.getLatitude() == null ? null : endLongLatArea.getLatitude().toString()); + + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java new file mode 100644 index 0000000000..1fd653dc70 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LineMapLongLatAreaPane.java @@ -0,0 +1,36 @@ +package com.fr.van.chart.map.designer.data.component.report; + + +import com.fr.design.gui.ilable.BoldFontTextLabel; + +import java.awt.Component; + +/** + * Created by hufan on 2016/12/22. + */ +public class LineMapLongLatAreaPane extends LineMapAreaPane { + + protected void initEndAreaPane() { + endAreaPane = new LongLatAreaPane() { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Longitude")), longitude}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Latitude")), latitude}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), areaName} + }; + } + }; + } + + protected void initAreaPane() { + areaPane = new LongLatAreaPane() { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Longitude")), longitude}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Latitude")), latitude}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), areaName} + }; + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java new file mode 100644 index 0000000000..af6b100661 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/LongLatAreaPane.java @@ -0,0 +1,77 @@ +package com.fr.van.chart.map.designer.data.component.report; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +/** + * Created by hufan on 2016/12/21. + */ +public class LongLatAreaPane extends AreaPane { + protected TinyFormulaPane longitude; + protected TinyFormulaPane latitude; + + public LongLatAreaPane() { + JPanel panel = createContentPane(); + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.CENTER); + } + + @Override + protected JPanel createContentPane() { + areaName = new TinyFormulaPane(); + longitude = new TinyFormulaPane(); + latitude = new TinyFormulaPane(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, COMPONENT_WIDTH}; + double[] rowSize = {p, p, p}; + Component[][] components = getComponent(); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); + } + + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitude}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitude}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), areaName} + }; + } + + @Override + public void populateBean(ChartCollection ob) { + + } + + @Override + protected String[] columnNames() { + return new String[0]; + } + + @Override + public void populate(LongitudeLatitudeAndArea longLatArea) { + super.populate(longLatArea); + if (longLatArea.getLongitude() != null) { + longitude.getUITextField().setText(longLatArea.getLongitude().toString()); + } + if (longLatArea.getLatitude() != null) { + latitude.getUITextField().setText(longLatArea.getLatitude().toString()); + } + } + + @Override + public LongitudeLatitudeAndArea update() { + LongitudeLatitudeAndArea longLatArea = super.update(); + longLatArea.setLongitude(canBeFormula(longitude.getUITextField().getText())); + longLatArea.setLatitude(canBeFormula(latitude.getUITextField().getText())); + return longLatArea; + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java new file mode 100644 index 0000000000..f47e2623ac --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapAreaPane.java @@ -0,0 +1,48 @@ +package com.fr.van.chart.map.designer.data.component.report; + +import com.fr.plugin.chart.map.data.VanMapReportDefinition; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; + +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/** + * Created by hufan on 2016/12/23. + */ +public class PointMapAreaPane extends AbstractLongLatAreaPane { + protected AreaPane areaPane; + + public PointMapAreaPane() { + JPanel contentPane = createContentPane(); + this.setLayout(new BorderLayout()); + this.add(contentPane, BorderLayout.CENTER); + } + + protected JPanel createContentPane() { + initAreaPane(); + JPanel content = new JPanel(new BorderLayout()); + content.add(areaPane, BorderLayout.CENTER); + return content; + } + + protected void initAreaPane() { + areaPane = new AreaPane(); + } + + @Override + public void populate(VanMapReportDefinition vanMapReportDefinition) { + LongitudeLatitudeAndArea longLatArea = new LongitudeLatitudeAndArea(); + longLatArea.setArea(vanMapReportDefinition.getCategoryName()); + longLatArea.setLongitude(vanMapReportDefinition.getLongitude()); + longLatArea.setLatitude(vanMapReportDefinition.getLatitude()); + areaPane.populate(longLatArea); + } + + @Override + public void update(VanMapReportDefinition vanMapReportDefinition) { + LongitudeLatitudeAndArea longLatArea = areaPane.update(); + vanMapReportDefinition.setCategoryName(longLatArea.getArea() == null ? null : longLatArea.getArea().toString()); + vanMapReportDefinition.setLongitude(longLatArea.getLongitude() == null ? null : longLatArea.getLongitude().toString()); + vanMapReportDefinition.setLatitude(longLatArea.getLatitude() == null ? null : longLatArea.getLatitude().toString()); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapLongLatAreaPane.java new file mode 100644 index 0000000000..a4919d0474 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/report/PointMapLongLatAreaPane.java @@ -0,0 +1,14 @@ +package com.fr.van.chart.map.designer.data.component.report; + +/** + * Created by hufan on 2016/12/23. + */ +public class PointMapLongLatAreaPane extends PointMapAreaPane { + public PointMapLongLatAreaPane() { + super(); + } + + protected void initAreaPane() { + areaPane = new LongLatAreaPane(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java new file mode 100644 index 0000000000..9d2603f136 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AbstractLongLatAreaPane.java @@ -0,0 +1,26 @@ +package com.fr.van.chart.map.designer.data.component.table; + +import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; + +import javax.swing.JPanel; +import java.util.List; + +/** + * Created by hufan on 2016/12/21. + */ +public abstract class AbstractLongLatAreaPane extends JPanel { + + public abstract boolean isSelectedItem(); + + public abstract void populate(VanMapTableDefinitionProvider mapTableDefinitionProvider); + + public abstract void update(VanMapTableDefinitionProvider mapTableDefinitionProvider); + + public abstract void refreshBoxListWithSelectTableData(List list); + + public abstract void checkBoxUse(boolean hasUse); + + public abstract void clearAllBoxList(); + + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java new file mode 100644 index 0000000000..d7934dc294 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/AreaPane.java @@ -0,0 +1,104 @@ +package com.fr.van.chart.map.designer.data.component.table; + +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +/** + * Created by hufan on 2016/12/21. + */ +public class AreaPane extends AbstractTableDataContentPane { + protected VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane listener; + protected UIComboBox areaNameCom; + + public AreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + this.listener = parentPane; + this.setLayout(new BorderLayout()); + JPanel panel = createAreaNamePane(); + this.add(panel, BorderLayout.CENTER); + } + + @Override + public void updateBean(ChartCollection ob) { + + } + + public void checkBoxUse(boolean hasUse) { + areaNameCom.setEnabled(hasUse); + } + + + protected JPanel createAreaNamePane() { + initAreaNameCom(); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, COMPONENT_WIDTH}; + double[] rowSize = {p}; + Component[][] components = getComponent(); + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); + } + + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), areaNameCom} + }; + } + + protected void initAreaNameCom() { + + areaNameCom = new UIComboBox(); + + areaNameCom.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + listener.fireCheckSeriesUse(areaNameCom.getSelectedItem() != null); + makeToolTipUse(areaNameCom); + } + }); + } + + protected void makeToolTipUse(UIComboBox comBox) { + if (comBox.getSelectedItem() != null) { + comBox.setToolTipText(comBox.getSelectedItem().toString()); + } else { + comBox.setToolTipText(null); + } + } + + @Override + public void refreshBoxListWithSelectTableData(List list) { + refreshBoxItems(areaNameCom, list); + } + + public boolean isSelectedItem() { + return areaNameCom.getSelectedItem() != null; + } + + public void populate(LongitudeLatitudeAndArea longLatArea) { + if (longLatArea.getArea() != null) { + areaNameCom.setSelectedItem(longLatArea.getArea()); + } + } + + public LongitudeLatitudeAndArea update() { + LongitudeLatitudeAndArea longLatArea = new LongitudeLatitudeAndArea(); + longLatArea.setArea(areaNameCom.getSelectedItem()); + return longLatArea; + } + + @Override + public void clearAllBoxList() { + clearBoxItems(areaNameCom); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java new file mode 100644 index 0000000000..200ae1e513 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapAreaPane.java @@ -0,0 +1,100 @@ +package com.fr.van.chart.map.designer.data.component.table; + +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.List; + + +/** + * Created by hufan on 2016/12/21. + */ +public class LineMapAreaPane extends PointMapAreaPane { + private static final int V_GAP = 10; + protected AreaPane endAreaPane; + + public LineMapAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + super(parentPane); + } + + protected JPanel createContentPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + initAreaPane(parentPane); + initEndAreaPane(parentPane); + + JPanel content = new JPanel(new BorderLayout(0, V_GAP)); + content.add(areaPane, BorderLayout.NORTH); + content.add(endAreaPane, BorderLayout.CENTER); + return content; + } + + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new AreaPane(parentPane) { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), areaNameCom} + }; + } + }; + } + + protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + endAreaPane = new AreaPane(parentPane) { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), areaNameCom} + }; + } + }; + } + + @Override + public void refreshBoxListWithSelectTableData(List list) { + super.refreshBoxListWithSelectTableData(list); + endAreaPane.refreshBoxListWithSelectTableData(list); + } + + @Override + public boolean isSelectedItem() { + return super.isSelectedItem() + && endAreaPane.isSelectedItem(); + } + + @Override + public void populate(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + super.populate(mapTableDefinitionProvider); + + LongitudeLatitudeAndArea endLongLatArea = new LongitudeLatitudeAndArea(); + endLongLatArea.setArea(mapTableDefinitionProvider.getEndAreaName()); + endLongLatArea.setLongitude(mapTableDefinitionProvider.getEndLongitude()); + endLongLatArea.setLatitude(mapTableDefinitionProvider.getEndLatitude()); + + endAreaPane.populate(endLongLatArea); + } + + @Override + public void update(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + super.update(mapTableDefinitionProvider); + + LongitudeLatitudeAndArea endLongLatArea = endAreaPane.update(); + mapTableDefinitionProvider.setEndAreaName(endLongLatArea.getArea() == null ? null : endLongLatArea.getArea().toString()); + mapTableDefinitionProvider.setEndLongitude(endLongLatArea.getLongitude() == null ? null : endLongLatArea.getLongitude().toString()); + mapTableDefinitionProvider.setEndLatitude(endLongLatArea.getLatitude() == null ? null : endLongLatArea.getLatitude().toString()); + } + + @Override + public void checkBoxUse(boolean hasUse) { + super.checkBoxUse(hasUse); + endAreaPane.checkBoxUse(hasUse); + } + + @Override + public void clearAllBoxList() { + super.clearAllBoxList(); + endAreaPane.clearAllBoxList(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java new file mode 100644 index 0000000000..8e6fc3c905 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LineMapLongLatAreaPane.java @@ -0,0 +1,41 @@ +package com.fr.van.chart.map.designer.data.component.table; + + +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; + +import java.awt.Component; + +/** + * Created by hufan on 2016/12/21. + */ +public class LineMapLongLatAreaPane extends LineMapAreaPane { + + public LineMapLongLatAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + super(parentPane); + } + + protected void initEndAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + endAreaPane = new LongLatAreaPane(parentPane) { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Longitude")), longitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Latitude")), latitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_End_Area_Name")), areaNameCom} + }; + } + }; + } + + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new LongLatAreaPane(parentPane) { + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Longitude")), longitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Latitude")), latitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Start_Area_Name")), areaNameCom} + }; + } + }; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java new file mode 100644 index 0000000000..b3e3dbd114 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/LongLatAreaPane.java @@ -0,0 +1,122 @@ +package com.fr.van.chart.map.designer.data.component.table; + +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; + +import javax.swing.JPanel; +import java.awt.Component; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +/** + * Created by hufan on 2016/12/21. + */ +public class LongLatAreaPane extends AreaPane { + protected UIComboBox longitudeCom; + protected UIComboBox latitudeCom; + + public LongLatAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + super(parentPane); + } + + @Override + protected JPanel createAreaNamePane() { + initAreaNameCom(); + initLongitudeCom(); + initLatitudeCom(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, COMPONENT_WIDTH}; + double[] rowSize = {p, p, p}; + Component[][] components = getComponent(); + + return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); + } + + protected Component[][] getComponent() { + return new Component[][]{ + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Longitude")), longitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Latitude")), latitudeCom}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")), areaNameCom} + }; + } + + public void refreshBoxListWithSelectTableData(List list) { + super.refreshBoxListWithSelectTableData(list); + refreshBoxItems(longitudeCom, list); + refreshBoxItems(latitudeCom, list); + } + + protected void initLatitudeCom() { + + latitudeCom = new UIComboBox(); + + latitudeCom.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + listener.fireCheckSeriesUse(latitudeCom.getSelectedItem() != null); + makeToolTipUse(latitudeCom); + } + }); + } + + @Override + public void populate(LongitudeLatitudeAndArea longLatArea) { + super.populate(longLatArea); + if (longLatArea.getLongitude() != null) { + longitudeCom.setSelectedItem(longLatArea.getLongitude()); + } + if (longLatArea.getLatitude() != null) { + latitudeCom.setSelectedItem(longLatArea.getLatitude()); + } + } + + @Override + public LongitudeLatitudeAndArea update() { + LongitudeLatitudeAndArea longitudeLatitudeAndArea = super.update(); + longitudeLatitudeAndArea.setLatitude(latitudeCom.getSelectedItem()); + longitudeLatitudeAndArea.setLongitude(longitudeCom.getSelectedItem()); + return longitudeLatitudeAndArea; + } + + @Override + public void checkBoxUse(boolean hasUse) { + super.checkBoxUse(hasUse); + longitudeCom.setEnabled(hasUse); + latitudeCom.setEnabled(hasUse); + } + + public void clearAllBoxList() { + super.clearAllBoxList(); + clearBoxItems(longitudeCom); + clearBoxItems(latitudeCom); + } + + protected void initLongitudeCom() { + + longitudeCom = new UIComboBox(); + + longitudeCom.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + listener.fireCheckSeriesUse(longitudeCom.getSelectedItem() != null); + makeToolTipUse(longitudeCom); + } + }); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + public boolean isSelectedItem() { + return super.isSelectedItem() + && longitudeCom.getSelectedItem() != null + && latitudeCom.getSelectedItem() != null; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapAreaPane.java new file mode 100644 index 0000000000..a6974be4b1 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapAreaPane.java @@ -0,0 +1,69 @@ +package com.fr.van.chart.map.designer.data.component.table; + +import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; +import com.fr.van.chart.map.designer.data.component.LongitudeLatitudeAndArea; +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.util.List; + +/** + * Created by hufan on 2016/12/23. + */ +public class PointMapAreaPane extends AbstractLongLatAreaPane { + protected AreaPane areaPane; + + public PointMapAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + JPanel contentPane = createContentPane(parentPane); + this.setLayout(new BorderLayout()); + this.add(contentPane, BorderLayout.CENTER); + } + + protected JPanel createContentPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + initAreaPane(parentPane); + JPanel content = new JPanel(new BorderLayout()); + content.add(areaPane, BorderLayout.CENTER); + return content; + } + + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new AreaPane(parentPane); + } + + public void refreshBoxListWithSelectTableData(List list) { + areaPane.refreshBoxListWithSelectTableData(list); + } + + @Override + public void checkBoxUse(boolean hasUse) { + areaPane.checkBoxUse(hasUse); + } + + @Override + public void clearAllBoxList() { + areaPane.clearAllBoxList(); + } + + @Override + public boolean isSelectedItem() { + return areaPane.isSelectedItem(); + } + + @Override + public void populate(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + LongitudeLatitudeAndArea longLatArea = new LongitudeLatitudeAndArea(); + longLatArea.setArea(mapTableDefinitionProvider.getCategoryName()); + longLatArea.setLongitude(mapTableDefinitionProvider.getLongitude()); + longLatArea.setLatitude(mapTableDefinitionProvider.getLatitude()); + areaPane.populate(longLatArea); + } + + @Override + public void update(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + LongitudeLatitudeAndArea longLatArea = areaPane.update(); + mapTableDefinitionProvider.setCategoryName(longLatArea.getArea() == null ? null : longLatArea.getArea().toString()); + mapTableDefinitionProvider.setLongitude(longLatArea.getLongitude() == null ? null : longLatArea.getLongitude().toString()); + mapTableDefinitionProvider.setLatitude(longLatArea.getLatitude() == null ? null : longLatArea.getLatitude().toString()); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapLongLatAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapLongLatAreaPane.java new file mode 100644 index 0000000000..93a9e833d2 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/component/table/PointMapLongLatAreaPane.java @@ -0,0 +1,18 @@ +package com.fr.van.chart.map.designer.data.component.table; + +import com.fr.van.chart.map.designer.data.contentpane.table.VanPointMapPlotTableDataContentPane; + + +/** + * Created by hufan on 2016/12/23. + */ +public class PointMapLongLatAreaPane extends PointMapAreaPane { + + public PointMapLongLatAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + super(parentPane); + } + + protected void initAreaPane(VanPointMapPlotTableDataContentPane.LongLatAreaTableComboPane parentPane) { + areaPane = new LongLatAreaPane(parentPane); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java new file mode 100644 index 0000000000..d19ad82df5 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanAreaMapPlotReportDataContentPane.java @@ -0,0 +1,110 @@ +package com.fr.van.chart.map.designer.data.contentpane.report; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartdata.SeriesDefinition; +import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; +import com.fr.plugin.chart.map.data.VanMapReportDefinition; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.util.List; + +/** + * Created by Mitisky on 16/5/16. + */ +public class VanAreaMapPlotReportDataContentPane extends AbstractReportDataContentPane { + protected TinyFormulaPane areaName; + + public VanAreaMapPlotReportDataContentPane(ChartDataPane parent) { + initEveryPane(); + initAreaName(); + JPanel panel = getContent(); + panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); + this.add(panel, "0,0,2,0"); + } + + protected void initAreaName() { + areaName = new TinyFormulaPane() { + @Override + protected void initLayout() { + this.setLayout(new BorderLayout(4, 0)); + + UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")); + label.setPreferredSize(new Dimension(75, 20)); + this.add(label, BorderLayout.WEST); + + formulaTextField.setPreferredSize(new Dimension(100, 20)); + this.add(formulaTextField, BorderLayout.CENTER); + this.add(formulaTextFieldButton, BorderLayout.EAST); + } + }; + } + + protected JPanel getContent() { + return getFormulaPane(); + } + + protected JPanel getFormulaPane() { + return areaName; + } + + @Override + protected String[] columnNames() { + return new String[]{ + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value") + }; + } + + public void populateBean(ChartCollection collection) { + TopDefinitionProvider topDefinitionProvider = collection.getSelectedChart().getFilterDefinition(); + if (topDefinitionProvider instanceof VanMapReportDefinition) { + + VanMapReportDefinition mapReportDefinition = (VanMapReportDefinition) topDefinitionProvider; + + populateDefinition(mapReportDefinition); + } + } + + protected void populateDefinition(VanMapReportDefinition mapReportDefinition) { + if (mapReportDefinition.getCategoryName() != null) { + areaName.getUITextField().setText(mapReportDefinition.getCategoryName().toString()); + } + if (mapReportDefinition.getSeriesSize() > 0) { + seriesPane.populateBean(mapReportDefinition.getEntryList()); + } + } + + public void updateBean(ChartCollection collection) { + collection.getSelectedChart().setFilterDefinition(new VanMapReportDefinition()); + + TopDefinitionProvider topDefinitionProvider = collection.getSelectedChart().getFilterDefinition(); + if (topDefinitionProvider instanceof VanMapReportDefinition) { + + VanMapReportDefinition mapReportDefinition = (VanMapReportDefinition) topDefinitionProvider; + + updateDefinition(mapReportDefinition); + } + } + + protected void updateDefinition(VanMapReportDefinition mapReportDefinition) { + mapReportDefinition.setCategoryName(canBeFormula(areaName.getUITextField().getText())); + mapReportDefinition.setLatitude(null); + mapReportDefinition.setLongitude(null); + + List list = seriesPane.updateBean(); + for (Object[] o : list) { + SeriesDefinition sd = new SeriesDefinition(); + + sd.setSeriesName(canBeFormula(o[0])); + sd.setValue(canBeFormula(o[1])); + mapReportDefinition.addSeriesValue(sd); + } + } +} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanLineMapPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanLineMapPlotReportDataContentPane.java new file mode 100644 index 0000000000..f28d212365 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanLineMapPlotReportDataContentPane.java @@ -0,0 +1,24 @@ +package com.fr.van.chart.map.designer.data.contentpane.report; + +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.van.chart.map.designer.data.component.report.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.report.LineMapAreaPane; +import com.fr.van.chart.map.designer.data.component.report.LineMapLongLatAreaPane; + +/** + * Created by hufan on 2016/12/15. + */ +public class VanLineMapPlotReportDataContentPane extends VanPointMapPlotReportDataContentPane { + + public VanLineMapPlotReportDataContentPane(ChartDataPane parent) { + super(parent); + } + + protected AbstractLongLatAreaPane getAreaPane() { + return new LineMapAreaPane(); + } + + protected AbstractLongLatAreaPane getLongLatAreaPane() { + return new LineMapLongLatAreaPane(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java new file mode 100644 index 0000000000..00e4d67182 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/report/VanPointMapPlotReportDataContentPane.java @@ -0,0 +1,170 @@ +package com.fr.van.chart.map.designer.data.contentpane.report; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.plugin.chart.map.data.VanMapReportDefinition; +import com.fr.van.chart.map.designer.data.component.report.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.report.PointMapAreaPane; +import com.fr.van.chart.map.designer.data.component.report.PointMapLongLatAreaPane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; + +/** + * Created by Mitisky on 16/5/17. + */ +public class VanPointMapPlotReportDataContentPane extends VanAreaMapPlotReportDataContentPane { + private LongLatReportFormulaPane longLatReportFormulaPane; + + public VanPointMapPlotReportDataContentPane(ChartDataPane parent) { + super(parent); + } + + @Override + protected JPanel getContent() { + longLatReportFormulaPane = new LongLatReportFormulaPane(); + JPanel content = new JPanel(new BorderLayout(0, 4)); + content.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0)); + content.add(longLatReportFormulaPane, BorderLayout.CENTER); + return content; + } + + @Override + protected void populateDefinition(VanMapReportDefinition mapReportDefinition) { + super.populateDefinition(mapReportDefinition); + longLatReportFormulaPane.populateBean(mapReportDefinition); + } + + @Override + protected void updateDefinition(VanMapReportDefinition mapReportDefinition) { + super.updateDefinition(mapReportDefinition); + longLatReportFormulaPane.updateBean(mapReportDefinition); + } + + //================================public class=================================== + + public class LongLatReportFormulaPane extends BasicBeanPane { + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + private UIButtonGroup locationType; + + private JPanel centerPane; + private AbstractLongLatAreaPane areaPane; + private AbstractLongLatAreaPane longLatAreaPane; + + public LongLatReportFormulaPane() { + this.setLayout(new BorderLayout(0, 5)); + centerPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (locationType.getSelectedIndex() == 0) { + return areaPane.getPreferredSize(); + } else { + return longLatAreaPane.getPreferredSize(); + } + } + }; + + locationType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Location_With_Area_Name"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Location_With_LongAndLat")}); + locationType.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCenterPane(); + } + }); + + longLatAreaPane = getLongLatAreaPane(); + areaPane = getAreaPane(); + + centerPane.add(areaPane, "area"); + centerPane.add(longLatAreaPane, "longLat"); + + locationType.setSelectedIndex(0); + + double[] columnSize = {p, f}; + double[] rowSize = {p}; + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")), locationType}, + }; + + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 12, 6); + + + this.add(panel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + + } + + private void checkCenterPane() { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (locationType.getSelectedIndex() == 0) { + cardLayout.show(centerPane, "area"); + } else { + cardLayout.show(centerPane, "longLat"); + } + } + + public void populateBean(VanMapReportDefinition mapReportDefinition) { + locationType.setSelectedIndex(mapReportDefinition.isUseAreaName() ? 0 : 1); + if (locationType.getSelectedIndex() == 0) { + areaPane.populate(mapReportDefinition); + + } else { + longLatAreaPane.populate(mapReportDefinition); + } + + checkCenterPane(); + + } + + public void updateBean(VanMapReportDefinition mapReportDefinition) { + boolean useAreaName = locationType.getSelectedIndex() == 0; + mapReportDefinition.setUseAreaName(useAreaName); + if (useAreaName) { + areaPane.update(mapReportDefinition); + } else { + longLatAreaPane.update(mapReportDefinition); + } + + checkCenterPane(); + } + + /** + * Update. + */ + @Override + public VanMapReportDefinition updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return null; + } + + + } + + protected AbstractLongLatAreaPane getAreaPane() { + return new PointMapAreaPane(); + } + + protected AbstractLongLatAreaPane getLongLatAreaPane() { + return new PointMapLongLatAreaPane(); + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java new file mode 100644 index 0000000000..b8c1d3a756 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanAreaMapPlotTableDataContentPane.java @@ -0,0 +1,176 @@ +package com.fr.van.chart.map.designer.data.contentpane.table; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; +import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; +import com.fr.van.chart.map.designer.data.component.SeriesTypeUseComboxPaneWithOutFilter; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JSeparator; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.List; + +/** + * Created by Mitisky on 16/5/16. + */ +public class VanAreaMapPlotTableDataContentPane extends AbstractTableDataContentPane { + private UIComboBox areaNameCom; + + protected SeriesTypeUseComboxPaneWithOutFilter seriesTypeUseComboxPane; + + public VanAreaMapPlotTableDataContentPane(ChartDataPane parent) { + this.setLayout(new BorderLayout(0, 4)); + + initAreaNameCom(); + + JPanel areaNamePane = createAreaNamePane(); + JSeparator jSeparator = new JSeparator(); + areaNamePane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); + jSeparator.setPreferredSize(new Dimension(246, 2)); + + this.add(areaNamePane, BorderLayout.NORTH); + this.add(jSeparator, BorderLayout.CENTER); + + seriesTypeUseComboxPane = new SeriesTypeUseComboxPaneWithOutFilter(parent, new VanChartMapPlot()); + this.add(seriesTypeUseComboxPane, BorderLayout.SOUTH); + + } + + protected void initAreaNameCom() { + + areaNameCom = new UIComboBox(); + + areaNameCom.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + checkSeriseUse(areaNameCom.getSelectedItem() != null); + makeToolTipUse(areaNameCom); + } + }); + } + + protected JPanel createAreaNamePane() { + UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Area_Name")); + label.setPreferredSize(new Dimension(80, 20)); + areaNameCom.setPreferredSize(new Dimension(100, 20)); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p}; + + Component[][] components = new Component[][]{ + new Component[]{label, areaNameCom}, + }; + + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + + } + + protected void makeToolTipUse(UIComboBox comBox) { + if (comBox.getSelectedItem() != null) { + comBox.setToolTipText(comBox.getSelectedItem().toString()); + } else { + comBox.setToolTipText(null); + } + } + + /** + * 检查 某些Box是否可用 + * + * @param hasUse 是否使用. + */ + public void checkBoxUse(boolean hasUse) { + checkAreaName(hasUse); + checkSeriseUse(hasUse); + } + + protected void checkAreaName(boolean hasUse) { + areaNameCom.setEnabled(hasUse); + } + + protected void checkSeriseUse(boolean hasUse) { + if (seriesTypeUseComboxPane != null) { + seriesTypeUseComboxPane.checkUseBox(hasUse && isAreaSelectedItem()); + } + } + + protected boolean isAreaSelectedItem() { + return areaNameCom.getSelectedItem() != null; + } + + protected void refreshBoxListWithSelectTableData(java.util.List list) { + refreshAreaName(list); + seriesTypeUseComboxPane.refreshBoxListWithSelectTableData(list); + } + + protected void refreshAreaName(List list) { + refreshBoxItems(areaNameCom, list); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList() { + clearAreaName(); + seriesTypeUseComboxPane.clearAllBoxList(); + } + + protected void clearAreaName() { + clearBoxItems(areaNameCom); + } + + /** + * 保存界面内容到ChartCollection + */ + public void updateBean(ChartCollection collection) { + seriesTypeUseComboxPane.updateBean(collection); + TopDefinitionProvider topDefinitionProvider = collection.getSelectedChart().getFilterDefinition(); + if (topDefinitionProvider instanceof VanMapTableDefinitionProvider) { + VanMapTableDefinitionProvider mapTableDefinitionProvider = (VanMapTableDefinitionProvider) topDefinitionProvider; + updateDefinition(mapTableDefinitionProvider); + } + } + + protected void updateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + Object o = areaNameCom.getSelectedItem(); + mapTableDefinitionProvider.setCategoryName(o == null ? null : o.toString()); + } + + /** + * 根据ChartCollection 更新界面 + */ + public void populateBean(ChartCollection collection) { + seriesTypeUseComboxPane.populateBean(collection, this.isNeedSummaryCaculateMethod()); + TopDefinitionProvider topDefinitionProvider = collection.getSelectedChart().getFilterDefinition(); + if (topDefinitionProvider instanceof VanMapTableDefinitionProvider) { + VanMapTableDefinitionProvider mapTableDefinitionProvider = (VanMapTableDefinitionProvider) topDefinitionProvider; + populateDefinition(mapTableDefinitionProvider); + } + } + + protected void populateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + if (mapTableDefinitionProvider.getCategoryName() != null) { + areaNameCom.setSelectedItem(mapTableDefinitionProvider.getCategoryName()); + } + } + + /** + * 重新布局整个面板 + */ + public void redoLayoutPane() { + seriesTypeUseComboxPane.relayoutPane(this.isNeedSummaryCaculateMethod()); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java new file mode 100644 index 0000000000..abbddc7321 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanLineMapPlotTableDataContentPane.java @@ -0,0 +1,25 @@ +package com.fr.van.chart.map.designer.data.contentpane.table; + + +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.LineMapAreaPane; +import com.fr.van.chart.map.designer.data.component.table.LineMapLongLatAreaPane; + + +/** + * Created by hufan on 2016/12/15. + */ +public class VanLineMapPlotTableDataContentPane extends VanPointMapPlotTableDataContentPane { + public VanLineMapPlotTableDataContentPane(ChartDataPane parent) { + super(parent); + } + + protected AbstractLongLatAreaPane createAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { + return new LineMapAreaPane(longLatAreaTableComboPane); + } + + protected AbstractLongLatAreaPane createLongLatAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { + return new LineMapLongLatAreaPane(longLatAreaTableComboPane); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java new file mode 100644 index 0000000000..724da26752 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/data/contentpane/table/VanPointMapPlotTableDataContentPane.java @@ -0,0 +1,224 @@ +package com.fr.van.chart.map.designer.data.contentpane.table; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.plugin.chart.map.data.VanMapTableDefinitionProvider; +import com.fr.van.chart.map.designer.data.component.table.AbstractLongLatAreaPane; +import com.fr.van.chart.map.designer.data.component.table.PointMapAreaPane; +import com.fr.van.chart.map.designer.data.component.table.PointMapLongLatAreaPane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.util.List; + +/** + * Created by Mitisky on 16/5/17. + */ +public class VanPointMapPlotTableDataContentPane extends VanAreaMapPlotTableDataContentPane { + private static final int LEFT_GAP = 19; + private static final int V_GAP = 15; + //改控件相当于面积图的区域名控件 + private LongLatAreaTableComboPane longLatTableComboPane; + + public VanPointMapPlotTableDataContentPane(ChartDataPane parent) { + super(parent); + } + + protected void initAreaNameCom() { + longLatTableComboPane = new LongLatAreaTableComboPane(); + } + + protected JPanel createAreaNamePane() { + JPanel panel = new JPanel(new BorderLayout()); + panel.setBorder(BorderFactory.createEmptyBorder(0, LEFT_GAP, V_GAP, 0)); + panel.add(longLatTableComboPane, BorderLayout.CENTER); + return panel; + } + + @Override + protected void refreshAreaName(List list) { + longLatTableComboPane.refreshBoxListWithSelectTableData(list); + } + + @Override + protected void checkAreaName(boolean hasUse) { + longLatTableComboPane.checkBoxUse(hasUse); + } + + protected boolean isAreaSelectedItem() { + return longLatTableComboPane.isSelectedItem(); + } + + @Override + protected void clearAreaName() { + longLatTableComboPane.clearAllBoxList(); + } + + @Override + protected void updateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + longLatTableComboPane.updateBean(mapTableDefinitionProvider); + } + + @Override + protected void populateDefinition(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + longLatTableComboPane.populateBean(mapTableDefinitionProvider); + } + + + public class LongLatAreaTableComboPane extends BasicBeanPane { + private UIButtonGroup locationType; + + private JPanel centerPane; + + private AbstractLongLatAreaPane longLatAreaPane; + + private AbstractLongLatAreaPane areaNamePane; + + + public LongLatAreaTableComboPane() { + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + + this.setLayout(new BorderLayout(0, 5)); + centerPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (locationType.getSelectedIndex() == 0) { + return new Dimension(180, (int) areaNamePane.getPreferredSize().getHeight()); + } else { + return new Dimension(180, (int) longLatAreaPane.getPreferredSize().getHeight()); + } + } + }; + + locationType = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Location_With_Area_Name"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Location_With_LongAndLat")}); + + locationType.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + checkCenterPane(); + } + }); + + longLatAreaPane = createLongLatAreaPane(this); + areaNamePane = createAreaPane(this); + + centerPane.add(areaNamePane, "area"); + centerPane.add(longLatAreaPane, "longLat"); + + locationType.setSelectedIndex(0); + + double[] columnSize = {p, f}; + double[] rowSize = {p}; + Component[][] components = new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Geographic")), locationType}, + }; + + JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 30, 6); + + this.add(panel, BorderLayout.NORTH); + this.add(centerPane, BorderLayout.CENTER); + + } + + public void fireCheckSeriesUse(boolean hasUse) { + checkSeriseUse(hasUse); + } + + private void checkCenterPane() { + CardLayout cardLayout = (CardLayout) centerPane.getLayout(); + if (locationType.getSelectedIndex() == 0) { + cardLayout.show(centerPane, "area"); + } else { + cardLayout.show(centerPane, "longLat"); + } + fireCheckSeriesUse(true); + } + + protected void refreshBoxListWithSelectTableData(List list) { + areaNamePane.refreshBoxListWithSelectTableData(list); + longLatAreaPane.refreshBoxListWithSelectTableData(list); + } + + /** + * 检查 某些Box是否可用 + * + * @param hasUse 是否使用. + */ + public void checkBoxUse(boolean hasUse) { + areaNamePane.checkBoxUse(hasUse); + longLatAreaPane.checkBoxUse(hasUse); + } + + /** + * 清空所有的box设置 + */ + public void clearAllBoxList() { + areaNamePane.clearAllBoxList(); + longLatAreaPane.clearAllBoxList(); + } + + @Override + public void populateBean(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + locationType.setSelectedIndex(mapTableDefinitionProvider.isUseAreaName() ? 0 : 1); + + if (locationType.getSelectedIndex() == 0) { + areaNamePane.populate(mapTableDefinitionProvider); + } else { + longLatAreaPane.populate(mapTableDefinitionProvider); + } + checkCenterPane(); + } + + public void updateBean(VanMapTableDefinitionProvider mapTableDefinitionProvider) { + boolean useAreaName = locationType.getSelectedIndex() == 0; + mapTableDefinitionProvider.setUseAreaName(useAreaName); + if (useAreaName) { + areaNamePane.update(mapTableDefinitionProvider); + } else { + longLatAreaPane.update(mapTableDefinitionProvider); + } + + checkCenterPane(); + } + + @Override + public VanMapTableDefinitionProvider updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return "longAndLat"; + } + + public boolean isSelectedItem() { + if (locationType.getSelectedIndex() == 0) { + return areaNamePane.isSelectedItem(); + } else { + return longLatAreaPane.isSelectedItem(); + } + } + } + + protected AbstractLongLatAreaPane createAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { + return new PointMapAreaPane(longLatAreaTableComboPane); + } + + protected AbstractLongLatAreaPane createLongLatAreaPane(LongLatAreaTableComboPane longLatAreaTableComboPane) { + return new PointMapLongLatAreaPane(longLatAreaTableComboPane); + } + +}