Context: We are designing a Netbeans Platform RCP based Lua IDE. We have implemented a build system that allows users to easily enable/disable files and add aliases to rename files at buildtime. We feel it is necessary in a UI standpoint to have checkboxes next to our custom nodes in the projects logical tab in order to simplify enabling and disabling files
Problem: We want to replace the default BeanTreeView with an Outline view because the default view does not honor the CheckableNode in the lookup. We are not sure of the best way to do this but the solution we have devised seems like the wrong way to go. The component does not resize properly and the nodes do not auto-expand at startup like they do in the native BeanTreeView.
Implementation Details: We created a FilterNode that proxies the DataObject node delegate. We also added our own property sets to the lookup and added a class that implements CheckableNode (hence the checkboxes on the left of the outline view).
Here is it looks now, this is exactly how we want it to look:
And here is the code we used to install it:
final String PROJECT_LOGICAL_TAB_ID = "projectTabLogical_tc";
WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
@Override
public void run() {
TopComponent findTopComponent = WindowManager.getDefault().findTopComponent(PROJECT_LOGICAL_TAB_ID);
if (findTopComponent != null) {
Component[] components = findTopComponent.getComponents();
for (Component component : components) {
component.setVisible(false);
}
OutlineView myView2 = new OutlineView("Filename");
Outline outline2 = myView2.getOutline();
outline2.setRootVisible(false);
outline2.setTableHeader(null);
findTopComponent.add(myView2, BorderLayout.CENTER);
findTopComponent.revalidate();
findTopComponent.validate();
findTopComponent.repaint();
}
}
});
Thanks in advance.