forked from fanruan/design
Browse Source
* commit 'edae2bdcbf58abc88d3943320457c636b41e8158': style 还需按图表类型切换数据面板 #CHART-4248 refactor:散点图气泡图数据面板 CHART-4248 CHART-4248 重命名非抽象类persist/11.0
Wim.Zhai
5 years ago
11 changed files with 302 additions and 25 deletions
@ -0,0 +1,66 @@
|
||||
package com.fr.design.chartx.component; |
||||
|
||||
import com.fr.base.Utils; |
||||
import com.fr.chartx.data.field.ColumnField; |
||||
import com.fr.chartx.data.field.diff.BubbleColumnField; |
||||
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; |
||||
import com.fr.design.chartx.component.correlation.AbstractCorrelationPane; |
||||
import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper; |
||||
import com.fr.design.chartx.component.correlation.TinyFormulaPaneEditorComponent; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by Wim on 2019/11/04. |
||||
*/ |
||||
public class CellDataSeriesXYValueCorrelationPane extends AbstractCorrelationPane<BubbleColumnFieldCollection> { |
||||
|
||||
@Override |
||||
protected FieldEditorComponentWrapper[] createFieldEditorComponentWrappers() { |
||||
return new FieldEditorComponentWrapper[]{ |
||||
new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), |
||||
new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_X_Axis")), |
||||
new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Y_Axis")), |
||||
new TinyFormulaPaneEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Value")) |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected List<Object[]> covertTBeanToTableModelList(BubbleColumnFieldCollection bubbleColumnFieldCollection) { |
||||
List<Object[]> result = new ArrayList<>(); |
||||
|
||||
List<BubbleColumnField> bubbleColumnFieldList = bubbleColumnFieldCollection.getList(); |
||||
for (BubbleColumnField field : bubbleColumnFieldList) { |
||||
Object[] array = new Object[]{ |
||||
field.getSeriesName().getFieldName(), |
||||
field.getXField().getFieldName(), |
||||
field.getYField().getFieldName(), |
||||
field.getValueField().getFieldName() |
||||
}; |
||||
result.add(array); |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
protected void setTableModelListToTBean(List<Object[]> tableValues, BubbleColumnFieldCollection bubbleColumnFieldCollection) { |
||||
List<BubbleColumnField> bubbleColumnFieldList = new ArrayList<>(); |
||||
for (Object[] oneLine : tableValues) { |
||||
BubbleColumnField bubbleColumnField = new BubbleColumnField(); |
||||
ColumnField series = new ColumnField(Utils.objectToString(oneLine[0])); |
||||
ColumnField xField = new ColumnField(Utils.objectToString(oneLine[1])); |
||||
ColumnField yField = new ColumnField(Utils.objectToString(oneLine[2])); |
||||
ColumnField value = new ColumnField(Utils.objectToString(oneLine[3])); |
||||
bubbleColumnField.setSeriesName(series); |
||||
bubbleColumnField.setXField(xField); |
||||
bubbleColumnField.setYField(yField); |
||||
bubbleColumnField.setValueField(value); |
||||
bubbleColumnFieldList.add(bubbleColumnField); |
||||
} |
||||
|
||||
bubbleColumnFieldCollection.setList(bubbleColumnFieldList); |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.fr.design.chartx.fields.diff; |
||||
|
||||
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; |
||||
import com.fr.design.chartx.component.AbstractSingleFilterPane; |
||||
import com.fr.design.chartx.component.CellDataSeriesXYValueCorrelationPane; |
||||
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* Created by Wim on 2019/11/04. |
||||
*/ |
||||
public class ScatterCellDataFieldsPane extends AbstractCellDataFieldsPane<BubbleColumnFieldCollection> { |
||||
|
||||
private CellDataSeriesXYValueCorrelationPane seriesXYValueCorrelationPane; |
||||
private AbstractSingleFilterPane filterPane; |
||||
|
||||
|
||||
public CellDataSeriesXYValueCorrelationPane getSeriesXYValueCorrelationPane() { |
||||
return seriesXYValueCorrelationPane; |
||||
} |
||||
|
||||
public void setSeriesXYValueCorrelationPane(CellDataSeriesXYValueCorrelationPane seriesXYValueCorrelationPane) { |
||||
this.seriesXYValueCorrelationPane = seriesXYValueCorrelationPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void initComponents() { |
||||
filterPane = new AbstractSingleFilterPane() { |
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Series"); |
||||
} |
||||
}; |
||||
|
||||
this.setLayout(new BorderLayout(0, 6)); |
||||
this.add(createCenterPane(), BorderLayout.NORTH); |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
contentPane.add(new JPanel(), BorderLayout.NORTH); |
||||
contentPane.add(filterPane, BorderLayout.CENTER); |
||||
this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createCenterPane() { |
||||
JPanel normalCenter = super.createCenterPane(); |
||||
seriesXYValueCorrelationPane = new CellDataSeriesXYValueCorrelationPane(); |
||||
|
||||
if (normalCenter != null) { |
||||
JPanel panel = new JPanel(new BorderLayout(0, 6)); |
||||
panel.add(normalCenter, BorderLayout.NORTH); |
||||
panel.add(seriesXYValueCorrelationPane, BorderLayout.CENTER); |
||||
return panel; |
||||
} else { |
||||
return seriesXYValueCorrelationPane; |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[0]; |
||||
} |
||||
|
||||
@Override |
||||
protected TinyFormulaPane[] formulaPanes() { |
||||
return new TinyFormulaPane[0]; |
||||
} |
||||
|
||||
@Override |
||||
public BubbleColumnFieldCollection updateBean() { |
||||
BubbleColumnFieldCollection collection = new BubbleColumnFieldCollection(); |
||||
seriesXYValueCorrelationPane.updateBean(collection); |
||||
return collection; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(BubbleColumnFieldCollection ob) { |
||||
seriesXYValueCorrelationPane.populateBean(ob); |
||||
} |
||||
} |
@ -0,0 +1,95 @@
|
||||
package com.fr.design.chartx.fields.diff; |
||||
|
||||
import com.fr.chartx.data.field.diff.BubbleColumnField; |
||||
import com.fr.chartx.data.field.diff.BubbleColumnFieldCollection; |
||||
import com.fr.design.chartx.component.AbstractSingleFilterPane; |
||||
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.extended.chart.UIComboBoxWithNone; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JSeparator; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* Created by Wim on 2019/10/29. |
||||
*/ |
||||
public class ScatterDataSetFieldsPane extends AbstractDataSetFieldsPane<BubbleColumnFieldCollection> { |
||||
|
||||
private UIComboBoxWithNone series; |
||||
private UIComboBox xField; |
||||
private UIComboBox yField; |
||||
private UIComboBoxWithNone value; |
||||
|
||||
//todo 数据筛选
|
||||
private AbstractSingleFilterPane filterPane; |
||||
|
||||
|
||||
@Override |
||||
protected void initComponents() { |
||||
|
||||
series = new UIComboBoxWithNone(); |
||||
xField = new UIComboBox(); |
||||
yField = new UIComboBox(); |
||||
value = new UIComboBoxWithNone(); |
||||
|
||||
filterPane = new AbstractSingleFilterPane() { |
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Series"); |
||||
} |
||||
}; |
||||
|
||||
JPanel northPane = new JPanel(new BorderLayout(0, 6)); |
||||
northPane.add(new JSeparator(), BorderLayout.CENTER); |
||||
northPane.add(createCenterPane(), BorderLayout.SOUTH); |
||||
northPane.setBorder(BorderFactory.createEmptyBorder(4, 24, 0, 15)); |
||||
|
||||
this.setLayout(new BorderLayout(0, 6)); |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
contentPane.add(new JPanel(), BorderLayout.NORTH); |
||||
contentPane.add(filterPane, BorderLayout.CENTER); |
||||
this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
protected UIComboBox[] filedComboBoxes() { |
||||
return new UIComboBox[]{ |
||||
series, xField, yField, value |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Chart_Series_Name"), |
||||
"x", |
||||
"y", |
||||
Toolkit.i18nText("Fine-Design_Chart_Use_Value") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public BubbleColumnFieldCollection updateBean() { |
||||
BubbleColumnFieldCollection collection = new BubbleColumnFieldCollection(); |
||||
BubbleColumnField field = collection.getBubbleColumnField(0); |
||||
updateField(series, field.getSeriesName()); |
||||
updateField(xField, field.getXField()); |
||||
updateField(yField, field.getYField()); |
||||
updateField(value, field.getValueField()); |
||||
return collection; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(BubbleColumnFieldCollection ob) { |
||||
BubbleColumnField field = ob.getBubbleColumnField(0); |
||||
populateField(series, field.getSeriesName()); |
||||
populateField(xField, field.getXField()); |
||||
populateField(yField, field.getYField()); |
||||
populateField(value, field.getValueField()); |
||||
} |
||||
} |
Loading…
Reference in new issue