|
|
@ -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(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isMatchedDataType(dataSetCollection)) { |
|
|
|
populate((T) 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) { |
|
|
|