Browse Source

REPORT-59963 调整Tab块样式会导致Tab标题背景色重置

【问题原因】
调整Tab块样式导致样式刷新时,标题栏的样式均被初始化

【改动思路】
1. Tab组件虽然在样式面板上没有设置标题样式的设置项,即
TitlePacker,但依然使用了标题样式相关的字段,如背景,
是否显示标题栏等,这些标题相关的字段不能在调整样式时被重置,
所以需要在Tab的StylePane中始终保持
2. Tab组件的样式数据初始化应该在数据模型层完成
research/11.0
Starryi 3 years ago
parent
commit
652f107a25
  1. 13
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  2. 18
      designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java

13
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,19 +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) {
//初始化默认标题样式
style.setType(LayoutBorderStyle.TITLE);
style.setBorder(Constants.LINE_THIN);
TitlePacker widgetTitle = style.getTitle();
widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR));
}
//隐藏或显示标题部分
protected void clearOrShowTitleLayout(boolean isTitleStyle) {
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) this.getBackupParent();

18
designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java

@ -3,13 +3,15 @@
*/
package com.fr.design.gui.xpane;
import com.fr.form.ui.LayoutBorderStyle;
import javax.swing.JPanel;
/**
* CardTagLayoutBorderPane Pane.
*/
public class CardTagLayoutStylePane extends LayoutStylePane {
private LayoutBorderStyle backupStyleFromPopulating = new LayoutBorderStyle();
@Override
protected JPanel createNamedTitleStylePane(boolean isRootLayout) {
@ -20,4 +22,18 @@ public class CardTagLayoutStylePane extends LayoutStylePane {
protected JPanel createNamedIntegralStylePane(boolean isRootLayout, boolean supportCornerRadius) {
return super.createNamedIntegralStylePane(isRootLayout, 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;
}
}

Loading…
Cancel
Save