Browse Source
Merge in DESIGN/design from ~STARRYI/design:REPORT-58744/release/11.0 to release/11.0 * commit 'fcaf293f105fdf6efcf3686549fd33ec0a311c34': REPORT-58744 【主题切换】撤销操作后,样式设置不符合预期 REPORT-58744 【主题切换】撤销操作后,样式设置不符合预期bugfix/11.0
starryi
3 years ago
11 changed files with 130 additions and 54 deletions
@ -0,0 +1,47 @@ |
|||||||
|
package com.fr.design.gui.frpane; |
||||||
|
|
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.Container; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Starryi |
||||||
|
* @version 1.0 |
||||||
|
* Created by Starryi on 2021/9/17 |
||||||
|
*/ |
||||||
|
public class AttributeChangeUtils { |
||||||
|
private static AbstractAttrNoScrollPane findNearestAttrNoScrollPaneAncestor(Component c) { |
||||||
|
for(Container p = c.getParent(); p != null; p = p.getParent()) { |
||||||
|
if (p instanceof AbstractAttrNoScrollPane) { |
||||||
|
return (AbstractAttrNoScrollPane) p; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static void changeComposedUI(Component composedComponent, boolean fireMiddleStateChanged, UIChangeAction action) { |
||||||
|
AbstractAttrNoScrollPane attrPane = findNearestAttrNoScrollPaneAncestor(composedComponent); |
||||||
|
boolean oldAutoFire = true; |
||||||
|
|
||||||
|
if (!fireMiddleStateChanged) { |
||||||
|
// 禁止属性面板自动处理属性更新
|
||||||
|
if (attrPane != null) { |
||||||
|
oldAutoFire = attrPane.isAutoFireAttributesChanged(); |
||||||
|
attrPane.setAutoFireAttributesChanged(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 更新UI
|
||||||
|
action.changeComposedUI(); |
||||||
|
|
||||||
|
if (!fireMiddleStateChanged) { |
||||||
|
// 恢复属性面板自动处理属性更新
|
||||||
|
if (attrPane != null) { |
||||||
|
attrPane.setAutoFireAttributesChanged(oldAutoFire); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public interface UIChangeAction { |
||||||
|
void changeComposedUI(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue