1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 from pyjamas import DOM
16 from pyjamas import Factory
17
18 from pyjamas.ui.CellPanel import CellPanel
19 from pyjamas.ui import HasHorizontalAlignment
20 from pyjamas.ui import HasVerticalAlignment
21
23
24 - def insert(self, widget, container, beforeIndex=None):
25 """ has two modes of operation:
26 widget, beforeIndex
27 widget, container, beforeIndex.
28 if beforeIndex argument is not given, the 1st mode is assumed.
29 this technique is less costly than using *args.
30 """
31 if widget.getParent() == self:
32 return
33
34 if beforeIndex is None:
35 beforeIndex = container
36 container = self.getBody()
37
38 widget.removeFromParent()
39
40 tr = DOM.createTR()
41 td = DOM.createTD()
42
43 DOM.insertChild(container, tr, beforeIndex)
44 DOM.appendChild(tr, td)
45
46 CellPanel.insert(self, widget, td, beforeIndex)
47
48 self.setCellHorizontalAlignment(widget, self.horzAlign)
49 self.setCellVerticalAlignment(widget, self.vertAlign)
50
64
65
66 Factory.registerClass('pyjamas.ui.VerticalPanel', 'VerticalPanel', VerticalPanel)
67