Browse Source

Merge pull request #991 in DESIGN/design from ~ZHENG/c-design:refactor/19.4.3 to refactor/19.4.3

* commit '1d369e6a0decfb6b1028bfdbebd244d196a73d71':
  CHART-9141 filter界面&xml、processor不合理改成枚举、result流程一部分
research/10.0
zheng 5 years ago
parent
commit
94251dc0e2
  1. 171
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractSingleFilterPane.java
  2. 47
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java
  3. 47
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java
  4. 8
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java

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

@ -0,0 +1,171 @@
package com.fr.design.chartx.component;
import com.fr.base.Utils;
import com.fr.chartx.data.field.DataFilterProperties;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.data.PresentComboBox;
import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
/**
* Created by shine on 2019/07/18.
*/
public abstract class AbstractSingleFilterPane extends AbstractChartTabPane<DataFilterProperties> {
private static final int FIL_HEIGHT = 150;
private UICheckBox useTopCheckBox;
private UITextField topNumTextField;
private UICheckBox hideNullCheckBox;
private UICheckBox mergeOtherCheckBox;
private PresentComboBox present;
private AbstractAttrNoScrollPane parent;
private JPanel topPane;
public AbstractSingleFilterPane() {
super(true);
//todo@shinerefactor present的时候这边可以整理下
// this.parent = parent;
}
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height = FIL_HEIGHT;
return dim;
}
protected void layoutContentPane() {
super.layoutContentPane();
leftcontentPane.setBorder(BorderFactory.createEmptyBorder());
}
public void reloaPane(JPanel pane) {
super.reloaPane(pane);
leftcontentPane.setBorder(BorderFactory.createEmptyBorder());
}
@Override
protected JPanel createContentPane() {
this.setLayout(new BorderLayout());
JPanel pane = initPane();
this.add(pane, BorderLayout.NORTH);
return pane;
}
private JPanel initPane() {
useTopCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
JPanel panel1 = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout());
panel1.add(useTopCheckBox, BorderLayout.NORTH);
topNumTextField = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
mergeOtherCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
mergeOtherCheckBox.setSelected(true);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{label, topNumTextField},
new Component[]{mergeOtherCheckBox, null}
};
topPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
topPane.setBorder(BorderFactory.createEmptyBorder(10, 15, 0, 0));
//默认不显示
topPane.setVisible(false);
panel1.add(topPane, BorderLayout.CENTER);
hideNullCheckBox = new UICheckBox(title4PopupWindow() + " is null, hidden");
panel2.add(hideNullCheckBox, BorderLayout.NORTH);
useTopCheckBox.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
checkBoxUse();
}
});
present = new PresentComboBox() {
protected void fireChange() {
fire();
}
};
JPanel presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present"), present);
panel2.add(presentPane, BorderLayout.SOUTH);
double[] column = {f};
double[] row = {p, p};
Component[][] coms = new Component[][]{
new Component[]{panel1},
new Component[]{panel2}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(coms, row, column);
}
private void fire() {
if (this.parent != null) {
parent.attributeChanged();
}
}
/**
* 检查Box是否可用
*/
public void checkBoxUse() {
topPane.setVisible(useTopCheckBox.isSelected());
}
@Override
public void populateBean(DataFilterProperties ob) {
useTopCheckBox.setSelected(ob.isUseTop());
topNumTextField.setText(String.valueOf(ob.getTop()));
hideNullCheckBox.setSelected(ob.isHideNull());
mergeOtherCheckBox.setSelected(ob.isMerge());
present.populate(ob.getPresent());
checkBoxUse();
}
@Override
public DataFilterProperties updateBean() {
DataFilterProperties dataFilterProperties = new DataFilterProperties();
dataFilterProperties.setUseTop(useTopCheckBox.isSelected());
Number number = Utils.objectToNumber(topNumTextField.getText(), true);
if (number != null) {
dataFilterProperties.setTop(number.intValue());
}
dataFilterProperties.setHideNull(hideNullCheckBox.isSelected());
dataFilterProperties.setMerge(mergeOtherCheckBox.isSelected());
dataFilterProperties.setPresent(present.update());
return dataFilterProperties;
}
}

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

