pack();
setLocationRelativeTo(window);
}
private JComponent createTree() {
ToolBarContainer treePanel = ToolBarContainer.createDefaultContainer(true, true, true, true, FlowLayout.RIGHT);
treePanel.setBorder(new EtchedBorder());
VLToolBar bar = new VLToolBar();
JButton button = UIUtils.createExpandAllButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
expandAll(tree, true);
}
});
bar.add(button);
button = UIUtils.createCollapseAllButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
expandAll(tree, false);
}
});
bar.add(button);
button = UIUtils.createRefreshButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Module module = window.refreshModuleFunctions();
DefaultMutableTreeNode rootNode = module.createTreeNode(filterByWindowName.isSelected() ? windowName : null);
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
model.setRoot(rootNode);
root = module;
expandAll(tree, true);
tree.setSelectionRows(new int[] {});
argumentPanel.removeAll();
}
});
bar.add(button);
treePanel.getToolBarPanelAt(BorderLayout.NORTH).add(bar, new ToolBarConstraints());
filterByWindowName = new JCheckBox("Filter by window name", true);
filterByWindowName.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
DefaultMutableTreeNode rootNode = root.refreshNode(filterByWindowName.isSelected() ? windowName : null);
((DefaultTreeModel) tree.getModel()).reload(rootNode);
expandAll(tree, true);
tree.setSelectionRows(new int[] {});
}
});
treePanel.add(filterByWindowName, BorderLayout.SOUTH);
tree = new JTree(root.createTreeNode(windowName));
tree.setRootVisible(false);
tree.getSelectionModel().addTreeSelectionListener(new FunctionNodeSelectionListener());
tree.setCellRenderer(new FunctionNodeRenderer());
expandAll(tree, true);
treePanel.add(new JScrollPane(tree), BorderLayout.CENTER);
return treePanel;
}