Browse Source

CHART-4027 系列+值 自定义相关 design

research/10.0
zheng 6 years ago
parent
commit
d7d95ef78a
  1. 58
      designer-chart/src/main/java/com/fr/design/chartx/component/CustomFieldComboBoxPane.java
  2. 108
      designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java
  3. 28
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java
  4. 2
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java

58
designer-chart/src/main/java/com/fr/design/chartx/component/CustomFieldComboBoxPane.java

@ -1,58 +0,0 @@
package com.fr.design.chartx.component;
import com.fr.chartx.data.field.CustomFieldValueColumnFields;
/**
* Created by shine on 2019/5/17.
*/
public class CustomFieldComboBoxPane extends AbstractCustomFieldComboBoxPane<CustomFieldValueColumnFields> {
@Override
protected AbstractUseFieldValuePane createUseFieldValuePane() {
return new UseFieldValuePane();
}
@Override
protected AbstractCustomFieldNamePane createCustomFieldNamePane() {
return new CustomFieldNamePane();
}
@Override
public void populateBean(CustomFieldValueColumnFields ob) {
if (ob.isCustomFieldValue()) {
populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else {
populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
}
}
@Override
public void updateBean(CustomFieldValueColumnFields ob) {
if (jcb.getSelectedIndex() == 0) {
ob.setCustomFieldValue(false);
updateUseFieldValuePane(ob);
} else {
ob.setCustomFieldValue(true);
updateCustomFieldNamePane(ob);
}
}
private class UseFieldValuePane extends AbstractUseFieldValuePane<CustomFieldValueColumnFields> {
@Override
public void populateBean(CustomFieldValueColumnFields ob) {
}
}
private class CustomFieldNamePane extends AbstractCustomFieldNamePane<CustomFieldValueColumnFields> {
@Override
public void populateBean(CustomFieldValueColumnFields ob) {
}
}
}

108
designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java

@ -0,0 +1,108 @@
package com.fr.design.chartx.component;
import com.fr.chartx.data.field.ColumnField;
import com.fr.chartx.data.field.SeriesValueColumnFields;
import com.fr.chartx.data.field.SeriesValueField;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.GeneralUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2019/5/17.
*/
public class SeriesValueFieldComboBoxPane extends AbstractCustomFieldComboBoxPane<SeriesValueColumnFields> {
@Override
protected AbstractUseFieldValuePane createUseFieldValuePane() {
return new UseFieldValuePane();
}
@Override
protected AbstractCustomFieldNamePane createCustomFieldNamePane() {
return new CustomFieldNamePane();
}
@Override
public void populateBean(SeriesValueColumnFields ob) {
if (ob.isCustomFieldValue()) {
populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else {
populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
}
}
@Override
public void updateBean(SeriesValueColumnFields ob) {
if (jcb.getSelectedIndex() == 0) {
ob.setCustomFieldValue(false);
updateUseFieldValuePane(ob);
} else {
ob.setCustomFieldValue(true);
updateCustomFieldNamePane(ob);
}
}
private class UseFieldValuePane extends AbstractUseFieldValuePane<SeriesValueColumnFields> {
@Override
public void populateBean(SeriesValueColumnFields ob) {
List<SeriesValueField> list = ob.getSeriesValueFieldList();
if (list != null && list.size() > 0) {
populateSeries(list.get(0).getSeries().getFieldName());
populateValue(list.get(0).getValue().getFieldName());
populateFunction((AbstractDataFunction) list.get(0).getValue().getDataFunction());
}
}
@Override
public void updateBean(SeriesValueColumnFields ob) {
List<SeriesValueField> list = new ArrayList<SeriesValueField>();
SeriesValueField seriesValueField = new SeriesValueField();
ColumnField series = new ColumnField(updateSeries());
ColumnField value = new ColumnField(updateValue());
value.setDataFunction(updateFunction());
seriesValueField.setValue(value);
seriesValueField.setSeries(series);
list.add(seriesValueField);
ob.setSeriesValueFieldList(list);
}
}
private class CustomFieldNamePane extends AbstractCustomFieldNamePane<SeriesValueColumnFields> {
@Override
public void populateBean(SeriesValueColumnFields ob) {
List<Object[]> list = new ArrayList<Object[]>();
for (SeriesValueField seriesValueField : ob.getSeriesValueFieldList()) {
Object[] array = new Object[3];
array[0] = seriesValueField.getSeries().getFieldName();
array[1] = seriesValueField.getValue().getFieldName();
array[2] = DataPaneHelper.getFunctionString(seriesValueField.getValue().getDataFunction());
list.add(array);
}
populate(list);
}
@Override
public void updateBean(SeriesValueColumnFields ob) {
List<Object[]> list = update();
List<SeriesValueField> seriesValueFields = new ArrayList<SeriesValueField>();
for (Object[] line : list) {
ColumnField series = new ColumnField(GeneralUtils.objectToString(line[0]));
ColumnField value = new ColumnField(GeneralUtils.objectToString(line[1]));
value.setDataFunction(DataPaneHelper.getFunctionByName(GeneralUtils.objectToString(line[2])));
SeriesValueField seriesValueField = new SeriesValueField();
seriesValueField.setValue(value);
seriesValueField.setSeries(series);
seriesValueFields.add(seriesValueField);
}
ob.setSeriesValueFieldList(seriesValueFields);
}
}
}

28
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithCustomFieldPane.java → designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java

@ -1,7 +1,7 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithCustomField;
import com.fr.design.chartx.component.CustomFieldComboBoxPane;
import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue;
import com.fr.design.chartx.component.SeriesValueFieldComboBoxPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import javax.swing.JPanel;
@ -12,49 +12,49 @@ import java.util.List;
* Created by shine on 2019/5/16.
* 带有 自定义系列名fr表现为 系列名使用字段名 的字段集合 的一个pane
*/
public abstract class AbstractDataSetFieldsWithCustomFieldPane<T extends AbstractColumnFieldCollectionWithCustomField>
public abstract class AbstractDataSetFieldsWithSeriesValuePane<T extends AbstractColumnFieldCollectionWithSeriesValue>
extends AbstractDataSetFieldsPane<T> {
private CustomFieldComboBoxPane customFieldComboBoxPane;
private SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane;
@Override
protected JPanel createCenterPane() {
JPanel normalCenter = super.createCenterPane();
customFieldComboBoxPane = new CustomFieldComboBoxPane();
seriesValueFieldComboBoxPane = new SeriesValueFieldComboBoxPane();
if (normalCenter != null) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(normalCenter, BorderLayout.CENTER);
panel.add(customFieldComboBoxPane, BorderLayout.SOUTH);
panel.add(seriesValueFieldComboBoxPane, BorderLayout.SOUTH);
return panel;
} else {
return customFieldComboBoxPane;
return seriesValueFieldComboBoxPane;
}
}
@Override
public void checkBoxUse(boolean hasUse) {
super.checkBoxUse(hasUse);
customFieldComboBoxPane.checkBoxUse(hasUse);
seriesValueFieldComboBoxPane.checkBoxUse(hasUse);
}
@Override
public void clearAllBoxList() {
super.clearAllBoxList();
customFieldComboBoxPane.clearAllBoxList();
seriesValueFieldComboBoxPane.clearAllBoxList();
}
@Override
public void refreshBoxListWithSelectTableData(List columnNameList) {
super.refreshBoxListWithSelectTableData(columnNameList);
customFieldComboBoxPane.refreshBoxListWithSelectTableData(columnNameList);
seriesValueFieldComboBoxPane.refreshBoxListWithSelectTableData(columnNameList);
}
protected void populateCustomPane(AbstractColumnFieldCollectionWithCustomField t) {
customFieldComboBoxPane.populateBean(t.getCustomFieldValueColumnFields());
protected void populateCustomPane(AbstractColumnFieldCollectionWithSeriesValue t) {
seriesValueFieldComboBoxPane.populateBean(t.getSeriesValueColumnFields());
}
protected void updateCustomPane(AbstractColumnFieldCollectionWithCustomField t) {
customFieldComboBoxPane.updateBean(t.getCustomFieldValueColumnFields());
protected void updateCustomPane(AbstractColumnFieldCollectionWithSeriesValue t) {
seriesValueFieldComboBoxPane.updateBean(t.getSeriesValueColumnFields());
}
}

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

@ -13,7 +13,7 @@ import java.util.List;
/**
* Created by shine on 2019/4/10.
*/
public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithCustomFieldPane<MultiCategoryColumnFieldCollection> {
public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSeriesValuePane<MultiCategoryColumnFieldCollection> {
private MultiComboBoxPane multiCategoryPane;

Loading…
Cancel
Save