-
Notifications
You must be signed in to change notification settings - Fork 5
/
HtmlApp.java
43 lines (34 loc) · 1.06 KB
/
HtmlApp.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
package org.genericsystem.reactor.html;
import io.vertx.core.http.ServerWebSocket;
import org.genericsystem.reactor.Model;
import org.genericsystem.reactor.ViewContext.RootViewContext;
import org.genericsystem.reactor.appserver.PersistentApplication.App;
/**
* @author Nicolas Feybesse
*
*/
public abstract class HtmlApp<M extends Model> extends HtmlSection<M> implements App<M> {
private final ServerWebSocket webSocket;
private RootViewContext<M> rootViewContext;
public HtmlApp(ServerWebSocket webSocket) {
super(null);
this.webSocket = webSocket;
}
public HtmlApp<M> init(M rootModelContext, String rootId) {
HtmlDomNode rootNode = new HtmlDomNode(rootId);
rootNode.sendAdd(0);
rootViewContext = new RootViewContext<M>(rootModelContext, this, rootNode);
return this;
}
@Override
public ServerWebSocket getWebSocket() {
return webSocket;
}
public HtmlDomNode getNodeById(String id) {
return rootViewContext.getNodeById(id);
}
@Override
protected HtmlDomNode createNode(String parentId) {
throw new UnsupportedOperationException();
}
}