📄 linkprotocol802_11frame.java
字号:
/*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/import java.awt.BorderLayout;import java.awt.GraphicsConfiguration;import java.awt.HeadlessException;import java.awt.Toolkit;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTabbedPane;import javax.swing.JTable;import javax.swing.table.TableModel;import com.intel.mobile.base.EventProperty;import com.intel.mobile.base.IntelMobileException;import com.intel.mobile.base.Property;import com.intel.mobile.network.Protocol802_11Class;import com.intel.mobile.network.Protocol802_11Instance;public class LinkProtocol802_11Frame extends JFrame { private javax.swing.JPanel jContentPane = null; private Protocol802_11Instance protocol802_11Instance =null; private static Protocol802_11Class tempProtocol802_11Class = null; private JTabbedPane jTabbedPane = null; private JPanel jPanelGeneral = null; private JPanel jPanelAdvanced = null; private PropertyEventPanel jPropertyPanelEvent = null; private FunctionEventPanel jFunctionPanelEvent=null; private ThresholdsPanel jThresholdPanel=null; private JPanel jPanelEvent = null; private JScrollPane jScrollPane = null; private JTable jTable = null; private TableModel dataModel = null; private javax.swing.JLabel jLabel = null; private javax.swing.JPanel jPanel = null; private javax.swing.JLabel jLabel1 = null; private javax.swing.JLabel jLabel2 = null; private javax.swing.JLabel jLabel3 = null; private javax.swing.JLabel jLabel4 = null; private javax.swing.JLabel jLabel5 = null; private javax.swing.JLabel jLabel6 = null; private javax.swing.JLabel jLabel7 = null; private javax.swing.JLabel jLabel8 = null; private javax.swing.JLabel jLabel9 = null; private javax.swing.JLabel jLabel10 = null; private javax.swing.JLabel jLabel11 = null; private javax.swing.JLabel jLabel12 = null; static { try { tempProtocol802_11Class = new Protocol802_11Class(); } catch (IntelMobileException ex) { ex.printStackTrace(); } } /** * @throws java.awt.HeadlessException */ public LinkProtocol802_11Frame(Protocol802_11Instance myInstance) throws HeadlessException, IntelMobileException { super(); protocol802_11Instance = myInstance; dataModel = new Protocol802_11TableModel(myInstance); initialize(); } /** * @param arg0 */ public LinkProtocol802_11Frame(GraphicsConfiguration arg0) throws IntelMobileException { super(arg0); initialize(); } /** * @param arg0 * @throws java.awt.HeadlessException */ public LinkProtocol802_11Frame(String arg0) throws HeadlessException, IntelMobileException { super(); protocol802_11Instance = (Protocol802_11Instance)tempProtocol802_11Class.GetInstance(arg0); dataModel = new Protocol802_11TableModel(protocol802_11Instance); initialize(); } /** * @param arg0 * @param arg1 */ public LinkProtocol802_11Frame(String arg0, GraphicsConfiguration arg1) throws IntelMobileException { super(arg0, arg1); initialize(); } /** * This method initializes this * * @return void */ private void initialize() throws IntelMobileException { this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Resx/Java-app_ico16.gif"))); this.setSize(620, 400); this.setContentPane(getJContentPane()); this.setResizable(false); this.setTitle("802.11 Protocol Information"); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private javax.swing.JPanel getJContentPane() throws IntelMobileException { if (jContentPane == null) { jContentPane = new javax.swing.JPanel(); jContentPane.setLayout(new java.awt.BorderLayout()); jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER); } return jContentPane; } /** * This method initializes jTabbedPane * * @return javax.swing.JTabbedPane */ private JTabbedPane getJTabbedPane() throws IntelMobileException { if (jTabbedPane == null) { jTabbedPane = new JTabbedPane(); jTabbedPane.addTab("General", null, getJPanelGeneral(), null); jTabbedPane.addTab("Advanced", null, getJPanelAdvanced(), null); jTabbedPane.addTab("Property Change Event", null, getJPanelPropertyEvent(), null); jTabbedPane.addTab("Function Event", null, getJPanelFunctionEvent(), null); jTabbedPane.addTab("Threshold", null, getJPanelThreshold(), null); initialFunctionEvent(); initialPropertyEvent(); } return jTabbedPane; } private void initialFunctionEvent() { AddFunctionEvent(this.protocol802_11Instance.StatusChanged,"StatusChanged"); AddFunctionEvent(this.protocol802_11Instance.MediaConnected,"MediaConnected"); AddFunctionEvent(this.protocol802_11Instance.MediaDisconnected,"MediaDisconnected"); AddFunctionEvent(this.protocol802_11Instance.Associated,"Associated"); AddFunctionEvent(this.protocol802_11Instance.Disassociated,"Disassociated"); AddFunctionEvent(this.protocol802_11Instance.StatisticsReset,"StatisticsReset"); } private void AddFunctionEvent(EventProperty event, String eventName) { getJPanelFunctionEvent().PropertyEventPanel.dataModel.addEventItem(event,eventName,"",this.protocol802_11Instance); } private void initialPropertyEvent() { AddProperty(this.protocol802_11Instance.Id); AddProperty(this.protocol802_11Instance.Enabled); AddProperty(this.protocol802_11Instance.State); AddProperty(this.protocol802_11Instance.IpAddress); AddProperty(this.protocol802_11Instance.MediaPresent); AddProperty(this.protocol802_11Instance.DataRateRx); AddProperty(this.protocol802_11Instance.DataRateTx); AddProperty(this.protocol802_11Instance.MaxLinkSpeed); AddProperty(this.protocol802_11Instance.Oids); // AddProperty(this.protocol802_11Instance.OidDescriptions); AddProperty(this.protocol802_11Instance.DataRatesRx); AddProperty(this.protocol802_11Instance.DataRatesTx); AddProperty(this.protocol802_11Instance.TxPower); AddProperty(this.protocol802_11Instance.MacAddress); AddProperty(this.protocol802_11Instance.MulticastAddresses); AddProperty(this.protocol802_11Instance.Bssid); AddProperty(this.protocol802_11Instance.AtimWindow); AddProperty(this.protocol802_11Instance.BeaconPeriod); AddProperty(this.protocol802_11Instance.Frequency); AddProperty(this.protocol802_11Instance.DwellTime); AddProperty(this.protocol802_11Instance.HopPattern); AddProperty(this.protocol802_11Instance.HopSet); AddProperty(this.protocol802_11Instance.FailedCount); AddProperty(this.protocol802_11Instance.FcsErrorCount); AddProperty(this.protocol802_11Instance.FrameDuplicateCount); AddProperty(this.protocol802_11Instance.MulticastReceivedFrameCount); AddProperty(this.protocol802_11Instance.MulticastTransmittedFrameCount); AddProperty(this.protocol802_11Instance.MultipleRetryCount); AddProperty(this.protocol802_11Instance.ReceivedFragmentCount); AddProperty(this.protocol802_11Instance.RetryCount); AddProperty(this.protocol802_11Instance.RtsFailureCount); AddProperty(this.protocol802_11Instance.RtsSuccessCount); AddProperty(this.protocol802_11Instance.TransmittedFragmentCount); AddProperty(this.protocol802_11Instance.OperatingMode); AddProperty(this.protocol802_11Instance.Rssi); AddProperty(this.protocol802_11Instance.ModulationType); AddProperty(this.protocol802_11Instance.ModulationTypes); AddProperty(this.protocol802_11Instance.Ssid); AddProperty(this.protocol802_11Instance.RxAntennaId); AddProperty(this.protocol802_11Instance.TxAntennaId); AddProperty(this.protocol802_11Instance.PowerMode); AddProperty(this.protocol802_11Instance.FragmentationThreshold); AddProperty(this.protocol802_11Instance.Frequency); AddProperty(this.protocol802_11Instance.Channel); AddProperty(this.protocol802_11Instance.AuthenticationMode); AddProperty(this.protocol802_11Instance.Band); AddProperty(this.protocol802_11Instance.EncryptionMode); AddProperty(this.protocol802_11Instance.AssociationState); AddProperty(this.protocol802_11Instance.SecurityModes); AddProperty(this.protocol802_11Instance.Qos); AddProperty(this.protocol802_11Instance.DataTxPackets); AddProperty(this.protocol802_11Instance.DataRxPackets); AddProperty(this.protocol802_11Instance.DataTxBytes); AddProperty(this.protocol802_11Instance.DataRxBytes); AddProperty(this.protocol802_11Instance.LinkQuality); } private void AddProperty(Property property) { try { if(!property.IsStatic()) { getJPanelPropertyEvent().PropertyEventPanel.dataModel.addEventItem(property,property.GetName(),"",this.protocol802_11Instance); getJPanelThreshold().addPropertyItem(property); } }catch(IntelMobileException e) { } } /** * This method initializes jPanelGeneral * * @return javax.swing.JPanel */ private JPanel getJPanelGeneral() throws IntelMobileException { if (jPanelGeneral == null) { jPanelGeneral = new JPanel(); jPanelGeneral.setLayout(null); jPanelGeneral.add(getJLabel(), null); jPanelGeneral.add(getJPanel(), null); jPanelGeneral.add(getJLabel1(), null); jPanelGeneral.add(getJLabel2(), null); } return jPanelGeneral; } /** * This method initializes jPanelAdvanced * * @return javax.swing.JPanel */ private JPanel getJPanelAdvanced() { if(jPanelAdvanced == null) { jPanelAdvanced = new JPanel(); jPanelAdvanced.setLayout(new BorderLayout()); jPanelAdvanced.add(getJScrollPane(), BorderLayout.CENTER); } return jPanelAdvanced; } private PropertyEventPanel getJPanelPropertyEvent() { if (jPropertyPanelEvent == null) { jPropertyPanelEvent = new PropertyEventPanel(); } return jPropertyPanelEvent; } private FunctionEventPanel getJPanelFunctionEvent() { if (jFunctionPanelEvent == null) { jFunctionPanelEvent = new FunctionEventPanel(); } return jFunctionPanelEvent; } private ThresholdsPanel getJPanelThreshold() { if (jThresholdPanel == null) { jThresholdPanel = new ThresholdsPanel(); } return jThresholdPanel; } /** * This method initializes jScrollPane * * @return javax.swing.JScrollPane */ private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); jScrollPane.setViewportView(getJTable()); } return jScrollPane; } /** * This method initializes jTable * * @return javax.swing.JTable */ private JTable getJTable() { if (jTable == null) { jTable = new JTable(dataModel); } return jTable; } private javax.swing.JLabel getJLabel() throws IntelMobileException { if(jLabel == null) { jLabel = new javax.swing.JLabel(); jLabel.setBounds(14, 8, 406, 18); jLabel.setText(protocol802_11Instance.GetKey()); jLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); jLabel.setToolTipText(protocol802_11Instance.GetKey().toString()); } return jLabel; } /** * This method initializes jPanel * * @return javax.swing.JPanel */ private javax.swing.JPanel getJPanel() throws IntelMobileException { if(jPanel == null) { jPanel = new javax.swing.JPanel(); jPanel.setLayout(null); jPanel.add(getJLabel3(), null); jPanel.add(getJLabel4(), null); jPanel.add(getJLabel5(), null); jPanel.add(getJLabel6(), null); jPanel.add(getJLabel7(), null); jPanel.add(getJLabel8(), null); jPanel.add(getJLabel9(), null); jPanel.add(getJLabel10(), null); jPanel.add(getJLabel11(), null); jPanel.add(getJLabel12(), null); jPanel.setBounds(12, 62, 474, 206); jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Properties", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); } return jPanel; } /** * This method initializes jLabel1 * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel1() throws IntelMobileException { if(jLabel1 == null) { jLabel1 = new javax.swing.JLabel(); jLabel1.setBounds(66, 38, 450, 18); /*StringBuffer strEnabled = null, strMediaPresented = null,strStatus =null; if(!protocol802_11Instance.Enabled.IsNull()) { if(protocol802_11Instance.Enabled.GetValue() == true) strEnabled = new StringBuffer("Enabled"); else strEnabled = new StringBuffer("Disabled"); } else strEnabled = new StringBuffer("NULL"); if(!protocol802_11Instance.MediaPresent.IsNull()) { if(protocol802_11Instance.MediaPresent.GetValue() == true) strMediaPresented = new StringBuffer("Media Presented"); else strMediaPresented = new StringBuffer("Media not Presented"); } else strMediaPresented = new StringBuffer("NULL"); if(!protocol802_11Instance.State.IsNull()) { //strStatus = new StringBuffer(new Integer(protocol802_11Instance.Status.GetValue()).toString()); //strStatus = LinkProtocolTableModel.getProtocolStatus(protocol802_11Instance.Status.GetValue()); strStatus = new StringBuffer(protocol802_11Instance.State.GetValue().toString()); } else strStatus = new StringBuffer("NULL"); */ //jLabel1.setText(protocol802_11Instance.State.GetValue().toString()); jLabel1.setText("Unknow"); } return jLabel1; } /** * This method initializes jLabel2 * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel2() { if(jLabel2 == null) { jLabel2 = new javax.swing.JLabel(); jLabel2.setBounds(14, 37, 45, 18); jLabel2.setText("State"); } return jLabel2; } /** * This method initializes jLabel3 * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel3() { if(jLabel3 == null) { jLabel3 = new javax.swing.JLabel(); jLabel3.setBounds(31, 26, 96, 18); jLabel3.setText("Mac Address:"); } return jLabel3; } /** * This method initializes jLabel4 * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel4() throws IntelMobileException { if(jLabel4 == null) { jLabel4 = new javax.swing.JLabel(); jLabel4.setBounds(151, 28, 309, 18); if(!protocol802_11Instance.MacAddress.IsNull()) { String macAddr = LinkProtocolTableModel.getHexString(protocol802_11Instance.MacAddress.GetValue(0)) + "-" + LinkProtocolTableModel.getHexString(protocol802_11Instance.MacAddress.GetValue(1)) + "-" + LinkProtocolTableModel.getHexString(protocol802_11Instance.MacAddress.GetValue(2)) + "-" + LinkProtocolTableModel.getHexString(protocol802_11Instance.MacAddress.GetValue(3)) +"-" + LinkProtocolTableModel.getHexString(protocol802_11Instance.MacAddress.GetValue(4)) +"-" + LinkProtocolTableModel.getHexString(protocol802_11Instance.MacAddress.GetValue(5)); jLabel4.setText(macAddr); } else { jLabel4.setText("(null)");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -