sensoranalyzer.java

来自「用于传感器网络的节点操作系统 TinyOS 结构设计非常有意思」· Java 代码 · 共 718 行 · 第 1/3 页

JAVA
718
字号
		{
			nodeNumber = pNodeNumber;
			value = -1;//if it doesn't change from this value nothing will be written
		}
		
		public Integer GetNodeNumber()
		{
			return nodeNumber;
		}
		
		public void SetNodeNumber(Integer pNodeNumber)
		{
			nodeNumber = pNodeNumber;
		}
		
		public int GetValue(){return value;}
		public void SetValue(int l){value = l;}
	}                                         
	          //NODE INFO
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************
	
	
	
	        
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************
	          //EDGEINFO
              //this class should hold any special information you hold about the
              //edge, for example time created or a history of the number of packets
              //forwarded over this edge or whetever it is you are studying
/*	public class EdgeInfo
	{
		protected Integer sourceNodeNumber;
		protected Integer destinationNodeNumber;
		
		public EdgeInfo(Integer pSourceNodeNumber, Integer pDestinationNodeNumber)
		{
			sourceNodeNumber = pSourceNodeNumber;
			destinationNodeNumber = pDestinationNodeNumber;
		}
		
		public Integer GetSourceNodeNumber()
		{
			return sourceNodeNumber;
		}
		
		public void SetSourceNodeNumber(Integer pNodeNumber)
		{
			sourceNodeNumber = pNodeNumber;
		}
	}*/
	          //EDGE INFO
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************



	        //*********************************************************
	        //*********************************************************
	        //*********************************************************
              //PROPRIETARY NODE INFO DISPLAY PANEL
              //This class is an ActivePanel and should have all the information
              //in GUI form that this class stores with respect to nodes
              //It should be returned with GetProprietaryNodeInfoPanel and it will be displayed
              //with all the other packet analyzer proprietary info when a node is clicked.
	public class ProprietaryNodeInfoPanel extends net.tinyos.tinydb.topology.Dialog.ActivePanel
	{
		NodeInfo nodeInfo;
		
		public ProprietaryNodeInfoPanel(NodeInfo pNodeInfo)
		{
			nodeInfo = pNodeInfo;
			tabTitle = "Sensor Value";//this will be the title of the tab
			//{{INIT_CONTROLS
			setLayout(null);
//			Insets ins = getInsets();
			setSize(307,168);
			JLabel3.setToolTipText("This text will appear with mouse hover over this component");
			JLabel3.setText("Node Number:");
			add(JLabel3);
			JLabel3.setBounds(12,36,108,24);
			JLabel4.setToolTipText("This is the value of NodeNumber");
			JLabel4.setText("text");
			add(JLabel4);
			JLabel4.setBounds(12,60,108,24);
			JLabel5.setToolTipText("This text will appear with mouse hover over this component");
			JLabel5.setText("Sensor Reading:");
			add(JLabel5);
			JLabel5.setBounds(12,84,108,24);
			JLabel6.setToolTipText("This is the value of Sensor Reading");
			JLabel6.setText("text");
			add(JLabel6);
			JLabel6.setBounds(12,108,108,24);
			//}}

			//{{REGISTER_LISTENERS
			//}}
		}

		//{{DECLARE_CONTROLS
		javax.swing.JLabel JLabel3 = new javax.swing.JLabel();
		javax.swing.JLabel JLabel4 = new javax.swing.JLabel();
		javax.swing.JLabel JLabel5 = new javax.swing.JLabel();
		javax.swing.JLabel JLabel6 = new javax.swing.JLabel();
		//}}
		
		public void ApplyChanges()//this function will be called when the apply button is hit
		{
			nodeInfo.SetNodeNumber(Integer.getInteger(JLabel4.getText()));
		}
		
		public void InitializeDisplayValues()//this function will be called when the panel is first shown
		{
			JLabel4.setText(String.valueOf(nodeInfo.GetNodeNumber()));
			JLabel6.setText(String.valueOf(nodeInfo.GetValue()));
		}
	}	          
              //PROPRIETARY NODE INFO DISPLAY PANEL
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************


	        //*********************************************************
	        //*********************************************************
	        //*********************************************************
              //PROPRIETARY EDGE INFO DISPLAY PANEL
              //This class is an ActivePanel and should have all the information
              //in GUI form that this class stores with respect to EDGES
              //It should be return with GetProprietaryEdgeInfoPanel and it will be displayed
              //with all the other packet analyzer proprietary info when a edgeis clicked.
