Class SectionFactory


  • public final class SectionFactory
    extends org.eclipse.jface.widgets.AbstractCompositeFactory<SectionFactory,​Section>
    This class provides a convenient shorthand for creating and initializing Section. This offers several benefits over creating Section normal way: Example usage:
     Section section = SectionFactory.newSection(Section.TWISTIE | Section.DESCRIPTION) //
                    .title("My Section") //
                    .description("My section created with a factory") //
                    .onExpand(event -> sectionExpanded(event)) //
                    .create(parent);
     

    The above example creates a section with a title, a description, registers an IExpansionListener and finally creates the section in "parent".

     SectionFactory sectionFactory = SectionFactory.newSection(Section.TWISTIE);
     sectionFactory.title("Section 1").create(parent);
     sectionFactory.title("Section 2").create(parent);
     sectionFactory.title("Section 3").create(parent);
     

    The above example creates three section using the same instance of SectionFactory.

    Since:
    3.10
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SectionFactory description​(java.lang.String description)
      Sets the description text.
      SectionFactory description​(java.util.function.Function<Section,​Control> controlFunction)
      Sets a function which must provide a description control for the given Section.
      static SectionFactory newSection​(int style)
      Creates a new SectionFactory with the given style.
      SectionFactory onExpanded​(java.util.function.Consumer<ExpansionEvent> consumer)
      Creates an IExpansionListener and registers it for the expansionStateChanged event.
      SectionFactory onExpanding​(java.util.function.Consumer<ExpansionEvent> consumer)
      Creates an IExpansionListener and registers it for the expansionStateChanging event.
      SectionFactory title​(java.lang.String title)
      Sets the title of the section.
      • Methods inherited from class org.eclipse.jface.widgets.AbstractCompositeFactory

        layout
      • Methods inherited from class org.eclipse.jface.widgets.AbstractControlFactory

        background, enabled, font, foreground, layoutData, orientation, supplyLayoutData, tooltip
      • Methods inherited from class org.eclipse.jface.widgets.AbstractWidgetFactory

        addProperty, cast, create, data
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait