Source for file AConnection.php

Documentation is available at AConnection.php

  1. <?php
  2. /**
  3.  *  
  4.  */
  5.  
  6. require_once 'AConnectionRegistry.php';
  7. require_once 'ASignalDefinition.php';
  8.  
  9.  
  10. /**
  11.  * AConnection
  12.  * 
  13.  * @package Alia
  14.  * @subpackage Core
  15.  * @version $id$
  16.  * @author Jordan CM Wambaugh <jordan@wambaugh.org>
  17.  * @license
  18.  */
  19. {
  20.  
  21.      /*** Attributes: ***/
  22.  
  23.     /**
  24.      * The target object (the object with the slot)
  25.      *
  26.      * @var AObject 
  27.      */
  28.     public $targetObject;
  29.     
  30.     
  31.     /**
  32.      * the method to be exicuted when a signal is emitted
  33.      *
  34.      * @var string 
  35.      */
  36.     private $targetMethod;
  37.     
  38.     
  39.     /**
  40.      * The name of the signal connected to
  41.      * @access string
  42.      */
  43.     private $signalName;
  44.     
  45.     /**
  46.      * the source AObject
  47.      *
  48.      * @var AObject 
  49.      */
  50.     private $sourceObject;
  51.  
  52.     private $connectionType;
  53.     
  54.     private $connectionID;
  55.     
  56.     private $javascript;
  57.     
  58.     const PHP_CONNECION "0";
  59.     
  60.     const JSCRIPT_CONNECTION "1";
  61.     
  62.     
  63.     public function __construct($target,$method,AObject $source,$signal,$script=null){
  64.         if($target!==null){
  65.             $this->setTarget($target,$method);
  66.         }
  67.         $this->setJavascript($script);
  68.         $this->setSignalName($signal);
  69.         $this->sourceObject = $source;
  70.     }
  71.     
  72.     public function getJavascript(){
  73.         return $this->javascript;
  74.     }
  75.     
  76.     public function setJavascript($script){
  77.         $this->javascript=$script;
  78.     }
  79.     
  80.     public function getTarget(){
  81.         return $this->targetObject;
  82.     }
  83.     
  84.     
  85.     public function getSource(){
  86.         return $this->sourceObject;
  87.     }
  88.     
  89.     public function getSlotMethod(){
  90.         return $this->targetMethod;
  91.     }
  92.  
  93.     /**
  94.      * sets the target slot
  95.      *
  96.      * @param AObject $target 
  97.      * @param unknown_type $method 
  98.      */
  99.     function setTarget(AObject $target,$method){
  100.  
  101.         $this->targetObject=$target;
  102.         $method=(string)$method;
  103.         if(!method_exists($target,$method)){
  104.             throw new Exception("Method '$method' does not exist in object of class '".get_class($target)."'.");
  105.         }
  106.         $this->targetMethod = $method;
  107.     }
  108.     
  109.     function setSignalName($name){
  110.         $this->signalName=$name;
  111.     }
  112.     
  113.     function getSignalName(){
  114.         return $this->signalName;
  115.     }
  116.     
  117.     function setConnectionID($id){
  118.         $this->connectionID=$id;
  119.     }
  120.     
  121.     function getConnectionID(){
  122.         return $this->connectionID;
  123.     }
  124.  
  125.     function clear(){
  126.         unset($this->sourceObject);
  127.         unset($this->targetObject);
  128.     }
  129.     
  130. // end of AConnection
  131. ?>

Documentation generated on Fri, 11 Jul 2008 13:28:39 -0400 by phpDocumentor 1.4.2