jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Libraries/] [UI/] [Model/] [Window.php] - Rev 2

Compare with Previous - Blame - Download


<?php

namespace Phem\Libraries\UI\Model;

use Doctrine\Common\Annotations\AnnotationReader;
use Phem\Core\Collection;
use Phem\Core\Object;
use Phem\Environment\EnvironmentManager;
use Phem\Libraries\UI\Annotations\ContentAttr;
use Phem\Libraries\UI\Annotations\DomAttr;
use Phem\Libraries\UI\Annotations\NoUpdateAttr;
use Phem\Libraries\UI\Annotations\StyleAttr;
use Phem\ToolSuite;
use Ratchet\Wamp\Exception;
use ReflectionProperty;

/**
 * @author Jakub PetrŞílka <petrzilka@czweb.net>
 */
abstract class Window extends Component
{
    protected $name;
    protected $title;
    protected $titleIcon;
    /* protected $size;
      protected $position; */
    /**
     * @\Phem\Libraries\UI\Annotations\StyleAttr(name="z-index")
     */    
    protected $zIndex;

    /**
     * @\Phem\Libraries\UI\Annotations\StyleAttr(name="left")
     */
    protected $left;

    /**
     * @\Phem\Libraries\UI\Annotations\StyleAttr(name="top")
     */
    protected $top;
    protected $width;
    protected $height;
    protected $backgroundColor;
    protected $draggable;
    protected $parent;
    protected $scope;
    protected $sharePosition;
    private $onDrag;
    private $onMouseDown;

    function __construct($parent)
    {
        $this->parent = $parent;
        $this->onDrag = new Collection();
        $this->onMouseDown = new Collection();
        
        $this->onMouseDown->add(array($this,"window_onMouseDown"));
    }
    
    public function getTemplateName()
    {
        return "Window";
    }    

    public function getTitleIcon()
    {
        return $this->titleIcon;
    }

    protected function setTitleIcon($titleIcon)
    {
        $this->titleIcon = $titleIcon;
    }

    public function getName()
    {
        return $this->name;
    }

    protected function setName($name)
    {
        $this->name = $name;
    }

    public function getTitle()
    {
        return $this->title;
    }

    protected function setTitle($title)
    {
        $this->title = $title;
    }

    /* public function getSize()
      {
      return $this->size;
      }

      protected function setSize(Size $size)
      {
      $this->size = $size;
      }

      public function getPosition()
      {
      return $this->position;
      }

      protected function setPosition(Position $position)
      {
      $this->position = $position;
      } */

    public function getZIndex()
    {
        return $this->zIndex;
    }

    public function getLeft()
    {
        return $this->left;
    }

    public function getTop()
    {
        return $this->top;
    }

    public function getWidth()
    {
        return $this->width;
    }

    public function getHeight()
    {
        return $this->height;
    }

    protected function setZIndex($zIndex)
    {
        $this->zIndex = $zIndex;
    }

    protected function setLeft($left)
    {
        $this->left = $left;
    }

    protected function setTop($top)
    {
        $this->top = $top;
    }

    protected function setWidth($width)
    {
        $this->width = $width;
    }

    protected function setHeight($height)
    {
        $this->height = $height;
    }

    public function getBackgroundColor()
    {
        return $this->backgroundColor;
    }

    protected function setBackgroundColor($backgroundColor)
    {
        $this->backgroundColor = $backgroundColor;
    }

    public function getDraggable()
    {
        return $this->draggable;
    }

    protected function setDraggable($draggable)
    {
        $this->draggable = $draggable;
    }

    public function getParent()
    {
        return $this->parent;
    }

    protected function setParent($parent)
    {
        $this->parent = $parent;
    }
    
    public function getSharePosition()
    {
        return $this->sharePosition;
    }

    public function setSharePosition($sharePosition)
    {
        $this->sharePosition = $sharePosition;
    }
    
    public function getScope()
    {
        return $this->scope;
    }

    public function setScope($scope)
    {
        $this->scope = $scope;
    }

    
    public function OnDrag()
    {
        return $this->onDrag;
    }
    
    public function OnMouseDown()
    {
        return $this->onMouseDown;
    }    
    
    public function window_onMouseDown()
    {     
        foreach ($this->getWorkspace()->getWindows() as $window)
        {
            $window->__call("setZIndex", array(0));
        }
        
        $this->__call("setZIndex", array(1));
    }

    public function getControls()
    {

        $controls = new Collection();

        $methods = get_class_methods($this);
        foreach ($methods as $method)
        {
            if ((ToolSuite::startsWith($method, 'get') !== false) && ($method != "getControls"))
            {
                $val = $this->$method();
                if (is_a($val, '\Phem\Libraries\UI\Model\Control'))
                {
                    $controls->put(lcfirst(substr($method, 3)), $val);
                }
            }
        }
        return $controls;
    }

}

Powered by WebSVN 2.2.1