X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Fwidgets%2FStyledControl.java;h=1814131f4b39d5f8bc32dc73a572512ec2d405fb;hb=be5b6f089e1562db7344d70ff019c3f564b308c7;hp=0455d2cdc9e1f0669b8e5eecd521f1a5c53c83d3;hpb=4f6cfbd6862813e917883ea93e13ee95edc1c024;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 0455d2cdc..1814131f4 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 @@ -39,11 +39,17 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants protected abstract Control createControl(Composite box, String style); - protected Composite createBox(Composite parent) { - Composite box = new Composite(parent, SWT.INHERIT_DEFAULT); + protected Composite createBox() { + Composite box = new Composite(container, SWT.INHERIT_DEFAULT); + setContainerLayoutData(box); + box.setLayout(CmsUiUtils.noSpaceGridLayout(3)); + return box; + } + + protected Composite createContainer() { + Composite box = new Composite(this, SWT.INHERIT_DEFAULT); setContainerLayoutData(box); box.setLayout(CmsUiUtils.noSpaceGridLayout()); - // new Label(box, SWT.NONE).setText("BOX"); return box; } @@ -91,10 +97,10 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants control = createControl(box, style); setControlLayoutData(control); -// control.getParent().setData(STYLE, style + "_box"); - EclipseUiSpecificUtils.setStyleData(control.getParent(), style + "_box"); -// control.getParent().getParent().setData(STYLE, style + "_container"); - EclipseUiSpecificUtils.setStyleData(control.getParent().getParent(), style + "_container"); + if (style != null) { + CmsUiUtils.style(box, style + "_box"); + CmsUiUtils.style(container, style + "_container"); + } } /** To be overridden */ @@ -111,8 +117,8 @@ public abstract class StyledControl extends JcrComposite implements CmsConstants if (deep) { for (Control control : getChildren()) control.dispose(); - container = createBox(this); - box = createBox(container); + container = createContainer(); + box = createBox(); } else { control.dispose(); }