X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Fwidgets%2FStyledControl.java;h=5dde1f63708e161a26428521d8749924341f52e1;hb=632b55e1fdf15316fd5a460e98b547aa1d49d66f;hp=1814131f4b39d5f8bc32dc73a572512ec2d405fb;hpb=5e3263b18866736c3973cb2654c72fa4e549df05;p=lgpl%2Fargeo-commons.git 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 1814131f4..5dde1f637 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 @@ -47,10 +47,10 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants } protected Composite createContainer() { - Composite box = new Composite(this, SWT.INHERIT_DEFAULT); - setContainerLayoutData(box); - box.setLayout(CmsUiUtils.noSpaceGridLayout()); - return box; + Composite container = new Composite(this, SWT.INHERIT_DEFAULT); + setContainerLayoutData(container); + container.setLayout(CmsUiUtils.noSpaceGridLayout()); + return container; } public Control getControl() { @@ -67,8 +67,7 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants // int height = control.getSize().y; String style = (String) EclipseUiSpecificUtils.getStyleData(control); clear(false); - control = createControl(box, style); - setControlLayoutData(control); + refreshControl(style); // add the focus listener to the newly created edition control if (focusListener != null) @@ -80,8 +79,13 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants editing = false; String style = (String) EclipseUiSpecificUtils.getStyleData(control); clear(false); + refreshControl(style); + } + + protected void refreshControl(String style) { control = createControl(box, style); setControlLayoutData(control); + getParent().layout(true, true); } public void setStyle(String style) { @@ -91,11 +95,8 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants if (currentStyle != null && currentStyle.equals(style)) return; - // Integer preferredHeight = control != null ? control.getSize().y : - // null; clear(true); - control = createControl(box, style); - setControlLayoutData(control); + refreshControl(style); if (style != null) { CmsUiUtils.style(box, style + "_box");