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 028/** 029 * This class provides a full implementation of a {@link Property} wrapping a 030 * {@code boolean} value. 031 * 032 * @see BooleanPropertyBase 033 * 034 */ 035public class SimpleBooleanProperty extends BooleanPropertyBase { 036 037 private static final Object DEFAULT_BEAN = null; 038 private static final String DEFAULT_NAME = ""; 039 040 private final Object bean; 041 private final String name; 042 043 /** 044 * {@inheritDoc} 045 */ 046 @Override 047 public Object getBean() { 048 return bean; 049 } 050 051 /** 052 * {@inheritDoc} 053 */ 054 @Override 055 public String getName() { 056 return name; 057 } 058 059 /** 060 * The constructor of {@code BooleanProperty} 061 */ 062 public SimpleBooleanProperty() { 063 this(DEFAULT_BEAN, DEFAULT_NAME); 064 } 065 066 /** 067 * The constructor of {@code BooleanProperty} 068 * 069 * @param initialValue 070 * the initial value of the wrapped value 071 */ 072 public SimpleBooleanProperty(boolean initialValue) { 073 this(DEFAULT_BEAN, DEFAULT_NAME, initialValue); 074 } 075 076 /** 077 * The constructor of {@code BooleanProperty} 078 * 079 * @param bean 080 * the bean of this {@code BooleanProperty} 081 * @param name 082 * the name of this {@code BooleanProperty} 083 */ 084 public SimpleBooleanProperty(Object bean, String name) { 085 this.bean = bean; 086 this.name = (name == null) ? DEFAULT_NAME : name; 087 } 088 089 /** 090 * The constructor of {@code BooleanProperty} 091 * 092 * @param bean 093 * the bean of this {@code BooleanProperty} 094 * @param name 095 * the name of this {@code BooleanProperty} 096 * @param initialValue 097 * the initial value of the wrapped value 098 */ 099 public SimpleBooleanProperty(Object bean, String name, boolean initialValue) { 100 super(initialValue); 101 this.bean = bean; 102 this.name = (name == null) ? DEFAULT_NAME : name; 103 } 104 105}