Browse Source

Merge pull request #1304 in DESIGN/design from ~WIM.ZHAI/xdesign:feature/10.0 to feature/10.0

* commit 'c5171b5bf76811944d6d6522487dd8133263b03c':
  CHART-11093 fix 数据面板切换
persist/11.0
Wim.Zhai 5 years ago
parent
commit
829d7e3def
  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.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.AssistUtils;
import java.awt.BorderLayout;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/**
* Created by shine on 2019/4/15.
@ -42,12 +45,31 @@ public abstract class AbstractChartDataPane<T extends ChartDataDefinitionProvide
ChartDataDefinitionProvider dataSetCollection = vanChart.getChartDataDefinition();
populate((T) dataSetCollection);
if (isMatchedDataType(dataSetCollection)) {
populate((T) dataSetCollection);
}
this.initAllListeners();
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
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
public void populateBean(CellDataDefinition ob) {
if (ob == null || ob.getColumnFieldCollection() == null) {
return;
}
Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) {
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
public void populateBean(DataSetDefinition ob) {
if (ob == null || ob.getColumnFieldCollection() == null) {
return;
}
refreshBoxList();
checkBoxUse();

Loading…
Cancel
Save