Browse Source

为“值”下拉框添加选项“无”的判断条件

final/10.0
Qinghui.Liu 6 years ago
parent
commit
ca1ab3c670
  1. 13
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java
  2. 26
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

13
designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java

@ -10,14 +10,13 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.general.GeneralUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
/**
* Created by shine on 2018/3/2.
@ -54,7 +53,7 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
this.add(panel, BorderLayout.NORTH);
if (hasCustomFieldPane()) {
customFieldComboBoxPane = new ExtendedCustomFieldComboBoxPane();
customFieldComboBoxPane = new ExtendedCustomFieldComboBoxPane(hasNoneItem());
this.add(customFieldComboBoxPane, BorderLayout.CENTER);
}
@ -69,6 +68,10 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
return false;
}
protected boolean hasNoneItem() {
return false;
}
protected Component[] fieldComponents() {
return filedComboBoxes();
}

26
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -38,10 +38,17 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private UseFieldValuePane useFieldValuePane;
private boolean hasNoneItem = false;
private CustomFieldNamePane customFieldNamePane;
private List<String> fieldList = new ArrayList<String>();
public ExtendedCustomFieldComboBoxPane(boolean hasNoneItem) {
this.hasNoneItem = hasNoneItem;
}
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(0, 6));
@ -119,7 +126,11 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
series = new UIComboBox();
value = new UIComboBox();
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
if (hasNoneItem) {
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
function = new CalculateComboBox();
Component[][] components = new Component[][]{
@ -147,7 +158,9 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
public void clearAllBoxList() {
DataPaneHelper.clearBoxItems(series);
DataPaneHelper.clearBoxItems(value);
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
if (hasNoneItem) {
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
}
public void refreshBoxListWithSelectTableData(List columnNameList) {
@ -158,12 +171,19 @@ public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractData
@Override
public void populateBean(AbstractDataConfig ob) {
List<ExtendedField> list = ob.getCustomFields();
if (hasNoneItem) {
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
if (list.size() == 2) {
series.setSelectedItem(list.get(0).getFieldName());
value.setSelectedItem(list.get(1).getFieldName());
value.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
function.populateBean((AbstractDataFunction) list.get(1).getDataFunction());
}
if (value.getSelectedItem() == null) {
value.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
}
@Override

Loading…
Cancel
Save