package com.fr.plugin.demo; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.itextfield.UITextField; import com.fr.extended.chart.AbstractExtendedChartTableDataPane; import java.awt.Component; /** * Created by shine on 2018/3/24. */ public class DemoTableDataPane extends AbstractExtendedChartTableDataPane{ private UIComboBox xComboBox; private UITextField targetName; private UIComboBox yComboBox; private UIComboBox zComboBox; @Override protected String[] fieldLabels() { return new String[]{ "X轴", "指标名", "Y轴", "Z轴" }; } @Override protected Component[] fieldComponents() { if (xComboBox == null) { xComboBox = new UIComboBox(); targetName = new UITextField(); yComboBox = new UIComboBox(); zComboBox = new UIComboBox(); } return new Component[]{ xComboBox, targetName, yComboBox, zComboBox }; } @Override protected UIComboBox[] filedComboBoxes() { if (xComboBox == null) { xComboBox = new UIComboBox(); yComboBox = new UIComboBox(); zComboBox = new UIComboBox(); } return new UIComboBox[]{ xComboBox, yComboBox, zComboBox }; } @Override protected void populate(DemoDataConfig dataConf) { populateField(xComboBox, dataConf.getX()); targetName.setText(dataConf.getTargetName()); populateField(yComboBox, dataConf.getY()); populateField(zComboBox, dataConf.getZ()); } @Override protected DemoDataConfig update() { DemoDataConfig dataConfig = new DemoDataConfig(); updateField(xComboBox, dataConfig.getX()); dataConfig.setTargetName(targetName.getText()); updateField(yComboBox, dataConfig.getY()); updateField(zComboBox, dataConfig.getZ()); return dataConfig; } }