From 2d0177c6cce1ddde8bd3d6f01c28bb3411fd2c27 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 26 Jul 2017 10:37:11 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3348=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=95=B0=E6=8D=AE=E5=88=97=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8A=A8=E6=80=81=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dscolumn/DSColumnBasicEditorPane.java | 33 ++++++++----- .../cellquick/CellDSColumnEditor.java | 48 +++++++++---------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java b/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java index 2c7b0d311..a04397c7b 100644 --- a/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java +++ b/designer/src/com/fr/design/dscolumn/DSColumnBasicEditorPane.java @@ -31,19 +31,6 @@ public class DSColumnBasicEditorPane extends CellEditorPane { this.add(this.createContentPane(), BorderLayout.CENTER); } - private JPanel createContentPane() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {p, f}; - double[] rowSize = {p, p}; - Component[][] components = new Component[][]{ - //数据集列选择 - new Component[]{this.dataPane, null}, - //数据分组设置 - new Component[]{this.groupPane, null} - }; - return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - } @Override public String getIconPath() { @@ -68,4 +55,24 @@ public class DSColumnBasicEditorPane extends CellEditorPane { dataPane.populate(null, cellElement); groupPane.populate(cellElement); } + + + /** + * 创建有内容的面板显示信息 + * + * @return content JPanel + */ + private JPanel createContentPane() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {p, f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + //数据集列选择 + new Component[]{this.dataPane, null}, + //数据分组设置 + new Component[]{this.groupPane, null} + }; + return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + } } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 32ed44d0a..de5cf5167 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -92,12 +92,14 @@ public class CellDSColumnEditor extends CellQuickEditor { } /** + * 创建面板占位 + * * @return JComponent 详细信息面板 */ @Override public JComponent createCenterBody() { - this.initPaneList(); - this.initSwitchTab(); + this.createPanes(); + this.createSwitchTab(); dsColumnRegion = new JPanel(new BorderLayout()); dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); dsColumnRegion.add(center, BorderLayout.CENTER); @@ -107,12 +109,20 @@ public class CellDSColumnEditor extends CellQuickEditor { } /** - * TODO 内容全部重新动态生成,不然容易出错 + * 内容全部重新动态生成,不然容易出错 * 刷新详细信息面板 */ @Override protected void refreshDetails() { + this.createPanes(); + this.createSwitchTab(); + dsColumnRegion = new JPanel(new BorderLayout()); + dsColumnRegion.add(tabsHeaderIconPane, BorderLayout.NORTH); + dsColumnRegion.add(center, BorderLayout.CENTER); + //必须removeAll之后再添加;重新再实例化一个centerJPanel,因为对象变了会显示不出来 + centerPane.removeAll(); + centerPane.add(dsColumnRegion, BorderLayout.CENTER); for (CellEditorPane cellEditorPane : paneList) { cellEditorPane.populate(cellElement); } @@ -129,25 +139,11 @@ public class CellDSColumnEditor extends CellQuickEditor { centerPane = null; } - /** - * 初始化数据列基本和高级设置面板 - */ - private void initPaneList() { - paneList = new ArrayList<>(); - - paneList.add(this.initBasicPane()); - paneList.add(this.initAdvancedPane()); - - /* - todo 预留插件的接口 - doSomething() - */ - } /** * 初始化基本和高级设置切换tab */ - private void initSwitchTab() { + private void createSwitchTab() { String[] iconArray = new String[paneList.size()]; card = new CardLayout(); center = new JPanel(card); @@ -166,17 +162,21 @@ public class CellDSColumnEditor extends CellQuickEditor { tabsHeaderIconPane.setNeedLeftRightOutLine(false); } - private DSColumnBasicEditorPane initBasicPane() { + /** + * 刷新数据列基本和高级设置面板 + */ + private void createPanes() { + paneList = new ArrayList<>(); + /*基本设置面板*/ this.dataPane = new SelectedDataColumnPane(false); this.groupPane = new ResultSetGroupDockingPane(tc); dataPane.addListener(dataListener); groupPane.addListener(groupListener); - return new DSColumnBasicEditorPane(cellElement, dataPane, groupPane); - } + paneList.add(new DSColumnBasicEditorPane(cellElement, dataPane, groupPane)); - private DSColumnAdvancedEditorPane initAdvancedPane() { - return new DSColumnAdvancedEditorPane(); - } + /*高级设置面板*/ + paneList.add(new DSColumnAdvancedEditorPane()); + } } \ No newline at end of file