From fafd3b57bd8294525a4310c7b90ba0ba1c2ed789 Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 6 Dec 2021 11:13:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-63760=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E6=92=A4=E9=94=80=E4=BB=A5=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=A0=B7=E5=BC=8F=E8=AE=BE=E7=BD=AE=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 背景色控件中父组件ColorBackgroundQuickPane 和子组件NewColorSelectBox内部实现,都给 NewColorSelectBox添加了监听器,导致颜色值发生 一次更改后,调用了两次回调,产生了两个UndoState 【改动思路】 ColorBackgroundQuickPane的UIObserver实现置空 --- .../backgroundpane/ColorBackgroundQuickPane.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java index 2fbdb974e..88bedf17c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java @@ -40,16 +40,15 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { return this.colorSelectBox.getSelectObject(); } - /** - * 给组件登记一个观察者监听事件 - * - * @param listener 观察者监听事件 - */ @Override - public void registerChangeListener(final UIObserverListener listener) { - this.colorSelectBox.addSelectChangeListener(new ChangeListenerImpl(listener)); + public boolean shouldResponseChangeListener() { + // NewColorSelectBox实现了UIObserver接口,这里就不要重复注册监听器了,以避免产生重复UndoState. + return false; } + @Override + public void registerChangeListener(final UIObserverListener listener) { } + @Override /** * 是否为ColorBackground 类型