Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package javafx.beans.property; 027 028import javafx.collections.ObservableList; 029 030/** 031 * This class provides a full implementation of a {@link Property} wrapping an 032 * {@code ObservableList}. 033 * 034 * @see ListPropertyBase 035 * 036 * @param <E> the type of the {@code List} elements 037 */ 038public class SimpleListProperty<E> extends ListPropertyBase<E> { 039 040 private static final Object DEFAULT_BEAN = null; 041 private static final String DEFAULT_NAME = ""; 042 043 private final Object bean; 044 private final String name; 045 046 /** 047 * {@inheritDoc} 048 */ 049 @Override 050 public Object getBean() { 051 return bean; 052 } 053 054 /** 055 * {@inheritDoc} 056 */ 057 @Override 058 public String getName() { 059 return name; 060 } 061 062 /** 063 * The constructor of {@code SimpleListProperty} 064 */ 065 public SimpleListProperty() { 066 this(DEFAULT_BEAN, DEFAULT_NAME); 067 } 068 069 /** 070 * The constructor of {@code SimpleListProperty} 071 * 072 * @param initialValue 073 * the initial value of the wrapped value 074 */ 075 public SimpleListProperty(ObservableList<E> initialValue) { 076 this(DEFAULT_BEAN, DEFAULT_NAME, initialValue); 077 } 078 079 /** 080 * The constructor of {@code SimpleListProperty} 081 * 082 * @param bean 083 * the bean of this {@code SetProperty} 084 * @param name 085 * the name of this {@code SetProperty} 086 */ 087 public SimpleListProperty(Object bean, String name) { 088 this.bean = bean; 089 this.name = (name == null) ? DEFAULT_NAME : name; 090 } 091 092 /** 093 * The constructor of {@code SimpleListProperty} 094 * 095 * @param bean 096 * the bean of this {@code ListProperty} 097 * @param name 098 * the name of this {@code ListProperty} 099 * @param initialValue 100 * the initial value of the wrapped value 101 */ 102 public SimpleListProperty(Object bean, String name, ObservableList<E> initialValue) { 103 super(initialValue); 104 this.bean = bean; 105 this.name = (name == null) ? DEFAULT_NAME : name; 106 } 107 108}