Browse Source

代码合并冲突

feature/big-screen
eason-skx 5 years ago
parent
commit
1810907a62
  1. 40
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java
  2. 99
      designer-chart/src/main/java/com/fr/design/chartx/component/CategorySeriesFilterPane.java
  3. 6
      designer-chart/src/main/java/com/fr/design/chartx/component/MultiTinyFormulaPane.java
  4. 8
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java
  5. 8
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java
  6. 74
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryCellDataFieldsPane.java

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

@ -10,13 +10,13 @@ import com.fr.general.IOUtils;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/** /**
@ -24,7 +24,6 @@ import java.util.List;
* 一列组件<T extends JComponent> 可增可删通过JComponent后面的加减button增删 * 一列组件<T extends JComponent> 可增可删通过JComponent后面的加减button增删
*/ */
public abstract class AbstractMultiComponentPane<T extends JComponent> extends JPanel { public abstract class AbstractMultiComponentPane<T extends JComponent> extends JPanel {
private static final int COM_W = 96;
private static final int H = 20; private static final int H = 20;
private static final int ICON_W = 20; private static final int ICON_W = 20;
@ -35,6 +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 categoryAxis = true;
protected abstract T createFirstFieldComponent(); protected abstract T createFirstFieldComponent();
@ -44,13 +44,23 @@ 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 setCategoryAxis(boolean categoryAxis) {
this.categoryAxis = categoryAxis;
if(!categoryAxis){
addButton.setEnabled(false);
for (JComponent component : categoryComponentList) {
component.setEnabled(false);
}
}
}
public AbstractMultiComponentPane() { public AbstractMultiComponentPane() {
UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")); UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
firstFieldComponent = createFirstFieldComponent(); firstFieldComponent = createFirstFieldComponent();
firstFieldComponent.setPreferredSize(new Dimension(COM_W, H)); firstFieldComponent.setPreferredSize(new Dimension(componentWidth(), H));
addButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
addButton.setPreferredSize(new Dimension(ICON_W, H)); addButton.setPreferredSize(new Dimension(ICON_W, H));
@ -64,7 +74,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
}); });
final JPanel panel = new JPanel(); final JPanel panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 2));
panel.add(label); panel.add(label);
panel.add(firstFieldComponent); panel.add(firstFieldComponent);
@ -78,6 +88,10 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
this.add(boxPane, BorderLayout.CENTER); this.add(boxPane, BorderLayout.CENTER);
} }
protected int componentWidth() {
return 96;
}
private JPanel addComboBoxAndButtonToBox(T uiComboBox, UIButton uiButton) { private JPanel addComboBoxAndButtonToBox(T uiComboBox, UIButton uiButton) {
final JPanel panel = new JPanel(); final JPanel panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2));
@ -93,7 +107,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
private void addNewComboBox() { private void addNewComboBox() {
final T comboBox = createOtherFieldComponent(); final T comboBox = createOtherFieldComponent();
comboBox.setPreferredSize(new Dimension(COM_W, H)); comboBox.setPreferredSize(new Dimension(componentWidth(), H));
UIButton delButton = new UIButton(IOUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); UIButton delButton = new UIButton(IOUtils.readIcon("com/fr/design/images/toolbarbtn/close.png"));
delButton.setPreferredSize(new Dimension(ICON_W, H)); delButton.setPreferredSize(new Dimension(ICON_W, H));
@ -123,7 +137,7 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
} }
private boolean canAdd() { private boolean canAdd() {
return categoryComponentList.size() < 3; return categoryComponentList.size() < 2 && categoryAxis;
} }
public List<T> componentList() { public List<T> componentList() {
@ -165,4 +179,16 @@ public abstract class AbstractMultiComponentPane<T extends JComponent> extends J
updateField(comboBox, temp); updateField(comboBox, temp);
} }
} }
public void checkEnable(boolean hasUse) {
//增加按钮是否灰化要根据是否选择了数据源,是否分类轴,分类数量是否超标三个判断
boolean buttonUse = hasUse && categoryAxis && categoryComponentList.size() < 2;
//额外的分类是否灰化根据是否选择了数据源,是否分类轴判断
boolean categoryUse = hasUse && categoryAxis;
addButton.setEnabled(buttonUse);
for (JComponent component : categoryComponentList) {
component.setEnabled(categoryUse);
}
}
} }

99
designer-chart/src/main/java/com/fr/design/chartx/component/CategorySeriesFilterPane.java

