Added Node selection and Sliver (attribute) configuration panels to
[sfa-gui.git] / PlanetLab.py
index 50407c7..6488da9 100644 (file)
@@ -1,31 +1,42 @@
 from Sink import Sink, SinkInfo
+from pyjamas.ui.TabPanel import TabPanel
 from pyjamas.ui.VerticalPanel import VerticalPanel
 from pyjamas.ui.TextArea import TextArea
 from pyjamas.ui.HTML import HTML
 from SfaData import PlanetLabData
+from NodePanel import NodePanel
+from LinkPanel import LinkPanel
+from SliverPanel import SliverPanel
 
-class PlanetLab(Sink):
+class PlTabs(TabPanel):
     def __init__(self):
+        TabPanel.__init__(self)
 
-        Sink.__init__(self)
-        self.panel = VerticalPanel()
-        self.panel.setSize("100%", "100%")
         self.data = PlanetLabData()
         self.rspec = self.data.getRSpec()
 
-        # Just to show that we can retrieve the RSpec
-        ta = TextArea()
-        ta.setSize("100%", "100%")
-        ta.setText(self.rspec)
-        self.panel.add(ta)
+        nodetab = NodePanel(self.data, self.rspec)
+        slivertab = SliverPanel(self.data, self.rspec)
+    
+        self.add(nodetab, "Nodes")
+        self.add(slivertab, "Slivers")
+        self.selectTab(0)
+
+    def onTabSelected(self, sender, index):
+        tab = self.getWidget(index)
+        tab.refresh()
+        TabPanel.onTabSelected(self, sender, index)
 
-        self.initWidget(self.panel)
+class PlanetLab(Sink):
+    def __init__(self):
 
-    def onShow(self):
-        # Do we want to refresh the RSpec?
-        pass
+        Sink.__init__(self)
         
+        self.tabs = PlTabs()
 
+        self.tabs.setWidth("100%")
+        self.tabs.setHeight("100%")
+        self.initWidget(self.tabs)
 
 def init():
     return SinkInfo("PlanetLab", "Specify PlanetLab Resources", PlanetLab)