use of com.alibaba.druid.support.jconsole.model.GroupableTableHeader in project druid by alibaba.
the class DruidSQLPanel method addTableGroup.
private void addTableGroup() {
TableColumnModel cm = table.getColumnModel();
// System.out.println(SHOW_LIST.size());
for (int i : listHistogram) {
groupHistogram.add(cm.getColumn(i));
}
for (int j : listEffectedRowCountHistogram) {
groupEffectedRowCountHistogram.add(cm.getColumn(j));
}
for (int x : listExecuteAndResultHoldTimeHistogram) {
groupExecuteAndResultHoldTimeHistogram.add(cm.getColumn(x));
}
for (int y : listFetchRowCountHistogram) {
groupFetchRowCountHistogram.add(cm.getColumn(y));
}
GroupableTableHeader header = (GroupableTableHeader) table.getTableHeader();
header.addColumnGroup(groupHistogram);
header.addColumnGroup(groupEffectedRowCountHistogram);
header.addColumnGroup(groupExecuteAndResultHoldTimeHistogram);
header.addColumnGroup(groupFetchRowCountHistogram);
header.setUI(new GroupableTableHeaderUI());
}
use of com.alibaba.druid.support.jconsole.model.GroupableTableHeader in project druid by alibaba.
the class DruidSQLPanel method tableDataProcess.
@Override
protected void tableDataProcess(ArrayList<LinkedHashMap<String, Object>> data) {
table = new JTable() {
private static final long serialVersionUID = 1L;
@Override
protected JTableHeader createDefaultTableHeader() {
return new GroupableTableHeader(columnModel);
}
};
data = preProcess(data);
// System.out.println(SHOW_LIST);
tableModel = new DruidTableModel(data, REAL_SHOW_LIST);
// System.out.println(data.toString());
table.setModel(tableModel);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
addTableGroup();
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
// 点击几次,这里是双击事件
int row = table.getSelectedRow();
String id = ids.get(row);
new DruidSqlDetailFrame(id, conn);
}
}
});
RowHeaderTable header = new RowHeaderTable(table, 20);
scrollPane.setRowHeaderView(header);
scrollPane.setViewportView(table);
JLabel jb = new JLabel("N", SwingConstants.CENTER);
jb.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, jb);
}
Aggregations