@NotNull
        @Override
        public Component getTreeCellRendererComponent(
            @NotNull JTree tree,
            Object value,
            boolean selected,
            boolean expanded,
            boolean leaf,
            int row,
            boolean hasFocus) {
          if (value instanceof MyTreeNode) {
            MyTreeNode node = (MyTreeNode) value;
            myLabel.setText(getRenamedTitle(node.getKey().field.getName(), node.getText()));
            myLabel.setFont(
                myLabel
                    .getFont()
                    .deriveFont(node.getKey().groupName == null ? Font.BOLD : Font.PLAIN));
            myLabel.setEnabled(node.isEnabled());
          } else {
            myLabel.setText(getRenamedTitle(value.toString(), value.toString()));
            myLabel.setFont(myLabel.getFont().deriveFont(Font.BOLD));
            myLabel.setEnabled(true);
          }

          Color foreground =
              selected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground();
          myLabel.setForeground(foreground);

          return myLabel;
        }
 private ITreeNode createTreeNodes(MethodStats method) {
   final MyTreeNode node = new MyTreeNode(method);
   for (MethodStats entry : method.getCallees().values()) {
     node.addChild(createTreeNodes(entry));
   }
   return node;
 }
 @Override
 public Object valueOf(Object o) {
   if (o instanceof MyTreeNode) {
     MyTreeNode node = (MyTreeNode) o;
     return node.getText();
   }
   return o.toString();
 }
        @Override
        public Object valueOf(Object o) {
          if (o instanceof MyTreeNode) {
            MyTreeNode node = (MyTreeNode) o;
            return node.getValue();
          }

          return null;
        }
 @Override
 public void insert(T x) {
   // TODO Auto-generated method stub
   if (root.lookup(x) == false) {
     // recursively calling insert
     root.insert(x);
   } else {
     System.out.println("Sry, you cannot insert " + x + " twice!");
   }
 }
 public void fillOptions(@NotNull ColorAndFontOptions options) {
   DefaultMutableTreeNode root = new DefaultMutableTreeNode();
   for (EditorSchemeAttributeDescriptor description : getOrderedDescriptors(options)) {
     if (!description.getGroup().equals(myCategoryName)) continue;
     List<String> path = extractPath(description);
     if (path != null && path.size() > 1) {
       MyTreeNode groupNode = ensureGroup(root, path, 0);
       groupNode.add(new MyTreeNode(description, path.get(path.size() - 1)));
     } else {
       root.add(new MyTreeNode(description));
     }
   }
   myTreeModel.setRoot(root);
 }
 private static void applyNode(TreeNode node, final CodeStyleSettings settings) {
   if (node instanceof MyTreeNode) {
     ((MyTreeNode) node).apply(settings);
   }
   for (int j = 0; j < node.getChildCount(); j++) {
     TreeNode child = node.getChildAt(j);
     applyNode(child, settings);
   }
 }
 private static void resetNode(TreeNode node, CodeStyleSettings settings) {
   if (node instanceof MyTreeNode) {
     ((MyTreeNode) node).reset(settings);
   }
   for (int j = 0; j < node.getChildCount(); j++) {
     TreeNode child = node.getChildAt(j);
     resetNode(child, settings);
   }
 }
 @Override
 public void delete(T x) {
   if (lookup(x) == true) {
     root.delete(x);
   } else {
     System.out.println("No " + x + " such element in the tree; what do you want me to delete?");
     System.out.println();
   }
 }
  private TreeTableView<ITreeNode> createTreeTableView(ProfileContainer container) {

    final List<Profile> profiles = container.getProfiles();
    final MyTreeNode rootNode = new MyTreeNode(null);
    for (Profile p : profiles) {
      final MyTreeNode profileNode = new MyTreeNode(p);
      rootNode.addChild(profileNode);

      profileNode.addChild(createTreeNodes(p.getTopLevelMethod()));
    }

    final MyTreeModel model = new MyTreeModel(rootNode, new MethodStatsHelper(container));

    final TreeItem<ITreeNode> root = model.toTreeItems();
    root.setExpanded(true);

    final TreeTableView<ITreeNode> treeTableView = new TreeTableView<>(root);

    for (int i = 0; i < model.getColumnCount(); i++) {
      final int columnNo = i;
      final TreeTableColumn<ITreeNode, String> newColumn =
          new TreeTableColumn<>(model.getColumnName(i));

      newColumn.setCellValueFactory(
          new Callback<
              TreeTableColumn.CellDataFeatures<ITreeNode, String>, ObservableValue<String>>() {

            @Override
            public ObservableValue<String> call(CellDataFeatures<ITreeNode, String> param) {
              return new ReadOnlyStringWrapper(
                  model.getValue(param.getValue().getValue(), columnNo));
            }
          });
      treeTableView.getColumns().add(newColumn);
    }

    treeTableView.setShowRoot(false);
    return treeTableView;
  }
    @Override
    public Component getTableCellEditorComponent(
        JTable table, Object value, boolean isSelected, int row, int column) {
      final DefaultMutableTreeNode defaultNode =
          (DefaultMutableTreeNode)
              ((TreeTable) table).getTree().getPathForRow(row).getLastPathComponent();
      myCurrentEditor = null;
      myCurrentNode = null;
      if (defaultNode instanceof MyTreeNode) {
        MyTreeNode node = (MyTreeNode) defaultNode;
        myCurrentNode = node;
        if (node.getKey() instanceof BooleanOption) {
          myCurrentEditor = myBooleanEditor;
          myBooleanEditor.setSelected(node.getValue() == Boolean.TRUE);
          myBooleanEditor.setEnabled(node.isEnabled());
        } else if (node.getKey() instanceof IntOption) {
          IntOption intOption = (IntOption) node.getKey();
          myCurrentEditor = myIntOptionsEditor;
          myIntOptionsEditor.setText(
              intOption.isDefaultValue(node.getValue()) ? "" : node.getValue().toString());
          myIntOptionsEditor.setMinValue(intOption.getMinValue());
          myIntOptionsEditor.setMaxValue(intOption.getMaxValue());
          myIntOptionsEditor.setDefaultValue(intOption.getDefaultValue());
        } else {
          myCurrentEditor = myOptionsEditor;
          myOptionsEditor.setCell(table, row, column);
          myOptionsEditor.setText(String.valueOf(node.getValue()));
          myOptionsEditor.setOptions(((SelectionOption) node.getKey()).options);
          myOptionsEditor.setDefaultValue(node.getValue());
        }
      }

      if (myCurrentEditor != null) {
        myCurrentEditor.setBackground(table.getBackground());
      }
      return myCurrentEditor;
    }
 @Override
 public void setValue(Object o, Object o1) {
   MyTreeNode node = (MyTreeNode) o;
   node.setValue(o1);
 }
 // constructor
 public BinarySearchTree() {
   root.data = null;
   root.leftChild = null;
   root.rightChild = null;
   root.parent = null;
 }
  @Override
  public boolean lookup(T x) {
    // TODO Auto-generated method stub

    return root.lookup(x);
  }
 @Override
 public void printPostOrder() {
   // TODO Auto-generated method stub
   root.printPostOrder();
 }