📄 editthresholddlg.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.util.Vector;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JComboBox;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JRadioButton;import javax.swing.JSlider;import javax.swing.JTextField;import com.intel.mobile.base.ByteProperty;import com.intel.mobile.base.FloatProperty;import com.intel.mobile.base.Int64Property;import com.intel.mobile.base.IntProperty;import com.intel.mobile.base.Property;import com.intel.mobile.base.StringProperty;import com.intel.mobile.base.Threshold;import com.intel.mobile.base.UInt64Property;import com.intel.mobile.base.UIntProperty;import com.intel.mobile.threshold.ByteCounterThreshold;import com.intel.mobile.threshold.ByteGaugeThreshold;import com.intel.mobile.threshold.FloatGaugeThreshold;import com.intel.mobile.threshold.Int64CounterThreshold;import com.intel.mobile.threshold.Int64GaugeThreshold;import com.intel.mobile.threshold.IntCounterThreshold;import com.intel.mobile.threshold.IntGaugeThreshold;import com.intel.mobile.threshold.StringValueThreshold;import com.intel.mobile.threshold.UInt64CounterThreshold;import com.intel.mobile.threshold.UInt64GaugeThreshold;import com.intel.mobile.threshold.UIntCounterThreshold;import com.intel.mobile.threshold.UIntGaugeThreshold;public class EditThresholdDlg extends JDialog { public int okFlag = 0; private javax.swing.JPanel jContentPane = null; private Vector vectProperties=null; private ThresholdsPanel.JThresholdListPanel.JPropertyTableModel m_model=null; //private ThresholdsPanel.propertyItem private JLabel jLabel = null; private JComboBox jComboBox = null; private JRadioButton jRadioButton = null; private JRadioButton jRadioButton1 = null; private JRadioButton jRadioButton2 = null; private JLabel jLabel1 = null; private JLabel jLabel2 = null; private JLabel jLabel3 = null; private JLabel jLabel4 = null; private JLabel jLabel5 = null; private JLabel jLabel6 = null; private JTextField jTextField1 = null; private JTextField jTextField2 = null; private JTextField jTextField3 = null; private JTextField jTextField4 = null; private JCheckBox jCheckBox = null; private JCheckBox jCheckBox1 = null; private JCheckBox jCheckBox2 = null; private JCheckBox jCheckBox3 = null; private JSlider jSlider = null; private JTextField jTextField5 = null; private JButton jButton = null; private JButton jButton1 = null; /** * This is the default constructor */ public EditThresholdDlg(Vector _Properties, String theproperty, ThresholdsPanel.JThresholdListPanel.JPropertyTableModel _model) { super(); vectProperties=new Vector(); for(int i=0;i<_Properties.size();i++) { if(((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.byteproperty") || ((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.stringproperty") || ((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.int64property") || ((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.intproperty") || ((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uintproperty") || ((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uint64property") || ((ThresholdsPanel.propertyItem)(_Properties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.floatproperty") ) { if(theproperty.toLowerCase().equals(((ThresholdsPanel.propertyItem)(_Properties.get(i))).propertyName.toLowerCase())) vectProperties.add(_Properties.get(i)); } } //_Properties; m_model=_model; initialize(); } /** * This method initializes this * * @return void */ private void initialize() { this.setTitle("Edit Threshold"); this.setSize(471, 319); this.setContentPane(getJContentPane()); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private javax.swing.JPanel getJContentPane() { if(jContentPane == null) { jLabel6 = new JLabel(); jLabel5 = new JLabel(); jLabel4 = new JLabel(); jLabel3 = new JLabel(); jLabel2 = new JLabel(); jLabel1 = new JLabel(); jLabel = new JLabel(); jContentPane = new javax.swing.JPanel(); jContentPane.setLayout(null); jLabel.setText("Property:"); jLabel.setBounds(17, 16, 74, 18); jLabel1.setBounds(17, 70, 74, 19); jLabel1.setText("Setting:"); jLabel2.setBounds(17, 96, 62, 16); jLabel2.setText("Match:"); jLabel3.setBounds(17, 123, 60, 20); jLabel3.setText("Low:"); jLabel4.setBounds(17, 152, 63, 21); jLabel4.setText("High:"); jLabel5.setBounds(17, 179, 72, 21); jLabel5.setText("Offset:"); jLabel6.setBounds(17, 206, 73, 18); jLabel6.setText("Rate:"); jContentPane.add(jLabel, null); jContentPane.add(getJRadioButton(), null); jContentPane.add(getJRadioButton1(), null); jContentPane.add(getJRadioButton2(), null); jContentPane.add(jLabel1, null); jContentPane.add(jLabel2, null); jContentPane.add(jLabel3, null); jContentPane.add(jLabel4, null); jContentPane.add(jLabel5, null); jContentPane.add(jLabel6, null); jContentPane.add(getJTextField1(), null); jContentPane.add(getJTextField2(), null); jContentPane.add(getJTextField3(), null); jContentPane.add(getJTextField4(), null); jContentPane.add(getJCheckBox(), null); jContentPane.add(getJCheckBox1(), null); jContentPane.add(getJCheckBox2(), null); jContentPane.add(getJCheckBox3(), null); jContentPane.add(getJSlider(), null); jContentPane.add(getJTextField5(), null); jContentPane.add(getJButton(), null); jContentPane.add(getJButton1(), null); jContentPane.add(getJComboBox(), null); } return jContentPane; } /** * This method initializes jComboBox * * @return javax.swing.JComboBox */ private JComboBox getJComboBox() { if (jComboBox == null) { jComboBox = new JComboBox(); jComboBox.setLocation(94, 16); jComboBox.setSize(150, 20); jComboBox.setName("cmbProperty"); jComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { propertyComboBoxChanged(); } }); for(int i=0;i<vectProperties.size();i++) { /*if(((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.byteproperty") || ((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.stringproperty") || ((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.int64property") || ((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.intproperty") || ((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uintproperty") || ((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uint64property") || ((ThresholdsPanel.propertyItem)(vectProperties.get(i))).property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.floatproperty") ) {*/ jComboBox.addItem(((ThresholdsPanel.propertyItem)vectProperties.get(i)).propertyName); //} } if(jComboBox.getItemCount()>0) { jComboBox.setSelectedIndex(0); } } return jComboBox; } private void propertyComboBoxChanged() { try { int index=jComboBox.getSelectedIndex(); if(index>=0) { Property property=((ThresholdsPanel.propertyItem)vectProperties.get(index)).property; if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.stringproperty")) { this.jRadioButton.setEnabled(false); this.jRadioButton1.setEnabled(false); this.jRadioButton2.setEnabled(true); if(this.jRadioButton2.isSelected()==false) { this.jRadioButton2.setSelected(true); radioValueSelected(); } } else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.floatproperty")) { this.jRadioButton.setEnabled(false); this.jRadioButton1.setEnabled(true); this.jRadioButton2.setEnabled(false); if(this.jRadioButton1.isSelected()==false) { this.jRadioButton1.setSelected(true); radioGaugeSelected(); } } else { this.jRadioButton2.setEnabled(false); this.jRadioButton.setEnabled(true); this.jRadioButton1.setEnabled(true); if(this.jRadioButton.isSelected()==false && this.jRadioButton1.isSelected()==false) { this.jRadioButton.setSelected(true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -