Browse Source

完善面板结构

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
3755374686
  1. 29
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java
  2. 25
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java
  3. 20
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  4. 123
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotDataContentPaneHelp.java
  5. 116
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotTableDataContentPane.java
  6. 42
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotTableResultDataSeriesPane.java
  7. 96
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotTableSeriesTypeUsePane.java
  8. 38
      designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java

29
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java

@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
@ -41,11 +42,11 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
categoryCombox = new UIComboBox();
JPanel categoryPane = new JPanel(new BorderLayout(4,0));
categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label1 = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ;
UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ;
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT));
categoryCombox.setPreferredSize(new Dimension(100,20));
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null}));
categoryPane.setPreferredSize(new Dimension(246,30));
categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15));
@ -90,7 +91,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(categoryCombox, list);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list);
}
@ -100,7 +101,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
*/
public void clearAllBoxList(){
clearBoxItems(categoryCombox);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
seriesTypeComboxPane.clearAllBoxList();
}
@ -135,9 +136,9 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
}
NormalTableDataDefinition data = (NormalTableDataDefinition)top;
if(data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(data!= null && !this.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
if(ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(!DataPaneHelper.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
categoryCombox.setSelectedItem(null);
}else {
combineCustomEditValue(categoryCombox, data.getCategoryName());
@ -146,20 +147,6 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
seriesTypeComboxPane.populateBean(collection,this.isNeedSummaryCaculateMethod());
}
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
/**
* 重新布局整个面板
*/

25
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java

@ -7,6 +7,7 @@ import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.ComboBoxModel;
import java.util.List;
/**
@ -24,6 +25,30 @@ public class DataPaneHelper {
box.refreshBoxItems(list);
}
public static boolean boxItemsContainsObject(UIComboBox box, Object item) {
if (box == null) {
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) {
return true;
}
}
return false;
}
public static void combineCustomEditValue(UIComboBox comBox, String value) {
if(comBox != null) {
comBox.setEditable(true);
comBox.setSelectedItem(value);
comBox.setEditable(false);
}
}
/**
* 清空box里所有东西
*

20
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java

@ -14,10 +14,8 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
@ -171,20 +169,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
DataPaneHelper.clearBoxItems(seriesValue);
}
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
/**
* 判断界面是否接受
* @param ob 接受的对象
@ -238,11 +222,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
if (topDefinition instanceof OneValueCDDefinition) {
OneValueCDDefinition oneDefinition = (OneValueCDDefinition) topDefinition;
seriesName.setEditable(true);
seriesName.setSelectedItem(this.boxItemsContainsObject(seriesName,oneDefinition.getSeriesColumnName())
seriesName.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesName, oneDefinition.getSeriesColumnName())
? oneDefinition.getSeriesColumnName() : null);
seriesName.setEditable(false);
seriesValue.setEditable(true);
seriesValue.setSelectedItem(this.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
seriesValue.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
? oneDefinition.getValueColumnName() : null);
seriesValue.setEditable(false);
if(this.isNeedSummary){

123
designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotDataContentPaneHelp.java

@ -1,123 +0,0 @@
package com.fr.van.chart.box.data;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.chart.chartdata.TableDataDefinition;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper;
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.ComboBoxModel;
public class BoxPlotDataContentPaneHelp {
public static void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (detailedDefinition != null) {
dataScreeningPane.populateDefinition(detailedDefinition, false);
} else if (resultDefinition != null) {
dataScreeningPane.populateDefinition(resultDefinition, false);
}
}
public static void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (detailedDefinition != null) {
dataScreeningPane.updateDefinition(detailedDefinition);
}
if (resultDefinition != null) {
dataScreeningPane.updateDefinition(resultDefinition);
}
}
public static void updateCategoryPane(UIComboBox categoryCombox, ChartCollection collection, boolean isDetailed) {
Object categoryName = categoryCombox.getSelectedItem();
TableDataDefinition dataDefinition;
if (isDetailed) {
dataDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
if (dataDefinition == null) {
return;
}
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) {
((NormalTableDataDefinition) dataDefinition).setCategoryName(StringUtils.EMPTY);
} else {
((NormalTableDataDefinition) dataDefinition).setCategoryName(categoryName == null ? null : categoryName.toString());
}
} else {
dataDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (dataDefinition == null) {
return;
}
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) {
((VanBoxTableResultDefinition) dataDefinition).setCategoryName(StringUtils.EMPTY);
} else {
((VanBoxTableResultDefinition) dataDefinition).setCategoryName(categoryName == null ? null : categoryName.toString());
}
}
}
public static void populateCategoryPane(UIComboBox categoryCombox, ChartCollection collection, boolean isDetailed) {
TableDataDefinition data;
if (isDetailed) {
data = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
if (data == null) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else {
populateCategoryItem(categoryCombox, ((NormalTableDataDefinition) data).getCategoryName());
}
} else {
data = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (data == null) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else {
populateCategoryItem(categoryCombox, ((VanBoxTableResultDefinition) data).getCategoryName());
}
}
}
public static void populateCategoryItem(UIComboBox categoryCombox, Object item) {
if (ComparatorUtils.equals(item, StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if (!boxItemsContainsObject(categoryCombox, item)) {
categoryCombox.setSelectedItem(null);
} else {
categoryCombox.setSelectedItem(item);
}
}
public static boolean boxItemsContainsObject(UIComboBox box, Object item) {
if (box == null) {
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) {
return true;
}
}
return false;
}
}

116
designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotTableDataContentPane.java

@ -2,19 +2,18 @@ package com.fr.van.chart.box.data;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -23,14 +22,11 @@ import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
private UIButtonGroup dataType;
private UIComboBox categoryCombox;
private BoxPlotTableSeriesTypeUsePane seriesTypeComboxPane;
private BoxPlotTableResultDataSeriesPane resultDataSeriesPane;
@ -46,7 +42,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
this.setLayout(new BorderLayout());
this.add(createTypeAndCategoryPane(), BorderLayout.NORTH);
this.add(createDataTypePane(), BorderLayout.NORTH);
this.add(createSeriesPane(), BorderLayout.CENTER);
this.add(createFilterPane(), BorderLayout.SOUTH);
@ -54,12 +50,12 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
checkDataPaneVisible();
}
private JPanel createTypeAndCategoryPane() {
UILabel buttonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type"));
UILabel comboBoxLabel = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
private JPanel createDataTypePane() {
JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
buttonLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
comboBoxLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"),
@ -67,25 +63,11 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
};
dataType = new UIButtonGroup(names);
categoryCombox = new UIComboBox();
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
dataType.setPreferredSize(new Dimension(100, 20));
categoryCombox.setPreferredSize(new Dimension(100, 20));
double p = TableLayout.PREFERRED;
double[] column = {p, COMPONENT_WIDTH};
double[] row = {p, p};
Component[][] components = new Component[][]{
new Component[]{buttonLabel, dataType},
new Component[]{comboBoxLabel, categoryCombox}
};
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
pane.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));
pane.setPreferredSize(new Dimension(246, 30));
pane.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15));
return pane;
}
@ -118,13 +100,6 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
checkDataPaneVisible();
}
});
categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
checkSeriseUse(categoryCombox.getSelectedItem() != null);
makeToolTipUse(categoryCombox);
}
});
}
private void checkDataPaneVisible() {
@ -137,8 +112,6 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
}
public void checkBoxUse(boolean hasUse) {
categoryCombox.setEnabled(hasUse);
if (dataType.getSelectedIndex() == 0 && seriesTypeComboxPane != null) {
seriesTypeComboxPane.checkBoxUse(hasUse);
}
@ -150,25 +123,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
dataScreeningPane.checkBoxUse();
}
private void checkSeriseUse(boolean hasUse) {
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.checkBoxUse(hasUse && categoryCombox.getSelectedItem() != null);
}
}
private void makeToolTipUse(UIComboBox comBox) {
if (comBox.getSelectedItem() != null) {
comBox.setToolTipText(comBox.getSelectedItem().toString());
} else {
comBox.setToolTipText(null);
}
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(categoryCombox, list);
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list);
}
@ -178,9 +133,6 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
}
public void clearAllBoxList() {
clearBoxItems(categoryCombox);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.clearAllBoxList();
}
@ -192,40 +144,36 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
public void updateBean(ChartCollection collection) {
checkChartCollection(collection);
VanBoxTableDefinitionHelper.updateTableDataType(dataType.getSelectedIndex() == 0, collection);
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table != null) {
table.setDetailed(dataType.getSelectedIndex() == 0);
}
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.updateBean(collection);
BoxPlotDataContentPaneHelp.updateCategoryPane(categoryCombox, collection, true);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.updateBean(collection);
BoxPlotDataContentPaneHelp.updateCategoryPane(categoryCombox, collection, false);
}
if (dataScreeningPane != null) {
BoxPlotDataContentPaneHelp.updateDataScreeningPane(dataScreeningPane, collection);
updateDataScreeningPane(dataScreeningPane, collection);
}
}
public void populateBean(ChartCollection collection) {
checkChartCollection(collection);
if (dataType != null) {
dataType.setSelectedIndex(VanBoxTableDefinitionHelper.isDetailedTableDataType(collection) ? 0 : 1);
}
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.populateBean(collection);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.populateBean(collection);
}
if (dataType.getSelectedIndex() == 0 && categoryCombox != null) {
BoxPlotDataContentPaneHelp.populateCategoryPane(categoryCombox, collection, true);
}
if (dataType.getSelectedIndex() == 1 && categoryCombox != null) {
BoxPlotDataContentPaneHelp.populateCategoryPane(categoryCombox, collection, false);
}
if (dataScreeningPane != null) {
BoxPlotDataContentPaneHelp.populateDataScreeningPane(dataScreeningPane, collection);
populateDataScreeningPane(dataScreeningPane, collection);
}
checkDataPaneVisible();
@ -238,4 +186,28 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition());
}
}
private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (detailedDefinition != null) {
dataScreeningPane.populateDefinition(detailedDefinition, false);
} else if (resultDefinition != null) {
dataScreeningPane.populateDefinition(resultDefinition, false);
}
}
private void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
VanBoxTableResultDefinition resultDefinition = VanBoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (detailedDefinition != null) {
dataScreeningPane.updateDefinition(detailedDefinition);
}
if (resultDefinition != null) {
dataScreeningPane.updateDefinition(resultDefinition);
}
}
}

42
designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotTableResultDataSeriesPane.java

@ -23,6 +23,7 @@ import java.util.List;
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane {
private UIComboBox category;
private UIComboBox seriesName;
private UIComboBox max;
private UIComboBox q3;
@ -37,17 +38,13 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
this.setLayout(new BorderLayout());
this.add(createDataSeriesPane(), BorderLayout.CENTER);
seriesName.addItemListener(tooltipListener);
max.addItemListener(tooltipListener);
q3.addItemListener(tooltipListener);
median.addItemListener(tooltipListener);
q1.addItemListener(tooltipListener);
min.addItemListener(tooltipListener);
addItemListener();
}
private void initComboxSize() {
Dimension preferredSize = new Dimension(100, 20);
category = new UIComboBox();
seriesName = new UIComboBox();
max = new UIComboBox();
q3 = new UIComboBox();
@ -55,6 +52,7 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
q1 = new UIComboBox();
min = new UIComboBox();
category.setPreferredSize(preferredSize);
seriesName.setPreferredSize(preferredSize);
max.setPreferredSize(preferredSize);
q3.setPreferredSize(preferredSize);
@ -63,14 +61,25 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
min.setPreferredSize(preferredSize);
}
private void addItemListener() {
category.addItemListener(tooltipListener);
seriesName.addItemListener(tooltipListener);
max.addItemListener(tooltipListener);
q3.addItemListener(tooltipListener);
median.addItemListener(tooltipListener);
q1.addItemListener(tooltipListener);
min.addItemListener(tooltipListener);
}
private JPanel createDataSeriesPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] column = {f, COMPONENT_WIDTH};
double[] row = {p, p, p, p, p, p};
double[] row = {p, p, p, p, p, p, p};
Component[][] components_north = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category")), category},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), seriesName},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")), max},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")), q3},
@ -89,6 +98,7 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(category, list);
refreshBoxItems(seriesName, list);
refreshBoxItems(max, list);
refreshBoxItems(q3, list);
@ -98,6 +108,7 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
}
public void clearAllBoxList() {
clearBoxItems(category);
clearBoxItems(seriesName);
clearBoxItems(max);
clearBoxItems(q3);
@ -115,6 +126,7 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
return;
}
combineCustomEditValue(category, definition.getCategoryName());
combineCustomEditValue(seriesName, definition.getSeriesName());
combineCustomEditValue(max, definition.getMax());
combineCustomEditValue(q3, definition.getQ3());
@ -128,19 +140,24 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
VanBoxTableResultDefinition definition = new VanBoxTableResultDefinition();
Object resultName = seriesName.getSelectedItem();
Object resultCategory = category.getSelectedItem();
Object resultSeries = seriesName.getSelectedItem();
Object resultMax = max.getSelectedItem();
Object resultQ3 = q3.getSelectedItem();
Object resultMedian = median.getSelectedItem();
Object resultQ1 = q1.getSelectedItem();
Object resultMin = min.getSelectedItem();
if (resultName == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultName)) {
if (resultCategory == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultCategory)) {
definition.setCategoryName(StringUtils.EMPTY);
} else {
definition.setCategoryName(resultCategory.toString());
}
if (resultSeries == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultSeries)) {
definition.setSeriesName(StringUtils.EMPTY);
} else {
definition.setSeriesName(resultName.toString());
definition.setSeriesName(resultSeries.toString());
}
if (resultMax != null) {
definition.setMax(resultMax.toString());
}
@ -159,7 +176,4 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
table.setResultDefinition(definition);
}
public void redoLayoutPane() {
}
}

96
designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotTableSeriesTypeUsePane.java

@ -1,5 +1,6 @@
package com.fr.van.chart.box.data;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.NormalTableDataDefinition;
@ -8,21 +9,28 @@ import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane;
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.plugin.chart.box.data.VanBoxTableDefinitionHelper;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
@ -30,12 +38,15 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
private static boolean NEED_SUMMERY = false;
private UIComboBox categoryCombox;
private SeriesNameUseFieldValuePane nameFieldValuePane;
private SeriesNameUseFieldNamePane nameFieldNamePane;
public BoxPlotTableSeriesTypeUsePane() {
cards = initPaneList();
initComponents();
initListener();
}
protected void initLayout() {
@ -44,7 +55,8 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(createNorthPane(), BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
this.add(createCenterPane(), BorderLayout.CENTER);
this.add(cardPane, BorderLayout.SOUTH);
}
protected UIComboBox createComboBox() {
@ -55,26 +67,69 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
private JPanel createNorthPane() {
JPanel north = new JPanel(new BorderLayout(4, 0));
north.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
categoryCombox = new UIComboBox();
categoryCombox.setPreferredSize(new Dimension(100, 20));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null}));
north.setPreferredSize(new Dimension(246, 30));
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15));
return north;
}
private JPanel createCenterPane() {
JPanel center = new JPanel(new BorderLayout(4, 0));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null}));
north.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15));
center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null}));
center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return north;
return center;
}
private void initListener() {
categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
checkBoxUse(categoryCombox.getSelectedItem() != null);
makeToolTipUse(categoryCombox);
}
});
}
public void checkBoxUse(boolean hasUse) {
categoryCombox.setEnabled(hasUse);
jcb.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse);
}
private void makeToolTipUse(UIComboBox comBox) {
if (comBox.getSelectedItem() != null) {
comBox.setToolTipText(comBox.getSelectedItem().toString());
} else {
comBox.setToolTipText(null);
}
}
public void refreshBoxListWithSelectTableData(List list) {
DataPaneHelper.refreshBoxItems(categoryCombox, list);
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
nameFieldValuePane.refreshBoxListWithSelectTableData(list);
nameFieldNamePane.refreshBoxListWithSelectTableData(list);
}
public void clearAllBoxList() {
DataPaneHelper.clearBoxItems(categoryCombox);
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList();
}
@ -117,6 +172,11 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
public void populateBean(ChartCollection collection) {
NormalTableDataDefinition definition = VanBoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
if (definition == null) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
return;
}
if (definition instanceof OneValueCDDefinition) {
this.setSelectedIndex(0);
nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY);
@ -124,10 +184,16 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
this.setSelectedIndex(1);
nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY);
}
populateCategoryItem(categoryCombox, definition.getCategoryName());
}
public void updateBean(ChartCollection ob) {
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(ob);
public void updateBean(ChartCollection collection) {
VanBoxTableDefinition table = VanBoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table == null) {
return;
}
NormalTableDataDefinition definition;
@ -137,7 +203,25 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition());
}
Object categoryName = categoryCombox.getSelectedItem();
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) {
definition.setCategoryName(StringUtils.EMPTY);
} else {
definition.setCategoryName(categoryName == null ? null : categoryName.toString());
}
table.setDetailedDefinition(definition);
}
private void populateCategoryItem(UIComboBox categoryCombox, String item) {
if (ComparatorUtils.equals(item, StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if (!DataPaneHelper.boxItemsContainsObject(categoryCombox, item)) {
categoryCombox.setSelectedItem(null);
} else {
DataPaneHelper.combineCustomEditValue(categoryCombox, item);
}
}
}

38
designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java

@ -14,16 +14,16 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.multilayer.data.MultiPieValueDefinition;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
@ -72,7 +72,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
for (int i = 0; i < levelNum; i++){
levelNameList.add(new UIComboBox());
levelNameList.get(i).setPreferredSize(new Dimension(WD, HT));
levelNameList.get(i).addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
levelNameList.get(i).addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
}
@ -103,7 +103,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
Component[][] components_center = new Component[levelNum + 3][];
for (int i = 0; i < levelNum; i++){
components_center[i] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Level") + String.valueOf(i+1)), levelNameList.get(i)};
components_center[i] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level") + String.valueOf(i+1)), levelNameList.get(i)};
}
value = new UIComboBox();
@ -113,8 +113,8 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
calculateCombox.setPreferredSize(new Dimension(WD, HT));
components_center[levelNum] = new Component[]{getJSeparator(), null};
components_center[levelNum+1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")), value};
components_center[levelNum+2] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")), calculateCombox};
components_center[levelNum+1] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Value")), value};
components_center[levelNum+2] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method")), calculateCombox};
initCenterItemListener();
@ -181,9 +181,9 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
nameField = new UITextField();
Component[][] components_north = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), nameField},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), nameField},
new Component[]{getJSeparator(),null },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Level_Number")), levelNumEdit},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level_Number")), levelNumEdit},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, rowSize_north, columnSize_north);
@ -243,7 +243,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
columnNameList = list;
for (int i = 0; i < levelNum; i++) {
refreshBoxItems(levelNameList.get(i), list);
levelNameList.get(i).addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
levelNameList.get(i).addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
refreshBoxItems(value, list);
}
@ -282,7 +282,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
//值
value.setEditable(true);
value.setSelectedItem(this.boxItemsContainsObject(value,data.getValueColumnName())
value.setSelectedItem(DataPaneHelper.boxItemsContainsObject(value,data.getValueColumnName())
? data.getValueColumnName() : null);
value.setEditable(false);
//汇总方式
@ -327,8 +327,8 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
for (int i = 0; i < levelNameList.size(); i++){
if(!definition.hasLevelIndex(i) || ComparatorUtils.equals(levelColumnNameList.get(i), StringUtils.EMPTY)) {
levelNameList.get(i).setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(definition.hasLevelIndex(i) && !this.boxItemsContainsObject(levelNameList.get(i),levelColumnNameList.get(i))){
levelNameList.get(i).setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(definition.hasLevelIndex(i) && !DataPaneHelper.boxItemsContainsObject(levelNameList.get(i),levelColumnNameList.get(i))){
levelNameList.get(i).setSelectedItem(null);
}else {
combineCustomEditValue(levelNameList.get(i), definition.hasLevelIndex(i) ? levelColumnNameList.get(i) : null);
@ -353,20 +353,6 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
}
}
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
protected JSeparator getJSeparator() {
JSeparator jSeparator = new JSeparator();
jSeparator.setPreferredSize(new Dimension(220, 2));

Loading…
Cancel
Save