@Override public void run() { if (!EventQueue.isDispatchThread()) { ProgressHandle ph; ph = ProgressHandleFactory.createHandle( NbBundle.getMessage(ResultsTopComponent.class, "PreparingResultsWindow.msg")); ph.start(); n = new ResultsNode(query); rtcsc = query.getColumns(); List cols = Arrays.asList(rtcsc); Iterator colsIt = cols.iterator(); alps = new ArrayList(); while (colsIt.hasNext()) { RtcQueryColumn rsc = (RtcQueryColumn) colsIt.next(); alps.add(rsc.getColumnIdentifier()); alps.add(rsc.getColumnDisplayName()); } actualCols = alps.toArray(new String[] {}); EventQueue.invokeLater(this); ph.finish(); } else { outlineView.setPropertyColumns(alps.toArray(new String[] {})); Outline outline = outlineView.getOutline(); removeDefaultColumn(outline); ETableColumnModel etcm = (ETableColumnModel) outline.getColumnModel(); // TODO: szymon : change j to proper sort order int j = 1; for (int i = 1; i < rtcsc.length; i++) { ETableColumn etc = (ETableColumn) etcm.getColumn(i); if (alps.get(i * 2 - 2).equals("id")) { etc.setMaxWidth(20); } if (alps.get(i * 2 - 2).equals("internalSeverity")) { etc.setMaxWidth(20); } if (alps.get(i * 2 - 2).equals("internalPriority")) { etc.setMaxWidth(20); } if (alps.get(i * 2 - 2).equals("workItemType")) { etc.setMaxWidth(20); } if (alps.get(i * 2 - 2).equals("internalState")) { etc.setMaxWidth(85); } if (alps.get(i * 2 - 2).equals("summary")) { etc.setMaxWidth(550); etc.setWidth(475); etc.setMinWidth(400); } if (rtcsc[i].isSortColumn()) { etcm.setColumnSorted(etc, rtcsc[i].isAscending(), j); j++; } } manager.setRootContext(n); } }
private void removeDefaultColumn(Outline o) { TableColumn nodeColumn = o.getColumnModel().getColumn(0); nodeColumn.setHeaderValue(""); nodeColumn.setWidth(1); nodeColumn.setMaxWidth(1); nodeColumn.setMinWidth(1); // o.getColumnModel().removeColumn(nodeColumn); }