This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
there should be some button in treetable title bar. this button will open some customirer dialog with list of all possible columns. user can select visible columns here. feel free to ask me for more details ;))
The "title bar" here refers to the corner of the JScrollPane surrounding the table (e.g. above the vertical scrollbar, to the right of the header table columns). Here's code which achieves that: ImageIcon ic = new ImageIcon(Whatever.class.getResource ( "/your/icon/here.gif")); // NOI18N JButton colsButton = new javax.swing.JButton(ic); colsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onTableColumns(); } }); tableScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, colsButton); The selector should have a row for each column in the table, with a checkbox showing the name of the column. We have already implemented all of this in ifdef so we can share some of this code if you're interested. We have an icon designed by the icon designer as well. It's "cols.gif" in the ifdef module (look in the FFJ closed source repository).
Tor please attach your code and the icon. Very much appreciated
Created attachment 5416 [details] Icon to use for the scrollbar button which brings up the selector panel
I doubt that you'll be able to use the code directly, because our implementation does not use the NetBeans TreeTable, it uses our own TreeTable (this was done a long time ago), and that TreeTable is not based on nodes! Let me first briefly explain how everything works. Each treetable client window registers its own TableModel. That model returns objects for getValueAt(row, col). Internally, we have an absolute column system. For example, in the Stack Window, column 0 is function name, column 1 is arguments, column 2 is address, and column 3 is a boolean indicating if symbol information is available for this frame (each row is a stack frame). In addition, the model also keeps a "bitmap" (a bool array), one bool for each column. This boolean keeps track of whether or not the corresponding column is visible. By default in the Stack Window, only column 0 and 1 are visible (stack and function). To make methods like getValueAt(row,col) work quickly, we also keep a direct map from "visible" to "absolute" column numbers. For example, if you have a column selection like this: false false false true false false true false this means we have two visible columns, and they are 3, 6 So when we get a call to getValueAt(col, row) we convert to absolute column by looking up the above array, toabsolute[col] So toabsolute[1] = 6. In getValueAt we then have a switch like this (example shown for the Stack table model) int realColumn = toabsolute[col]; switch (realColumn) { case 0: // Function ... case 1: // Method case 2: // Address ... The dialog which lets you select visible columns therefore just generate the full list of columns (all the absolute ones), put a checkbox for each, and the state of the checkbox is the visibility boolean for that column. When the user hits OK, we set the new visibility array, recompute the visibility map, and then do a table refresh. I did the original implementation for a regular JTable of this. We use a regular table for the stack window, the sessions window, the threads window, and the breakpoints window. We then added a TreeTable implementation similar to the above for the Watch and Variables window. Mike W did that, so he's more familiar with the TreeTable specifics, but I believe it's very similar to the above. When you look at the source code, you'll see the term "physical" and "virtual" columns, these are what I've called "absolute" and "visual" above (I think these latter ones are better terms but didn't think of them when I wrote the code in the first place). So as I said, you probably can't use the code directly, but I think at least the dialog selection code should be helpful, and hopefully the above discussion helps in some minor way. Feel free to lift all the table & treetable related code. I can't attach the source files to this bugreport since they contain a lot of proprietary debugger stuff, but I can e-mail the files to you, or better yet, you can fetch them yourself from the closed source FFJ repository. Look in the "ifdef" module, go down to src/com/sun/forte/st/ipe/debugger/. A lot of the generic Table stuff is in DebuggerTableWindow, which has subclasses StackWindow, ThreadsWindow, ... The TreeTable stuff is in TreeTable. By grepping around you'll probably find what you need. Since I promised above I would provide the code to set visibility, I'll attach that specific code. But you'll need more of the surrounding stuff to make it work so go look at the code.
Created attachment 5418 [details] Code fragment which does the column selection dialog
Implemented in trunk. Tor, thanks for your code and icon! Notes: To have corner button and vertical scrollbar use: TreeTableView.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); To set property column invisible: property.setValue( "InvisibleInTreeTableView", Boolean.TRUE );
Verified in #200205030100. The feature have been used in the debugger window.
Resolved for 3.4.x or earlier, no new info since then -> closing.