From 64ea27b9225f47c65efb91b88771f43b142e231d Mon Sep 17 00:00:00 2001 From: yaohwu Date: Wed, 27 May 2020 10:32:49 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-31454=20=E5=B1=95=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=A0=91-=E4=BA=A4=E4=BA=92=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=EF=BC=88=E9=9D=9Ecptx=E4=B8=8D=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E8=AF=A5=E9=9D=A2=E6=9D=BF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/CellExpandAttrPanelProvider.java | 7 +++++++ .../AbstractCellExpandAttrPanelProvider.java | 4 ++++ .../settingpane/CellExpandExtraAttrPane.java | 19 +++++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java b/designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java index ec37e1600..fd3953564 100644 --- a/designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java @@ -18,4 +18,11 @@ public interface CellExpandAttrPanelProvider extends Mutable { * @return 创建单元格属性-扩展设置中的额外面板 */ BasicBeanPane createPanel(); + + /** + * 是否应该展示 + * + * @return return {@code true} if extra panel is displayable + */ + boolean isDisplayable(); } diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java index 3ec730862..d0b1eca5c 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java @@ -36,4 +36,8 @@ public class AbstractCellExpandAttrPanelProvider implements CellExpandAttrPanelP public BasicBeanPane createPanel() { return null; } + + public boolean isDisplayable() { + return true; + } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java index 58f11277c..e5c7d3095 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellExpandExtraAttrPane.java @@ -73,6 +73,7 @@ public class CellExpandExtraAttrPane extends JPanel { } public void populate(TemplateCellElement cellElement) { + refreshExtraPanel(); this.cellElement = cellElement; if (extras != null) { for (BasicBeanPane extra : extras) { @@ -91,6 +92,13 @@ public class CellExpandExtraAttrPane extends JPanel { } private void refresh() { + refreshExtraPanel(); + if (this.cellElement != null) { + this.populate(cellElement); + } + } + + private void refreshExtraPanel() { this.removeAll(); if (extras == null) { extras = new ArrayList<>(); @@ -99,9 +107,11 @@ public class CellExpandExtraAttrPane extends JPanel { Set attrProviders = ExtraDesignClassManager.getInstance().getArray(CellExpandAttrPanelProvider.MARK_STRING); if (attrProviders != null) { for (CellExpandAttrPanelProvider attrProvider : attrProviders) { - BasicBeanPane extra = attrProvider.createPanel(); - if (extra != null) { - extras.add(extra); + if (attrProvider.isDisplayable()) { + BasicBeanPane extra = attrProvider.createPanel(); + if (extra != null) { + extras.add(extra); + } } } } @@ -115,9 +125,6 @@ public class CellExpandExtraAttrPane extends JPanel { double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL}; JPanel content = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, H_GAP, V_GAP); this.add(content, BorderLayout.CENTER); - if (this.cellElement != null) { - this.populate(cellElement); - } this.validate(); this.repaint(); }