modules/base/src/test/java/test/javafx/collections/TestedObservableLists.java

Print this page
rev 9235 : 8134760: Refactor Javafx base module tests for clear separation of tests
Reviewed-by:


   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 
  26 package javafx.collections;
  27 
  28 import com.sun.javafx.collections.VetoableListDecorator;
  29 
  30 import java.util.ArrayList;
  31 import java.util.LinkedList;
  32 import java.util.List;
  33 import javafx.beans.property.SimpleListProperty;


  34 
  35 public interface TestedObservableLists {
  36 
  37     Callable<ObservableList<String>> ARRAY_LIST = () -> FXCollections.observableList(new ArrayList<String>());
  38 
  39     Callable<ObservableList<String>> LINKED_LIST = () -> FXCollections.observableList(new LinkedList<String>());
  40 
  41     Callable<ObservableList<String>> VETOABLE_LIST = () -> new VetoableListDecorator<String>(FXCollections.<String>observableArrayList()) {
  42 
  43         @Override
  44         protected void onProposedChange(List list, int[] idx) { }
  45     };
  46 
  47     Callable<ObservableList<String>> CHECKED_OBSERVABLE_ARRAY_LIST = () -> FXCollections.checkedObservableList(FXCollections.observableList(new ArrayList()), String.class);
  48 
  49     Callable<ObservableList<String>> SYNCHRONIZED_OBSERVABLE_ARRAY_LIST = () -> FXCollections.synchronizedObservableList(FXCollections.observableList(new ArrayList<String>()));
  50     
  51     Callable<ObservableList<String>> OBSERVABLE_LIST_PROPERTY = () -> new SimpleListProperty<>(FXCollections.observableList(new ArrayList<String>()));
  52     
  53 }


   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 
  26 package test.javafx.collections;
  27 
  28 import com.sun.javafx.collections.VetoableListDecorator;
  29 
  30 import java.util.ArrayList;
  31 import java.util.LinkedList;
  32 import java.util.List;
  33 import javafx.beans.property.SimpleListProperty;
  34 import javafx.collections.FXCollections;
  35 import javafx.collections.ObservableList;
  36 
  37 public interface TestedObservableLists {
  38 
  39     Callable<ObservableList<String>> ARRAY_LIST = () -> FXCollections.observableList(new ArrayList<String>());
  40 
  41     Callable<ObservableList<String>> LINKED_LIST = () -> FXCollections.observableList(new LinkedList<String>());
  42 
  43     Callable<ObservableList<String>> VETOABLE_LIST = () -> new VetoableListDecorator<String>(FXCollections.<String>observableArrayList()) {
  44 
  45         @Override
  46         protected void onProposedChange(List list, int[] idx) { }
  47     };
  48 
  49     Callable<ObservableList<String>> CHECKED_OBSERVABLE_ARRAY_LIST = () -> FXCollections.checkedObservableList(FXCollections.observableList(new ArrayList()), String.class);
  50 
  51     Callable<ObservableList<String>> SYNCHRONIZED_OBSERVABLE_ARRAY_LIST = () -> FXCollections.synchronizedObservableList(FXCollections.observableList(new ArrayList<String>()));
  52     
  53     Callable<ObservableList<String>> OBSERVABLE_LIST_PROPERTY = () -> new SimpleListProperty<>(FXCollections.observableList(new ArrayList<String>()));
  54     
  55 }