From 1486e764cd9afc6ae092addb3c799bf4bdd365b6 Mon Sep 17 00:00:00 2001 From: zheng Date: Thu, 26 Apr 2018 09:18:47 +0800 Subject: [PATCH] =?UTF-8?q?CHART-2164=20=E6=B1=87=E6=80=BB=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E5=BC=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbstractExtendedChartTableDataPane.java | 48 +++++++++++++++---- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/designer_chart/src/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java b/designer_chart/src/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java index 4554abdd75..4c6a8e4129 100644 --- a/designer_chart/src/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java +++ b/designer_chart/src/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java @@ -2,10 +2,12 @@ package com.fr.extended.chart; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.ChartCollection; +import com.fr.data.util.function.AbstractDataFunction; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; 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; @@ -22,37 +24,57 @@ import java.util.List; */ public abstract class AbstractExtendedChartTableDataPane extends AbstractTableDataContentPane { + private CalculateComboBox function; + public AbstractExtendedChartTableDataPane() { initComponents(); } protected void initComponents() { - String[] labels = fieldLabel(); - UIComboBox[] comboBoxes = filedComboBoxes(); + String[] labels = fieldLabels(); + Component[] fieldComponents = fieldComponents(); - int len = Math.min(labels.length, comboBoxes.length); + int len = Math.min(labels.length, fieldComponents.length); - Component[][] components = new Component[len][2]; + Component[][] components = new Component[len + (hasFunction() ? 1 : 0)][2]; for (int i = 0; i < len; i++) { - UIComboBox comboBox = comboBoxes[i]; - comboBox.setPreferredSize(new Dimension(100, 20)); + Component fieldComponent = fieldComponents[i]; + fieldComponent.setPreferredSize(new Dimension(100, 20)); + + components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponent}; + } - components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), comboBox}; + if (hasFunction()) { + function = new CalculateComboBox(); + components[len] = new Component[]{new UILabel("function", SwingConstants.LEFT), function}; } double p = TableLayout.PREFERRED; double[] columnSize = {p, p}; - double[] rowSize = new double[len]; + double[] rowSize = new double[len + (hasFunction() ? 1 : 0)]; Arrays.fill(rowSize, p); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER); + this.add(addSouthPane(), BorderLayout.SOUTH); + } + + protected JPanel addSouthPane() { + return new JPanel(); + } + + protected boolean hasFunction() { + return false; + } + + protected Component[] fieldComponents() { + return filedComboBoxes(); } - protected abstract String[] fieldLabel(); + protected abstract String[] fieldLabels(); protected abstract UIComboBox[] filedComboBoxes(); @@ -70,6 +92,10 @@ public abstract class AbstractExtendedChartTableDataPane