-
Notifications
You must be signed in to change notification settings - Fork 5
/
GSModal.java
46 lines (39 loc) · 1.26 KB
/
GSModal.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.genericsystem.reactor.gs;
import java.util.function.Consumer;
import javafx.beans.binding.Bindings;
import org.genericsystem.reactor.Tag;
import org.genericsystem.reactor.gstag.HtmlHyperLink;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;
/**
* @author Nicolas Feybesse
*
*/
public class GSModal extends GSDiv implements SelectionDefaults {
public GSModal(Tag parent, Consumer<Tag> contentTagConsumer) {
this(parent, FlexDirection.COLUMN, contentTagConsumer);
}
public GSModal(Tag parent, FlexDirection direction, Consumer<Tag> contentTagConsumer) {
super(parent, direction);
addStyleClass("modal");
bindStyle(DISPLAY, DISPLAY, model -> Bindings.createStringBinding(() -> getSelectionProperty(model).getValue() != null ? "flex" : "none", getSelectionProperty(model)));
new GSDiv(this, FlexDirection.COLUMN) {
{
addStyle("max-width", "40%");
addStyleClass("modal-content");
new HtmlHyperLink(this) {
{
addStyleClass("close");
setText("×");
bindAction(model -> getSelectionProperty(model).setValue(null));
}
};
new GSDiv(this, FlexDirection.COLUMN) {
{
select__(model -> getSelectionProperty(model));
contentTagConsumer.accept(this);
}
};
}
};
}
}