Browse Source

CHART-11090 代码质量

research/11.0
白岳 5 years ago
parent
commit
d38d57ad38
  1. 10
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  2. 5
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AreaMapDataSetFieldsPane.java
  3. 5
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapDataSetFieldsPane.java
  4. 70
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java
  5. 5
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/PointMapDataSetFieldsPane.java
  6. 7
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

10
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java

@ -32,10 +32,20 @@ import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refres
*/
public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCollection> extends BasicBeanPane<T> {
public String tableName;
public AbstractDataSetFieldsPane() {
initComponents();
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
protected void initComponents() {
this.setLayout(new BorderLayout(0, 6));

5
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AreaMapDataSetFieldsPane.java

@ -3,7 +3,6 @@ package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.AreaMapColumnFieldCollection;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.type.MapType;
import java.awt.Component;
@ -57,8 +56,4 @@ public class AreaMapDataSetFieldsPane extends MapDataSetFieldsPane<AreaMapColumn
updateSeriesValuePane(fieldCollection);
return fieldCollection;
}
public MapType getMapType() {
return MapType.AREA;
}
}

5
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/LineMapDataSetFieldsPane.java

@ -3,7 +3,6 @@ package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.LineMapColumnFieldCollection;
import com.fr.design.chartx.data.map.LineMapAreaLngLatPaneWithComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.plugin.chart.type.MapType;
import com.fr.third.jodd.util.ArraysUtil;
import javax.swing.JPanel;
@ -59,8 +58,4 @@ public class LineMapDataSetFieldsPane extends MapDataSetFieldsPane<LineMapColumn
updateSeriesValuePane(columnFieldCollection);
return columnFieldCollection;
}
public MapType getMapType() {
return MapType.LINE;
}
}

70
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

@ -2,24 +2,16 @@ package com.fr.design.chartx.fields.diff;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.chart.chartattr.Plot;
import com.fr.chartx.TwoTuple;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.DataSetDefinition;
import com.fr.chartx.data.DrillMapChartDataDefinition;
import com.fr.chartx.data.MapChartDataDefinition;
import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.data.impl.NameTableData;
import com.fr.design.chartx.component.MapAreaMatchPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot;
import com.fr.plugin.chart.map.MapMatchResult;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.type.MapType;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JFrame;
@ -69,13 +61,14 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
@Override
public void actionPerformed(ActionEvent e) {
VanChartMapPlot plot = chart.getPlot();
if (treeNodeAndItems == null) {
treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(((VanChartMapPlot) chart.getPlot()).getGeoUrl(), level);
treeNodeAndItems = ChartGEOJSONHelper.getTreeNodeAndItems(plot.getGeoUrl(), level);
}
final MapAreaMatchPane pane = new MapAreaMatchPane(treeNodeAndItems);
String nameTable = getNameTable(chart, MapDataSetFieldsPane.this.getMapType(), level);
final MapMatchResult matchResult = getMatchResult(chart, level);
String nameTable = getTableName();
final MapMatchResult matchResult = plot.getMatchResult(level);
pane.populateBean(matchResult, nameTable, Utils.objectToString(areaBox.getSelectedItem()));
BasicDialog dialog = pane.showWindow(new JFrame());
@ -96,59 +89,4 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
areaPanel.add(uiButton, BorderLayout.EAST);
return areaPanel;
}
public abstract MapType getMapType();
public String getNameTable(VanChart vanChart, MapType mapType, int level) {
ChartDataDefinitionProvider chartDataDefinition = vanChart.getChartDataDefinition();
if (chartDataDefinition == null) {
return null;
}
DataSetDefinition dataSetDefinition;
if (chartDataDefinition instanceof MapChartDataDefinition) {
MapChartDataDefinition mapChartDataDefinition = (MapChartDataDefinition) chartDataDefinition;
switch (mapType) {
case AREA:
dataSetDefinition = (DataSetDefinition) mapChartDataDefinition.getAreaMapDataDefinition();
break;
case POINT:
dataSetDefinition = (DataSetDefinition) mapChartDataDefinition.getPointMapDataDefinition();
break;
default:
dataSetDefinition = (DataSetDefinition) mapChartDataDefinition.getLineMapDataDefinition();
break;
}
} else if (chartDataDefinition instanceof DrillMapChartDataDefinition) {
DrillMapChartDataDefinition drillMapChartDataDefinition = (DrillMapChartDataDefinition) chartDataDefinition;
if (drillMapChartDataDefinition.isFromBottomData()) {
dataSetDefinition = (DataSetDefinition) drillMapChartDataDefinition.getBottomDataDefinition();
} else {
dataSetDefinition = (DataSetDefinition) drillMapChartDataDefinition.getEachLayerDataDefinitionList().get(level);
}
} else {
dataSetDefinition = (DataSetDefinition) chartDataDefinition;
}
if (dataSetDefinition == null) {
return null;
}
NameTableData nameTableData = dataSetDefinition.getNameTableData();
if (nameTableData == null) {
return null;
}
return nameTableData.getName();
}
public MapMatchResult getMatchResult(VanChart vanChart, int level) {
Plot plot = vanChart.getPlot();
if (plot == null) {
return null;
}
if (level < 0 && plot instanceof VanChartMapPlot) {
return ((VanChartMapPlot) plot).getMatchResult();
} else if (plot instanceof VanChartDrillMapPlot) {
return ((VanChartDrillMapPlot) plot).getMatchResultList().get(level);
}
return null;
}
}

5
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/PointMapDataSetFieldsPane.java

@ -3,7 +3,6 @@ package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.PointMapColumnFieldCollection;
import com.fr.design.chartx.data.map.PointMapAreaLngLatPaneWithComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.plugin.chart.type.MapType;
import javax.swing.JPanel;
@ -49,8 +48,4 @@ public class PointMapDataSetFieldsPane extends MapDataSetFieldsPane<PointMapColu
updateSeriesValuePane(fieldCollection);
return fieldCollection;
}
public MapType getMapType() {
return MapType.POINT;
}
}

7
designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

@ -39,7 +39,7 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
tableDataPane = new DatabaseTableDataPane(label) {
@Override
protected void userEvent() {
refreshBoxList();
refreshBoxListAndTableName();
checkBoxUse();
}
};
@ -67,7 +67,7 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
/**
* 刷新字段下拉列表
*/
private void refreshBoxList() {
private void refreshBoxListAndTableName() {
TableDataWrapper dataWrap = tableDataPane.getTableDataWrapper();
if (dataWrap == null) {
@ -78,6 +78,7 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
if (dataSetFieldsPane != null) {
dataSetFieldsPane.refreshBoxListWithSelectTableData(columnNameList);
dataSetFieldsPane.setTableName(dataWrap.getTableDataName());
}
}
@ -102,7 +103,7 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
return;
}
refreshBoxList();
refreshBoxListAndTableName();
tableDataPane.populateBean(ob.getNameTableData());

Loading…
Cancel
Save