use of com.alibaba.druid.support.jconsole.model.DruidTableCellRenderer in project druid by alibaba.
the class DruidDataSourcePanel method addTable.
private void addTable(ColumnData columnData) {
ArrayList<ArrayList<LinkedHashMap<String, Object>>> data = columnData.getTableData();
int i = 0;
ArrayList<String> ids = columnData.getNames();
for (ArrayList<LinkedHashMap<String, Object>> listNow : data) {
JTable table = new JTable();
tableModel = new DruidTableModel(listNow);
table.setModel(tableModel);
String id = ids.get(i);
JPanel panelNow = new JPanel(new BorderLayout());
panelNow.setBorder((TitledBorder) BorderFactory.createTitledBorder(KEY_WORD_IDENTITY + ":" + id));
contentPanel.add(panelNow);
panelNow.add(table.getTableHeader(), BorderLayout.NORTH);
panelNow.add(table);
table.getColumnModel().getColumn(0).setCellRenderer(new DruidTableCellRenderer());
i++;
}
}
use of com.alibaba.druid.support.jconsole.model.DruidTableCellRenderer in project druid by alibaba.
the class DruidDriverPanel method tableDataProcess.
@Override
protected void tableDataProcess(ArrayList<LinkedHashMap<String, Object>> data) {
ColumnData columnData = TableDataProcessor.row2col(data);
tableModel = new DruidTableModel(columnData.getData());
table.setModel(tableModel);
table.getColumnModel().getColumn(0).setCellRenderer(new DruidTableCellRenderer());
scrollPane.setViewportView(table);
}
use of com.alibaba.druid.support.jconsole.model.DruidTableCellRenderer in project druid by alibaba.
the class DruidSqlDetailFrame method addTable.
/**
* 将表格添加到contentPanel对象内部。
*
* @param contentPanel JPanel对象
* @param 当前表格的标题
* @param data 当前表格的数据
*/
private void addTable(JPanel contentPanel, String title, ArrayList<LinkedHashMap<String, Object>> data) {
final JPanel content1 = new JPanel();
content1.setLayout(new BorderLayout());
content1.setBorder((TitledBorder) BorderFactory.createTitledBorder(title));
contentPanel.add(content1);
ColumnData colData = TableDataProcessor.row2col(data);
JTable table = new JTable();
DruidTableModel tableModel = new DruidTableModel(colData.getData());
table.setModel(tableModel);
TableColumn col = table.getColumnModel().getColumn(0);
col.setCellRenderer(new DruidTableCellRenderer());
final JTableHeader header1 = table.getTableHeader();
content1.add(header1, BorderLayout.NORTH);
content1.add(table);
}
Aggregations