Package org.eclipse.jface.widgets
Class CompositeFactory
This class provides a convenient shorthand for creating and initializing
Composite. This offers several benefits over creating Composite
normal way:
- The same factory can be used many times to create several Composite instances
- The setters on CompositeFactory all return "this", allowing them to be chained
- Since:
- 3.18
-
Method Summary
Modifier and TypeMethodDescriptionstatic CompositeFactorynewComposite(int style) Creates a new CompositeFactory with the given style.supplyLayout(Supplier<Layout> layoutSupplier) Sets aSupplierfor the creation of layout associated with the receiver.Methods inherited from class org.eclipse.jface.widgets.AbstractCompositeFactory
layoutMethods inherited from class org.eclipse.jface.widgets.AbstractControlFactory
background, enabled, font, foreground, layoutData, orientation, supplyLayoutData, tooltipMethods inherited from class org.eclipse.jface.widgets.AbstractWidgetFactory
addProperty, cast, create, data, data
-
Method Details
-
newComposite
Creates a new CompositeFactory with the given style. Refer toComposite(Composite, int)for possible styles.- Returns:
- a new CompositeFactory instance
-
supplyLayout
Sets aSupplierfor the creation of layout associated with the receiver. The supplier should always create a new instance of the layout in order to make this factory reusableGridLayoutFactory gridFactory = GridLayoutFactory.fillDefaults(); CompositeFactory.newComposite(SWT.BODER).supplyLayout(gridFactory::create);
or without GridDataFactory:CompositeFactory.newComposite(SWT.BODER).supplyLayout(GridLayout::new);
- Parameters:
layoutSupplier-Suppliercreating a new layout instance on every call- Returns:
- this
- Since:
- 3.22
- See Also:
-