/* 	Copyright 2008 Maximum Processing Inc
	
	ABOUT THIS SCRIPT

	
	Change Log
 	Created 12/16/2008 Nathan Townsend
*/


function DELPHI(){

  this.inheritFrom = BaseComponent;

	this.inheritFrom();

	var _xmlNode = null;
	
  this.Src = "../../images/RulePascal.png";

  this.Title = "Pascal Component";
	
	this.ToolTip = "Add pascal code";
	
	
	

  this.Create = function()
  {
	  try{
		
		  var uo = new UndoObject();
			
			uo.AddUndo(RulesMaker.Load, RuleXML.GetVRM().xml);

      this.BaseCreate();
			
			this.SetType("DELPHI");	

			_xmlNode = this.GetNode();

      var values = $(_xmlNode.find('>values')[0]);
      
      values.append(RuleXML.GetNewElement('v'));

      uo.AddRedo(RulesMaker.Load, RuleXML.GetVRM().xml);
      
      Undo.Add(uo);								

		} catch(err){Log.Add("DELPHI.Create", err, LogType.DELPHI);}    
  }
  
	this.Load = function(xmlNode)
  {
	  try{
		
		  _xmlNode = $(xmlNode);
		
		  this.BaseLoad(_xmlNode);
			
		} catch(err){Log.Add("DELPHI.Load", err, LogType.DELPHI);}	  	
  }
  
  
	this.GetProperties = function(){
    try{
	
  	  var properties = this.GetBaseProperties();

      properties[properties.length] = new PropertiesEditor.Property(PropertyFields.GetProperty("DELPHI"), this.GetDELPHI, this.SetDELPHI);

  		return properties;

		} catch(err){Log.Add("DELPHI.GetProperties", err, LogType.DELPHI);}		

	}
	
  this.GetDELPHI = function(){
	  try{
		
      return $(_xmlNode.find(">values>v")[0]).text();

		} catch(err){Log.Add("DELPHI.GetDELPHI", err, LogType.DELPHI);}			
  }
	

 
  this.SetDELPHI = function(newDELPHI)
  {
	 	try{

      RuleXML.ReplaceCDATA(_xmlNode.find(">values>v")[0], newDELPHI);
			
		} catch(err){Log.Add("DELPHI.SetDELPHI", err, LogType.DELPHI);}    
  }
	

 
}







