Browse Source

CHART-11265

research/11.0
白岳 5 years ago
parent
commit
f1f33297f9
  1. 4
      designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java
  2. 18
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java
  3. 6
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java
  4. 6
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java
  5. 4
      designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java
  6. 48
      designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java

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

@ -34,8 +34,4 @@ public abstract class AbstractVanSingleDataPane extends AbstractChartDataPane<Ab
protected AbstractDataDefinition update() { protected AbstractDataDefinition update() {
return singleDataPane.updateBean(); return singleDataPane.updateBean();
} }
public void setSelectedIndex(int index) {
singleDataPane.setSelectedIndex(index);
}
} }

18
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java

@ -34,7 +34,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
private List<T> categoryComponentList = new ArrayList<T>(); private List<T> categoryComponentList = new ArrayList<T>();
private boolean isCategoryAxis = true; private boolean categoryAxis = true;
protected abstract T createFirstFieldComponent(); protected abstract T createFirstFieldComponent();
@ -44,8 +44,14 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
protected abstract void updateField(T component, ColumnField field); protected abstract void updateField(T component, ColumnField field);
public void setIsCategoryAxis(boolean isCategoryAxis) { public void setCategoryAxis(boolean categoryAxis) {
this.isCategoryAxis = isCategoryAxis; this.categoryAxis = categoryAxis;
if(!categoryAxis){
addButton.setEnabled(false);
for (JComponent component : categoryComponentList) {
component.setEnabled(false);
}
}
} }
public AbstractMultiComponentPane() { public AbstractMultiComponentPane() {
@ -131,7 +137,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
} }
private boolean canAdd() { private boolean canAdd() {
return categoryComponentList.size() < 2 && isCategoryAxis; return categoryComponentList.size() < 2 && categoryAxis;
} }
public List<T> componentList() { public List<T> componentList() {
@ -176,9 +182,9 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
public void checkEnable(boolean hasUse) { public void checkEnable(boolean hasUse) {
//增加按钮是否灰化要根据是否选择了数据源,是否分类轴,分类数量是否超标三个判断 //增加按钮是否灰化要根据是否选择了数据源,是否分类轴,分类数量是否超标三个判断
boolean buttonUse = hasUse && isCategoryAxis && categoryComponentList.size() < 2; boolean buttonUse = hasUse && categoryAxis && categoryComponentList.size() < 2;
//额外的分类是否灰化根据是否选择了数据源,是否分类轴判断 //额外的分类是否灰化根据是否选择了数据源,是否分类轴判断
boolean categoryUse = hasUse && isCategoryAxis; boolean categoryUse = hasUse && categoryAxis;
addButton.setEnabled(buttonUse); addButton.setEnabled(buttonUse);
for (JComponent component : categoryComponentList) { for (JComponent component : categoryComponentList) {

6
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java

@ -53,8 +53,6 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
multiCategoryPane.populate(categoryList); multiCategoryPane.populate(categoryList);
multiCategoryPane.setIsCategoryAxis(multiCategoryColumnFieldCollection.isCategoryAxis());
populateSeriesValuePane(multiCategoryColumnFieldCollection); populateSeriesValuePane(multiCategoryColumnFieldCollection);
filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection); filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection);
@ -74,4 +72,8 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
return fieldCollection; return fieldCollection;
} }
public void setCategoryAxis(boolean categoryAxis){
multiCategoryPane.setCategoryAxis(categoryAxis);
}
} }

6
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java

@ -67,8 +67,6 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
multiCategoryPane.populate(categoryList); multiCategoryPane.populate(categoryList);
multiCategoryPane.setIsCategoryAxis(multiCategoryColumnFieldCollection.isCategoryAxis());
populateSeriesValuePane(multiCategoryColumnFieldCollection); populateSeriesValuePane(multiCategoryColumnFieldCollection);
filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection); filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection);
@ -88,4 +86,8 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
return columnFieldCollection; return columnFieldCollection;
} }
public void setCategoryAxis(boolean categoryAxis){
multiCategoryPane.setCategoryAxis(categoryAxis);
}
} }

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

@ -89,8 +89,4 @@ public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
protected String title4PopupWindow() { protected String title4PopupWindow() {
return null; return null;
} }
public void setSelectedIndex(int index) {
comboBoxPane.setSelectedIndex(index);
}
} }

48
designer-chart/src/main/java/com/fr/van/chart/vanchart/AbstractMultiCategoryVanChartUI.java

@ -3,11 +3,6 @@ package com.fr.van.chart.vanchart;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.CellDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.DataSetDefinition;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.AbstractVanSingleDataPane; import com.fr.design.chartx.AbstractVanSingleDataPane;
import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane; import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane;
@ -80,13 +75,19 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependen
@Override @Override
public ChartDataPane getChartDataPane(AttributeChangeListener listener) { public ChartDataPane getChartDataPane(AttributeChangeListener listener) {
return new AbstractVanSingleDataPane(listener) { return new AbstractVanSingleDataPane(listener) {
MultiCategoryDataSetFieldsPane multiCategoryDataSetFieldsPane;
MultiCategoryCellDataFieldsPane multiCategoryCellDataFieldsPane;
@Override @Override
protected SingleDataPane createSingleDataPane() { protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); multiCategoryDataSetFieldsPane = new MultiCategoryDataSetFieldsPane();
multiCategoryCellDataFieldsPane = new MultiCategoryCellDataFieldsPane();
return new SingleDataPane(multiCategoryDataSetFieldsPane, multiCategoryCellDataFieldsPane);
} }
@Override @Override
public void populate(ChartCollection collection) { public void populate(ChartCollection collection) {
super.populate(collection);
if (collection == null) { if (collection == null) {
return; return;
} }
@ -102,39 +103,8 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependen
axis = plot.getDefaultYAxis(); axis = plot.getDefaultYAxis();
} }
boolean isCategoryAxis = ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY); multiCategoryDataSetFieldsPane.setCategoryAxis(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY));
MultiCategoryColumnFieldCollection multiCategoryColumnFieldCollection = new MultiCategoryColumnFieldCollection(); multiCategoryCellDataFieldsPane.setCategoryAxis(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY));
multiCategoryColumnFieldCollection.setCategoryAxis(isCategoryAxis);
//如果DataDefinition为空,对数据集数据源配置面板和单元格数据源配置面板进行更新。
ChartDataDefinitionProvider definition = vanChart.getChartDataDefinition();
if (definition == null) {
CellDataDefinition cellDataDefinition = new CellDataDefinition();
cellDataDefinition.setColumnFieldCollection(multiCategoryColumnFieldCollection);
populate(cellDataDefinition);
DataSetDefinition dataSetDefinition = new DataSetDefinition();
dataSetDefinition.setColumnFieldCollection(multiCategoryColumnFieldCollection);
populate(dataSetDefinition);
return;
}
MultiCategoryColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(MultiCategoryColumnFieldCollection.class);
columnFieldCollection.setCategoryAxis(isCategoryAxis);
super.populate(collection);
//如果DataDefinition不为空,对另一种数据源配置进行更新
if (definition instanceof DataSetDefinition) {
CellDataDefinition cellDataDefinition = new CellDataDefinition();
cellDataDefinition.setColumnFieldCollection(multiCategoryColumnFieldCollection);
populate(cellDataDefinition);
setSelectedIndex(0);
} else {
DataSetDefinition dataSetDefinition = new DataSetDefinition();
dataSetDefinition.setColumnFieldCollection(multiCategoryColumnFieldCollection);
populate(dataSetDefinition);
setSelectedIndex(1);
}
} }
}; };
} }

Loading…
Cancel
Save