Browse Source

CHART-11093 不实例化,类型不同就不populate 验证了没问题

persist/11.0
Wim.Zhai 5 years ago
parent
commit
796e7be795
  1. 13
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  2. 14
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

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

@ -1,11 +1,9 @@
package com.fr.design.chartx.single; package com.fr.design.chartx.single;
import com.fr.chartx.data.CellDataDefinition; import com.fr.chartx.data.CellDataDefinition;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -48,15 +46,10 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
@Override @Override
public void populateBean(CellDataDefinition ob) { public void populateBean(CellDataDefinition ob) {
try {
Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; Type dataType = ((ParameterizedType) cellDataFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (ob.getColumnFieldCollection() != null && !AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) { if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) {
Object fieldCollection = Class.forName(((Class) dataType).getName()).newInstance();
ob.setColumnFieldCollection((AbstractColumnFieldCollection) fieldCollection);
}
cellDataFieldsPane.populateBean(ob.getColumnFieldCollection()); cellDataFieldsPane.populateBean(ob.getColumnFieldCollection());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

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

@ -1,7 +1,6 @@
package com.fr.design.chartx.single; package com.fr.design.chartx.single;
import com.fr.chartx.data.DataSetDefinition; import com.fr.chartx.data.DataSetDefinition;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
@ -12,7 +11,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -105,16 +103,10 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
refreshBoxList(); refreshBoxList();
checkBoxUse(); checkBoxUse();
try { tableDataPane.populateBean(ob.getNameTableData());
Type dataType = ((ParameterizedType) dataSetFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; Type dataType = ((ParameterizedType) dataSetFieldsPane.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (ob.getColumnFieldCollection() != null && !AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) { if (AssistUtils.equals(ob.getColumnFieldCollection().getClass(), dataType)) {
Object fieldCollection = Class.forName(((Class) dataType).getName()).newInstance();
ob.setColumnFieldCollection((AbstractColumnFieldCollection) fieldCollection);
}
tableDataPane.populateBean(ob.getNameTableData());
dataSetFieldsPane.populateBean(ob.getColumnFieldCollection()); dataSetFieldsPane.populateBean(ob.getColumnFieldCollection());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }

Loading…
Cancel
Save