import javax.jcr.Item;
+import org.argeo.cms.swt.CmsSwtUtils;
import org.argeo.cms.ui.CmsConstants;
-import org.argeo.cms.ui.util.CmsUiUtils;
import org.argeo.eclipse.ui.specific.EclipseUiSpecificUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusListener;
private Boolean editing = Boolean.FALSE;
+ private Composite ancestorToLayout;
+
public StyledControl(Composite parent, int swtStyle) {
super(parent, swtStyle);
- setLayout(CmsUiUtils.noSpaceGridLayout());
+ setLayout(CmsSwtUtils.noSpaceGridLayout());
}
public StyledControl(Composite parent, int style, Item item) {
protected Composite createBox() {
Composite box = new Composite(container, SWT.INHERIT_DEFAULT);
setContainerLayoutData(box);
- box.setLayout(CmsUiUtils.noSpaceGridLayout(3));
+ box.setLayout(CmsSwtUtils.noSpaceGridLayout(3));
return box;
}
protected Composite createContainer() {
Composite container = new Composite(this, SWT.INHERIT_DEFAULT);
setContainerLayoutData(container);
- container.setLayout(CmsUiUtils.noSpaceGridLayout());
+ container.setLayout(CmsSwtUtils.noSpaceGridLayout());
return container;
}
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) {
refreshControl(style);
if (style != null) {
- CmsUiUtils.style(box, style + "_box");
- CmsUiUtils.style(container, style + "_container");
+ CmsSwtUtils.style(box, style + "_box");
+ CmsSwtUtils.style(container, style + "_container");
}
}
/** To be overridden */
protected void setControlLayoutData(Control control) {
- control.setLayoutData(CmsUiUtils.fillWidth());
+ control.setLayoutData(CmsSwtUtils.fillWidth());
}
/** To be overridden */
protected void setContainerLayoutData(Composite composite) {
- composite.setLayoutData(CmsUiUtils.fillWidth());
+ composite.setLayoutData(CmsSwtUtils.fillWidth());
}
protected void clear(boolean deep) {
if (control != null && this.focusListener != null)
control.addFocusListener(focusListener);
}
+
+ public void setAncestorToLayout(Composite ancestorToLayout) {
+ this.ancestorToLayout = ancestorToLayout;
+ }
+
}