package Frame;
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.Container;
|
import java.awt.Dimension;
|
import java.awt.Font;
|
import java.awt.Toolkit;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowListener;
|
import java.util.List;
|
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.JDialog;
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.JTable;
|
import javax.swing.JTextField;
|
import javax.swing.table.DefaultTableModel;
|
import ColorAndFont.English;
|
import ColorAndFont.NothJPanel;
|
import ColorAndFont.UIColor;
|
import ColorAndFont.buttonTitle;
|
import DataBase.DatabaseManagement;
|
import Method.GetNowTime;
|
import Method.IpIsTrue;
|
import Method.ZuJian;
|
import PbuliClass.JButtonModel;
|
import PbuliClass.JlableModel;
|
import PbuliClass.ShowMessage;
|
import PbuliClass.Systems;
|
import PbuliClass.WarningMessage;
|
import PbuliClass.greateTables;
|
import PbuliClass.jinternalFrame;
|
import VectroData.ForwardDatas;
|
import tbDataModel.Tb_forward_data;
|
/**Êý¾Ýת·¢¹ÜÀí*/
|
@SuppressWarnings("rawtypes")
|
public class ForwardManage extends jinternalFrame {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
JButtonModel search=null;//ËÑË÷°´Å¥
|
JButtonModel shuaxin=null;//ˢа´Å¥
|
JButtonModel add=null;//ÐÂÔö°´Å¥
|
JButtonModel delete=null;//ɾ³ý°´Å¥
|
JButtonModel deleteAll=null;//È«²¿É¾³ý°´Å¥
|
JButtonModel xiu_gai=null;
|
JScrollPane gd=null;//¹ö¶¯Ãæ°å
|
NothJPanel northPanel=null;//Äϲ¿Ãæ°å
|
JTextField searchFileld=null;//ËÑË÷Îı¾¿ò
|
JTable table=null;//ÉêÃ÷±í¸ñ
|
DefaultTableModel tableModel=null;//ÉùÃ÷±í¸ñÄ£ÐÍ
|
Vector rowData=null;
|
AddTagDialog adddialog=null;
|
XiugaiDialog xiugaidialog=null;
|
Container rq;
|
List list;
|
JTextField port_text=null;//ת·¢¶Ë¿Ú
|
boolean adds=false;
|
public ForwardManage() {//¹¹Ôì·½·¨
|
String title="Êý¾Ýת·¢";
|
if(Systems.sys().getLanguage().equals("English")) {
|
title="Data forwarding";
|
}
|
this.setTitle(title);
|
rowData=new Vector();
|
rq=getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(Color.white);
|
rq.add(getGd(),BorderLayout.CENTER);
|
rq.add(getNorthPanel(),BorderLayout.NORTH);
|
this.setFrameIcon(new ImageIcon("image/icon/renyuanicon.png"));//ÉèÖô°Ìåͼ±ê
|
|
}
|
|
/**ËÑË÷°´Å¥*/
|
public JButtonModel getSearch() {
|
if(search==null){
|
search=new JButtonModel(buttonTitle.getSerch());
|
search.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(getSearchFileld().getText().length()>=1) {
|
String go=getSearchFileld().getText().trim();
|
String serch="select * from tb_forward_data where type like'"+go+"%'or ip like'"+go+"%'or port like '"+go+"%'";
|
updateSerch(serch);
|
}
|
}
|
});
|
|
}
|
return search;
|
}
|
|
/**»ñÈ¡ËÑË÷Îı¾¿òµÄ·½·¨*/
|
public JTextField getSearchFileld() {
|
if(searchFileld==null){
|
searchFileld=ZuJian.getSearchFileld(getSearch());
|
}
|
return searchFileld;
|
}
|
|
/**ËÑË÷·½·¨*/
|
public void updateSerch(String serch) {
|
ShowMessage.zidingyi("ËÑË÷¹¦ÄÜ먦·Å");
|
}
|
|
/**»ñÈ¡±í¸ñ*/
|
@SuppressWarnings("serial")
|
public JTable getTable() {
|
if(table==null) {
|
String[] name1= {"ÐòºÅ","ÐÒéÀàÐÍ","ת·¢µØÖ·","ת·¢¶Ë¿Ú","Êý¾ÝÄÚÈÝ","´´½¨Ê±¼ä"};//±í¸ñÁÐÃû
|
String[] name2= {"Serial Number","Protocol Type",
|
"Address","Port","Data Content","Time"};//±í¸ñÁÐÃû
|
String[] columnNames=English.columnNames(name1, name2);
|
//Ìí¼Ó±í¸ñÁÐÏòÁ¿
|
Vector<String> columnName=new Vector<>();
|
for(int i=0;i<columnNames.length;i++){
|
columnName.add(columnNames[i]);
|
}
|
greateTables tables=new greateTables();
|
tableModel=new DefaultTableModel(rowData, columnName){
|
public boolean isCellEditable(int row,int column){ // ʵÏÖÈÃÕû¸ö±í¸ñ²»²»ÔÊÐí±»±à¼
|
return false;
|
}
|
};
|
|
table=tables.getTable(tableModel);
|
getRowData( ForwardDatas.get_tb_forward_datas());
|
table.getColumnModel().getColumn(2).setPreferredWidth(100);// ÉèÖõÚÁпí
|
table.getColumnModel().getColumn(5).setPreferredWidth(100);// ÉèÖõÚÁпí
|
}
|
return table;
|
|
}
|
|
|
public JButtonModel getShuaxin() {
|
if(shuaxin==null){
|
shuaxin=new JButtonModel(buttonTitle.getRefresh());
|
shuaxin.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
updateTable() ;
|
}
|
});
|
|
}
|
return shuaxin;
|
}
|
|
public JButtonModel getAdd() {
|
if(add==null){
|
add=new JButtonModel(buttonTitle.getAddOne());
|
add.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(adddialog==null) {
|
adddialog=new AddTagDialog("Ìí¼ÓÊý¾Ýת·¢");
|
adds=true;
|
}
|
}
|
});
|
|
}
|
return add;
|
}
|
|
public JButtonModel get_xiu_gai() {
|
if(xiu_gai==null){
|
xiu_gai=new JButtonModel(buttonTitle.getAlert());
|
xiu_gai.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(xiugaidialog==null && table.getSelectedRow() !=-1) {
|
xiugaidialog=new XiugaiDialog("ÐÞ¸ÄÊý¾Ýת·¢");
|
adds=false;
|
}else {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÖÐÐèÒªÐ޸ĵÄÐУ¡");
|
return;
|
}
|
}
|
});
|
|
}
|
return xiu_gai;
|
}
|
|
public JButtonModel getDelete() {
|
if(delete==null){
|
delete=new JButtonModel("ɾ³ý");
|
delete.addActionListener(new ActionListener() {
|
@SuppressWarnings("unused")
|
public void actionPerformed(ActionEvent e) {
|
int[] selectedRows=table.getSelectedRows();//±»Ñ¡ÖÐÐеÄË÷Òý¼¯ºÏ
|
if(selectedRows.length !=0) {
|
for(int i=0;i<selectedRows.length;i++){
|
String id=(String) table.getValueAt(selectedRows[i], 0);
|
String port=(String) table.getValueAt(selectedRows[i], 3);
|
String deleteSql="DELETE FROM tb_forward_data WHERE id='"+id+"'";
|
DatabaseManagement.update(deleteSql);// ɾ³ý±êÇ©ÐÅÏ¢
|
ForwardDatas.delete_forward_data(id);
|
}
|
|
for(int j=selectedRows.length-1;j>=0;j--){//ÕâÊǹؼü´úÂë
|
tableModel.removeRow(selectedRows[j]);//ɾ³ýÈÎÒⱻѡÖÐÐÐ
|
}
|
table.setModel(tableModel);//¸üбí¸ñÄ£ÐÍ
|
|
//ɾ³ý³É¹¦ÌáʾÐÅÏ¢
|
ShowMessage.delteSuccess(selectedRows.length);
|
|
}
|
else {
|
ShowMessage.chooseRow(buttonTitle.getDelete());
|
}
|
|
}
|
});
|
|
}
|
return delete;
|
}
|
|
public JButtonModel getDeleteAll() {
|
if(deleteAll==null){
|
deleteAll=new JButtonModel(buttonTitle.getDeleteall());
|
deleteAll.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
//Ñ¡Ôñ¶Ô»°¿òÈçyes·µ»Ø0£¬NO·µ»Ø1£¬È¡Ïû·µ»Ø2
|
WarningMessage warning=new WarningMessage();
|
warning.setMessage("Ñ¡Ôñɾ³ýÈ«²¿½«»á°Ñ±í¸ñÊý¾ÝÈ«²¿É¾³ýÈ·¶¨Âð£¿");
|
int warn=warning.getwarMss(getNorthPanel());
|
int tagnum=table.getRowCount();//±í¸ñ×ÜÐÐÊý
|
if(tagnum!=0 && warn==0) {
|
String deleteSql="TRUNCATE TABLE tb_forward_data";
|
ShowMessage.deleteAll(DatabaseManagement.update(deleteSql));
|
ForwardDatas.delete_all_forward_data();
|
rq.repaint();
|
|
}
|
}
|
});
|
|
}
|
return deleteAll;
|
}
|
|
|
/**ˢбí¸ñ·½·¨*/
|
public void updateTable() {
|
if(tableModel !=null) {
|
tableModel.getDataVector().clear();
|
getRowData(ForwardDatas.getTb_forward_datas());
|
gd.validate();
|
}
|
}
|
|
/**Ìí¼Ó±í¸ñÐÐÏòÁ¿Êý¾Ý·½·¨*/
|
public void getRowData(Vector<Tb_forward_data> vc ) {
|
int size=vc.size();
|
for(int i=0;i<size;i++) {
|
Tb_forward_data tb=vc.get(i);
|
Vector<String> row = new Vector<>();
|
row.add(tb.getId()+"");
|
row.add(tb.getType());
|
row.add(tb.getIp());
|
row.add(tb.getPort());
|
row.add(tb.getDatatype());
|
row.add(tb.getAddtime());
|
tableModel.addRow(row);
|
}
|
|
}
|
|
/**¹ö¶¯Ãæ°å*/
|
public JScrollPane getGd() {
|
if(gd==null){
|
gd=new JScrollPane(getTable());
|
gd.getViewport().setBackground(UIColor.getNorth_color());
|
|
}
|
return gd;
|
}
|
/**Äϲ¿Ãæ°å*/
|
public NothJPanel getNorthPanel() {
|
if(northPanel==null) {
|
northPanel=new NothJPanel();
|
Box topicBox = Box.createHorizontalBox();// ´´½¨Ò»¸öˮƽÏäÈÝÆ÷
|
topicBox.add(getSearchFileld());//Ìí¼ÓËÑË÷Îı¾¿ò
|
topicBox.add(Box.createHorizontalStrut(3));// Ìí¼ÓÒ»¸ö3ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getSearch());//Ìí¼ÓËÑË÷°´Å¥
|
topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getShuaxin());//Ìí¼Óˢа´Å¥
|
topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getAdd());//Ìí¼ÓÐÂÔö°´Å¥
|
topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(get_xiu_gai());//Ìí¼ÓÐ޸İ´Å¥
|
topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getDelete());//Ìí¼Óɾ³ý°´Å¥
|
topicBox.add(Box.createHorizontalStrut(10));// Ìí¼ÓÒ»¸ö5ÏñËØ¿íµÄˮƽ֧Öù
|
topicBox.add(getDeleteAll());//Ìí¼Óɾ³ýÈ«²¿°´Å¥
|
northPanel.add(topicBox );
|
}
|
return northPanel;
|
}
|
|
/**ÐÂÔöת·¢¶Ô»°¿ò*/
|
class AddTagDialog extends JDialog implements WindowListener{
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
JlableModel type_lable=null;//ÐÒéÀàÐÍ
|
JlableModel ip_lable=null;//ip
|
JlableModel port_lable=null;//ת·¢¶Ë¿Ú
|
JlableModel neirong_lable=null;//Êý¾ÝÄÚÈÝ
|
|
JTextField ip_text=null;//ת·¢µØÖ·Îı¾¿ò
|
|
|
|
JComboBox<String> type_box=null;//Ñ¡ÔñÐÒéÀàÐÍÏÂÀ¿ò
|
JComboBox<String> neirong_box=null;//Ñ¡ÔñÊý¾ÝÄÚÈÝÏÂÀ¿ò
|
|
JButtonModel sure=null;
|
JButtonModel quxiao=null;
|
|
JPanel mb=null;//ÉêÃ÷Ò»¸öÃæ°å
|
|
/**¹Ø±Õ¶Ô»°¿ò·½·¨*/
|
public void closeTagDialog() {
|
this.dispose();
|
adddialog=null;
|
|
}
|
/**»ñÈ¡¶Ô»°¿ò·½·¨*/
|
public AddTagDialog(String title) {
|
super();
|
this.setAlwaysOnTop(true);//×ÜÊÇÖö¥
|
this.setTitle(title);
|
Toolkit toolkit = getToolkit();// »ñµÃ´°Ì幤¾ß°ü
|
Dimension screenSize = toolkit.getScreenSize();// »ñÈ¡ÆÁÄ»´óС
|
int width = (int) (screenSize.width* 0.5);// ¼ÆËã´°Ìåпí¶È
|
int height = (int) (screenSize.height * 0.5);// ¼ÆËã´°Ìåпí¶È
|
int x0=width-225;//´°Ìåx0×ø±ê
|
int y0=height-160;//´°Ìåy0×ø±ê
|
Container rq=getContentPane();
|
rq.add(getMb());
|
this.addWindowListener((WindowListener) this);
|
this.setBounds(x0, y0, 550, 320);
|
this.setVisible(true);
|
}
|
|
|
public JPanel getMb() {
|
if(mb==null){
|
mb=new JPanel();
|
mb.setLayout(null);
|
mb.add(getType_lable());
|
mb.add(getIp_lable());
|
mb.add(getPort_lable());
|
mb.add(getNeirong_lable());
|
mb.add(getIp_text());
|
mb.add(getPort_text());
|
mb.add(getPort_text());
|
mb.add(getType_box());
|
mb.add(getNeirong_box());
|
mb.add(getSure());
|
mb.add(getQuxiao());
|
|
int x=60;
|
int w0=80;
|
int width=300;
|
type_lable.setBounds(x, 20,w0, 25);
|
type_box.setBounds(x+w0, 20,width, 25);
|
|
|
ip_lable.setBounds(x, 65,w0, 25);
|
ip_text.setBounds(x+w0, 65,width, 25);
|
|
port_lable.setBounds(x, 110,w0, 25);
|
port_text.setBounds(x+w0, 110,width, 25);
|
|
neirong_lable.setBounds(x, 155,w0, 25);
|
neirong_box.setBounds(x+w0, 155,width, 25);
|
|
sure.setBounds(x+60, 220,w0, 25);
|
quxiao.setBounds(x+w0+150, 220,80, 25);
|
|
|
}
|
|
return mb;
|
}
|
|
|
|
public JlableModel getType_lable() {
|
if(type_lable==null) {
|
type_lable=new JlableModel("ÐÒéÀàÐÍ:");
|
}
|
return type_lable;
|
}
|
public JlableModel getIp_lable() {
|
if(ip_lable==null) {
|
ip_lable=new JlableModel("ת·¢µØÖ·:");
|
}
|
return ip_lable;
|
}
|
public JlableModel getPort_lable() {
|
if(port_lable==null) {
|
port_lable=new JlableModel("ת·¢¶Ë¿Ú:");
|
}
|
return port_lable;
|
}
|
public JlableModel getNeirong_lable() {
|
if(neirong_lable==null) {
|
neirong_lable=new JlableModel("Êý¾ÝÄÚÈÝ:");
|
}
|
return neirong_lable;
|
}
|
public JTextField getIp_text() {
|
if(ip_text==null) {
|
ip_text=new JTextField(10);
|
}
|
return ip_text;
|
}
|
public JTextField getPort_text() {
|
if(port_text==null) {
|
port_text=new JTextField(10);
|
}
|
return port_text;
|
}
|
public JComboBox<String> getType_box() {
|
if(type_box==null) {
|
type_box=new JComboBox<>();//´´½¨ÏÂÀ¿ò¶ÔÏó
|
type_box.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
|
String[] type_neirong= {"TCP","UDP","HTTP-Client","HTTP-Server"};
|
ComboBoxModel<String > coModel=new DefaultComboBoxModel<>(type_neirong);//ÏÂÀÁбíÄ£ÐÍ
|
type_box.setModel(coModel);
|
type_box.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(adds) {
|
String type=(String) type_box.getSelectedItem();
|
if(type.equals("HTTP-Client")) {
|
port_text.setText("²»ÓÃÌîд");
|
port_text.setEnabled(false);
|
}else {
|
port_text.setText("");
|
port_text.setEnabled(true);
|
}
|
}
|
}
|
});
|
}
|
return type_box;
|
}
|
public JComboBox<String> getNeirong_box() {
|
if(neirong_box==null) {
|
neirong_box=new JComboBox<>();//´´½¨ÏÂÀ¿ò¶ÔÏó
|
neirong_box.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
|
String[] shuju_neirong= {"λÖÃÊý¾Ý","È«²¿Êý¾Ý","¸æ¾¯Êý¾Ý","ÔʼÊý¾Ý","ÆøÌåÊý¾Ý","ͳ¼ÆÊý¾Ý","²½¾àÊý¾Ý","GNGGA","custom1"};
|
ComboBoxModel<String > coModel=new DefaultComboBoxModel<>(shuju_neirong);//ÏÂÀÁбíÄ£ÐÍ
|
neirong_box.setModel(coModel);
|
}
|
return neirong_box;
|
}
|
/**»ñȡȷ¶¨°´Å¥*/
|
public JButtonModel getSure() {
|
if(sure==null) {
|
sure=new JButtonModel("È·¶¨");
|
sure.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
String type=(String) getType_box().getSelectedItem();
|
String ip=ip_text.getText().trim();
|
String port=port_text.getText().trim();
|
String datatyp=getNeirong_box().getSelectedItem().toString();
|
|
if(port.length()<3) {
|
ShowMessage.zidingyi("ת·¢¶Ë¿Ú²»ÕýÈ·"+port);
|
return;
|
}
|
|
if((type.equals("TCP") || type.equals("UDP")) && !IpIsTrue.ipCheck(ip)) {
|
ShowMessage.zidingyi("ipµØÖ·²»ºÏ·¨£¡");
|
return;
|
}
|
if( ForwardDatas.forward_data_is_have(type, ip, port, datatyp)) {
|
ShowMessage.zidingyi("ÒѾ´æÔÚ£¬²»ÄÜÖØ¸´Ìí¼Ó£¡");
|
return;
|
}
|
|
//ÒѾ´æÔÚת·¢È«²¿Êý¾ÝÁ˲»ÄÜÌí¼Ó
|
if(ForwardDatas.get_all(type, ip, port)) {
|
ShowMessage.zidingyi("¸ÃµØÖ·¶Ë¿ÚÒѾѡÔñת·¢È«²¿Êý¾Ý£¬²»ÄÜÖØ¸´Ìí¼Ó£¡");
|
return;
|
}
|
|
String[] ziduan= {"type","ip","port","datatype","addtime"};
|
String[] zhi= {type,ip,port,datatyp,GetNowTime.now()};
|
|
if(DatabaseManagement.insertfast("tb_forward_data", ziduan, zhi)) {
|
ForwardDatas.add_tb_forward_data(type, ip, port, datatyp);
|
ShowMessage.zidingyi("Êý¾ÝÌí¼Ó³É¹¦£¡");
|
|
//ÐÂÔöÒ»ÐÐÊý¾Ý,Ïò±í¸ñĩβÌí¼ÓÒ»ÐÐÊý¾Ý
|
Vector<String> addrowData=new Vector<>();
|
addrowData.add(String.valueOf(table.getRowCount()+1));
|
addrowData.add(type);
|
addrowData.add(ip);
|
addrowData.add(port);
|
addrowData.add(datatyp);
|
addrowData.add(GetNowTime.now());
|
tableModel.addRow(addrowData);
|
closeTagDialog();
|
}
|
}
|
});
|
}
|
return sure;
|
}
|
|
|
|
/**»ñȡȡÏû°´Å¥*/
|
public JButtonModel getQuxiao() {
|
if(quxiao==null) {
|
quxiao=new JButtonModel("È¡Ïû");
|
quxiao.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
closeTagDialog();
|
adddialog=null;
|
}
|
});
|
}
|
return quxiao;
|
}
|
@Override
|
public void windowOpened(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
@Override
|
public void windowClosing(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
adddialog=null;
|
|
}
|
@Override
|
public void windowClosed(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
@Override
|
public void windowIconified(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
@Override
|
public void windowDeiconified(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
@Override
|
public void windowActivated(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
@Override
|
public void windowDeactivated(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
|
|
}
|
|
/**ÐÞ¸Äת·¢¶Ô»°¿ò*/
|
class XiugaiDialog extends AddTagDialog{
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
int row;
|
String id;
|
String typex;
|
String ipx;
|
String portx;
|
String datatypx;
|
public XiugaiDialog(String title) {
|
super(title);
|
row=table.getSelectedRow();
|
id=(String)table.getValueAt(row, 0);
|
typex=(String)table.getValueAt(row, 1);
|
ipx=(String)table.getValueAt(row, 2);
|
portx=(String)table.getValueAt(row, 3);
|
datatypx=(String)table.getValueAt(row, 4);
|
ip_text.setText(ipx);
|
port_text.setText(portx);
|
type_box.setSelectedItem(typex);
|
neirong_box.setSelectedItem(datatypx);
|
// TODO ×Ô¶¯Éú³ÉµÄ¹¹Ô캯Êý´æ¸ù
|
}
|
|
/**»ñȡȡÏû°´Å¥*/
|
public JButtonModel getQuxiao() {
|
if(quxiao==null) {
|
quxiao=new JButtonModel("È¡Ïû");
|
quxiao.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
closeTagDialog();
|
xiugaidialog=null;
|
}
|
});
|
}
|
return quxiao;
|
}
|
|
public void windowClosing(WindowEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
xiugaidialog=null;
|
|
}
|
|
/**»ñȡȷ¶¨°´Å¥*/
|
public JButtonModel getSure() {
|
if(sure==null) {
|
sure=new JButtonModel("È·¶¨");
|
sure.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
String id=String.valueOf(table.getValueAt(row, 0));
|
String type=(String) getType_box().getSelectedItem();
|
String ip=ip_text.getText().trim();
|
String port=port_text.getText().trim();
|
String datatyp=getNeirong_box().getSelectedItem().toString();
|
|
if(!IpIsTrue.ipCheck(ip)&& !type.equals("HTTP-Client")) {
|
ShowMessage.zidingyi("ipµØÖ·²»ºÏ·¨£¡");
|
return;
|
}
|
if( ForwardDatas.forward_data_is_have(type, ip, port, datatyp)) {
|
ShowMessage.zidingyi("ÒѾ´æÔÚ£¬²»ÄÜÖØ¸´Ìí¼Ó£¡");
|
return;
|
}
|
|
|
StringBuffer SQL=new StringBuffer("UPDATE tb_forward_data SET type='"
|
+type+
|
"', ip='"+ip+
|
"', port='"+port+
|
"', datatype='"+datatyp+
|
"', addtime='"+GetNowTime.now()+
|
"' where id='"+id+"'");
|
|
if(DatabaseManagement.update(SQL.toString()) !=0) {
|
ForwardDatas.xiugai(id,type, ip, port, datatyp);
|
ShowMessage.zidingyi("Êý¾ÝÐ޸ijɹ¦£¡");
|
updateTable();
|
}
|
}
|
});
|
}
|
|
return sure;
|
}
|
|
|
}
|
|
}
|