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

📄 editthresholddlg.java

📁 270的linux说明
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
					OKPressed();				}			});		}		return jButton;	}	/**	 * This method initializes jButton1		 * 		 * @return javax.swing.JButton		 */    	private JButton getJButton1() {		if (jButton1 == null) {			jButton1 = new JButton();			jButton1.setBounds(369, 239, 78, 25);			jButton1.setText("Cancel");			jButton1.addActionListener(new java.awt.event.ActionListener() { 				public void actionPerformed(java.awt.event.ActionEvent e) {					CancelPressed();				}			});		}		return jButton1;	}		//OK button pressed	//Register the threshold	private void OKPressed()	{		okFlag = 1;		String Match=getJTextField1().getText();		int Rate=this.jSlider.getValue();		boolean IsMatchNotify=this.jCheckBox.isSelected();		boolean IsDiffNotify=this.jCheckBox1.isSelected();		boolean IsLowNotify=this.jCheckBox2.isSelected();		boolean IsHighNotify=this.jCheckBox3.isSelected();		int index=this.jComboBox.getSelectedIndex();		String Low=this.jTextField2.getText();		String High=this.jTextField3.getText();		String Offset=this.jTextField4.getText();				try		{			Property property=((ThresholdsPanel.propertyItem)vectProperties.get(index)).property;						if(this.jRadioButton.isSelected() || this.jRadioButton1.isSelected() || this.jRadioButton2.isSelected())			{				//Counter threshold				if(this.jRadioButton.isEnabled() && this.jRadioButton.isSelected() && this.jTextField1.getText().trim().length()>0)				{					if((property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uint64property") && Long.parseLong(Match)<0)							|| (property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uintproperty") && Integer.parseInt(Match)<0))					{						throw new Exception("Value fault exception");					}										if (Float.parseFloat(Offset) >= 0)					{						if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.byteproperty"))						{							ByteCounterThreshold pCountThreshold=new ByteCounterThreshold();							pCountThreshold.SetObservedProperty((ByteProperty)property);							pCountThreshold.SetThreshold(Byte.parseByte(Match));// .setThreshold(new Byte(Match));							pCountThreshold.SetOffset(Byte.parseByte(Offset));							pCountThreshold.SetGranularityPeriod(Rate);							pCountThreshold.SetNotify(IsMatchNotify);							pCountThreshold.AddObserver(MainFrame.clObserver);							pCountThreshold.Start();							m_model.addEventItem(property,(Threshold)pCountThreshold,property.GetParent(),property.GetName(),"Counter",Match,null,null,Rate,Offset);													}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.int64property"))						{							Int64CounterThreshold pCountThreshold=new Int64CounterThreshold();							pCountThreshold.SetObservedProperty((Int64Property)property);							pCountThreshold.SetThreshold(Long.parseLong(Match));// .setThreshold(new Byte(Match));							pCountThreshold.SetOffset(Long.parseLong(Offset));							pCountThreshold.SetGranularityPeriod(Rate);							pCountThreshold.SetNotify(IsMatchNotify);							pCountThreshold.AddObserver(MainFrame.clObserver);							pCountThreshold.Start();							m_model.addEventItem(property,(Threshold)pCountThreshold,property.GetParent(),property.GetName(),"Counter",Match,null,null,Rate,Offset);													}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.intproperty"))						{							IntCounterThreshold pCountThreshold=new IntCounterThreshold();							pCountThreshold.SetObservedProperty((IntProperty)property);							pCountThreshold.SetThreshold(Integer.parseInt(Match));// .setThreshold(new Byte(Match));							pCountThreshold.SetOffset(Integer.parseInt(Offset));							pCountThreshold.SetGranularityPeriod(Rate);							pCountThreshold.SetNotify(IsMatchNotify);							pCountThreshold.AddObserver(MainFrame.clObserver);							pCountThreshold.Start();							m_model.addEventItem(property,(Threshold)pCountThreshold,property.GetParent(),property.GetName(),"Counter",Match,null,null,Rate,Offset);													}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uint64property"))						{							UInt64CounterThreshold pCountThreshold=new UInt64CounterThreshold();							pCountThreshold.SetObservedProperty((UInt64Property)property);							pCountThreshold.SetThreshold(Long.parseLong(Match));// .setThreshold(new Byte(Match));							pCountThreshold.SetOffset(Long.parseLong(Offset));							pCountThreshold.SetGranularityPeriod(Rate);							pCountThreshold.SetNotify(IsMatchNotify);							pCountThreshold.AddObserver(MainFrame.clObserver);							pCountThreshold.Start();							m_model.addEventItem(property,(Threshold)pCountThreshold,property.GetParent(),property.GetName(),"Counter",Match,null,null,Rate,Offset);													}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uintproperty"))						{							UIntCounterThreshold pCountThreshold=new UIntCounterThreshold();							pCountThreshold.SetObservedProperty((UIntProperty)property);							pCountThreshold.SetThreshold(Integer.parseInt(Match));// .setThreshold(new Byte(Match));							pCountThreshold.SetOffset(Integer.parseInt(Offset));							pCountThreshold.SetGranularityPeriod(Rate);							pCountThreshold.SetNotify(IsMatchNotify);							pCountThreshold.AddObserver(MainFrame.clObserver);							pCountThreshold.Start();							m_model.addEventItem(property,(Threshold)pCountThreshold,property.GetParent(),property.GetName(),"Counter",Match,null,null,Rate,Offset);													}						this.dispose();					}					else					{					//	JOptionPane.showMessageDialog(null, "Offset must greater than or equal to 0 !", "Alert", JOptionPane.ERROR_MESSAGE); 					//	jTextField4.requestFocus();						throw new Exception("Value fault exception");					}					return;				}								//Gauge Threshold				if(this.jRadioButton1.isEnabled() && this.jRadioButton1.isSelected() && this.jTextField2.getText().trim().length()>0 && this.jTextField3.getText().trim().length()>0)				{					if(Long.parseLong(High)<=Long.parseLong(Low))					{						throw new Exception("Low/High value fault exception");					}										if((property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uint64property") && (Long.parseLong(Low)<0 || Long.parseLong(High)<0))							|| (property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uintproperty") && (Integer.parseInt(Low)<0 || Integer.parseInt(High)<0)))					{						throw new Exception("Value fault exception");					}										if (Float.parseFloat(Offset) >= 0)					{						if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.byteproperty"))						{							ByteGaugeThreshold pGaugeThreshold=new ByteGaugeThreshold();							pGaugeThreshold.SetObservedProperty((ByteProperty)property);							pGaugeThreshold.SetLowThreshold(Byte.parseByte(Low));							pGaugeThreshold.SetHighThreshold(Byte.parseByte(High));							pGaugeThreshold.SetGranularityPeriod(Rate);							pGaugeThreshold.SetNotifyHigh(IsHighNotify);							pGaugeThreshold.SetNotifyLow(IsLowNotify);							pGaugeThreshold.SetOffset(Byte.parseByte(Offset));							pGaugeThreshold.AddObserver(MainFrame.clObserver);							pGaugeThreshold.Start();							m_model.addEventItem(property,(Threshold)pGaugeThreshold,property.GetParent(),property.GetName(),"Gauge",null,High,Low,Rate,Offset);						}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.int64property"))						{							Int64GaugeThreshold pGaugeThreshold=new Int64GaugeThreshold();							pGaugeThreshold.SetObservedProperty((Int64Property)property);							pGaugeThreshold.SetLowThreshold(Long.parseLong(Low));							pGaugeThreshold.SetHighThreshold(Long.parseLong(High));							pGaugeThreshold.SetGranularityPeriod(Rate);							pGaugeThreshold.SetNotifyHigh(IsHighNotify);							pGaugeThreshold.SetNotifyLow(IsLowNotify);							pGaugeThreshold.SetOffset(Long.parseLong(Offset));							pGaugeThreshold.AddObserver(MainFrame.clObserver);							pGaugeThreshold.Start();							m_model.addEventItem(property,(Threshold)pGaugeThreshold,property.GetParent(),property.GetName(),"Gauge",null,High,Low,Rate,Offset);						}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.intproperty"))						{							IntGaugeThreshold pGaugeThreshold=new IntGaugeThreshold();							pGaugeThreshold.SetObservedProperty((IntProperty)property);							pGaugeThreshold.SetLowThreshold(Integer.parseInt(Low));							pGaugeThreshold.SetHighThreshold(Integer.parseInt(High));							pGaugeThreshold.SetGranularityPeriod(Rate);							pGaugeThreshold.SetNotifyHigh(IsHighNotify);							pGaugeThreshold.SetNotifyLow(IsLowNotify);							pGaugeThreshold.SetOffset(Integer.parseInt(Offset));							pGaugeThreshold.AddObserver(MainFrame.clObserver);							pGaugeThreshold.Start();							m_model.addEventItem(property,(Threshold)pGaugeThreshold,property.GetParent(),property.GetName(),"Gauge",null,High,Low,Rate,Offset);						}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uint64property"))						{							UInt64GaugeThreshold pGaugeThreshold=new UInt64GaugeThreshold();							pGaugeThreshold.SetObservedProperty((UInt64Property)property);							pGaugeThreshold.SetLowThreshold(Long.parseLong(Low));							pGaugeThreshold.SetHighThreshold(Long.parseLong(High));							pGaugeThreshold.SetGranularityPeriod(Rate);							pGaugeThreshold.SetNotifyHigh(IsHighNotify);							pGaugeThreshold.SetNotifyLow(IsLowNotify);							pGaugeThreshold.SetOffset(Long.parseLong(Offset));							pGaugeThreshold.AddObserver(MainFrame.clObserver);							pGaugeThreshold.Start();							m_model.addEventItem(property,(Threshold)pGaugeThreshold,property.GetParent(),property.GetName(),"Gauge",null,High,Low,Rate,Offset);						}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.uintproperty"))						{							UIntGaugeThreshold pGaugeThreshold=new UIntGaugeThreshold();							pGaugeThreshold.SetObservedProperty((UIntProperty)property);							pGaugeThreshold.SetLowThreshold(Integer.parseInt(Low));							pGaugeThreshold.SetHighThreshold(Integer.parseInt(High));							pGaugeThreshold.SetGranularityPeriod(Rate);							pGaugeThreshold.SetNotifyHigh(IsHighNotify);							pGaugeThreshold.SetNotifyLow(IsLowNotify);							pGaugeThreshold.SetOffset(Integer.parseInt(Offset));							pGaugeThreshold.AddObserver(MainFrame.clObserver);							pGaugeThreshold.Start();							m_model.addEventItem(property,(Threshold)pGaugeThreshold,property.GetParent(),property.GetName(),"Gauge",null,High,Low,Rate,Offset);						}else if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.floatproperty"))						{							FloatGaugeThreshold pGaugeThreshold=new FloatGaugeThreshold();							pGaugeThreshold.SetObservedProperty((FloatProperty)property);							pGaugeThreshold.SetLowThreshold(Float.parseFloat(Low));							pGaugeThreshold.SetHighThreshold(Float.parseFloat(High));							pGaugeThreshold.SetGranularityPeriod(Rate);							pGaugeThreshold.SetNotifyHigh(IsHighNotify);							pGaugeThreshold.SetNotifyLow(IsLowNotify);							pGaugeThreshold.SetOffset(Float.parseFloat(Offset));							pGaugeThreshold.AddObserver(MainFrame.clObserver);							pGaugeThreshold.Start();							m_model.addEventItem(property,(Threshold)pGaugeThreshold,property.GetParent(),property.GetName(),"Gauge",null,High,Low,Rate,Offset);						}												this.dispose();					}					else					{					//	JOptionPane.showMessageDialog(null, "Offset must greater than or equal to 0 !", "Alert", JOptionPane.ERROR_MESSAGE); 					//	jTextField4.requestFocus();						throw new Exception("Value fault exception");					}					return;				}								//Value threshold				if(this.jRadioButton2.isEnabled() && this.jRadioButton2.isSelected() && this.jTextField1.getText().trim().length()>0)				{					if(property.getClass().toString().toLowerCase().equals("class com.intel.mobile.base.stringproperty"))					{						StringValueThreshold pValueThreshold=new StringValueThreshold();						pValueThreshold.SetObservedProperty((StringProperty)property);						pValueThreshold.SetValue(Match);						pValueThreshold.SetNotifyDiffer(IsDiffNotify);						pValueThreshold.SetNotifyMatch(IsMatchNotify);						pValueThreshold.SetGranularityPeriod(Rate);						pValueThreshold.AddObserver(MainFrame.clObserver);						pValueThreshold.Start();						m_model.addEventItem(property,(Threshold)pValueThreshold,property.GetParent(),property.GetName(),"Value",Match,null,null,Rate,null);					}										this.dispose();					return;				}								throw new Exception("Field Value fault exception");			}		}catch(Exception e)		{			JOptionPane.showMessageDialog(null,"Please fill in the fields with correct value types. \n - CounterThreshold: Match value should be a number, such as 1000; Offset must be greater than or equal to 0.\n - GaugeThreshold: The values of Low, High and Offset value should be numbers. The High value should be greater than the Low value;\n Offset must be greater than or equal to 0.\n - Check the \"Programmer's Guide\" for the property value ranges. \n - ValueThreshold: Match value should be a string, like \"Hello123\".", "Alert", JOptionPane.ERROR_MESSAGE); 		}	}				private void CancelPressed()	{		this.dispose();	}   }  //  @jve:decl-index=0:visual-constraint="10,10"

⌨️ 快捷键说明

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