📄 radioadapterframe.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.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.RadioAdapterClass;import com.intel.mobile.network.RadioAdapterInstance;import com.intel.mobile.network.*;public class RadioAdapterFrame extends JFrame { private javax.swing.JPanel jContentPane = null; private RadioAdapterInstance radioadapterInstance = null; private static RadioAdapterClass tempRadioAdapterClass = 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 JScrollPane jScrollPane = null; private JTable jTable = null; private TableModel dataModel = null; private javax.swing.JLabel jLabel = null; private javax.swing.JLabel jLabel2 = null; private javax.swing.JLabel jLabel3 = null; private javax.swing.JPanel jPanel = null; private javax.swing.JLabel jLabel1 = null; private javax.swing.JLabel jLabel4 = null; private javax.swing.JPanel jPanel1 = 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; private javax.swing.JLabel jLabel13 = null; private javax.swing.JLabel jLabel14 = null; static { try { tempRadioAdapterClass = new RadioAdapterClass(); } catch (IntelMobileException ex) { ex.printStackTrace(); } } /** * This is the default constructor */ public RadioAdapterFrame(RadioAdapterInstance myInstance) throws IntelMobileException { super(); radioadapterInstance = myInstance; dataModel = new RadioAdapterTableModel(myInstance); initialize(); } public RadioAdapterFrame(String myInstanceKey) throws IntelMobileException { super(); radioadapterInstance = (RadioAdapterInstance)tempRadioAdapterClass.GetInstance(myInstanceKey); dataModel = new RadioAdapterTableModel(radioadapterInstance); 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("Wireless Network Adapter 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() throws IntelMobileException { AddFunctionEvent(this.radioadapterInstance.StatusChanged,"StatusChanged"); if(!radioadapterInstance.AdapterLink.GetValue().toString().equals("Bluetooth")) { AddFunctionEvent(this.radioadapterInstance.HardwareRadioDisabled,"HardwareRadioDisabled"); AddFunctionEvent(this.radioadapterInstance.HardwareRadioEnabled,"HardwareRadioEnabled"); AddFunctionEvent(this.radioadapterInstance.SoftwareRadioDisabled,"SoftwareRadioDisabled"); AddFunctionEvent(this.radioadapterInstance.SoftwareRadioEnabled,"SoftwareRadioEnabled"); } } private void AddFunctionEvent(EventProperty event, String eventName) { getJPanelFunctionEvent().PropertyEventPanel.dataModel.addEventItem(event,eventName,"",this.radioadapterInstance); } private void initialPropertyEvent() { AddProperty(this.radioadapterInstance.CardType); AddProperty(this.radioadapterInstance.HardwareRadioState); AddProperty(this.radioadapterInstance.SoftwareRadioState); AddProperty(this.radioadapterInstance.AdapterPacketFilterMask); AddProperty(this.radioadapterInstance.Bands); AddProperty(this.radioadapterInstance.Index); AddProperty(this.radioadapterInstance.AutoSense); AddProperty(this.radioadapterInstance.Manufacturer); AddProperty(this.radioadapterInstance.Name); AddProperty(this.radioadapterInstance.Description); AddProperty(this.radioadapterInstance.DeviceId); AddProperty(this.radioadapterInstance.ConnectionId); AddProperty(this.radioadapterInstance.PnpDeviceId); AddProperty(this.radioadapterInstance.Enabled); AddProperty(this.radioadapterInstance.NdiUpper); AddProperty(this.radioadapterInstance.NdiLower); AddProperty(this.radioadapterInstance.Protocols); AddProperty(this.radioadapterInstance.ConnectionState); AddProperty(this.radioadapterInstance.AdapterLink); } private void AddProperty(Property property) { try { if(!property.IsStatic()) { getJPanelPropertyEvent().PropertyEventPanel.dataModel.addEventItem(property,property.GetName(),"",this.radioadapterInstance); 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(getJPanel1(), 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; } /** * This method initializes jLabel * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel() throws IntelMobileException { if(jLabel == null) { jLabel = new javax.swing.JLabel(); jLabel.setBounds(13, 8, 413, 18); jLabel.setText(radioadapterInstance.Name.GetValue()); jLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); } return jLabel; } /** * This method initializes jLabel2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -