From 55ce7416233fe7bc9f589306b30b37f9fe462eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Sun, 28 Jun 2020 15:50:46 +0800 Subject: [PATCH] =?UTF-8?q?CHART-13666=20=E8=87=AA=E5=8A=A8=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/chart/AutoChartDialog.java | 11 +++++++++++ .../java/com/fr/design/chart/AutoChartTypePane.java | 12 ++++++++++-- .../main/java/com/fr/design/chart/ChartDialog.java | 11 ++++++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java b/designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java index 058e070452..34dacfa902 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java +++ b/designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java @@ -7,6 +7,9 @@ import com.fr.chartx.TwoTuple; import com.fr.design.i18n.Toolkit; import com.fr.plugin.chart.vanchart.VanChart; +import javax.swing.JList; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import java.awt.Component; import java.awt.Dialog; import java.awt.Frame; @@ -33,6 +36,14 @@ public class AutoChartDialog extends ChartDialog { protected Component initCenterPane() { autoChartTypePane = new AutoChartTypePane(); + getOk().setEnabled(false); + + autoChartTypePane.registsListAction(new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent e) { + getOk().setEnabled(((JList) e.getSource()).getSelectedIndex() >= 0); + } + }); return autoChartTypePane; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java index 1d827c00f5..b7974fb6e9 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java @@ -13,7 +13,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.GeneralUtils; @@ -31,6 +30,7 @@ import javax.swing.JSplitPane; import javax.swing.ListCellRenderer; import javax.swing.SwingWorker; import javax.swing.UIManager; +import javax.swing.event.ListSelectionListener; import javax.swing.plaf.SplitPaneUI; import javax.swing.plaf.basic.BasicSplitPaneUI; import java.util.ArrayList; @@ -159,6 +159,10 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent } } + public void registsListAction(ListSelectionListener listSelectionListener) { + chartViewList.addListSelectionListener(listSelectionListener); + } + private void refreshBox() { TableDataWrapper dataWrap = tableNameComboBox.getSelectedItem(); @@ -225,12 +229,12 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent } } catch (Exception e) { if (!(e instanceof CancellationException)) { - connectionBar.close(); FineLoggerFactory.getLogger().error(e.getMessage(), e); FineJOptionPane.showMessageDialog(AutoChartTypePane.this, e.getMessage(), Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } } finally { + connectionBar.close(); refreshButton.setEnabled(true); } } @@ -254,6 +258,10 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent map.put(dataField, true); } dataFieldBox.setSelectedValues(map); + if (refreshButton.isEnabled()) { + refreshButton.setEnabled(false); + calculateAutoChart(); + } } public void update(ChartCollection cc, String createTime) { diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java index b2d273a603..4cd00e5772 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java @@ -48,6 +48,9 @@ public class ChartDialog extends MiddleChartDialog { this.setLayout(new BorderLayout()); setTitle(getDialogTitle()); + ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")); + cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); + this.applyClosingAction(); this.applyEscapeAction(); this.setBasicDialogSize(BasicDialog.DEFAULT); @@ -57,9 +60,6 @@ public class ChartDialog extends MiddleChartDialog { buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); this.add(buttonPane, BorderLayout.SOUTH); - ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")); - cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel")); - ok.addActionListener(getActionListener(createTime)); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -91,6 +91,11 @@ public class ChartDialog extends MiddleChartDialog { }; } + + public UIButton getOk() { + return ok; + } + /** * 不处理 */