From ef86abec5ae2a96c5d27acc2d895c98cbf132453 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 8 Oct 2021 09:42:58 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-63310=20=E5=B7=B2=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=9A=84=E6=97=A0=E8=BE=B9=E6=A1=86tab=E5=9D=97=E5=9C=A8?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E5=86=85=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E5=90=8E=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90=E4=BA=86=E9=BB=98=E8=AE=A4=E9=BB=91?= =?UTF-8?q?=E8=89=B2=E8=BE=B9=E6=A1=86=20&=20REPORT-59963=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4Tab=E5=9D=97=E6=A0=B7=E5=BC=8F=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4Tab=E6=A0=87=E9=A2=98=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 11.0上修复了一个相同的问题REPORT-59963,需要在10.0 上也提交下 调整Tab块样式导致样式刷新时,标题栏的样式均被初始化 【改动思路】 1. Tab组件虽然在样式面板上没有设置标题样式的设置项,即 TitlePacker,但依然使用了标题样式相关的字段,如背景, 是否显示标题栏等,这些标题相关的字段不能在调整样式时被重置, 所以需要在Tab的StylePane中始终保持 2. Tab组件的样式数据初始化应该在数据模型层完成 --- .../creator/cardlayout/XWCardLayout.java | 18 ------------------ .../gui/xpane/CardTagLayoutStylePane.java | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index e1d4a416e7..578b509ec0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -62,10 +62,6 @@ public class XWCardLayout extends XLayoutContainer { public static final String DEFAULT_NAME = "cardlayout"; - - //默认蓝色标题背景 - private static final Color TITLE_COLOR = new Color(51, 132, 240); - public XWCardLayout(WCardLayout widget, Dimension initSize) { super(widget, initSize); } @@ -399,24 +395,10 @@ public class XWCardLayout extends XLayoutContainer { @Override public void refreshStylePreviewEffect() { BorderPacker style = toData().getBorderStyle(); - initBorderTitleStyle(style); refreshBorderAndBackgroundStylePreviewEffect(); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); } - private void initBorderTitleStyle(BorderPacker style) { - //初始化默认标题样式 - if (!initFlag) { - return; - } - - style.setType(LayoutBorderStyle.TITLE); - style.setBorder(Constants.LINE_THIN); - TitlePacker widgetTitle = style.getTitle(); - widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR)); - initFlag = false; - } - //隐藏或显示标题部分 protected void clearOrShowTitleLayout(boolean isTitleStyle) { XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent(); diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java index 37db551027..ab953166cf 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java @@ -3,6 +3,8 @@ */ package com.fr.design.gui.xpane; +import com.fr.form.ui.LayoutBorderStyle; + import javax.swing.JPanel; /** @@ -10,6 +12,8 @@ import javax.swing.JPanel; */ public class CardTagLayoutStylePane extends LayoutStylePane { + private LayoutBorderStyle backupStyleFromPopulating = new LayoutBorderStyle(); + @Override protected JPanel createTitleStylePane(){ JPanel panel = super.createTitleStylePane(); @@ -21,4 +25,18 @@ public class CardTagLayoutStylePane extends LayoutStylePane { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) { return super.createBackgroundStylePane(false); } + + @Override + public void populateBean(LayoutBorderStyle style) { + this.backupStyleFromPopulating = style; + super.populateBean(style); + } + + @Override + public LayoutBorderStyle updateBean() { + LayoutBorderStyle style = super.updateBean(); + style.setTitle(backupStyleFromPopulating.getTitle()); + style.setType(backupStyleFromPopulating.getType()); + return style; + } }