SFA browser basic functionality
[sfa-gui.git] / VINI.py
1 from Sink import Sink, SinkInfo
2 from pyjamas.ui.TabPanel import TabPanel
3 from pyjamas.ui.VerticalPanel import VerticalPanel
4 from pyjamas.ui.HTML import HTML
5 from SfaData import ViniData
6 from NodePanel import NodePanel
7 from LinkPanel import LinkPanel
8 from SliverPanel import SliverPanel
9 from SubmitPanel import SubmitPanel
10 from HelpPanel import VINIHelpPanel
11
12 class VINITabs(TabPanel):
13     def __init__(self):
14         TabPanel.__init__(self)
15
16         self.data = ViniData()
17         self.data.refreshRSpec()
18
19         nodetab = NodePanel(self.data)
20         linktab = LinkPanel(self.data)
21         slivertab = SliverPanel(self.data)
22         submittab = SubmitPanel(self.data)
23         helptab = VINIHelpPanel()
24
25         self.add(nodetab, "Nodes")
26         self.add(linktab, "Links")
27         self.add(slivertab, "Slivers")
28         self.add(submittab, "Submit")
29         self.add(HTML("force tabs to right"), None)
30         self.add(helptab, "Help")
31
32         self.selectTab(0)
33
34     def onTabSelected(self, sender, index):
35         tab = self.getWidget(index)
36         tab.refresh()
37         TabPanel.onTabSelected(self, sender, index)
38
39 class VINI(Sink):
40     def __init__(self):
41
42         Sink.__init__(self)
43         
44         self.tabs = VINITabs()
45
46         self.tabs.setWidth("100%")
47         self.tabs.setHeight("100%")
48         self.initWidget(self.tabs)
49
50 def init():
51     return SinkInfo("VINI", "<b>Specify VINI Resources</b>", VINI)