From: Mathieu Baudier Date: Fri, 22 Jan 2021 10:36:16 +0000 (+0100) Subject: Add ancestor to refresh. X-Git-Tag: argeo-commons-2.1.91~13 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=10aaa7aff828d944077aa2016be1987f2ed47fa8 Add ancestor to refresh. --- diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java index 5dde1f637..b413faf3e 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/widgets/StyledControl.java @@ -24,6 +24,8 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants private Boolean editing = Boolean.FALSE; + private Composite ancestorToLayout; + public StyledControl(Composite parent, int swtStyle) { super(parent, swtStyle); setLayout(CmsUiUtils.noSpaceGridLayout()); @@ -81,11 +83,14 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants clear(false); refreshControl(style); } - + protected void refreshControl(String style) { control = createControl(box, style); setControlLayoutData(control); - getParent().layout(true, true); + if (ancestorToLayout != null) + ancestorToLayout.layout(true, true); + else + getParent().layout(true, true); } public void setStyle(String style) { @@ -140,4 +145,9 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants if (control != null && this.focusListener != null) control.addFocusListener(focusListener); } + + public void setAncestorToLayout(Composite ancestorToLayout) { + this.ancestorToLayout = ancestorToLayout; + } + }