Browse Source

CHART-11093 fix 数据面板切换

persist/11.0
Wim.Zhai 5 years ago
parent
commit
af3ab4f439
  1. 24
      designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java
  2. 4
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  3. 4
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

24
designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java

@ -5,8 +5,11 @@ import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.AssistUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/** /**
* Created by shine on 2019/4/15. * Created by shine on 2019/4/15.
@ -42,12 +45,31 @@ public abstract class AbstractChartDataPane<T extends ChartDataDefinitionProvide
ChartDataDefinitionProvider dataSetCollection = vanChart.getChartDataDefinition(); ChartDataDefinitionProvider dataSetCollection = vanChart.getChartDataDefinition();
populate((T) dataSetCollection); if (isMatchedDataType(dataSetCollection)) {
populate((T) dataSetCollection);
}
this.initAllListeners(); this.initAllListeners();
this.validate(); this.validate();
} }
private boolean isMatchedDataType(ChartDataDefinitionProvider dataDefinition) {
if (dataDefinition == null) {
return true;
}
Type dataType = this.getClass().getGenericSuperclass();
if (dataType instanceof ParameterizedType) {
dataType = ((ParameterizedType) dataType).getActualTypeArguments()[0];
return AssistUtils.equals(dataDefinition.getClass(), dataType);
} else if (dataType instanceof Class) {
dataType = ((ParameterizedType) (((Class) dataType).getGenericSuperclass())).getActualTypeArguments()[0];
return ((Class) dataType).isAssignableFrom(dataDefinition.getClass());
}
return true;
}
@Override @Override
public void update(ChartCollection collection) { public void update(ChartCollection collection) {

4
designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java

@ -47,6 +47,10 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
@Override @Override
public void populateBean(CellDataDefinition ob) { public void populateBean(CellDataDefinition ob) {
if (ob == null || ob.getColumnFieldCollection() == null) {
return;
}
Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) { if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) {
cellDataFieldsPane.populateBean(ob.getColumnFieldCollection()); cellDataFieldsPane.populateBean(ob.getColumnFieldCollection());

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

@ -100,6 +100,10 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
@Override @Override
public void populateBean(DataSetDefinition ob) { public void populateBean(DataSetDefinition ob) {
if (ob == null || ob.getColumnFieldCollection() == null) {
return;
}
refreshBoxList(); refreshBoxList();
checkBoxUse(); checkBoxUse();

Loading…
Cancel
Save