/*	public class ProprietaryEdgeInfoPanel extends net.tinyos.tinydb.topology.Dialog.ActivePanel
	{
		EdgeInfo edgeInfo;
		
		public ProprietaryEdgeInfoPanel(EdgeInfo pEdgeInfo)
		{
			edgeInfo = pEdgeInfo;
			tabTitle = "Light";//this will be the title of the tab
			//{{INIT_CONTROLS
			setLayout(null);
//			Insets ins = getInsets();
			setSize(307,168);
			JLabel3.setToolTipText("This text will appear with mouse hover over this component");
			JLabel3.setText("Source Node NUmber:");
			add(JLabel3);
			JLabel3.setBounds(12,36,108,24);
			JLabel4.setToolTipText("This is the value of SOURCENodeNumber");
			JLabel4.setText("text");
			add(JLabel4);
			JLabel4.setBounds(12,60,108,24);
			//}}

			//{{REGISTER_LISTENERS
			//}}
		}

		//{{DECLARE_CONTROLS
		javax.swing.JLabel JLabel3 = new javax.swing.JLabel();
		javax.swing.JLabel JLabel4 = new javax.swing.JLabel();
		//}}
		
		public void ApplyChanges()//this function will be called when the apply button is hit
		{
			edgeInfo.SetSourceNodeNumber(Integer.getInteger(JLabel4.getText()));
		}
		
		public void InitializeDisplayValues()//this function will be called when the panel is first shown
		{
			JLabel4.setText(String.valueOf(edgeInfo .GetSourceNodeNumber()));
		}
	}*/	          
              //PROPRIETARY NODE INFO DISPLAY PANEL
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************


	        
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************
              //PacketAnalyzerTemplatePropertiesPanel
              //This class is an ActivePanel and should have all the information
              //in GUI form that this class stores with respect to EDGES
              //It will be displayed automatically with ShowPropertiesDialog
	public class DisplayPropertiesPanel extends net.tinyos.tinydb.topology.Dialog.ActivePanel
	{
		SensorAnalyzer analyzer;
		
		public DisplayPropertiesPanel(SensorAnalyzer pAnalyzer)
		{
			analyzer = pAnalyzer;
			tabTitle = "Light";//this will be the title of the tab
			//{{INIT_CONTROLS
			setLayout(null);
//			Insets ins = getInsets();
			setSize(307,168);
			JLabel3.setToolTipText("This text will appear with mouse hover over this component");
			JLabel3.setText("Variable Name:");
			add(JLabel3);
			JLabel3.setBounds(12,36,108,24);
			JLabel4.setToolTipText("This is the value of Variable Name");
			JLabel4.setText("text");
			add(JLabel4);
			JLabel4.setBounds(12,60,108,24);
			//}}

			//{{REGISTER_LISTENERS
			//}}
		}

		//{{DECLARE_CONTROLS
		javax.swing.JLabel JLabel3 = new javax.swing.JLabel();
		javax.swing.JLabel JLabel4 = new javax.swing.JLabel();
		//}}
		
		public void ApplyChanges()//this function will be called when the apply button is hit
		{
//			analyzer.SetVariableName(Integer.getInteger(JLabel4.getText()).intValue());
		}
		
		public void InitializeDisplayValues()//this function will be called when the panel is first shown
		{
//			JLabel4.setText(String.valueOf(analyzer.GetVariableName()));
		}
	}	          
              //PacketAnalyzerTemplatePropertiesPanel
	        //*********************************************************
	        //*********************************************************
	        //*********************************************************

}

⌨️ 快捷键说明

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