Class AbstractWidgetFactory<F extends AbstractWidgetFactory<?,?,?>,W extends Widget,P extends Widget>

java.lang.Object
org.eclipse.jface.widgets.AbstractWidgetFactory<F,W,P>
Type Parameters:
F - factory
W - widget
P - parent
Direct Known Subclasses:
AbstractControlFactory, AbstractItemFactory

@NoExtend public abstract class AbstractWidgetFactory<F extends AbstractWidgetFactory<?,?,?>,W extends Widget,P extends Widget> extends Object
Abstract factory for widgets. Factories for widgets that inherit from Widget should extend this factory to handle creation of widgets and setting all the properties.
Since:
3.18
  • Method Details

    • cast

      protected final F cast(AbstractWidgetFactory<F,W,P> factory)
      Casts to the concrete instance of factory class. Needs to be called by abstract factory classes.
      Parameters:
      factory - extending WidgetFactory, usually "this"
      Returns:
      casted factory
    • create

      public final W create(P parent)
      Returns:
      this
    • addProperty

      protected final void addProperty(Property<W> property)
      Adds a property like image, text, enabled, listeners, ... to the widget.
      Example:
       public LabelFactory text(String text) {
              addProperty(l -> l.setText(text));
              return this;
       }
       
      Parameters:
      property - usually a lambda
    • data

      public F data(Object data)
      Sets the application defined widget data associated with the receiver to be the argument. The widget data is a single, unnamed field that is stored with every widget.
      Parameters:
      data - the widget data
      Returns:
      this
      Since:
      3.21
      See Also:
    • data

      public F data(String key, Object value)
      Sets the application defined property of the receiver with the specified name to the given value.
      Parameters:
      key - the name of the property
      value - the new value for the property
      Returns:
      this
      Since:
      3.33
      See Also: