1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javafx.scene.control.skin;
  26 
  27 import com.sun.javafx.scene.control.VirtualScrollBar;
  28 import javafx.collections.ObservableList;
  29 import javafx.scene.Node;
  30 import javafx.scene.control.IndexedCell;
  31 import javafx.scene.layout.StackPane;
  32 
  33 public class VirtualFlowShim<T extends IndexedCell> extends VirtualFlow<T> {
  34 
  35     public final ArrayLinkedList<T> cells = super.cells;
  36     public final ObservableList<Node> sheetChildren = super.sheetChildren;
  37 
  38     @Override
  39     public double getViewportLength() {
  40         return super.getViewportLength();
  41     }
  42 
  43     @Override
  44     public void setViewportLength(double value) {
  45         super.setViewportLength(value);
  46     }
  47 
  48     @Override
  49     public double getCellLength(int index) {
  50         return super.getCellLength(index);
  51     }
  52 
  53     @Override
  54     public void recreateCells() {
  55         super.recreateCells();
  56     }
  57 
  58     public double shim_getMaxPrefBreadth() {
  59         return super.getMaxPrefBreadth();
  60     }
  61 
  62     public VirtualScrollBar shim_getHbar() {
  63         return super.getHbar();
  64     }
  65 
  66     public VirtualScrollBar shim_getVbar() {
  67         return super.getVbar();
  68     }
  69 
  70     public ClippedContainer get_clipView() {
  71         return super.clipView;
  72     }
  73 
  74     public double get_clipView_getWidth() {
  75         return super.clipView.getWidth();
  76     }
  77 
  78     public double get_clipView_getHeight() {
  79         return super.clipView.getHeight();
  80     }
  81 
  82 
  83     public StackPane get_corner() {
  84         return super.corner;
  85     }
  86 
  87     public T get_accumCell() {
  88         return super.accumCell;
  89     }
  90 
  91     @Override
  92     public boolean addTrailingCells(boolean fillEmptyCells) {
  93         return super.addTrailingCells(fillEmptyCells);
  94     }
  95 
  96     @Override
  97     public void addLeadingCells(int currentIndex, double startOffset) {
  98         super.addLeadingCells(currentIndex, startOffset);
  99     }
 100 
 101     //------------------- statics --------------------
 102 
 103     public static <T> T cells_getFirst(VirtualFlow.ArrayLinkedList<T> list) {
 104         return list.getFirst();
 105     }
 106 
 107     public static <T> T cells_getLast(VirtualFlow.ArrayLinkedList<T> list) {
 108         return list.getLast();
 109     }
 110 
 111     public static <T> T cells_get(VirtualFlow.ArrayLinkedList<T> list, int i) {
 112         return list.get(i);
 113     }
 114 
 115     public static int cells_size(VirtualFlow.ArrayLinkedList<?> list) {
 116         return list.size();
 117     }
 118 
 119 
 120 
 121     public static class ArrayLinkedListShim<T> extends VirtualFlow.ArrayLinkedList<T> {
 122 
 123         @Override
 124         public T getFirst() {
 125             return super.getFirst();
 126         }
 127 
 128         @Override
 129         public T getLast() {
 130             return super.getLast();
 131         }
 132 
 133         @Override
 134         public void addFirst(T cell) {
 135             super.addFirst(cell);
 136         }
 137 
 138         @Override
 139         public void addLast(T cell) {
 140             super.addLast(cell);
 141         }
 142 
 143         @Override
 144         public int size() {
 145             return super.size();
 146         }
 147 
 148         @Override
 149         public boolean isEmpty() {
 150             return super.isEmpty();
 151         }
 152 
 153         @Override
 154         public T get(int index) {
 155             return super.get(index);
 156         }
 157 
 158         @Override
 159         public void clear() {
 160             super.clear();
 161         }
 162 
 163         @Override
 164         public T removeFirst() {
 165             return super.removeFirst();
 166         }
 167 
 168         @Override
 169         public T removeLast() {
 170             return super.removeLast();
 171         }
 172 
 173         @Override
 174         public T remove(int index) {
 175             return super.remove(index);
 176         }
 177 
 178     }
 179 
 180 }