changeset 4212:51cabebc81a9

RT-31460: Allow VirtualContainerBase and derived classes to use a pre-existing instance of a subclass of VirtualFlow
author jgiles
date Mon, 08 Jul 2013 17:58:02 +1200
parents d6d09c8c7236
children 1788f06e4db6
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualContainerBase.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualContainerBase.java	Fri Jul 05 12:02:56 2013 +1200
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/VirtualContainerBase.java	Mon Jul 08 17:58:02 2013 +1200
@@ -46,7 +46,7 @@
 
     public VirtualContainerBase(final C control, B behavior) {
         super(control, behavior);
-        flow = new VirtualFlow<I>();
+        flow = createVirtualFlow();
         
         control.addEventHandler(ScrollToEvent.scrollToTopIndex(), new EventHandler<ScrollToEvent<Integer>>() {
             @Override public void handle(ScrollToEvent<Integer> event) {
@@ -79,6 +79,14 @@
     public abstract I createCell();
 
     /**
+     * This enables skin subclasses to provide a custom VirtualFlow implementation,
+     * rather than have VirtualContainerBase instantiate the default instance.
+     */
+    protected VirtualFlow<I> createVirtualFlow() {
+        return new VirtualFlow<I>();
+    }
+
+    /**
      * Returns the total number of items in this container, including those
      * that are currently hidden because they are out of view.
      */