@ -1,9 +1,12 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.ColumnField;
import com.fr.chartx.data.field.SeriesValueCorrelationDefinition;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.chartx.component.AbstractSingleFilterPane;
import com.fr.design.chartx.component.MultiTinyFormulaPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.van.chart.map.designer.VanChartGroupPane;
import javax.swing.JPanel;
import java.util.List;
@ -15,6 +18,9 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
private MultiTinyFormulaPane multiCategoryPane;
private AbstractSingleFilterPane seriesFilterPane;
private AbstractSingleFilterPane categoryFilterPane;
private void createMultiFormulaPane() {
if (multiCategoryPane == null) {
multiCategoryPane = new MultiTinyFormulaPane();
@ -29,6 +35,28 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
return multiCategoryPane;
}
@Override
protected JPanel createSouthPane() {
if (seriesFilterPane == null) {
seriesFilterPane = new AbstractSingleFilterPane() {
@Override
public String title4PopupWindow() {
//todo@shinerefactor
return "series";
}
};
categoryFilterPane = new AbstractSingleFilterPane() {
@Override
public String title4PopupWindow() {
return "category";
}
};
}
return new VanChartGroupPane(new String[]{seriesFilterPane.title4PopupWindow(), categoryFilterPane.title4PopupWindow()}
, new JPanel[]{seriesFilterPane, categoryFilterPane}) {
};
}
@Override
protected String[] fieldLabels() {
return new String[0];
@ -51,6 +79,16 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
multiCategoryPane.populate(categoryList);
populateSeriesValuePane(multiCategoryColumnFieldCollection);
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition();
if (seriesValueCorrelationDefinition != null) {
seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties());
}
if (categoryList != null && !categoryList.isEmpty()) {
categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties());
}
}
@Override
@ -63,6 +101,15 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
updateSeriesValuePane(fieldCollection);
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition();
if (seriesValueCorrelationDefinition != null) {
seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean());
}
if (categoryList != null && !categoryList.isEmpty()) {
categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean());
}
return fieldCollection;
}
}

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

@ -1,9 +1,12 @@
package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.ColumnField;
import com.fr.chartx.data.field.SeriesValueCorrelationDefinition;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.chartx.component.AbstractSingleFilterPane;
import com.fr.design.chartx.component.MultiComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.van.chart.map.designer.VanChartGroupPane;
import javax.swing.JPanel;
import java.util.List;
@ -16,6 +19,9 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
private MultiComboBoxPane multiCategoryPane;
private AbstractSingleFilterPane seriesFilterPane;
private AbstractSingleFilterPane categoryFilterPane;
@Override
protected String[] fieldLabels() {
return new String[0];
@ -39,6 +45,28 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
return initMultiCategoryPane();
}
@Override
protected JPanel createSouthPane() {
if (seriesFilterPane == null) {
seriesFilterPane = new AbstractSingleFilterPane() {
@Override
public String title4PopupWindow() {
//todo@shinerefactor
return "series";
}
};
categoryFilterPane = new AbstractSingleFilterPane() {
@Override
public String title4PopupWindow() {
return "category";
}
};
}
return new VanChartGroupPane(new String[]{seriesFilterPane.title4PopupWindow(), categoryFilterPane.title4PopupWindow()}
, new JPanel[]{seriesFilterPane, categoryFilterPane}) {
};
}
@Override
public void refreshBoxListWithSelectTableData(List columnNameList) {
super.refreshBoxListWithSelectTableData(columnNameList);
@ -52,6 +80,16 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
multiCategoryPane.populate(categoryList);
populateSeriesValuePane(multiCategoryColumnFieldCollection);
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition();
if (seriesValueCorrelationDefinition != null) {
seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties());
}
if (categoryList != null && !categoryList.isEmpty()) {
categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties());
}
}
@Override
@ -64,6 +102,15 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer
updateSeriesValuePane(columnFieldCollection);
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = columnFieldCollection.getSeriesValueCorrelationDefinition();
if (seriesValueCorrelationDefinition != null) {
seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean());
}
if (categoryList != null && !categoryList.isEmpty()) {
categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean());
}
return columnFieldCollection;
}
}

8
designer-realize/src/main/java/com/fr/design/actions/insert/flot/ChartFloatAction.java

@ -15,10 +15,9 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.module.DesignModuleFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection;
import com.fr.log.FineLoggerFactory;
import com.fr.report.ReportHelper;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
@ -27,8 +26,8 @@ import com.fr.stable.bridge.StableFactory;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.OLDPIX;
import javax.swing.*;
import java.awt.*;
import javax.swing.KeyStroke;
import java.awt.Color;
/**
* 图表插入悬浮元素的操作.
@ -80,7 +79,6 @@ public class ChartFloatAction extends ElementCaseAction {
reportPane.stopEditing();
final BaseChartCollection cc = (BaseChartCollection) StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
cc.removeAllNameObject();
final MiddleChartDialog chartDialog = DesignModuleFactory.getChartDialog(DesignerContext.getDesignerFrame());
chartDialog.populate(cc);
chartDialog.addDialogActionListener(new DialogActionAdapter() {

Loading…
Cancel
Save