Browse Source

Pull request #1789: CHART-14346 悬浮窗图表组合图不允许选择单元格数据源

Merge in DESIGN/design from ~BJORN/design:release/10.0 to release/10.0

* commit '40fb79cbf4d81faa9b93ed53b8a623571264d303':
  CHART-14346
  CHART-14346 悬浮窗图表组合图不允许选择单元格数据源
feature/big-screen
Bjorn 4 years ago
parent
commit
ff288f008c
  1. 65
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java

65
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java

@ -23,7 +23,7 @@ import java.util.Map;
*/ */
public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> { public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> {
private boolean supportCellData = true; private boolean supportCellData;
public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) {
super(plot, parent, listener); super(plot, parent, listener);
@ -40,7 +40,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
@Override @Override
protected void initTabTitle() { protected void initTabTitle() {
if (plot == null){ if (plot == null) {
return; return;
} }
@ -60,7 +60,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
@Override @Override
protected List<JPanel> initPaneList() { protected List<JPanel> initPaneList() {
if (plot == null){ if (plot == null) {
return null; return null;
} }
@ -68,7 +68,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < customPlotList.size(); i++){ for (int i = 0; i < customPlotList.size(); i++) {
//根据不同的plot创建不同的数据配置界面 //根据不同的plot创建不同的数据配置界面
ChartDataPane contentPane = new VanChartDataPane(listener); ChartDataPane contentPane = new VanChartDataPane(listener);
contentPane.setSupportCellData(supportCellData); contentPane.setSupportCellData(supportCellData);
@ -79,42 +79,38 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
} }
@Override @Override
public void populateBean(ChartCollection chartCollection){ public void populateBean(ChartCollection chartCollection) {
plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot(); plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot();
if (paneList == null){ paneList = initPaneList();
paneList = initPaneList();
}
if (paneList != null){
try {
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); relayoutWhenListChange();
try {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) {
//將plot包裝起来,主要是为了获取dataDefinition
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone();
//设置collection的plot for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) {
cloneCollection.getSelectedChart().setPlot(customPlotList.get(i)); //將plot包裝起来,主要是为了获取dataDefinition
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone();
//获取definitionMap中的dataDefinition //设置collection的plot
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition(); cloneCollection.getSelectedChart().setPlot(customPlotList.get(i));
TopDefinitionProvider dataDefinition = null;
if (definition != null && definition instanceof CustomDefinition) {
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition)definition).getDefinitionProviderMap();
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i)));
}
cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition);
((ChartDataPane) paneList.get(i)).populate(cloneCollection); //获取definitionMap中的dataDefinition
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition();
TopDefinitionProvider dataDefinition = null;
if (definition != null && definition instanceof CustomDefinition) {
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition) definition).getDefinitionProviderMap();
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i)));
} }
}catch (Exception e){ cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition);
return;
((ChartDataPane) paneList.get(i)).populate(cloneCollection);
} }
} catch (Exception e) {
return;
} }
} }
@ -124,8 +120,8 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
} }
@Override @Override
public void updateBean(ChartCollection collection){ public void updateBean(ChartCollection collection) {
if (paneList == null || plot == null){ if (paneList == null || plot == null) {
return; return;
} }
try { try {
@ -158,7 +154,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
customDefinition.setDefinitionProviderMap(definitionMap); customDefinition.setDefinitionProviderMap(definitionMap);
collection.getSelectedChart().setFilterDefinition(customDefinition); collection.getSelectedChart().setFilterDefinition(customDefinition);
}catch (Exception e){ } catch (Exception e) {
return; return;
} }
} }
@ -180,10 +176,11 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
/** /**
* 返回绑定的属性事件. * 返回绑定的属性事件.
* @param listener 增加监听 *
* @param listener 增加监听
*/ */
public void addAttributeChangeListener(AttributeChangeListener listener) { public void addAttributeChangeListener(AttributeChangeListener listener) {
for (int i = 0; i < paneList.size(); i++){ for (int i = 0; i < paneList.size(); i++) {
((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener); ((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener);
} }
} }

Loading…
Cancel
Save