001 /*
002 * SPDX-License-Identifier: Apache-2.0
003 *
004 * Copyright 2008-2017 the original author or authors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package griffon.javafx.beans.binding;
019
020 import javafx.beans.InvalidationListener;
021 import javafx.beans.binding.BooleanBinding;
022 import javafx.beans.binding.StringBinding;
023 import javafx.beans.property.BooleanProperty;
024 import javafx.beans.property.ObjectProperty;
025 import javafx.beans.property.Property;
026 import javafx.beans.value.ChangeListener;
027 import javafx.beans.value.ObservableBooleanValue;
028 import javafx.beans.value.ObservableValue;
029
030 import javax.annotation.Nonnull;
031
032 import static java.util.Objects.requireNonNull;
033
034 /**
035 * @author Andres Almiray
036 * @since 2.11.0
037 */
038 public class BooleanPropertyDecorator extends BooleanProperty {
039 private final BooleanProperty delegate;
040
041 public BooleanPropertyDecorator(@Nonnull BooleanProperty delegate) {
042 this.delegate = requireNonNull(delegate, "Argument 'delegate' must not be null");
043 }
044
045 @Nonnull
046 protected final BooleanProperty getDelegate() {
047 return delegate;
048 }
049
050 @Override
051 public void setValue(Boolean v) {
052 delegate.setValue(v);
053 }
054
055 @Override
056 public void bindBidirectional(Property<Boolean> other) {
057 delegate.bindBidirectional(other);
058 }
059
060 @Override
061 public void unbindBidirectional(Property<Boolean> other) {
062 delegate.unbindBidirectional(other);
063 }
064
065 @Override
066 public boolean equals(Object o) {
067 return this == o || delegate.equals(o);
068 }
069
070 @Override
071 public int hashCode() {
072 return delegate.hashCode();
073 }
074
075 @Override
076 public String toString() {
077 return getClass().getName() + ":" + delegate.toString();
078 }
079
080 @Override
081 public ObjectProperty<Boolean> asObject() {
082 return delegate.asObject();
083 }
084
085 @Override
086 public Boolean getValue() {
087 return delegate.getValue();
088 }
089
090 @Override
091 public BooleanBinding and(ObservableBooleanValue other) {
092 return delegate.and(other);
093 }
094
095 @Override
096 public BooleanBinding or(ObservableBooleanValue other) {
097 return delegate.or(other);
098 }
099
100 @Override
101 public BooleanBinding not() {
102 return delegate.not();
103 }
104
105 @Override
106 public BooleanBinding isEqualTo(ObservableBooleanValue other) {
107 return delegate.isEqualTo(other);
108 }
109
110 @Override
111 public BooleanBinding isNotEqualTo(ObservableBooleanValue other) {
112 return delegate.isNotEqualTo(other);
113 }
114
115 @Override
116 public StringBinding asString() {
117 return delegate.asString();
118 }
119
120 @Override
121 public boolean get() {
122 return delegate.get();
123 }
124
125 @Override
126 public void addListener(ChangeListener<? super Boolean> listener) {
127 delegate.addListener(listener);
128 }
129
130 @Override
131 public void removeListener(ChangeListener<? super Boolean> listener) {
132 delegate.removeListener(listener);
133 }
134
135 @Override
136 public void addListener(InvalidationListener listener) {
137 delegate.addListener(listener);
138 }
139
140 @Override
141 public void removeListener(InvalidationListener listener) {
142 delegate.removeListener(listener);
143 }
144
145 @Override
146 public Object getBean() {
147 return delegate.getBean();
148 }
149
150 @Override
151 public String getName() {
152 return delegate.getName();
153 }
154
155 @Override
156 public void bind(ObservableValue<? extends Boolean> observable) {
157 delegate.bind(observable);
158 }
159
160 @Override
161 public void unbind() {
162 delegate.unbind();
163 }
164
165 @Override
166 public boolean isBound() {
167 return delegate.isBound();
168 }
169
170 @Override
171 public void set(boolean value) {
172 delegate.set(value);
173 }
174 }
|