Beispiel #1
0
 @Override
 public Component getTreeCellRendererComponent(
     JTree tree,
     Object value,
     boolean sel,
     boolean expanded,
     boolean leaf,
     int row,
     boolean hasFocus) {
   Component component =
       super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
   if (value instanceof GroovyTreeNode) {
     GroovyTreeNode node = (GroovyTreeNode) value;
     if (node.attrKey != null) {
       setIcon(SwingHelper.ICON_ATTRIBUTE);
     } else if (!node.isLeaf()) {
       setIcon(SwingHelper.ICON_COMPOSITE);
     } else {
       setIcon(SwingHelper.ICON_VALUE);
     }
   } else {
     setIcon(SwingHelper.ICON_COMPOSITE);
   }
   return component;
 }
Beispiel #2
0
 @Override
 public void run() {
   if (metadataRecord == null) {
     recordTree.setModel(EMPTY_MODEL);
   } else {
     GroovyTreeNode root = new GroovyTreeNode(metadataRecord);
     recordTree.setModel(new DefaultTreeModel(root));
     root.expand();
   }
 }
Beispiel #3
0
 private void compilePathList(List<TreeNode> list) {
   if (parent != null) parent.compilePathList(list);
   list.add(this);
 }