Browse Source

CHART-11265 数据集配置多分类根据轴类型判断灰化 && CHART-11446 下拉框增加了默认无的选项,系列删除了对汇总方式和系列名使用的灰化

persist/11.0
白岳 5 years ago
parent
commit
65b2c16358
  1. 4
      designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java
  2. 6
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  3. 19
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java
  4. 3
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java
  5. 4
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java
  6. 2
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java
  7. 3
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  8. 4
      designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java
  9. 5
      designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java
  10. 64
      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,4 +34,8 @@ public abstract class AbstractVanSingleDataPane extends AbstractChartDataPane<Ab
protected AbstractDataDefinition update() {
return singleDataPane.updateBean();
}
public void setSelectedIndex(int index) {
singleDataPane.setSelectedIndex(index);
}
}

6
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -22,11 +22,11 @@ import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
@ -106,7 +106,6 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
}
public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse);
}
@ -171,7 +170,6 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
public void checkBoxUse(boolean hasUse) {
series.setEnabled(hasUse);
value.setEnabled(hasUse);
function.setEnabled(hasUse);
}
public void clearAllBoxList() {

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

@ -34,6 +34,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
private List<T> categoryComponentList = new ArrayList<T>();
private boolean isCategoryAxis = true;
protected abstract T createFirstFieldComponent();
@ -43,6 +44,10 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
protected abstract void updateField(T component, ColumnField field);
public void setIsCategoryAxis(boolean isCategoryAxis) {
this.isCategoryAxis = isCategoryAxis;
}
public AbstractMultiComponentPane() {
UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
@ -126,7 +131,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
}
private boolean canAdd() {
return categoryComponentList.size() < 2;
return categoryComponentList.size() < 2 && isCategoryAxis;
}
public List<T> componentList() {
@ -169,7 +174,15 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
}
}
public void checkEnable(boolean hasUse){
addButton.setEnabled(hasUse);
public void checkEnable(boolean hasUse) {
//增加按钮是否灰化要根据是否选择了数据源,是否分类轴,分类数量是否超标三个判断
boolean buttonUse = hasUse && isCategoryAxis && categoryComponentList.size() < 2;
//额外的分类是否灰化根据是否选择了数据源,是否分类轴判断
boolean categoryUse = hasUse && isCategoryAxis;
addButton.setEnabled(buttonUse);
for (JComponent component : categoryComponentList) {
component.setEnabled(categoryUse);
}
}
}

3
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java

@ -20,7 +20,6 @@ import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Label;
/**
* Created by shine on 2019/07/18.
@ -110,7 +109,7 @@ public abstract class AbstractSingleFilterPane extends AbstractChartTabPane<Data
}
};
JPanel presentPane = new JPanel(new BorderLayout(30, 0));
presentPane.add(new Label(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")), BorderLayout.WEST);
presentPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present")), BorderLayout.WEST);
presentPane.add(present,BorderLayout.CENTER);
presentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

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

@ -8,8 +8,8 @@ import com.fr.design.formula.TinyFormulaPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.List;
import java.awt.BorderLayout;
/**
* Created by shine on 2019/4/12.
@ -53,6 +53,8 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
multiCategoryPane.populate(categoryList);
multiCategoryPane.setIsCategoryAxis(multiCategoryColumnFieldCollection.isCategoryAxis());
populateSeriesValuePane(multiCategoryColumnFieldCollection);
filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection);

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

@ -67,6 +67,8 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
multiCategoryPane.populate(categoryList);
multiCategoryPane.setIsCategoryAxis(multiCategoryColumnFieldCollection.isCategoryAxis());
populateSeriesValuePane(multiCategoryColumnFieldCollection);
filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection);

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

@ -50,7 +50,6 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
this.setLayout(new BorderLayout());
this.add(tableDataPane, BorderLayout.NORTH);
this.add(dataSetFieldsPane, BorderLayout.CENTER);
checkBoxUse();
}
/**
@ -108,6 +107,8 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
tableDataPane.populateBean(ob.getNameTableData());
dataSetFieldsPane.populateBean(ob.getColumnFieldCollection());
checkBoxUse();
}
@Override

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

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

5
designer-chart/src/main/java/com/fr/extended/chart/UIComboBoxWithNone.java

@ -14,6 +14,11 @@ public class UIComboBoxWithNone extends UIComboBox {
return Toolkit.i18nText("Fine-Design_Chart_Use_None");
}
public UIComboBoxWithNone() {
super();
addDefaultItem();
}
@Override
public void refreshBoxItems(List list) {
super.refreshBoxItems(list);

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

@ -1,7 +1,13 @@
package com.fr.van.chart.vanchart;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
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.chartx.AbstractVanSingleDataPane;
import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane;
@ -14,7 +20,13 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.type.AxisType;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.designer.data.VanChartMoreCateReportDataContentPane;
import com.fr.van.chart.designer.data.VanChartMoreCateTableDataContentPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane;
@ -72,6 +84,58 @@ public abstract class AbstractMultiCategoryVanChartUI extends AbstractIndependen
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
@Override
public void populate(ChartCollection collection) {
if (collection == null) {
return;
}
VanChart vanChart = collection.getSelectedChartProvider(VanChart.class);
if (vanChart == null) {
return;
}
VanChartRectanglePlot plot = vanChart.getPlot();
VanChartAxis axis = plot.getDefaultXAxis();
if (plot instanceof VanChartColumnPlot
&& ((VanChartColumnPlot) plot).isBar()) {
axis = plot.getDefaultYAxis();
}
boolean isCategoryAxis = ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY);
MultiCategoryColumnFieldCollection multiCategoryColumnFieldCollection = new MultiCategoryColumnFieldCollection();
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