Package org.eclipse.jface.widgets
Class CompositeFactory
java.lang.Object
org.eclipse.jface.widgets.AbstractWidgetFactory<F,C,Composite>
org.eclipse.jface.widgets.AbstractControlFactory<F,C>
org.eclipse.jface.widgets.AbstractCompositeFactory<CompositeFactory,Composite>
org.eclipse.jface.widgets.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 CompositeFactory
newComposite
(int style) Creates a new CompositeFactory with the given style.supplyLayout
(Supplier<Layout> layoutSupplier) Sets aSupplier
for the creation of layout associated with the receiver.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, 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 aSupplier
for 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
-Supplier
creating a new layout instance on every call- Returns:
- this
- Since:
- 3.22
- See Also:
-