public Composite startBuildWidget( String elementName, Map<String, String> attributes, Composite container, SwtMetawidget metawidget) { // If our delegate is itself a NestedSectionLayoutDecorator, strip the section State state = getState(container, metawidget); if (getDelegate() instanceof NestedSectionLayoutDecorator) { String section = stripSection(attributes); // Stay where we are? if (section == null || (state.currentSections != null && section.equals(state.currentSections[0]))) { return delegateStartBuildWidget(elementName, attributes, container, metawidget); } // End nested LayoutDecorator's current section if (state.currentSections != null && !section.equals(state.currentSections[0])) { super.endContainerLayout(container, metawidget); } state.currentSections = new String[] {section}; // Add a heading if (!"".equals(section)) { addSectionWidget(section, 0, container, metawidget); } } else { String[] sections = getSections(attributes); // Stay where we are? if (sections.length == 0 || Arrays.equals(sections, state.currentSections)) { return delegateStartBuildWidget(elementName, attributes, container, metawidget); } // For each of the new sections... for (int level = 0; level < sections.length; level++) { String section = sections[level]; // ...that are different from our current... if ("".equals(section)) { continue; } if (state.currentSections != null && level < state.currentSections.length && section.equals(state.currentSections[level])) { continue; } // ...add a heading addSectionWidget(section, level, container, metawidget); } state.currentSections = sections; } // Add component as normal return delegateStartBuildWidget(elementName, attributes, container, metawidget); }
@Override public void startContainerLayout(Composite container, SwtMetawidget metawidget) { super.startContainerLayout(container, metawidget); container.setData(getClass().getName(), null); }