From 93f7fb7396b4b27c05dd2867709d1227b3b63bce Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 19:59:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-55554=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-mac=E4=B8=8A=EF=BC=8C=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E7=9A=84=E9=BB=98=E8=AE=A4=E5=AD=97=E4=BD=93?= =?UTF-8?q?=20=E5=92=8C=20=E5=8D=95=E5=85=83=E6=A0=BC=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=AD=97=E4=BD=93=20=E4=B8=8D=E6=98=AF=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=AD=97=E4=BD=93=EF=BC=9Bwindows=E8=BF=99=E8=BE=B9=E6=98=AF?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E7=9A=84=EF=BC=8C=E9=83=BD=E6=98=AF=E5=AE=8B?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 LayoutStyle中的默认标题字体确实和单元格的默认字体一致,但是字体控件的默认字体并不一致。 正常控件在拖拽到面板上是,会调用样式面板的LayoutStylePane.populate(LayoutBorderStyle) 方法,根据组件的样式数据,更新样式面板,所以最终样式面板中标题字体是和LayoutStyle中默认字体 一致,也就是和单元格默认字体一致。 但复用组件拖拽到面板上后,右侧栏实际上还是组件商城,需要点击一下右侧栏的组件设置按钮才能实例化 和初始化样式面板,就因为这点击了一下(设计器总体的问题,右侧栏的任何操作都被认为是UI发生了更新, 需要同步到数据模型),导致代码中调用了LayoutStylePane.update,从右侧栏的样式面板获取样式 数据,再设置到组件上,而右侧栏的字体控件默认值和单元格默认字体不一致,所以出现了问题。 【改动思路】 在字体控件实例化的时候,直接使用空的默认样式中的标题字体初始化它,保证UI和数据模型一致 --- .../java/com/fr/design/gui/xpane/LayoutStylePane.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index c0ad60ad4..3144e572f 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -215,6 +215,15 @@ public class LayoutStylePane extends BasicBeanPane { titleTextPane = new TinyFormulaPane(); titleFontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + TitlePacker title = style.getTitle(); + if (title != null) { + FRFont frFont = title.getFrFont(); + if (frFont != null) { + String fontFamily = frFont.getFamily(); + // 使用style中默认的字体初始化titleFontFamilyComboBox,保证UI和数据的一致性 + this.titleFontFamilyComboBox.setSelectedItem(fontFamily); + } + } titleFontFamilyComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family")); titleFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); From 006ae3f93654c74121787bf120021014d4ce1aa6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 20:34:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-55715=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E9=A2=9C=E8=89=B2=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E5=92=8C=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=87=8C=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=9C=B0=E6=96=B9=E7=9A=84=E9=A2=9C=E8=89=B2=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=99=A8=E4=B8=8D=E5=A4=AA=E4=B8=80=E6=A0=B7=EF=BC=8C?= =?UTF-8?q?=E7=9C=8B=E8=B5=B7=E6=9D=A5=E6=9C=89=E7=82=B9=E5=A5=87=E6=80=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 新颜色选择框的右侧Button与UIComboBox右侧的Button风格不一致,导致视觉上开起来不和谐; 而且因为因为新颜色选择框右侧Button背景为白色边框为灰色,而UIComboBox边框和背景都为灰色, 所以即使给颜色选择框和UIComboBox相同的宽度,看起来也不没有对齐 【改动思路】 统一下颜色选择框的右侧按钮显示效果,保持与UIComboBox中右侧按钮一致 --- .../fr/design/style/AbstractSelectBox.java | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 8b727e099..1d66094f1 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -10,16 +10,20 @@ import java.awt.RenderingHints; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import javax.swing.AbstractButton; import javax.swing.JPanel; import javax.swing.border.AbstractBorder; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; +import javax.swing.plaf.ButtonUI; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.stable.Constants; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.style.background.BackgroundJComponent; +import com.fr.stable.Constants; /** * @author kunsnat E-mail:kunsnat@gmail.com @@ -29,7 +33,7 @@ import com.fr.design.style.background.BackgroundJComponent; public abstract class AbstractSelectBox extends AbstractPopBox implements MouseListener { private static final long serialVersionUID = 2355250206956896774L; - private UIToggleButton triggleButton; + private UIButton triggleButton; protected void initBox(int preWidth) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -37,8 +41,34 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent = new BackgroundJComponent(); displayComponent.setEmptyBackground(); displayComponent.setBorder(new TriggleLineBorder()); - triggleButton = new UIToggleButton(UIConstants.ARROW_DOWN_ICON); + triggleButton = new UIButton(UIConstants.ARROW_DOWN_ICON) { + public boolean shouldResponseChangeListener() { + return false; + } + + @Override + public ButtonUI getUI() { + return new UIButtonUI() { + @Override + protected boolean isPressed(AbstractButton b) { + return model.isArmed() && model.isPressed(); + } + + @Override + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL); + } + } + }; + } + }; triggleButton.setPreferredSize(new Dimension(20, 20)); + triggleButton.setRoundBorder(true, Constants.LEFT); JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); displayPane.add(displayComponent, BorderLayout.CENTER);