Ejemplo n.º 1
0
 def valueChanged(self,evt):
   tnode = evt.getPath().getLastPathComponent()
   xnode_name = tnode.getUserObject()
   tw=TreeWalker(self.xroot)
   xnode=tw.getNextElement(xnode_name)
   if not xnode: return
   if isinstance(xnode,ElementNode):
     headerSorter = TableSorter(NodeTableModel(xnode))
   else:
     headerSorter = TableSorter(DefaultTableModel())
   headerSorter.addMouseListenerToHeaderInTable(self.jtb)
   self.jtb.setModel(headerSorter)
   #self.sizeColumns()
   self.jtb.sizeColumnsToFit(-1)
Ejemplo n.º 2
0
 def gui(self):
   xnode = self.xdoc.getDocumentElement()
   tnode = self.createTree(xnode)  
   # create tree and display
   jt = JTree(tnode)
   jsp = JScrollPane(jt)
   tree_box = Box(BoxLayout.Y_AXIS)
   tree_box.add(jsp)
   tree_box.add(Box.createHorizontalStrut(10))
   headerSorter = TableSorter(DefaultTableModel())
   jtb = JTable(headerSorter)
   headerSorter.addMouseListenerToHeaderInTable(jtb)
   jtb.setAutoResizeMode(JTable.AUTO_RESIZE_OFF)
   jsp2 = JScrollPane(jtb)
   table_box = Box(BoxLayout.Y_AXIS)
   table_box.add(jsp2)
   table_box.add(Box.createHorizontalStrut(500))
   mp = JPanel()
   mp.setLayout(BoxLayout(mp,BoxLayout.X_AXIS))
   mp.add(tree_box)
   mp.add(table_box)
   # add listeners
   nsl = NodeSelectionListener(jtb,xnode)
   jt.addTreeSelectionListener(nsl)
   #
   return mp