package Frame;
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.Container;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseListener;
|
import java.io.IOException;
|
import java.util.Iterator;
|
import java.util.Vector;
|
import javax.swing.ButtonGroup;
|
import javax.swing.ImageIcon;
|
import javax.swing.JRadioButton;
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.JTable;
|
import javax.swing.JTextArea;
|
import javax.swing.JTextField;
|
import javax.swing.ListSelectionModel;
|
import javax.swing.event.InternalFrameEvent;
|
import javax.swing.event.InternalFrameListener;
|
import javax.swing.table.DefaultTableModel;
|
import ColorAndFont.ChooseFont;
|
import ColorAndFont.English;
|
import ColorAndFont.UIColor;
|
import ColorAndFont.buttonTitle;
|
import DataBase.DatabaseManagement;
|
import Method.JComboBoxModel;
|
import PbuliClass.JButtonModel;
|
import PbuliClass.JlableModel;
|
import PbuliClass.ShowMessage;
|
import PbuliClass.Systems;
|
import PbuliClass.greateTables;
|
import PbuliClass.jinternalFrame;
|
import tbDataModel.Wifidata;
|
import tbDataModel_Dell.DellS2;
|
import tbDataModel_Dell.Dell_Wifi;
|
|
/* ´ËÀàÓÃÓÚÍøÂçÄ£¿éS2Ïà¹ØÉèÖÃ*/
|
public class WifiMange extends jinternalFrame implements Runnable{
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
|
Container rq;
|
JlableModel jl_name=new JlableModel("Óû§Ãû:");
|
JlableModel jl_pass=new JlableModel("ÃÜ Âë:");
|
JlableModel jl_shebeiname=new JlableModel("É豸ID:");
|
JlableModel jl_port=new JlableModel("Ä¿±ê¶Ë¿Ú:");
|
JlableModel jl_model=new JlableModel("ÐÒéÀàÐÍ:");
|
JlableModel jl_moshi=new JlableModel("¹¤×÷ģʽ:");
|
JlableModel jl_ip=new JlableModel("¾²Ì¬IP:");
|
JlableModel jl_wangguan=new JlableModel("Íø ¹Ø:");
|
JlableModel jl_ziwang=new JlableModel("×ÓÍøÑÚÂë:");
|
JlableModel jl_fuwuip=new JlableModel("Ä¿±êIP:");
|
JlableModel jl_MAC=new JlableModel("MACµØÖ·:");
|
JlableModel jl_wifiname=new JlableModel("WIFIÃû³Æ:");
|
JlableModel jl_wifipass=new JlableModel("WIFIÃÜÂë:");
|
JlableModel jl_jiamileixing=new JlableModel("¼ÓÃÜÀàÐÍ:");
|
JlableModel jl_jiamisuanfa=new JlableModel("¼ÓÃÜËã·¨:");
|
JlableModel jl_sousuoport=new JlableModel("ËÑË÷¶Ë¿Ú:");
|
JlableModel jl_keyword=new JlableModel("¹Ø¼ü×Ö:");
|
|
static JTextField jt_name=new JTextField(Dell_Wifi.getMoren().getWebname());
|
static JTextField jt_pass=new JTextField(Dell_Wifi.getMoren().getWebPass());
|
static JTextField jt_shebeiname=new JTextField(Dell_Wifi.getMoren().getAnchorid());
|
static JTextField jt_port=new JTextField(Dell_Wifi.getMoren().getPort());
|
static JTextField jt_ip=new JTextField(Dell_Wifi.getMoren().getIp());
|
static JTextField jt_wangguan=new JTextField(Dell_Wifi.getMoren().getWangguan());
|
static JTextField jt_ziwang=new JTextField(Dell_Wifi.getMoren().getZiwang());
|
static JTextField jt_fuwuip=new JTextField(Dell_Wifi.getMoren().getFuwuip());
|
static JTextField jt_MAC=new JTextField();
|
static JTextField jt_wifiname=new JTextField(Dell_Wifi.getMoren().getWifiname());
|
static JTextField jt_wifipass=new JTextField(Dell_Wifi.getMoren().getWifipass());
|
static JTextField jt_sousuoport=new JTextField(Dell_Wifi.getMoren().getSousuoport());
|
static JTextField jt_keyword=new JTextField(Dell_Wifi.getMoren().getKeyword());
|
|
JComboBoxModel jb_xieyi=null;//ÐÒéÀàÐÍ
|
JComboBoxModel jb_moshi=null;//¹¤×÷ģʽ
|
JComboBoxModel jb_jiamileixing=null;//¼ÓÃÜÀàÐÍ
|
JComboBoxModel jb_jiamisuanfa=null;//¼ÓÃÜËã·¨
|
ButtonGroup btgroup=null;//ÉêÃ÷°´Å¥×é
|
|
|
|
String ip=null;
|
int selectedrow=0;
|
static JTextArea textArea=null;
|
JButtonModel jbt_serch=null;//ËÑË÷°´Å¥
|
JButtonModel jbt_help=null;//°ïÖú
|
JButtonModel jbt_save=null;//±£´æ
|
JButtonModel jbt_clear=null;//Çå¿Õ
|
JButtonModel jbt_reboot=null;//ÖØÆô
|
JButtonModel jbt_reset=null;//»Ö¸´³ö³§ÉèÖÃ
|
JButtonModel jbt_alertall=null;//ÐÞ¸ÄÈ«²¿
|
JButtonModel jbt_moren=null;//ĬÈϲÎÊý
|
JButtonModel jbt_open=null;//ĬÈϲÎÊý
|
JButtonModel jbt_alertid=null;//ÐÞ¸ÄÉ豸ID
|
JButtonModel jbt_alertip=null;//ÐÞ¸ÄÉ豸ip
|
|
|
JRadioButton jc_ip=null;
|
JRadioButton jc_wangguan=null;
|
JRadioButton jc_adress=null;
|
JRadioButton jc_wifiname=null;
|
JRadioButton jc_wifipass=null;
|
|
|
JPanel jp_mb=null;//Äϲ¿Ãæ°å
|
JScrollPane gd=null;//¹ö¶¯Ãæ°å
|
JScrollPane gd2=null;//¹ö¶¯Ãæ°å
|
JTable table=null;//ÉêÃ÷±í¸ñ
|
static DefaultTableModel tableModel=null;//ÉùÃ÷±í¸ñÄ£ÐÍ
|
int x1=410;
|
int y1=30;
|
|
int x2=630;
|
int y2=30;
|
Vector<Vector<String>> rowData=null;
|
static boolean alertall=false;
|
boolean startsave=false;
|
int i=0;
|
int sleeptime=530;
|
|
int k=0;//Ö´ÐеÄ˳Ðò
|
int h=0;//È«²¿ÐÞ¸ÄÖ´ÐеÄ˳Ðò
|
boolean alertallok=false;
|
int anchornum=0;
|
String xieyi="UDP";
|
|
|
|
public WifiMange() {
|
String title="WIFI¹ÜÀí";
|
if(Systems.sys().getLanguage().equals("English")) {
|
title="Anchor WIFI Management";
|
}
|
this.setTitle(title);
|
rq=getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(Color.white);
|
rq.add(getJp_mb());
|
this.setFrameIcon(new ImageIcon("image/icon/anchoricon.png"));//ÉèÖô°Ìåͼ±ê
|
rowData=new Vector<>();
|
jt_sousuoport.setEnabled(false);
|
jt_MAC.setEnabled(false);
|
jt_port.setEnabled(false);
|
this.setSize(910,630);
|
this.addInternalFrameListener(new InternalFrameListener() {
|
public void internalFrameOpened(InternalFrameEvent e) {
|
}
|
|
public void internalFrameIconified(InternalFrameEvent e) {
|
|
}
|
|
public void internalFrameDeiconified(InternalFrameEvent e) {
|
|
}
|
|
public void internalFrameDeactivated(InternalFrameEvent e) {
|
}
|
|
public void internalFrameClosing(InternalFrameEvent e) {
|
}
|
|
public void internalFrameClosed(InternalFrameEvent e) {
|
textArea=null;
|
tableModel=null;
|
Dell_Wifi.setDellwifi(false);
|
}
|
|
public void internalFrameActivated(InternalFrameEvent e) {
|
|
}
|
});
|
|
}
|
|
|
public JPanel getJp_mb() {
|
if(jp_mb==null) {
|
jp_mb=new JPanel();
|
getBtgroup();
|
jp_mb.setLayout(null);
|
jp_mb.add(getJbt_serch());
|
jp_mb.add(getJbt_help() );
|
jp_mb.add(getGd());
|
jp_mb.add(getJbt_save());
|
jp_mb.add(getGd2());
|
jp_mb.add(getJbt_clear());
|
jp_mb.add(getJbt_reboot() );
|
jp_mb.add(getJbt_reset() );
|
jp_mb.add(getJbt_open());
|
jp_mb.add(getJc_ip());
|
jp_mb.add(getJc_wangguan());
|
jp_mb.add(getJc_adress());
|
jp_mb.add(getJc_wifiname());
|
jp_mb.add(getJc_wifipass());
|
jp_mb.add(getJbt_alertall());
|
jp_mb.add(jt_wifiname);
|
jp_mb.add(jt_wifipass);
|
jp_mb.add(getJb_jiamileixing());
|
jp_mb.add(getJb_jiamisuanfa());
|
jp_mb.add(jl_sousuoport);
|
jp_mb.add(jt_sousuoport);
|
jp_mb.add(getJbt_moren());
|
gd2.setBounds(x1, y2+320, 410,200);
|
gd.setBounds(10, y1,380,520);
|
jp_mb.add(jt_name);
|
jp_mb.add(jl_moshi);
|
jp_mb.add(jt_pass);
|
jp_mb.add(jt_shebeiname);
|
jp_mb.add(jt_port);
|
jp_mb.add(getJb_moshi());
|
jp_mb.add(getJb_xieyi());
|
jp_mb.add(jt_ip);
|
jp_mb.add(jt_wangguan);
|
jp_mb.add(jt_ziwang);
|
jp_mb.add(jt_fuwuip);
|
jp_mb.add(jt_MAC);
|
jp_mb.add(jl_name);
|
jp_mb.add(jl_pass);
|
jp_mb.add(jl_shebeiname);
|
jp_mb.add(jl_port);
|
jp_mb.add(jl_model);
|
jp_mb.add(jl_ip);
|
jp_mb.add(jl_wangguan);
|
jp_mb.add(jl_ziwang);
|
jp_mb.add(jl_fuwuip);
|
jp_mb.add(jl_MAC);
|
jp_mb.add(jl_wifiname);
|
jp_mb.add(jl_wifipass);
|
jp_mb.add(jl_jiamileixing);
|
jp_mb.add(jl_jiamisuanfa);
|
jp_mb.add(jl_keyword);
|
jp_mb.add(jt_keyword);
|
jp_mb.add(getJbt_alertid());
|
jp_mb.add(getJbt_alertip());
|
|
//Óû§Ãû
|
jl_name.setBounds(x1, y1,65, 25);
|
jt_name.setBounds(x1+65, y1, 110, 25);
|
|
//ÃÜÂë
|
jl_pass.setBounds(x1,y1+40, 65, 25);
|
jt_pass.setBounds(x1+65, y1+40, 110, 25);
|
|
//É豸Ãû³Æ
|
jl_shebeiname.setBounds(x1, y1+80, 80, 25);
|
jt_shebeiname.setBounds(x1+65, y1+80,50, 25);
|
jbt_alertid.setBounds(x1+120, y1+80,60, 25);
|
|
//·þÎñÆ÷¶Ë¿Ú
|
jl_port.setBounds(x1, y1+120, 80, 25);
|
jt_port.setBounds(x1+80, y1+120,100, 25);
|
|
//ÐÒéÀàÐÍ
|
jl_model.setBounds(x1, y1+160, 80, 25);
|
jb_xieyi.setBounds(x1+80, y1+160,100, 25);
|
|
//¹¤×÷ģʽ
|
jl_moshi.setBounds(x1, y1+200, 80, 25);
|
jb_moshi.setBounds(x1+80, y1+200, 100, 25);
|
|
//wifiÃû³Æ
|
jl_wifiname.setBounds(x1, y1+240, 80, 25);
|
jt_wifiname.setBounds(x1+80, y1+240,100, 25);
|
jc_wifiname.setBounds(x1+185, y1+240,20, 25);
|
|
//wifiÃÜÂë
|
jl_wifipass.setBounds(x1, y1+280, 80, 25);
|
jt_wifipass.setBounds(x1+80, y1+280, 100, 25);
|
jc_wifipass.setBounds(x1+185, y1+280,20, 25);
|
|
//ipµØÖ·
|
jl_ip.setBounds(x2, y2,80, 25);
|
jt_ip.setBounds(x2+80, y2,90, 25);
|
jbt_alertip.setBounds(x2+180, y2,60, 25);
|
jc_ip.setBounds(x2+245, y2,20, 25);
|
|
//Íø¹Ø
|
jl_wangguan.setBounds(x2, y2+40, 80, 25);
|
jt_wangguan.setBounds(x2+80, y2+40,100, 25);
|
jc_wangguan.setBounds(x2+185, y2+40,20, 25);
|
|
//×ÓÍøÑÚÂë
|
jl_ziwang.setBounds(x2, y2+80, 80, 25);
|
jt_ziwang.setBounds(x2+80, y2+80,100, 25);
|
|
//·þÎñÆ÷IPµØÖ·
|
jl_fuwuip.setBounds(x2, y2+120, 80, 25);
|
jt_fuwuip.setBounds(x2+80, y2+120,100, 25);
|
jc_adress.setBounds(x2+185, y2+120,20, 25);
|
|
//MACµØÖ·
|
jl_MAC.setBounds(x2, y2+160, 80, 25);
|
jt_MAC.setBounds(x2+80, y2+160,100, 25);
|
|
//¼ÓÃÜÀàÐÍ
|
jl_jiamileixing.setBounds(x2, y2+200, 80, 25);
|
jb_jiamileixing.setBounds(x2+80, y2+200,100, 25);
|
|
//¼ÓÃÜËã·¨
|
jl_jiamisuanfa.setBounds(x2, y2+240, 80, 25);
|
jb_jiamisuanfa.setBounds(x2+80, y2+240,100, 25);
|
|
//ËÑË÷¶Ë¿Ú
|
jl_sousuoport.setBounds(x2, y2+280, 80, 25);
|
jt_sousuoport.setBounds(x2+80, y2+280,100, 25);
|
|
//ËÑË÷¹Ø¼ü×Ö
|
jl_keyword.setBounds(10, y1+530, 60, 25);
|
jt_keyword.setBounds(70, y1+530, 80, 25);
|
jbt_serch.setBounds(155,y1+530, 60, 25);
|
jbt_moren.setBounds(225,y1+530, 80, 25);
|
jbt_open.setBounds(315,y1+530, 80, 25);
|
|
|
jbt_save.setBounds(x1, y1+530, 60, 25);
|
jbt_alertall.setBounds(x1+80, y1+530, 90, 25);
|
jbt_reset.setBounds(x1+190, y1+530,60, 25);
|
jbt_reboot.setBounds(x1+270,y1+530,60, 25);
|
jbt_clear.setBounds(x1+350, y1+530,60, 25);
|
//jbt_help.setBounds(x1, y1+530, 60, 25);
|
|
|
}
|
return jp_mb;
|
}
|
|
/**Æô¶¯Ï̵߳ķ½·¨*/
|
public void startThread() {
|
Thread t=new Thread(this);
|
t.start();
|
}
|
|
|
|
/**ËÑË÷°´Å¥*/
|
public JButtonModel getJbt_serch() {
|
if(jbt_serch==null) {
|
jbt_serch=new JButtonModel(buttonTitle.getSerch());
|
jbt_serch.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
textArea.setText("");
|
//Çå¿Õ¼¯ºÏÖеÄÐÅÏ¢
|
Dell_Wifi.getWifi_vector().removeAllElements();
|
updateTable();
|
Dell_Wifi.serch();
|
selectedrow=-1;
|
ip=null;
|
}
|
});
|
|
}
|
return jbt_serch;
|
}
|
|
/**°ïÖú°´Å¥*/
|
public JButtonModel getJbt_help() {
|
if(jbt_help==null) {
|
jbt_help=new JButtonModel("more");
|
jbt_help.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
try {
|
Runtime.getRuntime().exec("cmd /c systemFiles\\IP\\anchormage.exe");
|
} catch (IOException e1) {
|
e1.printStackTrace();
|
ShowMessage.zidingyi("´ò¿ªÊ§°Ü£¡");
|
}
|
}
|
});
|
|
}
|
return jbt_help;
|
}
|
|
/**±£´æ²ÎÊý*/
|
public JButtonModel getJbt_save() {
|
if(jbt_save==null) {
|
jbt_save=new JButtonModel(buttonTitle.getSave());
|
jbt_save.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
|
if(ip==null) {
|
ShowMessage.zidingyi("ÇëÑ¡ÖÐÐèÒª±£´æµÄÉ豸ip");
|
return;
|
}
|
|
textArea.setText("");
|
if(jt_MAC.getText().length()<5) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
if(i==0) {
|
if(jb_xieyi.getSelectedIndex()==0) {
|
xieyi="TCP";
|
}else {
|
xieyi="UDP";
|
}
|
startThread();
|
i=1;
|
}
|
startsave=true;
|
alertallok=false;
|
k=0;
|
|
}
|
});
|
}
|
return jbt_save;
|
}
|
|
|
/**ˢбí¸ñ·½·¨*/
|
public void updateTable() {
|
if(tableModel !=null) {
|
tableModel.getDataVector().clear();
|
getRowData(Dell_Wifi.getWifi_vector());
|
gd.validate();
|
}
|
}
|
|
/**Ìí¼Ó±í¸ñÐÐÏòÁ¿Êý¾Ý·½·¨*/
|
public void getRowData( Vector<Wifidata> wifidata ) {
|
Iterator<Wifidata> iterator = wifidata.iterator();//´´½¨µü´úÆ÷
|
|
while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ
|
Vector<String> row = new Vector<>();
|
Wifidata s2 = iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½list¼¯ºÏ
|
row.add(s2.getIp());
|
row.add(s2.getAnchorid());
|
row.add(s2.getMacid());
|
row.add(s2.getVersion());
|
tableModel.addRow(row);
|
}
|
}
|
|
|
|
public JScrollPane getGd() {
|
if(gd==null) {
|
gd=new JScrollPane(getTable());
|
gd.getViewport().setBackground(UIColor.getNorth_color());
|
}
|
return gd;
|
}
|
|
public JScrollPane getGd2() {
|
if(gd2==null) {
|
gd2=new JScrollPane(get_text_area());
|
}
|
return gd2;
|
}
|
|
/**»ñÈ¡»ùÕ¾±í¸ñµÄ·½·¨*/
|
public JTable getTable() {
|
if(table==null) {
|
//Ìí¼Ó±í¸ñÁÐÏòÁ¿
|
String[] name1= {"É豸ip","É豸Ãû³Æ","MACµØÖ·","°æ±¾"};//±í¸ñÁÐÃû
|
String[] name2= {"Device ip","device name","MAC address","version"};//±í¸ñÁÐÃû
|
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();
|
|
if(tableModel==null) {
|
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.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
//¸ø±í¸ñÌí¼Ó¼àÌýʼþ
|
//¸øtable¼ÓÉÏÒ»¸öÊó±êʼþ¼àÌýÆ÷¶ÔÏó
|
table.addMouseListener(new MouseListener() {
|
public void mouseReleased(MouseEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
|
@Override
|
public void mousePressed(MouseEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
|
@Override
|
public void mouseExited(MouseEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
|
@Override
|
public void mouseEntered(MouseEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
|
}
|
|
@Override
|
public void mouseClicked(MouseEvent e) {
|
selectedrow=table.getSelectedRow();
|
ip=(String) table.getValueAt(selectedrow, 0);
|
set_mess(selectedrow);
|
|
}
|
});
|
|
}
|
|
}
|
return table;
|
|
}
|
|
|
|
public static JTextArea get_text_area() {
|
if(textArea==null) {
|
textArea=new JTextArea(10,2);
|
textArea.setBackground(Color.white);
|
textArea.setForeground(Color.black);
|
textArea.setFont(ChooseFont.getFont(12));
|
|
}
|
return textArea;
|
}
|
|
|
public JButtonModel getJbt_clear() {
|
|
if(jbt_clear==null) {
|
jbt_clear=new JButtonModel("Çå ¿Õ");
|
jbt_clear.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
textArea.setText("");
|
}
|
});
|
}
|
return jbt_clear;
|
}
|
|
|
|
public static DefaultTableModel getTableModel() {
|
return tableModel;
|
}
|
|
|
public static JTextField getJt_name() {
|
return jt_name;
|
}
|
|
|
public static JTextField getJt_pass() {
|
return jt_pass;
|
}
|
|
|
public static JTextField getJt_shebeiname() {
|
return jt_shebeiname;
|
}
|
|
|
public static JTextField getJt_port() {
|
return jt_port;
|
}
|
|
|
|
|
public static JTextField getJt_ip() {
|
return jt_ip;
|
}
|
|
|
public static JTextField getJt_wangguan() {
|
return jt_wangguan;
|
}
|
|
|
public static JTextField getJt_ziwang() {
|
return jt_ziwang;
|
}
|
|
|
public static JTextField getJt_fuwuip() {
|
return jt_fuwuip;
|
}
|
|
|
|
|
public static void setJt_name(JTextField jt_name) {
|
WifiMange.jt_name = jt_name;
|
}
|
|
public void set_mess(int selectedrow) {
|
|
String shebeiname=(String) table.getValueAt(selectedrow, 1);
|
String jingtaiip=(String) table.getValueAt(selectedrow, 0);
|
if(!shebeiname.equals("USR-C215")) {
|
jt_shebeiname.setText((String) table.getValueAt(selectedrow, 1));
|
}
|
|
if(!jingtaiip.equals("10.10.100.254")) {
|
jt_ip.setText((String) table.getValueAt(selectedrow, 0));
|
}
|
|
jt_MAC.setText((String) table.getValueAt(selectedrow, 2));
|
}
|
|
|
public JButtonModel getJbt_reboot() {
|
if(jbt_reboot==null) {
|
jbt_reboot=new JButtonModel("ÖØ Æô");
|
jbt_reboot.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(ip==null) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
if(ip.length()<5 ) {
|
ShowMessage.zidingyi("ûÓÐÑ¡ÖÐÉ豸");
|
return;
|
}
|
Dell_Wifi.reboot(ip);
|
|
}
|
});
|
}
|
return jbt_reboot;
|
}
|
|
|
public JButtonModel getJbt_reset() {
|
if(jbt_reset==null) {
|
jbt_reset=new JButtonModel("ÖØ ÖÃ");
|
jbt_reset.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(ip==null) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
if(ip.length()<5 ) {
|
ShowMessage.zidingyi("ûÓÐÑ¡ÖÐÉ豸");
|
return;
|
}
|
Dell_Wifi.reset(ip);
|
}
|
});
|
}
|
return jbt_reset;
|
}
|
|
|
public JRadioButton getJc_ip() {
|
if(jc_ip==null) {
|
jc_ip=new JRadioButton();
|
jc_ip.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
DellS2.getalls2();
|
}
|
});
|
}
|
return jc_ip;
|
}
|
|
|
public JRadioButton getJc_wangguan() {
|
if(jc_wangguan==null) {
|
jc_wangguan=new JRadioButton();
|
jc_wangguan.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
DellS2.getalls2();
|
}
|
});
|
}
|
return jc_wangguan;
|
}
|
|
|
public JRadioButton getJc_adress() {
|
if(jc_adress==null) {
|
jc_adress=new JRadioButton();
|
jc_adress.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
DellS2.getalls2();
|
}
|
});
|
}
|
return jc_adress;
|
}
|
|
|
public JButtonModel getJbt_alertall() {
|
if(jbt_alertall==null) {
|
jbt_alertall=new JButtonModel("È«²¿ÐÞ¸Ä");
|
jbt_alertall.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
|
|
if(!jc_adress.isSelected() && !jc_wangguan.isSelected() && !jc_ip.isSelected()
|
&& !jc_wifiname.isSelected() && !jc_wifipass.isSelected()) {
|
ShowMessage.zidingyi("ÇëÑ¡ÖÐÐèҪȫ²¿Ð޸ĵÄÄÚÈÝÔÚµã»÷È«²¿Ð޸ģ¡");
|
return;
|
}
|
if(i==0) {
|
startThread();
|
i=1;
|
}
|
|
anchornum=Dell_Wifi.getWifi_vector().size();
|
|
if(anchornum !=0) {
|
//ÐÞ¸ÄÈ«²¿¹¦ÄÜ´ò¿ª
|
startsave=false;
|
alertallok=true;
|
h=0;
|
}
|
|
ShowMessage.zidingyi("È«²¿ÐÞ¸ÄÃüÁîÒÑÖ´ÐУ¡");
|
}
|
});
|
}
|
return jbt_alertall;
|
}
|
|
|
public static boolean isAlertall() {
|
return alertall;
|
}
|
|
|
public static void setAlertall(boolean alertall) {
|
WifiMange.alertall = alertall;
|
}
|
|
/**ÐÒéÀàÐÍ*/
|
public JComboBoxModel getJb_xieyi() {
|
if(jb_xieyi==null) {
|
String[] neirong= {"TCP-Client","TCP-Server","UDP-Server","UDP-Client"};
|
jb_xieyi=new JComboBoxModel(neirong);
|
if(Dell_Wifi.getMoren().getXieyitype().equals("TCP")) {
|
jb_xieyi.setSelectedIndex(0);
|
}else {
|
jb_xieyi.setSelectedIndex(3);
|
}
|
}
|
return jb_xieyi;
|
}
|
|
/**¹¤×÷ģʽ*/
|
public JComboBoxModel getJb_moshi() {
|
if(jb_moshi==null) {
|
String[] neirong= {"¹¤×÷Õ¾","½ÓÈëµã","ÖмÌ"};
|
jb_moshi=new JComboBoxModel(neirong);
|
if(Dell_Wifi.getMoren().getModel().equals("STA")) {
|
jb_moshi.setSelectedIndex(0);
|
}else if(Dell_Wifi.getMoren().getModel().equals("AP")) {
|
jb_xieyi.setSelectedIndex(1);
|
}else{
|
jb_xieyi.setSelectedIndex(0);
|
}
|
}
|
return jb_moshi;
|
}
|
|
/**¼ÓÃÜÀàÐÍ*/
|
public JComboBoxModel getJb_jiamileixing() {
|
if(jb_jiamileixing==null) {
|
String[] neirong= {"WPA2PSK","AUT0","OPEN","WPAPSK","WEB"};
|
jb_jiamileixing=new JComboBoxModel(neirong);
|
}
|
return jb_jiamileixing;
|
}
|
|
public static JTextField getJt_sousuoport() {
|
return jt_sousuoport;
|
}
|
|
|
public static JTextField getJt_keyword() {
|
return jt_keyword;
|
}
|
|
|
/**¼ÓÃÜËã·¨*/
|
public JComboBoxModel getJb_jiamisuanfa() {
|
if(jb_jiamisuanfa==null) {
|
String[] neirong= {"AES","TKIP"};
|
jb_jiamisuanfa=new JComboBoxModel(neirong);
|
}
|
return jb_jiamisuanfa;
|
}
|
|
/**da=1´ú±íÉèÖã¬da=0*/
|
public void savemessage(int da) throws InterruptedException {
|
//wifiģʽ
|
if(k==0) {
|
String model="STA";
|
String model1=(String) jb_moshi.getSelectedItem();
|
if(model1.equals("½ÓÈëµã")) {
|
model="AP";
|
}else if(model1.equals("ÖмÌ")) {
|
model="APSTA";
|
}
|
Dell_Wifi.wifi_model(ip,model,da);
|
|
}
|
|
|
//ÉèÖÃwifiÃû³Æ
|
if(k==1) {
|
String wifiname=jt_wifiname.getText().trim();
|
Dell_Wifi.wifi_WSSSID(wifiname,ip,da);
|
}
|
|
//ÉèÖÃSTAµÄ¼ÓÃܲÎÊý
|
if(k==2) {
|
String WPA2PSK=(String) jb_jiamileixing.getSelectedItem();
|
String AES=(String) jb_jiamisuanfa.getSelectedItem();
|
String mima=jt_wifipass.getText().trim();
|
Dell_Wifi.wifi_STAjiami(WPA2PSK, AES, mima, ip, da);
|
}
|
|
|
|
|
//ÍøÒ³Óû§Ãû
|
if(k==3) {
|
String webname= jt_name.getText().trim();
|
String webpass= jt_pass.getText().trim();
|
if(!webname.equals("admin") || !webpass.equals("admin")) {
|
Dell_Wifi.wifi_WEBU(webname, webpass,da,ip);
|
}
|
}
|
|
//É豸id
|
if(k==4) {
|
String id=jt_shebeiname.getText().trim();
|
Dell_Wifi.wifi_WRMID(id,ip,da);
|
}
|
|
//ÉèÖÃÍøÂç²ÎÊý
|
if(k==5) {
|
String nip=jt_ip.getText().trim();
|
String wangguan=jt_wangguan.getText().trim();
|
String ziwang=jt_ziwang.getText().trim();
|
Dell_Wifi.wifi_WANN(nip,wangguan,ziwang,ip,da);
|
}
|
|
|
|
//ÉèÖÃÍøÂçÐÒé²ÎÊý
|
if(k==6) {
|
String fuwuip=jt_fuwuip.getText().trim();
|
String port=jt_port.getText().trim();
|
Dell_Wifi.wifi_NETP(xieyi,"CLIENT",port,fuwuip,ip,da);
|
}
|
|
|
|
//ÉèÖÃËÑË÷¹Ø¼ü×Ö
|
if(k==7) {
|
Dell_Wifi.wifi_ASWD("HXZK",da, ip);
|
}
|
|
if(k==8) {
|
String nip=jt_ip.getText().trim();
|
Dell_Wifi.reboot(nip);
|
}
|
|
|
}
|
|
public void run() {
|
while(true) {
|
try {
|
if(startsave) {
|
savemessage(1);
|
k++;
|
if(k==9) {
|
k=0;
|
startsave=false;
|
}
|
}
|
|
if(alertallok) {
|
Wifidata wifi=Dell_Wifi.getWifi_vector().get(h);
|
String ip2=wifi.getIp();
|
//Èç¹ûµØÖ·±»Ñ¡ÖÐÐ޸ķþÎñÆ÷µØÖ·ºÍ¶Ë¿Ú
|
if(jc_adress.isSelected()) {
|
|
//ÉèÖÃÍøÂçÐÒé²ÎÊý
|
String fuwuip=jt_fuwuip.getText().trim();
|
String port=jt_port.getText().trim();
|
Dell_Wifi.wifi_NETP("TCP","CLIENT",port,fuwuip,ip2,1);
|
|
}else if(jc_wangguan.isSelected() || jc_ip.isSelected()) {
|
|
//ÉèÖÃÍøÂç²ÎÊý
|
String nip=jt_ip.getText().trim();
|
String wangguan=jt_wangguan.getText().trim();
|
String ziwang=jt_ziwang.getText().trim();
|
Dell_Wifi.wifi_WANN(nip,wangguan,ziwang,ip2,1);
|
}else if(jc_wifiname.isSelected() || jc_wifipass.isSelected()) {
|
|
//ÉèÖÃÍøÂçÐÒé²ÎÊý
|
String fuwuip=jt_fuwuip.getText().trim();
|
String port=jt_port.getText().trim();
|
Dell_Wifi.wifi_NETP("TCP","CLIENT",port,fuwuip,ip2,1);
|
}
|
|
//ÖØÆôÉ豸
|
Dell_Wifi.reboot(ip2);
|
|
h++;
|
if(h==(Dell_Wifi.getWifi_vector().size())) {
|
alertallok=false;
|
}
|
}
|
//ÐÝÃßʱ¼ä
|
Thread.sleep(sleeptime);
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|
|
|
public JButtonModel getJbt_moren() {
|
if(jbt_moren==null) {
|
jbt_moren=new JButtonModel("´æÎª³£ÓÃ");
|
jbt_moren.setToolTipText("½«²ÎÊý±£´æÎª³£ÓõÄĬÈϲÎÊý£¡");
|
jbt_moren.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
//ÍøÒ³Óû§Ãû
|
String webname= jt_name.getText().trim();
|
String webpass= jt_pass.getText().trim();
|
if(webname.length()<3 || webpass.length()<3) {
|
ShowMessage.zidingyi("ÍøÒ³µÇ¼Ãû»òÕßÃÜÂëÓÐÎó£¡");
|
return;
|
}
|
//É豸id
|
String id=jt_shebeiname.getText().trim();
|
if(id.length()<3 ) {
|
ShowMessage.zidingyi("É豸IDÊäÈëÓÐÎó£¡");
|
return;
|
}
|
|
//ÉèÖÃÍøÂç²ÎÊý
|
String nip=jt_ip.getText().trim();
|
String wangguan=jt_wangguan.getText().trim();
|
String ziwang=jt_ziwang.getText().trim();
|
ShowMessage.isIpAdress(nip);
|
ShowMessage.isIpAdress(wangguan);
|
ShowMessage.isIpAdress(ziwang);
|
|
|
//ÉèÖÃSTAµÄ¼ÓÃܲÎÊý
|
String WPA2PSK=(String) jb_jiamileixing.getSelectedItem();
|
String AES=(String) jb_jiamisuanfa.getSelectedItem();
|
|
|
//ÉèÖÃwifiÃû³Æ
|
String wifiname=jt_wifiname.getText().trim();
|
String wifipassword=jt_wifipass.getText().trim();
|
|
//ÉèÖÃÍøÂçÐÒé²ÎÊý
|
String fuwuip=jt_fuwuip.getText().trim();
|
String port=jt_port.getText().trim();
|
|
//wifiģʽ
|
String model="STA";
|
String model1=(String) jb_moshi.getSelectedItem();
|
if(model1.equals("½ÓÈëµã")) {
|
model="AP";
|
}else if(model1.equals("ÖмÌ")) {
|
model="APSTA";
|
}
|
|
String sousuoport=jt_sousuoport.getText().trim();
|
|
//ËÑË÷¹Ø¼ü×Ö
|
String keyword=jt_keyword.getText().trim();
|
|
Dell_Wifi.getMoren().setWebname(webname);
|
Dell_Wifi.getMoren().setWebPass(webpass);
|
Dell_Wifi.getMoren().setAnchorid(id);
|
Dell_Wifi.getMoren().setPort(port);
|
Dell_Wifi.getMoren().setModel(model);
|
Dell_Wifi.getMoren().setWifiname(wifiname);
|
Dell_Wifi.getMoren().setWifipass(wifipassword);
|
Dell_Wifi.getMoren().setIp(nip);
|
Dell_Wifi.getMoren().setWangguan(wangguan);
|
Dell_Wifi.getMoren().setZiwang(ziwang);
|
Dell_Wifi.getMoren().setFuwuip(fuwuip);
|
Dell_Wifi.getMoren().setJiamileixing(WPA2PSK);
|
Dell_Wifi.getMoren().setJiamisuanfa(AES);
|
Dell_Wifi.getMoren().setSousuoport(sousuoport);
|
Dell_Wifi.getMoren().setKeyword("HXZK");
|
String[] ziduan= {"webname","webPass","anchorid","port","xieyitype","model",
|
" wifiname","wifipass","ip","wangguan","ziwang",
|
"fuwuip","jiamileixing","jiamisuanfa","sousuoport","keyword","id"};
|
String[] zhi= {webname,webpass,id,port,"TCP",model,wifiname,wifipassword,
|
nip,wangguan,ziwang,fuwuip,WPA2PSK,AES,sousuoport,keyword,"1"};
|
DatabaseManagement.fast_alert_dbase("tb_wifi", ziduan, zhi);
|
ShowMessage.zidingyi("±£´æÄ¬ÈϲÎÊý³É¹¦£¡");
|
}
|
});
|
}
|
return jbt_moren;
|
}
|
|
|
|
public JRadioButton getJc_wifiname() {
|
if(jc_wifiname==null) {
|
jc_wifiname=new JRadioButton();
|
}
|
return jc_wifiname;
|
}
|
|
|
public JRadioButton getJc_wifipass() {
|
if(jc_wifipass==null) {
|
jc_wifipass=new JRadioButton();
|
}
|
return jc_wifipass;
|
}
|
|
|
public ButtonGroup getBtgroup() {
|
if(btgroup==null) {
|
btgroup=new ButtonGroup();
|
btgroup.add(getJc_ip());
|
btgroup.add(getJc_wangguan());
|
btgroup.add(getJc_adress());
|
btgroup.add(getJc_wifiname());
|
btgroup.add(getJc_wifipass());
|
}
|
return btgroup;
|
}
|
|
/**´ò¿ªÍøÒ³*/
|
public JButtonModel getJbt_open() {
|
if(jbt_open==null) {
|
jbt_open=new JButtonModel(English.name("´ò¿ªÍøÒ³", "Open"));
|
jbt_open.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(ip==null) {
|
ShowMessage.zidingyi("ûÓÐÑ¡ÖÐÐèÒª´ò¿ªµÄÉ豸£¡");
|
return;
|
}
|
|
try {
|
String url ="http://"+ip;
|
java.net.URI uri = java.net.URI.create(url);
|
// »ñÈ¡µ±Ç°ÏµÍ³×ÀÃæÀ©Õ¹
|
java.awt.Desktop dp = java.awt.Desktop.getDesktop();
|
// ÅжÏϵͳ×ÀÃæÊÇ·ñÖ§³ÖÒªÖ´ÐеŦÄÜ
|
if (dp.isSupported(java.awt.Desktop.Action.BROWSE)) {
|
dp.browse(uri);
|
// »ñȡϵͳĬÈÏä¯ÀÀÆ÷´ò¿ªÁ´½Ó
|
}
|
} catch (NullPointerException e1) {
|
// ´ËΪuriΪ¿ÕʱÅ׳öÒì³£
|
e1.printStackTrace();
|
} catch (IOException e1) {
|
// ´ËΪÎÞ·¨»ñȡϵͳĬÈÏä¯ÀÀÆ÷
|
e1.printStackTrace();
|
}
|
|
}
|
});
|
}
|
return jbt_open;
|
}
|
|
/**ÐÞ¸ÄÉ豸id*/
|
public JButtonModel getJbt_alertid() {
|
if(jbt_alertid==null) {
|
jbt_alertid=new JButtonModel(buttonTitle.getSave());
|
jbt_alertid.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(ip==null) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
if(jt_MAC.getText().length()<5 ) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
String id=jt_shebeiname.getText().trim();
|
Dell_Wifi.wifi_WRMID(id,ip,1);
|
}
|
});
|
}
|
return jbt_alertid;
|
}
|
|
/**ÐÞ¸ÄÉ豸ip*/
|
public JButtonModel getJbt_alertip() {
|
if(jbt_alertip==null) {
|
jbt_alertip=new JButtonModel(buttonTitle.getSave());
|
jbt_alertip.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
if(ip==null) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
if(jt_MAC.getText().length()<5 || ip.length()<5 ) {
|
ShowMessage.zidingyi("ÇëÏÈÑ¡ÔñÐèÒªÐ޸ĵÄÉ豸£¡");
|
return;
|
}
|
String nip=jt_ip.getText().trim();
|
String wangguan=jt_wangguan.getText().trim();
|
String ziwang=jt_ziwang.getText().trim();
|
Dell_Wifi.wifi_WANN(nip,wangguan,ziwang,ip,1);
|
|
}
|
});
|
}
|
return jbt_alertip;
|
}
|
|
|
|
}
|