Broke out PLE, PLJ, GpENI into separate tabs. For now, make as few assumptions as...
[sfa-gui.git] / SfaBrowser.py
index fe3f4ac..30442e8 100644 (file)
@@ -4,6 +4,9 @@ from pyjamas.ui.PopupPanel import PopupPanel
 from pyjamas.ui.HTML import HTML
 from SfaData import PlanetLabData
 
+def alwaysDelegateFocus(elem):
+    return True
+
 class PopupRecord(PopupPanel):
     def __init__(self, record):
         PopupPanel.__init__(self, True)
@@ -13,18 +16,19 @@ class PopupRecord(PopupPanel):
         self.setStyleName("ks-popups-Popup")
 
 class SfaItem(TreeItem):
-    def __init__(self, hrn, kind):
+    def __init__(self, hrn, kind, truncate = True):
         self.kind = kind
         self.hrn = hrn
-        last = hrn.split('.')[-1]
+        if truncate:
+            hrn = hrn.split('.')[-1]
         if self.kind == "(authority)":
-            self.label = "<b>%s</b>" % last
+            self.label = "<b>%s</b>" % hrn
         elif self.kind == "(slice)":
-            self.label = "<u><i>%s</i></u>" % last
+            self.label = "<u><i>%s</i></u>" % hrn
         elif self.kind == "(user)":
-            self.label = "%s" % last
+            self.label = "%s" % hrn
         else:
-            self.label = "<b>%s</b>" % last
+            self.label = "<b>%s</b>" % hrn
 
         TreeItem.__init__(self, self.label)
 
@@ -46,11 +50,21 @@ class SfaBrowser(Sink):
         self.data = PlanetLabData()
 
         self.tree = Tree()
+        self.tree.shouldTreeDelegateFocusToElement = alwaysDelegateFocus
         
-        item = SfaItem("plc", "(authority)")
+        item = SfaItem("plc", "(authority)", truncate = False)
+        self.tree.addItem(item)
+
+        item = SfaItem("plc.glc", "(authority)", truncate = False)
+        self.tree.addItem(item)
+
+        item = SfaItem("plc.vini", "(authority)", truncate = False)
+        self.tree.addItem(item)
+
+        item = SfaItem("ple", "(authority)", truncate = False)
         self.tree.addItem(item)
 
-        item = SfaItem("ple", "(authority)")
+        item = SfaItem("plj", "(authority)", truncate = False)
         self.tree.addItem(item)
 
         self.tree.addTreeListener(self)
@@ -67,7 +81,6 @@ class SfaBrowser(Sink):
         p.show()
 
     def onTreeItemStateChanged(self, item):
-        self.tree.moveFocus(item)
         child = item.getChild(0)
         if hasattr(child, "isPendingItem"):
             item.removeItem(child)