-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidgetcontainer.go
75 lines (52 loc) · 1.71 KB
/
widgetcontainer.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package wajaf
type WidgetContainer struct {
NodeDef
}
func NewWidgetContainer(id string) *WidgetContainer {
c := &WidgetContainer{
NodeDef: NewNode("container", "widgetContainer"),
}
c.SetID(id)
c.RegisterKnownAttributes([]string{"id", "type", "id", "display", "style", "classname", "classnamezone", "left", "width", "right", "top", "height", "bottom", "haslistener",
"columns", "classnamezone"})
c.RegisterKnownChildren([]string{"zone", "event", "template", "dataset", "event", "help"})
return c
}
func (c *WidgetContainer) NewZone(ztype string, id string) NodeDef {
z := NewWidgetZone(ztype, id)
c.AddChild(z)
return z
}
type WidgetZone NodeDef
func NewWidgetZone(ztype string, id string) WidgetZone {
z := NewNode("zone", ztype)
z.SetID(id)
z.RegisterKnownAttributes([]string{"style", "classname", "application", "params",
"title", "size", "column", "closeable", "sizeable", "maskable", "editable", "editor"})
z.RegisterKnownChildren([]string{"container", "element", "event", "help"})
return z
}
func (c *WidgetContainer) NewTemplate(ttype string, name string) NodeDef {
z := NewWidgetTemplate(ttype, name)
c.AddChild(z)
return z
}
type WidgetTemplate NodeDef
func NewWidgetTemplate(ttype string, name string) WidgetTemplate {
t := NewNode("template", ttype)
t.RegisterKnownAttributes([]string{"name"})
t.RegisterKnownChildren([]string{"container", "element"})
t.SetAttribute("name", name)
return t
}
func (c *WidgetContainer) NewDataset(dtype string, data string) NodeDef {
z := NewWidgetDataset(dtype, data)
c.AddChild(z)
return z
}
type WidgetDataset NodeDef
func NewWidgetDataset(dtype string, data string) WidgetDataset {
d := NewNode("dataset", dtype)
d.SetData(data)
return d
}