| 69 | |
| 70 | |
| 71 | public ErrorTable(final Editor editor) { |
| 72 | super(new DefaultTableModel(columnNames, 0)); |
| 73 | |
| 74 | setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
| 75 | |
| 76 | this.editor = editor; |
| 77 | JTableHeader header = getTableHeader(); |
| 78 | |
| 79 | Mode mode = editor.getMode(); |
| 80 | header.setDefaultRenderer(new GradyHeaderRenderer(mode)); |
| 81 | setDefaultRenderer(Object.class, new GradyRowRenderer(mode)); |
| 82 | //setShowGrid(false); |
| 83 | setIntercellSpacing(new Dimension(0, 0)); |
| 84 | |
| 85 | // be specific about the width of the first column |
| 86 | TableColumn emptyColumn = columnModel.getColumn(0); |
| 87 | emptyColumn.setMaxWidth(Editor.LEFT_GUTTER); |
| 88 | emptyColumn.setMinWidth(Editor.LEFT_GUTTER); |
| 89 | |
| 90 | columnModel.getColumn(PROBLEM_COLUMN).setPreferredWidth(400); |
| 91 | columnModel.getColumn(TAB_COLUMN).setPreferredWidth(100); |
| 92 | columnModel.getColumn(LINE_COLUMN).setPreferredWidth(50); |
| 93 | // // the other columns are just a preference |
| 94 | // for (int i = 1; i < columnModel.getColumnCount(); i++) { |
| 95 | // columnModel.getColumn(i).setPreferredWidth(columnWidths[i]); |
| 96 | // } |
| 97 | |
| 98 | addMouseListener(new MouseAdapter() { |
| 99 | @Override |
| 100 | synchronized public void mouseClicked(MouseEvent e) { |
| 101 | try { |
| 102 | int row = ((ErrorTable) e.getSource()).getSelectedRow(); |
| 103 | if (row >= 0 && row < getRowCount()) { |
| 104 | Object data = getModel().getValueAt(row, DATA_COLUMN); |
| 105 | int clickCount = e.getClickCount(); |
| 106 | if (clickCount == 1) { |
| 107 | editor.errorTableClick(data); |
| 108 | } else if (clickCount > 1) { |
| 109 | editor.errorTableDoubleClick(data); |
| 110 | } |
| 111 | editor.getTextArea().requestFocusInWindow(); |
| 112 | // editor.getErrorChecker().scrollToErrorLine(row); |
| 113 | } |
| 114 | } catch (Exception ex) { |
| 115 | ex.printStackTrace(); |
| 116 | } |
| 117 | } |
| 118 | }); |
| 119 | |
| 120 | header.setReorderingAllowed(false); |
| 121 | setFillsViewportHeight(true); |
| 122 | ToolTipManager.sharedInstance().registerComponent(this); |
| 123 | } |
| 124 | |
| 125 | |
| 126 | public void clearRows() { |