From 13944cc9344870d9778a7f44b6cf5f09aa9d2764 Mon Sep 17 00:00:00 2001 From: Starryi Date: Sat, 18 Sep 2021 15:25:22 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-59770=20=E3=80=90=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E3=80=91=E7=BC=96=E8=BE=91=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=BB=E9=A2=98=E9=85=8D=E8=89=B2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BB=A5=E5=90=8E=EF=BC=8C=E7=BB=86=E8=8A=82=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=92=8C=E6=95=B4=E4=BD=93=E9=A2=84=E8=A7=88=E9=87=8C?= =?UTF-8?q?=E7=9A=84=E9=A2=9C=E8=89=B2=E6=B2=A1=E6=9C=89=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 修复刷新界面时,触发fireChange导致数据改变的问题 【改动思路】 同上 --- .../design/mainframe/theme/TemplateThemeProfilePane.java | 2 +- .../fr/design/mainframe/theme/edit/ui/ColorListPane.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java index 7096d804cf..aef2959e35 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java @@ -111,7 +111,7 @@ public abstract class TemplateThemeProfilePane extends addAttributeChangeListener(new AttributeChangeListener() { @Override public void attributeChange() { - if (!isPopulating) { + if (!isPopulating && !refreshingThemedColor) { valueChangeAction(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java index adeca3d7a5..5c282033f0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java @@ -40,6 +40,8 @@ public class ColorListPane extends JPanel implements UIObserver { private final EventListenerList colorChangeListenerList = new EventListenerList(); private UIObserverListener uiObserverListener; + private boolean isPopulating = false; + public ColorListPane() { this(DEFAULT_COLOR_COUNT, DEFAULT_COLOR_SIZE, DEFAULT_COLOR_GAP); } @@ -61,6 +63,9 @@ public class ColorListPane extends JPanel implements UIObserver { colorButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { + if (isPopulating) { + return; + } colorList.set(index, colorButton.getSelectObject()); fireColorStateChanged(); } @@ -88,6 +93,7 @@ public class ColorListPane extends JPanel implements UIObserver { } public void populate(List colors) { + isPopulating = true; colorList.clear(); for (int i = 0; i < colors.size(); i++) { Color color = colors.get(i); @@ -96,6 +102,7 @@ public class ColorListPane extends JPanel implements UIObserver { colorButtons.get(i).setSelectObject(color); } } + isPopulating = false; } public List update() {