mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
jconsole
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@229 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -1,23 +1,50 @@
|
||||
package com.alibaba.druid.jconsole;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Panel;
|
||||
|
||||
import com.sun.tools.jconsole.JConsoleContext;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
|
||||
public class DataSourcePanel extends Panel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JConsoleContext context;
|
||||
private DataSourceInfo dataSourceInfo;
|
||||
|
||||
public DataSourcePanel(JConsoleContext context){
|
||||
this.context = context;
|
||||
|
||||
this.setBackground(Color.RED);
|
||||
private JTable table;
|
||||
|
||||
private String[] columns = new String[] { "Name", "Value" };
|
||||
|
||||
public DataSourcePanel(DataSourceInfo dataSourceInfo){
|
||||
this.dataSourceInfo = dataSourceInfo;
|
||||
|
||||
Object[][] rows = new Object[][] {
|
||||
{ "ID", dataSourceInfo.getId() },
|
||||
{ "Name", dataSourceInfo.getName() },
|
||||
{ "URL", dataSourceInfo.getUrl() },
|
||||
{ "Filters", dataSourceInfo.getFilters() },
|
||||
{ "CreatedTime", dataSourceInfo.getCreatedTime() },
|
||||
{ "RawDriverClassName", dataSourceInfo.getRawDriverClassName() },
|
||||
{ "RawUrl", dataSourceInfo.getRawUrl() },
|
||||
{ "RawDriverMajorVersion", dataSourceInfo.getRawDriverMajorVersion() },
|
||||
{ "RawDriverMinorVersion", dataSourceInfo.getRawDriverMinorVersion() },
|
||||
{ "Properties", dataSourceInfo.getProperties() },
|
||||
};
|
||||
table = new JTable(rows, columns);
|
||||
|
||||
JScrollPane tableScrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(tableScrollPane, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public JConsoleContext getJConsoleContext() {
|
||||
return context;
|
||||
public DataSourceInfo getDataSourceInfo() {
|
||||
return dataSourceInfo;
|
||||
}
|
||||
|
||||
public void setDataSourceInfo(DataSourceInfo dataSourceInfo) {
|
||||
this.dataSourceInfo = dataSourceInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user