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.beans.value.ObservableValue;
029import javafx.beans.value.WritableValue;
030
031/**
032 * Generic interface that defines the methods common to all (writable)
033 * properties independent of their type.
034 * 
035 * 
036 * @param <T>
037 *            the type of the wrapped value
038 */
039public interface Property<T> extends ReadOnlyProperty<T>, WritableValue<T> {
040
041    /**
042     * Create a unidirection binding for this {@code Property}.
043     * 
044     * @param observable
045     *            The observable this {@code Property} should be bound to.
046     * @throws NullPointerException
047     *             if {@code observable} is {@code null}
048     */
049    void bind(ObservableValue<? extends T> observable);
050
051    /**
052     * Remove the unidirectional binding for this {@code Property}.
053     * 
054     * If the {@code Property} is not bound, calling this method has no effect.
055     */
056    void unbind();
057
058    /**
059     * Can be used to check, if a {@code Property} is bound.
060     * 
061     * @return {@code true} if the {@code Property} is bound, {@code false}
062     *         otherwise
063     */
064    boolean isBound();
065
066    /**
067     * Create a bidirectional binding between this {@code Property} and another
068     * one.
069     * 
070     * @param other
071     *            the other {@code Property}
072     * @throws NullPointerException
073     *             if {@code other} is {@code null}
074     * @throws IllegalArgumentException
075     *             if {@code other} is {@code this}
076     */
077    void bindBidirectional(Property<T> other);
078
079    /**
080     * Remove a bidirectional binding between this {@code Property} and another
081     * one.
082     * 
083     * If no bidirectional binding between the properties exists, calling this
084     * method has no effect.
085     * 
086     * @param other
087     *            the other {@code Property}
088     * @throws NullPointerException
089     *             if {@code other} is {@code null}
090     * @throws IllegalArgumentException
091     *             if {@code other} is {@code this}
092     */
093    void unbindBidirectional(Property<T> other);
094
095}