⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 physicaldiskframe.java

📁 270的linux说明
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*

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.*;import javax.swing.table.*;import com.intel.mobile.base.EventProperty;import com.intel.mobile.base.IntelMobileException;import com.intel.mobile.base.Property;import com.intel.mobile.storage.*;/** * <class or interface desc> */public class PhysicalDiskFrame extends JFrame{    private JPanel jContentPane = null;	private static PhysicalDiskClass tempPhysicalDiskClass = null;	private JTabbedPane jTabbedPane = null;	private PhysicalDiskGeneralPanel jPanelGeneral = null;    private PhysicalDiskAdvancedPanel jPanelAdvanced = null;	private JPanel jPanelEvent = null;	private ThresholdsPanel jThresholdPanel=null;		private PropertyEventPanel jPropertyPanelEvent = null;	private FunctionEventPanel jFunctionPanelEvent=null;    private PhysicalDiskInstance myInstance = null;        static    {        try        {            tempPhysicalDiskClass = new PhysicalDiskClass();        }        catch (IntelMobileException ex)        {            ex.printStackTrace();        }    }        /**     * This is the default constructor     * @param myInstance     */    public PhysicalDiskFrame(PhysicalDiskInstance myInstance)    {        super();        this.myInstance = myInstance;        initialize();    }    	public PhysicalDiskFrame(String myInstanceKey) throws IntelMobileException	 {		 super();		 this.myInstance = (PhysicalDiskInstance)tempPhysicalDiskClass.GetInstance(myInstanceKey);		 initialize();	 }    /**     * This method initializes this     *      * @return void     */    private void initialize()    {    	this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Resx/Java-app_ico16.gif")));        this.setSize(620,430);        this.setContentPane(getJContentPane());        this.setTitle("PhysicalDisk Information");        this.setResizable(false);        this.addWindowListener(new java.awt.event.WindowAdapter() {        	public void windowActivated(java.awt.event.WindowEvent e) {                try                {                    jPanelGeneral.refresh();                    jPanelAdvanced.refresh();                }                catch (IntelMobileException ex)                {                    ex.printStackTrace();                }        	}        });    }        /**     * This method initializes jContentPane     *      * @return javax.swing.JPanel     */    private JPanel getJContentPane()    {        if (jContentPane == null)        {            jContentPane = new JPanel();            jContentPane.setLayout(new BorderLayout());            jContentPane.add(getJTabbedPane(), BorderLayout.CENTER);        }        return jContentPane;    }    	/**     * This method initializes jTabbedPane     *      * @return javax.swing.JTabbedPane     */    private JTabbedPane getJTabbedPane()    {        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.myInstance.StatusChanged,"StatusChanged");	}		private void AddFunctionEvent(EventProperty event, String eventName)	{					getJPanelFunctionEvent().PropertyEventPanel.dataModel.addEventItem(event,eventName,"",this.myInstance);				}		private void initialPropertyEvent()	{								AddProperty(this.myInstance.Id);					AddProperty(this.myInstance.Index);		AddProperty(this.myInstance.LogicalCount);		AddProperty(this.myInstance.Manufacturer);		AddProperty(this.myInstance.Interface);		AddProperty(this.myInstance.ModelId);			AddProperty(this.myInstance.Media);		AddProperty(this.myInstance.Size);		}		private void AddProperty(Property property)	{		try		{			if(!property.IsStatic())			{				getJPanelPropertyEvent().PropertyEventPanel.dataModel.addEventItem(property,property.GetName(),"",this.myInstance);				getJPanelThreshold().addPropertyItem(property);			}		}catch(IntelMobileException e)		{		}	}		/**	 * This method initializes jPanelGeneral	 * 	 * @return javax.swing.JPanel	 */	private JPanel getJPanelGeneral()    {		if (jPanelGeneral == null)        {			jPanelGeneral = new PhysicalDiskGeneralPanel(myInstance);		}		return jPanelGeneral;	}        /**     * This method initializes jPanelAdvanced     *      * @return javax.swing.JPanel     */    private JPanel getJPanelAdvanced()    {        if (jPanelAdvanced == null)        {            jPanelAdvanced = new PhysicalDiskAdvancedPanel(myInstance);        }        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;	}}/** * internal class * <class or interface desc> */class PhysicalDiskGeneralPanel extends JPanel{       private javax.swing.JPanel jPanelInfo = 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 jLabelId = null;    private javax.swing.JLabel jLabelIndex = null;    private javax.swing.JLabel jLabelLogicalCount = null;       private javax.swing.JLabel jLabelManufacturer = null;    private javax.swing.JLabel jLabelInterface = null;    private javax.swing.JLabel jLabelModelId = null;    private javax.swing.JLabel jLabelMedia = null;    private javax.swing.JLabel jLabelSize = null;        private PhysicalDiskInstance myInstance = null;	    /**     * Constructor     * @param myInstance     */    PhysicalDiskGeneralPanel(PhysicalDiskInstance myInstance)    {        this.myInstance = myInstance;                this.setLayout(null);               this.add(getJPanelInfo(), null);            }        void refresh() throws IntelMobileException    {               this.jLabelId.setText( myInstance.Id.IsNull() ?                "(null)" : myInstance.Id.GetValue() );                jLabelId.setToolTipText(myInstance.Id.GetValue().toString());        this.jLabelIndex.setText( myInstance.Index.IsNull() ?                "(null)" : String.valueOf(myInstance.Index.GetValue() ));                this.jLabelLogicalCount.setText( myInstance.LogicalCount.IsNull() ?                "(null)" : String.valueOf(myInstance.LogicalCount.GetValue()) );                                            this.jLabelManufacturer.setText( myInstance.Manufacturer.IsNull() ?                "(null)" : String.valueOf(myInstance.Manufacturer.GetValue()) );        this.jLabelInterface.setText( myInstance.Interface.IsNull() ?                "(null)" : String.valueOf(myInstance.Interface.GetValue()) );      		this.jLabelModelId.setText( myInstance.ModelId.IsNull() ?			"(null)" : String.valueOf(myInstance.ModelId.GetValue()) );  		this.jLabelMedia.setText( myInstance.Media.IsNull() ?			"(null)" : String.valueOf(myInstance.Media.GetValue()) );  		this.jLabelSize.setText( myInstance.Size.IsNull() ?			"(null)" : String.valueOf(myInstance.Size.GetValue()) ); 		    }               /**     * This method initializes jPanelInfo     *      * @return javax.swing.JPanel     */    private javax.swing.JPanel getJPanelInfo()    {        if (jPanelInfo == null)        {            jPanelInfo = new javax.swing.JPanel();            jPanelInfo.setLayout(null);            jPanelInfo.add(getJLabel1(), null);            jPanelInfo.add(getJLabel2(), null);            jPanelInfo.add(getJLabel3(), null);            jPanelInfo.add(getJLabel4(), null);            jPanelInfo.add(getJLabel5(), null);            jPanelInfo.add(getJLabel6(), null);            jPanelInfo.add(getJLabel7(), null);            jPanelInfo.add(getJLabel8(), null);                      jPanelInfo.add(getJLabelId(), null);            jPanelInfo.add(getJLabelIndex(), null);            jPanelInfo.add(getJLabelLogicalCount(), null);                      jPanelInfo.add(getJLabelManufacturer(), null);            jPanelInfo.add(getJLabelInterface(), null);            jPanelInfo.add(getJLabelModelId(), null);            jPanelInfo.add(getJLabelMedia(), null);            jPanelInfo.add(getJLabelSize(), null);            jPanelInfo.setBounds(18, 55, 550, 174);            jPanelInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Device", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));        }        return jPanelInfo;    }            /**     * This method initializes jLabel1     *      * @return javax.swing.JLabel     */    private javax.swing.JLabel getJLabel1()    {        if (jLabel1 == null)        {            jLabel1 = new javax.swing.JLabel();            jLabel1.setBounds(20, 20, 100, 25);            jLabel1.setText("Id:");        }        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(20, 50, 100, 25);            jLabel2.setText("Index:");        }        return jLabel2;    }        /**     * This method initializes jLabel3     *      * @return javax.swing.JLabel     */    private javax.swing.JLabel getJLabel3()    {        if (jLabel3 == null)        {            jLabel3 = new javax.swing.JLabel();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -