Package com.diffplug.common.swt
Class OnePerWidget<WidgetType extends Widget,T>
java.lang.Object
com.diffplug.common.swt.OnePerWidget<WidgetType,T>
Maintains a cache of values which are mapped to SWT widgets. The
cache is automatically updated as these widgets are disposed.
Useful for implementing resource managers, such as
ColorPool
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
create
(WidgetType ctl) Creates a new object for the control.forWidget
(WidgetType ctl) Returns the object for the given control.static <WidgetType extends Widget,
T>
OnePerWidget<WidgetType,T> Creates a OnePerWidget instance where objects are created using the given function.
-
Constructor Details
-
OnePerWidget
public OnePerWidget()
-
-
Method Details
-
from
public static <WidgetType extends Widget,T> OnePerWidget<WidgetType,T> from(Function<? super WidgetType, ? extends T> creator) Creates a OnePerWidget instance where objects are created using the given function. -
forWidget
Returns the object for the given control. -
create
Creates a new object for the control.
-