From b16381acf9f4ff57bbf261337be849658825e6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 27 Nov 2019 17:01:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?CHART-11446=20=E6=9C=AA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=81=B0=E5=8C=96=E4=BA=86combox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/chartx/component/MultiComboBoxPane.java | 10 +++++++++- .../component/MultiComboBoxPaneWithUISpinner.java | 10 +++++++++- .../fields/diff/MultiCategoryDataSetFieldsPane.java | 8 +++++++- .../chartx/fields/diff/MultiPieDataSetFieldsPane.java | 8 +++++++- .../java/com/fr/design/chartx/single/DataSetPane.java | 5 +++-- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java index f1716a0ae..2ed4b10ff 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPane.java @@ -14,10 +14,16 @@ import java.util.List; public class MultiComboBoxPane extends AbstractMultiComponentPane { private List currentBoxItems = new ArrayList(); + private boolean hasUse = false; + public void setCurrentBoxItems(List currentBoxItems) { this.currentBoxItems = currentBoxItems; } + public void setHasUse(boolean hasUse) { + this.hasUse = hasUse; + } + @Override protected UIComboBox createFirstFieldComponent() { return new UIComboBoxWithNone(); @@ -25,7 +31,9 @@ public class MultiComboBoxPane extends AbstractMultiComponentPane { @Override protected UIComboBox createOtherFieldComponent() { - return new UIComboBox(currentBoxItems.toArray(new Object[currentBoxItems.size()])); + UIComboBox uiComboBox = new UIComboBox(currentBoxItems.toArray(new Object[currentBoxItems.size()])); + uiComboBox.setEnabled(hasUse); + return uiComboBox; } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java index 8b20768e2..1b77d163e 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java @@ -13,6 +13,8 @@ import java.util.List; public class MultiComboBoxPaneWithUISpinner extends AbstractMultiComponentPaneWithUISpinner { private List currentBoxList = new ArrayList(); + private boolean hasUse = false; + @Override protected void initComps() { currentBoxList = new ArrayList(); @@ -23,9 +25,15 @@ public class MultiComboBoxPaneWithUISpinner extends AbstractMultiComponentPaneWi this.currentBoxList = currentBoxList; } + public void setHasUse(boolean hasUse) { + this.hasUse = hasUse; + } + @Override protected UIComboBox createJComponent() { - return new UIComboBox(currentBoxList.toArray(new Object[currentBoxList.size()])); + UIComboBox uiComboBox = new UIComboBox(currentBoxList.toArray(new Object[currentBoxList.size()])); + uiComboBox.setEnabled(hasUse); + return uiComboBox; } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java index 911db920c..b028a0b55 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiCategoryDataSetFieldsPane.java @@ -9,8 +9,8 @@ import com.fr.design.gui.icombobox.UIComboBox; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JSeparator; -import java.awt.BorderLayout; import java.util.List; +import java.awt.BorderLayout; /** @@ -49,6 +49,12 @@ public class MultiCategoryDataSetFieldsPane extends AbstractDataSetFieldsWithSer return list.toArray(new UIComboBox[list.size()]); } + @Override + public void checkBoxUse(boolean hasUse) { + super.checkBoxUse(hasUse); + multiCategoryPane.setHasUse(hasUse); + } + @Override public void refreshBoxListWithSelectTableData(List columnNameList) { super.refreshBoxListWithSelectTableData(columnNameList); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java index e18686616..26f623e37 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MultiPieDataSetFieldsPane.java @@ -16,9 +16,9 @@ import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.SwingConstants; +import java.util.List; import java.awt.BorderLayout; import java.awt.Component; -import java.util.List; /** * Created by shine on 2019/6/18. @@ -90,6 +90,12 @@ public class MultiPieDataSetFieldsPane extends AbstractDataSetFieldsPane { this.setLayout(new BorderLayout()); this.add(tableDataPane, BorderLayout.NORTH); this.add(dataSetFieldsPane, BorderLayout.CENTER); + checkBoxUse(); } /** From 18f0756d586e39d3e32907f14b3f2cd3b6226010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 27 Nov 2019 17:25:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?CHART-11446=20=E6=9C=AA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E7=81=B0=E5=8C=96=E4=BA=86combox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartx/component/AbstractMultiComponentPane.java | 8 ++++++-- .../AbstractMultiComponentPaneWithUISpinner.java | 8 ++++++-- .../fr/design/chartx/component/MultiComboBoxPane.java | 9 +-------- .../component/MultiComboBoxPaneWithUISpinner.java | 10 +--------- .../chartx/fields/AbstractDataSetFieldsPane.java | 6 +++--- .../fields/diff/MultiCategoryDataSetFieldsPane.java | 2 +- .../chartx/fields/diff/MultiPieDataSetFieldsPane.java | 2 +- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java index 6474cad0b..f82e4b253 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPane.java @@ -10,13 +10,13 @@ import com.fr.general.IOUtils; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; +import java.util.ArrayList; +import java.util.List; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; /** @@ -168,4 +168,8 @@ public abstract class AbstractMultiComponentPane extends J updateField(comboBox, temp); } } + + public void checkEnable(boolean hasUse){ + addButton.setEnabled(hasUse); + } } diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java index 5f0e6500b..f784c4a86 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/AbstractMultiComponentPaneWithUISpinner.java @@ -11,10 +11,10 @@ import com.fr.stable.AssistUtils; import javax.swing.JComponent; import javax.swing.JPanel; -import java.awt.BorderLayout; -import java.awt.Component; import java.util.ArrayList; import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by shine on 2019/6/18. @@ -148,4 +148,8 @@ public abstract class AbstractMultiComponentPaneWithUISpinner { private List currentBoxItems = new ArrayList(); - private boolean hasUse = false; public void setCurrentBoxItems(List currentBoxItems) { this.currentBoxItems = currentBoxItems; } - public void setHasUse(boolean hasUse) { - this.hasUse = hasUse; - } - @Override protected UIComboBox createFirstFieldComponent() { return new UIComboBoxWithNone(); @@ -31,9 +26,7 @@ public class MultiComboBoxPane extends AbstractMultiComponentPane { @Override protected UIComboBox createOtherFieldComponent() { - UIComboBox uiComboBox = new UIComboBox(currentBoxItems.toArray(new Object[currentBoxItems.size()])); - uiComboBox.setEnabled(hasUse); - return uiComboBox; + return new UIComboBox(currentBoxItems.toArray(new Object[currentBoxItems.size()])); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java index 1b77d163e..8b20768e2 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MultiComboBoxPaneWithUISpinner.java @@ -13,8 +13,6 @@ import java.util.List; public class MultiComboBoxPaneWithUISpinner extends AbstractMultiComponentPaneWithUISpinner { private List currentBoxList = new ArrayList(); - private boolean hasUse = false; - @Override protected void initComps() { currentBoxList = new ArrayList(); @@ -25,15 +23,9 @@ public class MultiComboBoxPaneWithUISpinner extends AbstractMultiComponentPaneWi this.currentBoxList = currentBoxList; } - public void setHasUse(boolean hasUse) { - this.hasUse = hasUse; - } - @Override protected UIComboBox createJComponent() { - UIComboBox uiComboBox = new UIComboBox(currentBoxList.toArray(new Object[currentBoxList.size()])); - uiComboBox.setEnabled(hasUse); - return uiComboBox; + return new UIComboBox(currentBoxList.toArray(new Object[currentBoxList.size()])); } @Override diff --git a/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java b/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java index 82cc89a62..9e8848ebc 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java @@ -17,10 +17,10 @@ import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; -import java.awt.BorderLayout; -import java.awt.Component; import java.util.Arrays; import java.util.List; +import java.awt.BorderLayout; +import java.awt.Component; import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems; @@ -95,7 +95,7 @@ public abstract class AbstractDataSetFieldsPane Date: Wed, 27 Nov 2019 17:34:50 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1,=20sonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/chartx/CustomChartDataPane.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java b/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java index 9ff8fd28c..197a1c1c9 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/CustomChartDataPane.java @@ -41,6 +41,9 @@ import java.util.Map; */ public class CustomChartDataPane extends ChartDataPane { + private static final int HGAP = 0; + private static final int VGAP = 6; + public CustomChartDataPane(AttributeChangeListener listener) { super(listener); } @@ -93,9 +96,11 @@ public class CustomChartDataPane extends ChartDataPane { case BUBBLE: return new SingleDataPane(new ScatterDataSetFieldsPane(), new ScatterCellDataFieldsPane()); default: - return StringUtils.equals(CustomStyle.CUSTOM.toString(), plot.getCustomType()) ? - new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()) : - new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + if (StringUtils.equals(CustomStyle.CUSTOM.toString(), plot.getCustomType())){ + return new SingleDataPane(new SingleCategoryDataSetFieldsPane(), new SingleCategoryCellDataFieldsPane()); + } else { + return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane()); + } } } @@ -147,7 +152,7 @@ public class CustomChartDataPane extends ChartDataPane { JPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, getBackground())); tabPanel.add(tabPane, BorderLayout.CENTER); - this.setLayout(new BorderLayout(0, 6)); + this.setLayout(new BorderLayout(HGAP, VGAP)); this.add(tabPanel, BorderLayout.NORTH); this.add(centerPane, BorderLayout.CENTER); }