-
Notifications
You must be signed in to change notification settings - Fork 5
/
TagSelector.java
28 lines (22 loc) · 903 Bytes
/
TagSelector.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.genericsystem.reactor.model;
import java.util.function.BiFunction;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;
import javafx.beans.value.ObservableValue;
import org.genericsystem.reactor.Context;
import org.genericsystem.reactor.Tag;
public interface TagSelector extends BiFunction<Context, Tag, ObservableValue<Boolean>> {
public static class NORMAL_MODE_ONLY implements TagSelector {
@Override
public ObservableValue<Boolean> apply(Context context, Tag tag) {
Property<Boolean> adminProperty = tag.getAdminModeProperty(context);
return Bindings.createBooleanBinding(() -> !Boolean.TRUE.equals(adminProperty.getValue()), adminProperty);
}
}
public static class ADMIN_MODE_ONLY implements TagSelector {
@Override
public ObservableValue<Boolean> apply(Context context, Tag tag) {
return tag.getAdminModeProperty(context);
}
}
}