package com.vci.client.framework.systemConfig;
|
|
import java.awt.BorderLayout;
|
import java.awt.Dimension;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JTextField;
|
import javax.swing.border.TitledBorder;
|
|
import com.vci.client.ui.swing.KJButton;
|
import com.vci.client.ui.swing.components.VCIJLabel;
|
import com.vci.client.ui.swing.components.VCIJPanel;
|
|
public class SystemMonitorPanel extends VCIJPanel {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = -8771349490879797327L;
|
|
VCIJLabel labelOnLineUser = new VCIJLabel("当前在线用户数:");
|
|
public SystemMonitorPanel(){
|
init();
|
}
|
|
private void init() {
|
this.setLayout(new BorderLayout());
|
this.setBorder(new TitledBorder("系统运行监控"));
|
JPanel mainPanel = new JPanel();
|
JPanel contentPanel = initContentPanel();
|
mainPanel.setLayout(new BorderLayout());
|
mainPanel.add(contentPanel, BorderLayout.LINE_START);
|
this.add(mainPanel, BorderLayout.LINE_START);
|
}
|
|
private JPanel initContentPanel() {
|
int iUserCount = getData();
|
|
labelOnLineUser.setHorizontalAlignment(JLabel.RIGHT);
|
|
String text = String.format("%d", iUserCount);
|
JTextField labelUserCount = new JTextField(text);
|
labelUserCount.setEnabled(false);
|
//labelUserCount.setBorder(BorderFactory.createLoweredBevelBorder());
|
labelUserCount.setHorizontalAlignment(JLabel.CENTER);
|
KJButton btnRefrash = new KJButton("刷新");
|
|
JPanel contentPanel = new JPanel();
|
contentPanel.setLayout(null);
|
contentPanel.setPreferredSize(new Dimension(3000,40));
|
|
labelOnLineUser.setBounds(20, 10, 130, 25);
|
labelUserCount.setBounds(160, 10, 70, 25);
|
btnRefrash.setBounds(240, 10, 80, 25);
|
contentPanel.add(labelOnLineUser,BorderLayout.LINE_START);
|
contentPanel.add(labelUserCount,BorderLayout.LINE_START);
|
contentPanel.add(btnRefrash,BorderLayout.LINE_START);
|
|
return contentPanel;
|
}
|
|
private int getData(){
|
String data="";
|
try {
|
// NameServiceUtility nsu = new NameServiceUtility();
|
// nsu.InitORB();
|
// nsu.InitNameContext();
|
// ORB orb = nsu.getOrb();
|
//
|
// org.jacorb.orb.ORB jorb = (org.jacorb.orb.ORB)orb;
|
|
// ClientConnectionManager ccm = jorb.getClientConnectionManager();
|
// ProfileBase profile = new ProfileBase();
|
// ccm.getConnection(profile);
|
// //ccm.getConnection(profile)
|
// BasicAdapter ba = jorb.getBasicAdapter();
|
// List<?> lst = ba.getEndpointProfiles();
|
//
|
// int size = lst.size();
|
// return size;
|
//ClientConnectionManager ccm = jorb.getClientConnectionManager();
|
//ccm.getConnection(profile)
|
|
// } catch (VCIError e) {
|
// // TODO Auto-generated catch block
|
// e.printStackTrace();
|
}catch (Exception e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
return 0;
|
}
|
}
|