From 476d3965398362b3a3b4f203a3a10466f6ccc2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 28 Jul 2020 14:21:00 +0800 Subject: [PATCH] =?UTF-8?q?CHART-9760=20=E7=B3=BB=E5=88=97=E5=90=8D?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../table/SeriesNameUseFieldValuePane.java | 5 +- .../data/table/SeriesTypeUseComboxPane.java | 125 +++++++++++++----- .../chart/gui/style/ThirdTabPane.java | 12 +- 3 files changed, 97 insertions(+), 45 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java index aab267c545..37dcdebf47 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java @@ -14,15 +14,16 @@ 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.utils.gui.GUICoreUtils; +import com.fr.extended.chart.UIComboBoxWithNone; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.List; /** * 属性表 数据集 系列名使用 系列值 界面. @@ -38,7 +39,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane { +public class SeriesTypeUseComboxPane extends BasicBeanPane { private SeriesNameUseFieldValuePane nameFieldValuePane; private SeriesNameUseFieldNamePane nameFieldNamePane; @@ -39,50 +40,100 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane { private ChartDataPane parent; private Plot initplot; - private boolean isNeedSummary = true; + private boolean isNeedSummary; + + protected UIButtonGroup content; + protected JPanel cardPane; public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) { this.initplot = initplot; this.parent = parent; - cards = initPaneList(); this.isNeedSummary = true; initComponents(); } + protected void initComponents() { + nameFieldValuePane = createValuePane(); + nameFieldNamePane = createNamePane(); + + cardPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (content.getSelectedIndex() == 0) { + return nameFieldValuePane.getPreferredSize(); + } else { + return nameFieldNamePane.getPreferredSize(); + } + } + }; + cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow()); + cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow()); + + content = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()}); + + addItemChangeEvent(); + + initLayout(); + content.setSelectedIndex(0); + } + + private void addItemChangeEvent() { + content.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + + } + }); + } + + protected void checkCardPane() { + comboBoxItemStateChanged(); + CardLayout cl = (CardLayout) cardPane.getLayout(); + if (content.getSelectedIndex() == 0) { + cl.show(cardPane, nameFieldValuePane.title4PopupWindow()); + } else { + cl.show(cardPane, nameFieldNamePane.title4PopupWindow()); + } + } + protected void initLayout() { this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); JPanel northPane = new JPanel(new BorderLayout(4, 0)); - UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); + UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); - northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); + JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, label1, null}); + northPane.add(borderLayoutPane); northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15)); cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); this.add(northPane, BorderLayout.NORTH); this.add(cardPane, BorderLayout.CENTER); - dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); - JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); - panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); - dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); + dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); + JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane); + panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15)); + dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.add(panel, BorderLayout.SOUTH); } - protected UIComboBox createComboBox() { - UIComboBox uiComboBox = new UIComboBox(); - UIComponentUtils.setPreferedWidth(uiComboBox, 100); - return uiComboBox; + public Dimension getPreferredSize() { + Dimension preferredSize = super.getPreferredSize(); + return new Dimension(260, (int) preferredSize.getHeight()); } + /** * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 + * * @param hasUse 是否使用 */ public void checkUseBox(boolean hasUse) { - jcb.setEnabled(hasUse); + content.setEnabled(hasUse); nameFieldValuePane.checkUse(hasUse); dataScreeningPane.checkBoxUse(); } /** * 切换 变更数据集时, 刷新Box选中项目 + * * @param list 列表 */ public void refreshBoxListWithSelectTableData(List list) { @@ -93,28 +144,20 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane { /** * 清空所有的box设置 */ - public void clearAllBoxList(){ + public void clearAllBoxList() { nameFieldValuePane.clearAllBoxList(); nameFieldNamePane.clearAllBoxList(); } /** * 界面标题 + * * @return 界面标题 */ protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"); } - @Override - protected List> initPaneList() { - nameFieldValuePane = createValuePane(); - nameFieldNamePane = createNamePane(); - List> paneList = new ArrayList>(); - paneList.add(nameFieldValuePane); - paneList.add(nameFieldNamePane); - return paneList; - } protected SeriesNameUseFieldValuePane createValuePane() { return new SeriesNameUseFieldValuePane(); @@ -135,15 +178,17 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane { nameFieldNamePane.populateBean(ob, isNeedSummary); } dataScreeningPane.populateBean(ob, isNeedSummary); + checkCardPane(); } /** * 重新布局整个面板 + * * @param isNeedSummary 是否需要汇总 */ public void relayoutPane(boolean isNeedSummary) { this.isNeedSummary = isNeedSummary; - if (jcb.getSelectedIndex() == 0) { + if (this.getSelectedIndex() == 0) { nameFieldValuePane.relayoutPane(this.isNeedSummary); } else { nameFieldNamePane.relayoutPane(this.isNeedSummary); @@ -152,9 +197,8 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane { } - @Override protected void comboBoxItemStateChanged() { - if (jcb.getSelectedIndex() == 0) { + if (this.getSelectedIndex() == 0) { nameFieldValuePane.relayoutPane(this.isNeedSummary); } else { nameFieldNamePane.relayoutPane(this.isNeedSummary); @@ -178,4 +222,21 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane { dataScreeningPane.updateBean(ob); } + /** + * 保存数据 + * + * @return 待保存的对象 + */ + public ChartCollection updateBean() { + return null; + } + + + public int getSelectedIndex() { + return content.getSelectedIndex(); + } + + public void setSelectedIndex(int index) { + content.setSelectedIndex(index); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java index a0580ba468..a58a889164 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java @@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import javax.swing.JPanel; import javax.swing.border.Border; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; @@ -20,7 +21,6 @@ import java.awt.Graphics2D; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.List; public abstract class ThirdTabPane extends BasicBeanPane{ @@ -74,16 +74,6 @@ public abstract class ThirdTabPane extends BasicBeanPane{ } } - @Override - public void paint(Graphics g) { - super.paint(g); - if (!paneList.isEmpty()) { - Graphics2D g2d = (Graphics2D)g; - g2d.setColor(UIConstants.LINE_COLOR); - g2d.drawLine(getWidth() - 2, tabPane.getPreferredSize().height, getWidth() - 2, getHeight() - 1); - } - } - protected void initLayout() { this.setLayout(new BorderLayout()); if (!paneList.isEmpty()) {