-
Notifications
You must be signed in to change notification settings - Fork 5
/
HtmlInputText.java
36 lines (29 loc) · 1.12 KB
/
HtmlInputText.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
package org.genericsystem.reactor.gstag;
import org.genericsystem.reactor.HtmlDomNode;
import org.genericsystem.reactor.ReactorStatics;
import org.genericsystem.reactor.gs.GSTag;
import org.genericsystem.reactor.model.GenericModel;
import org.genericsystem.reactor.modelproperties.ActionDefaults;
import io.vertx.core.json.JsonObject;
public class HtmlInputText extends GSTag implements ActionDefaults<GenericModel> {
public HtmlInputText(GSTag parent) {
super(parent, "input");
}
@Override
protected HtmlDomNode createNode(String parentId) {
return new HtmlDomNode(parentId) {
@Override
public JsonObject fillJson(JsonObject jsonObj) {
super.fillJson(jsonObj);
return jsonObj.put("type", "text");
}
@Override
public void handleMessage(JsonObject json) {
if (ADD.equals(json.getString(MSG_TYPE)))
((ActionDefaults<?>) viewContext.getTag()).getAction(viewContext.getModelContext()).accept(new Object());
if (UPDATE.equals(json.getString(MSG_TYPE)))
viewContext.getTag().getDomNodeAttributes(viewContext.getModelContext()).put(ReactorStatics.VALUE, json.getString(TEXT_CONTENT));
}
};
}
}