-
Notifications
You must be signed in to change notification settings - Fork 1
/
uihtml.go
49 lines (41 loc) · 1.01 KB
/
uihtml.go
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
48
49
package jaws
import (
"io"
"github.com/linkdata/jaws/what"
)
type UiHtml struct {
Tag any
}
func (ui *UiHtml) parseGetter(e *Element, getter interface{}) {
if getter != nil {
if tagger, ok := getter.(TagGetter); ok {
ui.Tag = tagger.JawsGetTag(e.Request)
if ch, ok := getter.(ClickHandler); ok {
e.handlers = append(e.handlers, clickHandlerWapper{ch})
}
if eh, ok := getter.(EventHandler); ok {
e.handlers = append(e.handlers, eh)
}
} else {
ui.Tag = getter
}
e.Tag(ui.Tag)
}
}
/*func (ui *UiHtml) parseParams(elem *Element, params []interface{}) (attrs []string) {
return elem.ParseParams(params)
}*/
func (ui *UiHtml) JawsRender(e *Element, w io.Writer, params []interface{}) (err error) {
if h, ok := ui.Tag.(UI); ok {
err = h.JawsRender(e, w, params)
}
return
}
func (ui *UiHtml) JawsUpdate(e *Element) {
if h, ok := ui.Tag.(UI); ok {
h.JawsUpdate(e)
}
}
func (ui *UiHtml) JawsEvent(e *Element, wht what.What, val string) error {
return callEventHandler(ui.Tag, e, wht, val)
}