|
|
|
@ -1,19 +1,18 @@
|
|
|
|
|
package com.fr.design.chartx.component; |
|
|
|
|
|
|
|
|
|
import com.fr.data.util.function.AbstractDataFunction; |
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
|
import com.fr.design.chartx.component.correlation.AbstractCorrelationPane; |
|
|
|
|
import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent; |
|
|
|
|
import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper; |
|
|
|
|
import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent; |
|
|
|
|
import com.fr.design.chartx.component.correlation.UITextFieldEditorComponent; |
|
|
|
|
import com.fr.design.gui.frpane.UIComboBoxPane; |
|
|
|
|
import com.fr.design.chartx.data.DataLayoutHelper; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
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.mainframe.chart.gui.data.table.DataPaneHelper; |
|
|
|
|
import com.fr.extended.chart.UIComboBoxWithNone; |
|
|
|
@ -22,19 +21,25 @@ import com.fr.stable.StringUtils;
|
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.CardLayout; |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Created by shine on 2018/9/12. |
|
|
|
|
* 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取 |
|
|
|
|
*/ |
|
|
|
|
public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<T> { |
|
|
|
|
public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T> { |
|
|
|
|
|
|
|
|
|
private UIButtonGroup<Boolean> nameOrValue; |
|
|
|
|
private JPanel cardPane; |
|
|
|
|
private CardLayout cardLayout; |
|
|
|
|
|
|
|
|
|
private AbstractUseFieldValuePane useFieldValuePane; |
|
|
|
|
|
|
|
|
@ -42,73 +47,43 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
|
|
|
|
|
|
|
|
|
|
private List<String> fieldList = new ArrayList<String>(); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void initLayout() { |
|
|
|
|
this.setLayout(new BorderLayout(0, 6)); |
|
|
|
|
JPanel northPane = new JPanel(new BorderLayout()); |
|
|
|
|
northPane.add(jcb, BorderLayout.CENTER); |
|
|
|
|
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); |
|
|
|
|
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, 20)); |
|
|
|
|
northPane.add(label, BorderLayout.WEST); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
this.add(cardPane, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
public AbstractCustomFieldComboBoxPane() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected List<FurtherBasicBeanPane<? extends T>> initPaneList() { |
|
|
|
|
useFieldValuePane = createUseFieldValuePane(); |
|
|
|
|
customFieldNamePane = createCustomFieldNamePane(); |
|
|
|
|
List<FurtherBasicBeanPane<? extends T>> list = new ArrayList<FurtherBasicBeanPane<? extends T>>(); |
|
|
|
|
list.add(useFieldValuePane); |
|
|
|
|
list.add(paneWrapper()); |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private FurtherBasicBeanPane<? extends T> paneWrapper() { |
|
|
|
|
FurtherBasicBeanPane pane = new FurtherBasicBeanPane() { |
|
|
|
|
nameOrValue = new UIButtonGroup<Boolean>( |
|
|
|
|
new String[]{useFieldValuePane.title4PopupWindow(), customFieldNamePane.title4PopupWindow()}, |
|
|
|
|
new Boolean[]{false, true}); |
|
|
|
|
nameOrValue.setSelectedItem(false); |
|
|
|
|
nameOrValue.addChangeListener(new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public String title4PopupWindow() { |
|
|
|
|
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
checkCardPane(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"), nameOrValue); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean accept(Object ob) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void reset() { |
|
|
|
|
} |
|
|
|
|
cardLayout = new CardLayout(); |
|
|
|
|
cardPane = new JPanel(cardLayout); |
|
|
|
|
cardPane.add(useFieldValuePane, useFieldValuePane.title4PopupWindow()); |
|
|
|
|
cardPane.add(customFieldNamePane, customFieldNamePane.title4PopupWindow()); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(Object ob) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object updateBean() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
pane.setLayout(new BorderLayout(0, 6)); |
|
|
|
|
pane.add(customFieldNamePane, BorderLayout.CENTER); |
|
|
|
|
return pane; |
|
|
|
|
this.setLayout(new BorderLayout(0, 6)); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
this.add(cardPane, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected abstract AbstractUseFieldValuePane createUseFieldValuePane(); |
|
|
|
|
|
|
|
|
|
protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane(); |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean valueComboBoxHasNone() { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void checkBoxUse(boolean hasUse) { |
|
|
|
|
jcb.setEnabled(hasUse); |
|
|
|
|
nameOrValue.setEnabled(hasUse); |
|
|
|
|
useFieldValuePane.checkBoxUse(hasUse); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -122,6 +97,19 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
|
|
|
|
|
fieldList = columnNameList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkCardPane() { |
|
|
|
|
cardLayout.show(cardPane, nameOrValue.getSelectedItem() ? customFieldNamePane.title4PopupWindow() : useFieldValuePane.title4PopupWindow()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateNameOrValue(boolean b) { |
|
|
|
|
nameOrValue.setSelectedItem(b); |
|
|
|
|
checkCardPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean updateNameOrValue() { |
|
|
|
|
return nameOrValue.getSelectedItem(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateCustomFieldNamePane(T t) { |
|
|
|
|
customFieldNamePane.populateBean(t); |
|
|
|
|
} |
|
|
|
@ -138,6 +126,16 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
|
|
|
|
|
useFieldValuePane.updateBean(t); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public T updateBean() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> { |
|
|
|
|
private UIComboBox series; |
|
|
|
|
private UIComboBox value; |
|
|
|
@ -169,11 +167,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
|
|
|
|
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function}, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double[] columnSize = {78, 122}; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
|
|
|
|
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
|
JPanel panel = DataLayoutHelper.createDataLayoutPane(components); |
|
|
|
|
|
|
|
|
|
this.setLayout(new BorderLayout(0, 6)); |
|
|
|
|
this.add(panel, BorderLayout.CENTER); |
|
|
|
@ -258,5 +252,10 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
|
|
|
|
|
protected Object[] createLine() { |
|
|
|
|
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|