From f8cd4e13c5161888fd12066277551b915b07475f Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 5 Sep 2017 19:16:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=9B=B4=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/impl/AbstractIndependentChartUI.java | 3 +- ...bstractIndependentChartUIWithAPILevel.java | 3 +- .../fun/impl/AbstractIndependentChartsUI.java | 2 +- .../design/mainframe/ChartPropertyPane.java | 10 +--- .../mainframe/MiddleChartPropertyPane.java | 60 ++++++++++--------- .../design/mainframe/chart/ChartEditPane.java | 13 +--- .../mainframe/chart/ChartsEditPane.java | 9 --- 7 files changed, 43 insertions(+), 57 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java index b5cd25a7f5..848fc44367 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.chart.ChartsConfigPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; +import com.fr.stable.StableUtils; /** @@ -57,7 +58,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr return new DataSeriesConditionPane(); } - public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();} + public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} public ChartsConfigPane getChartConfigPane(String plotID){return null;} diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java index cd8dbdcfcd..8aa412a6e3 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java @@ -12,6 +12,7 @@ import com.fr.design.mainframe.chart.ChartsConfigPane; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.general.ComparatorUtils; +import com.fr.stable.StableUtils; /** * Created by Mitisky on 16/3/7. @@ -68,7 +69,7 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ return getPlotTypePane().title4PopupWindow(); } - public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();} + public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} public ChartsConfigPane getChartConfigPane(String plotID){return null;} } diff --git a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java index 703852c206..fbd3ce36f1 100644 --- a/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java +++ b/designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java @@ -97,7 +97,7 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple @Override public ChartEditPane getChartEditPane(String plotID) { - return ChartsEditPane.getInstance(); + return new ChartsEditPane(); } } \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java index 64e2c0f79f..868fefbf76 100644 --- a/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java @@ -14,10 +14,9 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ * 创建图表属性表实例. */ private synchronized static ChartPropertyPane getInstance() { + //todo //创建新图表时,创建属性表配置面板 - if (singleton == null) { - singleton = new ChartPropertyPane(); - } + singleton = new ChartPropertyPane(); return singleton; } @@ -31,15 +30,12 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{ return new Dimension(super.getPreferredSize().width, 18); } }; - nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); + nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 1, 0)); nameLabel.setHorizontalAlignment(SwingConstants.CENTER); } @Override protected void createMainPane() { - this.removeAll(); - createNameLabel(); - this.add(createNorthComponent(), BorderLayout.NORTH); this.add(chartEditPane, BorderLayout.CENTER); } diff --git a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java index 5548e1ba79..4ddd8740c2 100644 --- a/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java +++ b/designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java @@ -15,6 +15,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.general.Inter; +import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; @@ -29,11 +30,14 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ public MiddleChartPropertyPane() { initComponenet(); } - + protected void initComponenet() { this.setLayout(new BorderLayout()); this.setBorder(null); - chartEditPane = ChartEditPane.getInstance(); + + createNameLabel(); + this.add(createNorthComponent(), BorderLayout.NORTH); + chartEditPane = StableUtils.construct(ChartEditPane.class); chartEditPane.setSupportCellData(true); } @@ -43,11 +47,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ this.createMainPane(); setSureProperty(); } - + protected abstract void createNameLabel(); - + protected abstract JComponent createNorthComponent(); - + protected abstract void createMainPane(); @@ -63,7 +67,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ nameLabel.setText(Inter.getLocText("Chart-Property_Table") + (tabname != null ? ('-' + chartEditPane.getSelectedTabName()) : "")); resetChartEditPane(); } - + protected void resetChartEditPane() { remove(chartEditPane); add(chartEditPane, BorderLayout.CENTER); @@ -71,20 +75,20 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ repaint(); revalidate(); } - + protected TitleChangeListener titleListener = new TitleChangeListener() { - + @Override public void fireTitleChange(String addName) { nameLabel.setText(Inter.getLocText("Chart-Property_Table") + '-' + addName); } }; - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ public void populateChartPropertyPane(ChartCollection collection, TargetComponent ePane) { addChartEditPane(collection.getSelectedChart().getPlot().getPlotID()); setSupportCellData(true); @@ -92,11 +96,11 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ chartEditPane.populate(collection); } - /** - * 感觉ChartCollection加载图表属性界面. - * @param collection 收集图表 - * @param ePane 面板 - */ + /** + * 感觉ChartCollection加载图表属性界面. + * @param collection 收集图表 + * @param ePane 面板 + */ public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent ePane) { if (collection instanceof ChartCollection) { populateChartPropertyPane((ChartCollection)collection, ePane); @@ -123,18 +127,18 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ return BaseUtils.readIcon("/com/fr/design/images/m_report/qb.png"); } - /** - * 预定义定位 - * @return 定位 - */ + /** + * 预定义定位 + * @return 定位 + */ public Location preferredLocation() { return Location.WEST_BELOW; } - /** - * 创建标题Panel - * @return 标题panel - */ + /** + * 创建标题Panel + * @return 标题panel + */ public UITitlePanel createTitlePanel() { return new UITitlePanel(this); } @@ -144,9 +148,9 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{ */ public void refreshDockingView() { // TODO Auto-generated method stub - + } - + /** * 设置是否支持单元格数据. */ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java index 5784293d1f..fed9d2a824 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java @@ -33,15 +33,6 @@ import java.util.List; public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider { - public synchronized static ChartEditPane getInstance() { - if (singleton == null) { - singleton = new ChartEditPane(); - } - return singleton; - } - - private static ChartEditPane singleton; - private final static int CHANGE_MIN_TIME = 80; protected ChartCollection collection; @@ -351,7 +342,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4 DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); - attrPane.refreshChartDataPane(collection); + if (attrPane.isShowing()) { + attrPane.refreshChartDataPane(collection); + } } }); } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java b/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java index 87873cfd85..3f35c585dc 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java @@ -13,15 +13,6 @@ import java.util.ArrayList; public class ChartsEditPane extends ChartEditPane { protected ChartsConfigPane chartsConfigPane; - private static ChartEditPane single; - - public synchronized static ChartEditPane getInstance() { - if (single == null) { - single = new ChartsEditPane(); - } - return single; - } - public ChartsEditPane() { this.setLayout(new BorderLayout());