@ -0,0 +1,99 @@
package com.fr.design.chartx.component;
import com.fr.chartx.data.field.ColumnField;
import com.fr.chartx.data.field.DataFilterProperties;
import com.fr.chartx.data.field.SeriesValueCorrelationDefinition;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.map.designer.VanChartGroupPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
/**
* @author shine
* @version 10.0
* Created by shine on 2019/9/26
*/
public class CategorySeriesFilterPane extends JPanel {
private AbstractSingleFilterPane seriesFilterPane;
private AbstractSingleFilterPane categoryFilterPane;
public CategorySeriesFilterPane() {
seriesFilterPane = new AbstractSingleFilterPane() {
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Series");
}
};
categoryFilterPane = new AbstractSingleFilterPane() {
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Style_Category");
}
};
JPanel groupPane = new VanChartGroupPane(new String[]{categoryFilterPane.title4PopupWindow(), seriesFilterPane.title4PopupWindow()}
, new JPanel[]{categoryFilterPane, seriesFilterPane}) {
};
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(new JPanel(), BorderLayout.NORTH);
contentPane.add(groupPane, BorderLayout.CENTER);
groupPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
this.setLayout(new BorderLayout());
this.add(TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), contentPane), BorderLayout.CENTER);
}
public void populateMultiCategoryFieldCollection(MultiCategoryColumnFieldCollection fieldCollection) {
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition();
if (seriesValueCorrelationDefinition != null) {
populateSeries(seriesValueCorrelationDefinition.getFilterProperties());
}
List<ColumnField> categoryList = fieldCollection.getCategoryList();
if (!categoryList.isEmpty()) {
populateCategory(categoryList.get(0).getFilterProperties());
}
}
public void updateMultiCategoryFieldCollection(MultiCategoryColumnFieldCollection fieldCollection) {
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition();
if (seriesValueCorrelationDefinition != null) {
seriesValueCorrelationDefinition.setFilterProperties(updateSeries());
}
List<ColumnField> categoryList = fieldCollection.getCategoryList();
if (!categoryList.isEmpty()) {
categoryList.get(0).setFilterProperties(updateCategory());
}
}
private void populateSeries(DataFilterProperties series) {
seriesFilterPane.populateBean(series);
}
private void populateCategory(DataFilterProperties category) {
categoryFilterPane.populateBean(category);
}
private DataFilterProperties updateSeries() {
return seriesFilterPane.updateBean();
}
private DataFilterProperties updateCategory() {
return categoryFilterPane.updateBean();
}
}

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

@ -8,6 +8,12 @@ import com.fr.design.formula.TinyFormulaPane;
* Created by shine on 2019/4/12. * Created by shine on 2019/4/12.
*/ */
public class MultiTinyFormulaPane extends AbstractMultiComponentPane<TinyFormulaPane> { public class MultiTinyFormulaPane extends AbstractMultiComponentPane<TinyFormulaPane> {
@Override
protected int componentWidth() {
return 116;
}
@Override @Override
protected TinyFormulaPane createFirstFieldComponent() { protected TinyFormulaPane createFirstFieldComponent() {
return new TinyFormulaPane(); return new TinyFormulaPane();

8
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractCellDataFieldsWithSeriesValuePane.java

@ -1,6 +1,6 @@
package com.fr.design.chartx.fields.diff; package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue; import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.design.chartx.component.CellDataSeriesValueCorrelationPane; import com.fr.design.chartx.component.CellDataSeriesValueCorrelationPane;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
@ -10,7 +10,7 @@ import java.awt.BorderLayout;
/** /**
* Created by shine on 2019/6/4. * Created by shine on 2019/6/4.
*/ */
public abstract class AbstractCellDataFieldsWithSeriesValuePane<T extends AbstractColumnFieldCollectionWithSeriesValue> public abstract class AbstractCellDataFieldsWithSeriesValuePane<T extends ColumnFieldCollectionWithSeriesValue>
extends AbstractCellDataFieldsPane<T> { extends AbstractCellDataFieldsPane<T> {
private CellDataSeriesValueCorrelationPane seriesValueFieldsPane; private CellDataSeriesValueCorrelationPane seriesValueFieldsPane;
@ -41,11 +41,11 @@ public abstract class AbstractCellDataFieldsWithSeriesValuePane<T extends Abstra
this.seriesValueFieldsPane = seriesValueFieldsPane; this.seriesValueFieldsPane = seriesValueFieldsPane;
} }
protected void populateSeriesValuePane(AbstractColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) { protected void populateSeriesValuePane(ColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) {
seriesValueFieldsPane.populateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition()); seriesValueFieldsPane.populateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition());
} }
protected void updateSeriesValuePane(AbstractColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) { protected void updateSeriesValuePane(ColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) {
seriesValueFieldsPane.updateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition()); seriesValueFieldsPane.updateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition());
} }

8
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/AbstractDataSetFieldsWithSeriesValuePane.java

