package Frame;
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.Container;
|
import java.awt.Font;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.util.Iterator;
|
import java.util.Vector;
|
import javax.swing.Box;
|
import javax.swing.ComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.ImageIcon;
|
import javax.swing.JComboBox;
|
import javax.swing.JInternalFrame;
|
import javax.swing.JScrollPane;
|
import javax.swing.JTable;
|
import javax.swing.JTextField;
|
import javax.swing.event.InternalFrameEvent;
|
import javax.swing.event.InternalFrameListener;
|
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionListener;
|
import javax.swing.table.DefaultTableModel;
|
import BaoWen.AA0CToJNA;
|
import BaoWen.Dell_Baowen;
|
import BaoWen.Dell_baowen_55AA0C;
|
import BaoWen.Udp_Receive;
|
import BaoWen.Urt_7000_port;
|
import ColorAndFont.ChooseFont;
|
import ColorAndFont.English;
|
import ColorAndFont.NothJPanel;
|
import ColorAndFont.UIColor;
|
import JNADell.DataToJnaDell;
|
import PbuliClass.JButtonModel;
|
import PbuliClass.JlableModel;
|
import PbuliClass.Systems;
|
import PbuliClass.greateTables;
|
import PbuliClass.jinternalFrame;
|
import circle.Dell_ResultYuang;
|
import circle.Dell_yuang;
|
import circle.Yuangvc;
|
import fence.warning.RealWarnings;
|
import tag.Tag_Dell;
|
import tbDataModel.Circles;
|
import udp_out.udpAndTcpout;
|
|
/**ϵͳµ÷ÊÔ*/
|
@SuppressWarnings("rawtypes")
|
public class DebugManage extends jinternalFrame {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
jinternalFrame jinerFrame=null;
|
JInternalFrame jinFrame=null;
|
NothJPanel northPanel=null;//±±²¿Ãæ°å
|
NothJPanel southPanel=null;//Äϲ¿²¿Ãæ°å2023.07.08
|
JButtonModel shuaxin=null;//ˢа´Å¥
|
JButtonModel jbt_statr=null;//¿ªÊ¼µ÷ÊÔ
|
JButtonModel jbt_stop=null;//ÔÝÍ£µ÷ÊÔ
|
JButtonModel jbt_stopjna=null;//ÔÝÍ£JNAµ÷ÓÃ
|
JButtonModel clear=null;//Çå¿Õ°´Å¥°´Å¥
|
JButtonModel jbt_nc1=null;//²é¿´ÄÚ´æ2023.07.08yang
|
JButtonModel jbt_nc=null;//Çå¿ÕÄÚ´æ
|
JScrollPane gd=null;//¹ö¶¯Ãæ°å
|
static JTable table=null;//ÉêÃ÷±í¸ñ
|
static Vector<Vector<String>> rowData=null;
|
static DefaultTableModel tableModel=null;//ÉùÃ÷±í¸ñÄ£ÐÍ
|
Container rq;
|
Box topicBox;
|
Font font=new Font("ºÚÌå", Font.BOLD, 14);
|
JTextField neichun=null;//2023.07.08Çå¿ÕÄÚ´æ
|
JlableModel jl_choose_anchor= new JlableModel("Ñ¡Ôñ±êÇ©:");
|
JComboBox<String> box_tagid=null;//±êÇ©µÄ¼¯ºÏ
|
static boolean start_test=false;
|
static String tagid_str="Ñ¡Ôñ±êÇ©";
|
static Vector<Circles> Circles;//µ±Ç°±»Ñ¡ÖеÄԲȦ¼¯ºÏ
|
static boolean test_model=false;//µ÷ÊÔģʽ
|
static int selectedRow=-1;//±»Ñ¡ÖеÄÐÐ
|
public DebugManage() {//¹¹Ôì·½·¨
|
topicBox = Box.createHorizontalBox();// ´´½¨Ò»¸öˮƽÏäÈÝÆ÷
|
rowData=new Vector<>();
|
rq=getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(UIColor.getNorth_color());
|
this.addInternalFrameListener(new InternalFrameListener() {
|
|
@Override
|
public void internalFrameOpened(InternalFrameEvent e) {
|
test_model=true;
|
AA0CToJNA.setOpenjna(true);
|
}
|
|
@Override
|
public void internalFrameIconified(InternalFrameEvent e) {
|
}
|
|
@Override
|
public void internalFrameDeiconified(InternalFrameEvent e) {
|
}
|
|
@Override
|
public void internalFrameDeactivated(InternalFrameEvent e) {
|
}
|
|
@Override
|
public void internalFrameClosing(InternalFrameEvent e) {
|
test_model=false;//µ÷ÊÔģʽ
|
start_test=false;
|
selectedRow=-1;
|
table=null;
|
Dell_yuang.deleteall();
|
Dell_ResultYuang.deleteall();
|
DataToJnaDell.setJianzhi(0);
|
}
|
|
@Override
|
public void internalFrameClosed(InternalFrameEvent e) {
|
}
|
|
@Override
|
public void internalFrameActivated(InternalFrameEvent e) {
|
}
|
});
|
String title="ϵͳµ÷ÊÔ";
|
if(Systems.sys().getLanguage().equals("English")) {
|
title="Software debugging";
|
}
|
this.setTitle(title);
|
this.setFrameIcon(new ImageIcon("image/icon/debug.png"));//ÉèÖô°Ìåͼ±ê
|
rq.add(getNorthPanel(),BorderLayout.NORTH);
|
rq.add(getGd(),BorderLayout.CENTER);
|
rq.add(getSouthPanel(),BorderLayout.SOUTH);//2023.07.08yang
|
this.setBounds(175, 0, 1000,500);
|
|
}
|
|
|
/**»ñÈ¡±±²¿Ãæ°åµÄ·½·¨*/
|
public NothJPanel getNorthPanel() {
|
if(northPanel==null) {
|
northPanel=new NothJPanel();
|
topicBox.add(jl_choose_anchor);
|
topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getBox_tagid() );
|
topicBox.add(Box.createHorizontalStrut(30));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getJbt_statr());
|
topicBox.add(Box.createHorizontalStrut(30));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getClear());
|
topicBox.add(Box.createHorizontalStrut(30));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getJbt_stopjna());
|
topicBox.add(Box.createHorizontalStrut(30));
|
topicBox.add(getJbtlook_nc());//2023.07.08yang²é¿´ÄÚ´æ
|
topicBox.add(Box.createHorizontalStrut(30));
|
topicBox.add(getJbt_nc());
|
northPanel.add(topicBox );
|
|
|
}
|
return northPanel;
|
}
|
|
|
/**»ñÈ¡Äϲ¿Ãæ°åµÄ·½·¨yang2023.07.08*/
|
public NothJPanel getSouthPanel() {
|
if(southPanel==null) {
|
southPanel=new NothJPanel();
|
Box topicBox = Box.createHorizontalBox();// ´´½¨Ò»¸öˮƽÏäÈÝÆ÷
|
topicBox.add(getNeichun());
|
southPanel.add(topicBox);
|
}
|
return southPanel;
|
}
|
|
/**»ñȡˢа´Å¥µÄ·½·¨*/
|
public JButtonModel getShuaxin() {
|
if(shuaxin==null){
|
shuaxin=new JButtonModel("Ë¢ ÐÂ");
|
shuaxin.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
updateTable() ;
|
}
|
});
|
|
}
|
return shuaxin;
|
}
|
|
|
|
|
/**»ñÈ¡¹ö¶¯Ãæ°åµÄ·½·¨*/
|
public JScrollPane getGd() {
|
if(gd==null){
|
gd=new JScrollPane(getTable());
|
gd.getViewport().setBackground(UIColor.getNorth_color());
|
|
}
|
return gd;
|
}
|
|
|
/**Ìí¼Ó±í¸ñÐÐÏòÁ¿Êý¾Ý·½·¨*/
|
@SuppressWarnings("unchecked")
|
public static void getRowData(Vector<Yuangvc> list ) {
|
Iterator<Yuangvc> it = list.iterator();//´´½¨µü´úÆ÷
|
while (it.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ
|
Yuangvc discir=it.next();
|
Vector row = new Vector();
|
row.add(discir.getJianzhi());
|
int key=discir.getJianzhi();
|
int[] pos=discir.getPos();
|
String posi="("+pos[0]+","+pos[1]+","+pos[2]+","+pos[3]+");";
|
row.add(posi+Dell_ResultYuang.get_resty(key).getText());
|
rowData.add(row);// Ïò±í¸ñ¶ÔÏóÌí¼ÓÐÐÊý¾Ý
|
pos=null;
|
row=null;
|
discir=null;
|
}
|
|
}
|
|
|
|
/**»ñÈ¡Ôʼ²â¾àÊý¾Ý±í¸ñµÄ·½·¨*/
|
public static JTable getTable() {
|
if(table==null) {
|
String[] name1= {"ÐòºÅ","Êý¾Ý"};//±í¸ñÁÐÃû
|
String[] name2= {"Serial Number","Original Data"};//±í¸ñÁÐÃû
|
String[] columnNames=English.columnNames(name1, name2);
|
//Ìí¼Ó±í¸ñÁÐÏòÁ¿
|
Vector<String> columnName=new Vector<>();
|
for(int i=0;i<columnNames.length;i++){
|
columnName.add(columnNames[i]);
|
}
|
|
getRowData(Dell_yuang.getYuang_vecs());
|
greateTables tables=new greateTables();
|
tableModel=new DefaultTableModel(rowData, columnName){
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
|
// ʵÏÖÈÃÕû¸ö±í¸ñ²»²»ÔÊÐí±»±à¼
|
public boolean isCellEditable(int row,int column){
|
return false;
|
}
|
};
|
table=tables.getTable(tableModel);
|
table.getColumnModel().getColumn(0).setPreferredWidth(40);
|
table.getColumnModel().getColumn(0).setMaxWidth(50);
|
table.getColumnModel().getColumn(0).setMinWidth(10);
|
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
public void valueChanged(ListSelectionEvent e) {
|
selectedRow=table.getSelectedRow();//Ñ¡ÖÐÐÐ
|
}
|
});
|
test_model=true;
|
|
}
|
return table;
|
|
}
|
|
|
|
|
/**ˢбí¸ñ·½·¨*/
|
public void updateTable() {
|
int tagnum=getTable().getRowCount();//±í¸ñ×ÜÐÐÊý
|
if(tagnum !=0 ) {
|
for (int i = 0; i < tagnum; i++) {//ɾ³ýËùÓÐÐÐ
|
tableModel.removeRow(0);
|
}
|
getRowData(Dell_yuang.getYuang_vecs());
|
|
}
|
|
}
|
|
|
|
|
public JComboBox<String> getBox_tagid() {
|
if(box_tagid==null) {
|
box_tagid=new JComboBox<String>();
|
box_tagid.setFont(ChooseFont.getFont(12));//ÉèÖÃ×ÖÌå
|
ComboBoxModel<String > coModel=new DefaultComboBoxModel<>(Tag_Dell.get_tag_str());//ÏÂÀÁбíÄ£ÐÍ
|
box_tagid.setModel(coModel);
|
box_tagid.setBackground(Color.white);
|
box_tagid.setEnabled(true);
|
//ÏÂÀ¿ò¿ÉÒÔÊäÈë
|
box_tagid.setEditable(true);
|
box_tagid.addActionListener(new ActionListener() {
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
tagid_str=(String) box_tagid.getSelectedItem();
|
|
}
|
});
|
}
|
return box_tagid;
|
}
|
|
|
public JButtonModel getJbt_statr() {
|
if(jbt_statr==null) {
|
jbt_statr=new JButtonModel("µ÷ ÊÔ");
|
jbt_statr.addActionListener(new ActionListener() {
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
if(!start_test) {
|
start_test=true;
|
test_model=true;
|
tagid_str=(String) box_tagid.getSelectedItem();
|
jbt_statr.setText(" ¿ª ʼ ");
|
jbt_statr.setBackground(Color.green);
|
}else {
|
start_test=false;
|
test_model=false;
|
jbt_statr.setText(" ÔÝ Í£ ");
|
jbt_statr.setBackground(Color.gray);
|
}
|
|
}
|
});
|
}
|
return jbt_statr;
|
}
|
|
|
|
|
public static boolean isStart_test() {
|
return start_test;
|
}
|
|
|
public static DefaultTableModel getTableModel() {
|
return tableModel;
|
}
|
|
|
public static String getTagid_str() {
|
return tagid_str;
|
}
|
|
|
public JButtonModel getClear() {
|
if(clear==null) {
|
clear=new JButtonModel("Çå ¿Õ");
|
clear.addActionListener(new ActionListener() {
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
int tagnum=getTable().getRowCount();//±í¸ñ×ÜÐÐÊý
|
Dell_yuang.deleteall();
|
Dell_ResultYuang.deleteall();
|
if(tagnum !=0 ) {
|
for (int i = 0; i < tagnum; i++) {//ɾ³ýËùÓÐÐÐ
|
tableModel.removeRow(0);
|
selectedRow=-1;
|
}
|
}
|
|
}
|
});
|
}
|
return clear;
|
}
|
|
|
|
public static boolean isTest_model() {
|
return test_model;
|
}
|
|
|
public static int getSelectedRow() {
|
return selectedRow;
|
}
|
|
/**¿ªÆô»òÕßÔÝÍ£JNAµ÷ÓÃ*/
|
public JButtonModel getJbt_stopjna() {
|
if(jbt_stopjna==null) {
|
jbt_stopjna=new JButtonModel("¹Ø±Õ½âËã");
|
jbt_stopjna.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(AA0CToJNA.isOpenjna()) {
|
jbt_stopjna.setText(" ¿ªÆô½âËã ");
|
jbt_stopjna.setBackground(Color.red);
|
AA0CToJNA.setOpenjna(false);
|
}else {
|
jbt_stopjna.setText(" ¹Ø±Õ½âËã ");
|
jbt_stopjna.setBackground(UIColor.getButton_color());
|
AA0CToJNA.setOpenjna(true);
|
}
|
|
}
|
});
|
}
|
return jbt_stopjna;
|
}
|
|
|
public JButtonModel getJbt_nc() {
|
if(jbt_nc==null) {
|
jbt_nc=new JButtonModel("Çå¿ÕÄÚ´æ");
|
jbt_nc.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
String a1="UDP¶Ë¿ÚÊý¾Ý:"+Dell_Baowen.getBaowenvec().size();
|
String a2="AA0CÊý¾Ý:"+Dell_baowen_55AA0C.getBaowenvec2().size();
|
String nic=a1+" ; "+a2;
|
getNeichun().setText(nic);
|
Dell_Baowen.getBaowenvec().removeAllElements();//Çå¿ÕUDPÄÚ´æÖб¨ÎÄ
|
RealWarnings.get_real_warnings().removeAllElements();//Çå¿Õʵʱ±¨¾¯ÄÚ´æ
|
Dell_baowen_55AA0C.getBaowenvec2().removeAllElements();//2023.07.08Çå¿Õ55AA0CÊý¾Ý
|
udpAndTcpout.getUdppojoVector().removeAllElements();//2023.07.13 zsh Çå¿Õת·¢Êý¾Ý
|
}
|
});
|
}
|
return jbt_nc;
|
}
|
|
/**2023.07.08yang²é¿´ÄÚ´æ*/
|
public JButtonModel getJbtlook_nc() {
|
if(jbt_nc1==null) {
|
jbt_nc1=new JButtonModel("²é¿´ÄÚ´æ");
|
jbt_nc1.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
String a1="UDP¶Ëδ´¦ÀíÊý:"+Dell_Baowen.getBaowenvec().size();
|
String a2="AA0Cδ´¦ÀíÊý¾Ý:"+Dell_baowen_55AA0C.getBaowenvec2().size();
|
String a3="UDP½ÓÊÕÊý:"+Udp_Receive.getUdpbaowenmun();
|
String a4="URT½ÓÊÕÊý:"+Urt_7000_port.getUrtbaowenmun();
|
String a5="55AA0C½ÓÊÕÊý:"+Dell_baowen_55AA0C.getAAaa0cnum();
|
String a6="UDPת·¢Êý¾Ý:"+ udpAndTcpout.getUdppojoVector().size();//2023.07.13 zsh
|
String nic=a1+"; "+a2+"; "+a3+"; "+a4+"; "+a5+"; "+a6;
|
getNeichun().setText(nic);
|
}
|
});
|
}
|
return jbt_nc1;
|
}
|
/**2023.07.08yang²é¿´ÄÚ´æ*/
|
public JTextField getNeichun() {
|
if(neichun==null) {
|
neichun=new JTextField(70);
|
neichun.setFont(ChooseFont.getFont(14));
|
}
|
return neichun;
|
}
|
|
|
|
}
|