Package org.eclipse.jface.widgets
Class AbstractControlFactory<F extends AbstractControlFactory<?,?>,C extends Control>
java.lang.Object
org.eclipse.jface.widgets.AbstractWidgetFactory<F,C,Composite>
org.eclipse.jface.widgets.AbstractControlFactory<F,C>
- Type Parameters:
F
- factoryC
- control
- Direct Known Subclasses:
AbstractCompositeFactory
,ButtonFactory
,DateTimeFactory
,LabelFactory
,LinkFactory
,SashFactory
,SashFormFactory
,SpinnerFactory
,TableFactory
,TextFactory
,TreeFactory
@NoExtend
public abstract class AbstractControlFactory<F extends AbstractControlFactory<?,?>,C extends Control>
extends AbstractWidgetFactory<F,C,Composite>
Abstract factory for controls. Factories for widgets that inherit from
Control should extend this factory to handle the properties of Control
itself, like enabled or tool tip.
- Since:
- 3.18
-
Method Summary
Modifier and TypeMethodDescriptionbackground
(Color color) Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.enabled
(boolean enabled) Enables the receiver if the argument is true, and disables it otherwise.Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.foreground
(Color color) Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.layoutData
(Object layoutData) Sets the layout data associated with the receiver to the argument.orientation
(int orientation) Sets the orientation of the receiver, which must be one of the constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT.supplyLayoutData
(Supplier<?> layoutDataSupplier) Sets aSupplier
for the creation of layout data associated with the receiver.Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown.Methods inherited from class org.eclipse.jface.widgets.AbstractWidgetFactory
addProperty, cast, create, data, data
-
Method Details
-
tooltip
Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown. The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.- Parameters:
tooltipText
- the tool tip text- Returns:
- this
- See Also:
-
enabled
Enables the receiver if the argument is true, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.- Parameters:
enabled
- the enabled state- Returns:
- this
- See Also:
-
supplyLayoutData
Sets aSupplier
for the creation of layout data associated with the receiver. The supplier should always create a new instance of the layoutData in order to make this factory reusable, because each and every control needs its own unique layoutData.GridDataFactory gridDataFactory = GridDataFactory.fillDefaults().grab(true, false); ButtonFactory.newButton(SWT.PUSH).supplyLayoutData(gridDataFactory::create);
or without GridDataFactory:ButtonFactory.newButton(SWT.PUSH).supplyLayoutData(GridData::new);
- Parameters:
layoutDataSupplier
-Supplier
creating a new layout data instance on every call- Returns:
- this
- See Also:
-
layoutData
Sets the layout data associated with the receiver to the argument. Sufficient for one time usage of this factory.GridData gd = new GridData(GridData.FILL_BOTH); ButtonFactory.newButton(SWT.PUSH).layoutData(gd);
In case this factory should be reused several time consider the usage of
supplyLayoutData(Supplier)
.- Parameters:
layoutData
- the layout data for the receiver.- Returns:
- this
- See Also:
-
font
Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.- Parameters:
font
- the font- Returns:
- this
- See Also:
-
foreground
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.- Parameters:
color
- the color- Returns:
- this
- See Also:
-
background
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.- Parameters:
color
- the color- Returns:
- this
- See Also:
-
orientation
Sets the orientation of the receiver, which must be one of the constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT.- Parameters:
orientation
- the orientation style- Returns:
- this
- See Also:
-