public ContentComposite(Composite parent, int style, Content item) {
super(parent, style);
- setData(item);
+ if (item != null)
+ setData(item);
+ }
+
+ public boolean hasContent() {
+ if (getData() == null)
+ return false;
+ return getData() instanceof Content;
}
public Content getContent() {
this(section, section, style, node);
}
+ public SwtSection(SwtSection section, int style) {
+ this(section, style, null);
+ }
+
protected SwtSection(Composite parent, SwtSection parentSection, int style, Content node) {
super(parent, style, node);
this.parentSection = parentSection;
- if (parentSection != null) {
+ if (parentSection != null && hasContent() && parentSection.hasContent()) {
relativeDepth = getProvidedContent().getDepth() - parentSection.getProvidedContent().getDepth();
} else {
relativeDepth = 0;