Browse Source

REPORT-61267 【FR11】【组件背景分离】组件复用-组件标题图案的“图案相对位置”切换不生效了,只有在重新上传图案的时候才生效;“位置”也不生效

【问题原因】
UIButtonGroup在点击控件时会触发多次内部ToggleButton的fireStateChange,所以需要在所有按钮内部状态改变时,
统一只触发一次fireStateChange. UIButtonGroup也需要实现UIObserver接口,否则外部不会挂载监听器,导致
不生效。

【改动思路】
同上
bugfix/11.0
Starryi 3 years ago
parent
commit
ecce754c42
  1. 18
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

18
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -3,6 +3,8 @@ package com.fr.design.gui.ibutton;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -24,7 +26,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver { public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver, UIObserver {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final int TEXT_LENGTH = 3; private static final int TEXT_LENGTH = 3;
private static final int BUTTON_SIZE = 2; private static final int BUTTON_SIZE = 2;
@ -37,6 +39,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
private boolean isToolBarComponent = false; private boolean isToolBarComponent = false;
private boolean isClick; private boolean isClick;
private UIObserverListener uiObserverListener;
private boolean autoFireStateChanged = true; private boolean autoFireStateChanged = true;
public UIButtonGroup(String[] textArray) { public UIButtonGroup(String[] textArray) {
@ -326,6 +329,9 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
((ChangeListener) listeners[i + 1]).stateChanged(e); ((ChangeListener) listeners[i + 1]).stateChanged(e);
} }
} }
if (uiObserverListener != null) {
uiObserverListener.doChange();
}
} }
/** /**
@ -368,6 +374,16 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return true; return true;
} }
@Override
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
/** /**
* @param l * @param l

Loading…
Cancel
Save