@ -1,6 +1,6 @@
package com.fr.design.chartx.fields.diff; package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.diff.AbstractColumnFieldCollectionWithSeriesValue; import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.design.chartx.component.SeriesValueFieldComboBoxPane; import com.fr.design.chartx.component.SeriesValueFieldComboBoxPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
@ -12,7 +12,7 @@ import java.awt.BorderLayout;
* Created by shine on 2019/5/16. * Created by shine on 2019/5/16.
* 带有 自定义系列名fr表现为 系列名使用字段名 的字段集合 的一个pane * 带有 自定义系列名fr表现为 系列名使用字段名 的字段集合 的一个pane
*/ */
public abstract class AbstractDataSetFieldsWithSeriesValuePane<T extends AbstractColumnFieldCollectionWithSeriesValue> public abstract class AbstractDataSetFieldsWithSeriesValuePane<T extends ColumnFieldCollectionWithSeriesValue>
extends AbstractDataSetFieldsPane<T> { extends AbstractDataSetFieldsPane<T> {
private SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane; private SeriesValueFieldComboBoxPane seriesValueFieldComboBoxPane;
@ -61,11 +61,11 @@ public abstract class AbstractDataSetFieldsWithSeriesValuePane<T extends Abstrac
seriesValueFieldComboBoxPane.refreshBoxListWithSelectTableData(columnNameList); seriesValueFieldComboBoxPane.refreshBoxListWithSelectTableData(columnNameList);
} }
protected void populateSeriesValuePane(AbstractColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) { protected void populateSeriesValuePane(ColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) {
seriesValueFieldComboBoxPane.populateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition()); seriesValueFieldComboBoxPane.populateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition());
} }
protected void updateSeriesValuePane(AbstractColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) { protected void updateSeriesValuePane(ColumnFieldCollectionWithSeriesValue fieldCollectionWithSeriesValue) {
seriesValueFieldComboBoxPane.updateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition()); seriesValueFieldComboBoxPane.updateBean(fieldCollectionWithSeriesValue.getSeriesValueCorrelationDefinition());
} }
} }

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

@ -1,15 +1,15 @@
package com.fr.design.chartx.fields.diff; package com.fr.design.chartx.fields.diff;
import com.fr.chartx.data.field.ColumnField; 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.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.chartx.component.AbstractSingleFilterPane; import com.fr.design.chartx.component.CategorySeriesFilterPane;
import com.fr.design.chartx.component.MultiTinyFormulaPane; import com.fr.design.chartx.component.MultiTinyFormulaPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.van.chart.map.designer.VanChartGroupPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List; import java.util.List;
import java.awt.BorderLayout;
/** /**
* Created by shine on 2019/4/12. * Created by shine on 2019/4/12.
@ -18,43 +18,21 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
private MultiTinyFormulaPane multiCategoryPane; private MultiTinyFormulaPane multiCategoryPane;
private AbstractSingleFilterPane seriesFilterPane; private CategorySeriesFilterPane filterPane;
private AbstractSingleFilterPane categoryFilterPane;
private void createMultiFormulaPane() {
if (multiCategoryPane == null) {
multiCategoryPane = new MultiTinyFormulaPane();
}
}
@Override @Override
protected JPanel createNorthPane() { protected void initComponents() {
multiCategoryPane = new MultiTinyFormulaPane();
filterPane = new CategorySeriesFilterPane();
createMultiFormulaPane(); JPanel northPane = new JPanel(new BorderLayout(0, 6));
northPane.add(multiCategoryPane, BorderLayout.NORTH);
northPane.add(createCenterPane(), BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 8));
return multiCategoryPane; this.setLayout(new BorderLayout(0, 6));
} this.add(northPane, BorderLayout.NORTH);
this.add(filterPane, BorderLayout.CENTER);
@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 @Override
@ -64,9 +42,6 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
@Override @Override
protected TinyFormulaPane[] formulaPanes() { protected TinyFormulaPane[] formulaPanes() {
createMultiFormulaPane();
List<TinyFormulaPane> list = multiCategoryPane.componentList(); List<TinyFormulaPane> list = multiCategoryPane.componentList();
return list.toArray(new TinyFormulaPane[list.size()]); return list.toArray(new TinyFormulaPane[list.size()]);
} }
@ -80,15 +55,7 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
populateSeriesValuePane(multiCategoryColumnFieldCollection); populateSeriesValuePane(multiCategoryColumnFieldCollection);
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = multiCategoryColumnFieldCollection.getSeriesValueCorrelationDefinition(); filterPane.populateMultiCategoryFieldCollection(multiCategoryColumnFieldCollection);
if (seriesValueCorrelationDefinition != null) {
seriesFilterPane.populateBean(seriesValueCorrelationDefinition.getFilterProperties());
}
if (categoryList != null && !categoryList.isEmpty()) {
categoryFilterPane.populateBean(categoryList.get(0).getFilterProperties());
}
} }
@Override @Override
@ -101,15 +68,12 @@ public class MultiCategoryCellDataFieldsPane extends AbstractCellDataFieldsWithS
updateSeriesValuePane(fieldCollection); updateSeriesValuePane(fieldCollection);
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = fieldCollection.getSeriesValueCorrelationDefinition(); filterPane.updateMultiCategoryFieldCollection(fieldCollection);
if (seriesValueCorrelationDefinition != null) {
seriesValueCorrelationDefinition.setFilterProperties(seriesFilterPane.updateBean());
}
if (categoryList != null && !categoryList.isEmpty()) { return fieldCollection;
categoryList.get(0).setFilterProperties(categoryFilterPane.updateBean());
} }
return fieldCollection; public void setCategoryAxis(boolean categoryAxis){
multiCategoryPane.setCategoryAxis(categoryAxis);
} }
} }
Loading…
Cancel
Save