-
Notifications
You must be signed in to change notification settings - Fork 5
/
GenericModal.java
47 lines (41 loc) · 1.51 KB
/
GenericModal.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
47
package org.genericsystem.carcolor;
import java.util.function.Consumer;
import javafx.beans.binding.Bindings;
import org.genericsystem.reactor.ReactorStatics;
import org.genericsystem.reactor.Tag;
import org.genericsystem.reactor.generic.FlexDirection;
import org.genericsystem.reactor.generic.GSSection;
import org.genericsystem.reactor.html.HtmlHyperLink;
import org.genericsystem.reactor.model.GenericModel;
import org.genericsystem.reactor.model.StringExtractor;
/**
* @author Nicolas Feybesse
*
*/
public class GenericModal extends GSSection {
public GenericModal(Tag<?> parent, FlexDirection direction, Consumer<Tag<?>> contentTagConsumer) {
super(parent, direction);
addStyleClass("modal");
bindStyle(ReactorStatics.DISPLAY, ReactorStatics.DISPLAY, model -> Bindings.createStringBinding(() -> getProperty(ReactorStatics.SELECTION, model).getValue() != null ? "flex" : "none", this.getProperty(ReactorStatics.SELECTION, model)));
new GSSection(this, FlexDirection.COLUMN) {
{
addStyle("max-width", "40%");
addStyle("max-height", "40%");
addStyleClass("modal-content");
new HtmlHyperLink<GenericModel>(this) {
{
addStyleClass("close");
setText("×");
bindAction(model -> getProperty(ReactorStatics.SELECTION, model).setValue(null));
}
};
new GSSection(this, FlexDirection.COLUMN) {
{
select_(StringExtractor.TYPE_INSTANCE_EXTRACTOR, model -> getProperty(ReactorStatics.SELECTION, model));
contentTagConsumer.accept(this);
}
};
}
};
}
}