Package org.eclipse.jface.widgets
Class SashFactory
java.lang.Object
org.eclipse.jface.widgets.AbstractWidgetFactory<SashFactory,Sash,Composite>
  
org.eclipse.jface.widgets.AbstractControlFactory<SashFactory,Sash>
 
org.eclipse.jface.widgets.SashFactory
This class provides a convenient shorthand for creating and initializing
 
Sash. This offers several benefits over creating Sash normal way:
 - The same factory can be used many times to create several Sash instances
- The setters on SashFactory all return "this", allowing them to be chained
- SashFactory accepts a Lambda for SelectionEvent(seeonSelect(java.util.function.Consumer<org.eclipse.swt.events.SelectionEvent>))
 Sash sash = SashFactory.newSash(SWT.HORIZONTAL) //
                .onSelect(event -> sashSelected(event)) //
                .layoutData(gridData) //
                .create(parent);
 
 The above example creates a horizontal sash, registers a SelectionListener and finally creates the sash in "parent".
 GridDataFactory gridDataFactory = GridDataFactory.swtDefaults();
 SashFactory sashFactory = SashFactory.newSash(SWT.HORIZONTAL).onSelect(event -> sashSelected(event))
                .layout(gridDataFactory::create);
 sashFactory.data("Sash 1").create(parent);
 sashFactory.data("Sash 2").create(parent);
 sashFactory.data("Sash 3").create(parent);
 
 The above example creates three sashs using the same instance of SashFactory. Note the layout method. A Supplier is used to create unique GridData for every single sash.
- Since:
- 3.21
- 
Method SummaryModifier and TypeMethodDescriptionstatic SashFactorynewSash(int style) Creates a new SashFactory with the given style.onSelect(Consumer<SelectionEvent> consumer) Creates aSelectionListenerand registers it for the widgetSelected event.Methods inherited from class org.eclipse.jface.widgets.AbstractControlFactorybackground, enabled, font, foreground, layoutData, orientation, supplyLayoutData, tooltipMethods inherited from class org.eclipse.jface.widgets.AbstractWidgetFactoryaddProperty, cast, create, data, data
- 
Method Details- 
newSashCreates a new SashFactory with the given style. Refer toSash(Composite, int)for possible styles.- Returns:
- a new SashFactory instance
 
- 
onSelectCreates aSelectionListenerand registers it for the widgetSelected event. If the receiver is selected by the user the given consumer is invoked. TheSelectionEventis passed to the consumer.- Parameters:
- consumer- the consumer whose accept method is called
- Returns:
- this
- See Also:
 
 
-