Browse Source

CHART-13666 自动推荐类型

feature/big-screen
白岳 4 years ago
parent
commit
55ce741623
  1. 11
      designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java
  2. 12
      designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java
  3. 11
      designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java

11
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.design.i18n.Toolkit;
import com.fr.plugin.chart.vanchart.VanChart; 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.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
@ -33,6 +36,14 @@ public class AutoChartDialog extends ChartDialog {
protected Component initCenterPane() { protected Component initCenterPane() {
autoChartTypePane = new AutoChartTypePane(); 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; return autoChartTypePane;
} }

12
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.gui.iprogressbar.AutoProgressBar;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -31,6 +30,7 @@ import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.event.ListSelectionListener;
import javax.swing.plaf.SplitPaneUI; import javax.swing.plaf.SplitPaneUI;
import javax.swing.plaf.basic.BasicSplitPaneUI; import javax.swing.plaf.basic.BasicSplitPaneUI;
import java.util.ArrayList; 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() { private void refreshBox() {
TableDataWrapper dataWrap = tableNameComboBox.getSelectedItem(); TableDataWrapper dataWrap = tableNameComboBox.getSelectedItem();
@ -225,12 +229,12 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
} }
} catch (Exception e) { } catch (Exception e) {
if (!(e instanceof CancellationException)) { if (!(e instanceof CancellationException)) {
connectionBar.close();
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(AutoChartTypePane.this, e.getMessage(), FineJOptionPane.showMessageDialog(AutoChartTypePane.this, e.getMessage(),
Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"));
} }
} finally { } finally {
connectionBar.close();
refreshButton.setEnabled(true); refreshButton.setEnabled(true);
} }
} }
@ -254,6 +258,10 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent
map.put(dataField, true); map.put(dataField, true);
} }
dataFieldBox.setSelectedValues(map); dataFieldBox.setSelectedValues(map);
if (refreshButton.isEnabled()) {
refreshButton.setEnabled(false);
calculateAutoChart();
}
} }
public void update(ChartCollection cc, String createTime) { public void update(ChartCollection cc, String createTime) {

11
designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java

@ -48,6 +48,9 @@ public class ChartDialog extends MiddleChartDialog {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
setTitle(getDialogTitle()); 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.applyClosingAction();
this.applyEscapeAction(); this.applyEscapeAction();
this.setBasicDialogSize(BasicDialog.DEFAULT); this.setBasicDialogSize(BasicDialog.DEFAULT);
@ -57,9 +60,6 @@ public class ChartDialog extends MiddleChartDialog {
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
this.add(buttonPane, BorderLayout.SOUTH); 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)); ok.addActionListener(getActionListener(createTime));
cancel.addActionListener(new ActionListener() { cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -91,6 +91,11 @@ public class ChartDialog extends MiddleChartDialog {
}; };
} }
public UIButton getOk() {
return ok;
}
/** /**
* 不处理 * 不处理
*/ */

Loading…
Cancel
Save