Class OnePerWidget<WidgetType extends Widget,​T>


  • public abstract class OnePerWidget<WidgetType extends Widget,​T>
    extends java.lang.Object
    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 
      Constructor Description
      OnePerWidget()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract T create​(WidgetType ctl)
      Creates a new object for the control.
      T forWidget​(WidgetType ctl)
      Returns the object for the given control.
      static <WidgetType extends Widget,​T>
      OnePerWidget<WidgetType,​T>
      from​(java.util.function.Function<? super WidgetType,​? extends T> creator)
      Creates a OnePerWidget instance where objects are created using the given function.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OnePerWidget

        public OnePerWidget()
    • Method Detail

      • from

        public static <WidgetType extends Widget,​T> OnePerWidget<WidgetType,​T> from​(java.util.function.Function<? super WidgetType,​? extends T> creator)
        Creates a OnePerWidget instance where objects are created using the given function.
      • forWidget

        public T forWidget​(WidgetType ctl)
        Returns the object for the given control.
      • create

        protected abstract T create​(WidgetType ctl)
        Creates a new object for the control.