From 51b9bfb372eb7d97ce633e130ca7ea8e1035403b Mon Sep 17 00:00:00 2001 From: Starryi Date: Wed, 15 Dec 2021 11:03:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-64267=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E6=8B=96=E5=85=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=97=E4=BB=A5=E5=90=8E=EF=BC=8C=E5=8F=8C=E5=87=BB=E6=89=93?= =?UTF-8?q?=E5=BC=80=E7=82=B9=E5=87=BB=E7=A1=AE=E5=AE=9A=EF=BC=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=97=E6=B2=A1=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 FormatPane并不一定会被注册GlobalNameListener,所以需要 进行判空处理,避免抛出异常 【改动思路】 同上 --- .../fr/design/gui/style/TextFormatPane.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java index fbe63218e..7e0db6051 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java @@ -372,10 +372,20 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName * update */ public Style update(Style style) { - if (ComparatorUtils.equals(globalNameListener.getGlobalName(), "textField") - || ComparatorUtils.equals(globalNameListener.getGlobalName(), "typeComboBox") - || ComparatorUtils.equals(globalNameListener.getGlobalName(), "roundingBox")) { - return style.deriveFormat(this.update()); + return updateByGlobalNamedSetting(style); + } + + private Style updateByGlobalNamedSetting(Style style) { + if (globalNameListener != null) { + String[] alterSettingNames = new String[] {"typeComboBox", "textField", "roundingBox"}; + String globalSettingName = globalNameListener.getGlobalName(); + if (StringUtils.isNotEmpty(globalSettingName)) { + for (String alterSettingName : alterSettingNames) { + if (ComparatorUtils.equals(alterSettingName, globalSettingName)) { + return style.deriveFormat(this.update()); + } + } + } } return style; }