From 49e23ae96eec8cfe1df818db2782b613417183d1 Mon Sep 17 00:00:00 2001 From: zheng Date: Sat, 29 Sep 2018 16:10:52 +0800 Subject: [PATCH] =?UTF-8?q?CHART-3122=20=E6=B5=81=E5=90=91=E5=9C=B0?= =?UTF-8?q?=E7=90=83=E4=B8=8D=E6=94=AF=E6=8C=81=E8=B6=85=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/extended/chart/ExtendedOtherPane.java | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java index a92e100e5..31aa2d003 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java @@ -16,22 +16,24 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.Component; +import java.util.Arrays; /** * Created by shine on 2018/3/12. */ -public class ExtendedOtherPane extends AbstractChartAttrPane { +public class ExtendedOtherPane extends AbstractChartAttrPane { private ExtendedChartHyperLinkPane hyperLinkPane; private UIButtonGroup refreshEnabled; private UISpinner autoRefreshTime; private JPanel contentPane; - protected AbstractChart getAbstractChart(Chart chart) { - if (chart != null && chart instanceof AbstractChart) { - return (AbstractChart) chart; + private T chart; + + protected void setChart(Chart chart) { + if (chart instanceof AbstractChart) { + this.chart = (T) chart; } - return null; } @Override @@ -40,7 +42,7 @@ public class ExtendedOtherPane extends AbstractChartAttrPane { return; } - AbstractChart chart = getAbstractChart(collection.getSelectedChart()); + setChart(collection.getSelectedChart()); if (chart != null) { hyperLinkPane.populateBean(chart); @@ -57,7 +59,7 @@ public class ExtendedOtherPane extends AbstractChartAttrPane { return; } - AbstractChart chart = getAbstractChart(collection.getSelectedChart()); + setChart(collection.getSelectedChart()); if (chart != null) { hyperLinkPane.updateBean(chart); @@ -77,16 +79,20 @@ public class ExtendedOtherPane extends AbstractChartAttrPane { double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; - double[] rowSize = {p, p, p, p, p, p}; - - Component[][] components = new Component[][]{ - new Component[]{createRefreshPane(), null}, - new Component[]{createHyperlinkPane(), null} - }; + Component[][] components = getComponents(createRefreshPane(), createHyperlinkPane()); + double[] rowSize = new double[components.length]; + Arrays.fill(rowSize, p); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + protected Component[][] getComponents(JPanel refresh, JPanel hyperlink) { + return new Component[][]{ + new Component[]{refresh, null}, + new Component[]{hyperlink, null} + }; + } + @Override public String getIconPath() { return null;