Class PresenterComponent (namespace Nette\Application)


PresenterComponent is the base class for all presenters components.

Components are persistent objects located on a presenter. They have ability to own other child components, and interact with user. Components have properties for storing their status, and responds to user command.

Object
   |
   --Component
      |
      --ComponentContainer
         |
         --PresenterComponent

Implements interfaces:

ISignalReceiver, IStatePersistent

Direct Known Sub-classes:

Control
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Abstract:
Located: in /Application/PresenterComponent.php (line 44)
Constructor Summary
public
__construct ([$parent = NULL], [$name = NULL])
Method Summary
void
ajaxLink ($destination, [$args = array()])
protected void
attached (IComponent $presenter)
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
protected string
formatSignalMethod (string $signal)
Formats signal handler method name -> case sensitivity doesn't matter.
mixed
getParam ([string $key = NULL], [mixed $default = NULL])
Returns component param.
string
getParamId ($key)
Returns a fully-qualified name that uniquely identifies the parameter.
Presenter|NULL
getPresenter ([bool $need = TRUE])
Returns the presenter where this component belongs to.
string
Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.
void
lazyLink ($destination, [$args = array()])
string
link (string $destination, [array|mixed $args = array()])
Generates URL to presenter, view or signal.
void
loadState ($params)
Loads state informations.
void
redirect (string $destination, [array $args = NULL], [int $code = IHttpResponse::S303_POST_GET])
Redirect to another presenter, view or signal.
void
saveState (&$params, [portion $forClass = NULL])
Saves state informations for next request.
void
signalReceived (string $signal)
Calls signal handler method.
protected bool
tryCall (string $method, $params)
Calls public method if exists.
Methods Inherited From ComponentContainer
ComponentContainer::addComponent(), ComponentContainer::createComponent(), ComponentContainer::getComponent(), ComponentContainer::getComponents(), ComponentContainer::isCloning(), ComponentContainer::removeComponent(), ComponentContainer::validateChildComponent(), ComponentContainer::__clone()
Methods Inherited From Component
Component::__construct(), Component::attached(), Component::detached(), Component::getName(), Component::getParent(), Component::getService(), Component::getServiceLocator(), Component::lookup(), Component::lookupPath(), Component::monitor(), Component::setParent(), Component::setServiceLocator(), Component::validateParent(), Component::__clone(), Component::__wakeup()
Methods Inherited From Object
Object::extensionMethod(), Object::getClass(), Object::getReflection(), Object::__call(), Object::__callStatic(), Object::__get(), Object::__isset(), Object::__set(), Object::__unset()
Variable Summary
protected array $params array()

line 47


Constructor Details

line 53

__construct

public __construct ([$parent = NULL], [$name = NULL])

Input
$parent
$name
Method Details

line 91

attached

protected void attached (IComponent $presenter)

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.

Input
IComponent $presenter
Output
void  

line 239

formatSignalMethod

protected string formatSignalMethod (string $signal)

Formats signal handler method name -> case sensitivity doesn't matter.

Input
string $signal
Output
string  

line 188

getParam

public mixed getParam ([string $key = NULL], [mixed $default = NULL])

Returns component param.

If no key is passed, returns the entire array.

Input
string $key key
mixed $default default value
Output
mixed  

line 207

getParamId

public string getParamId ($key)

Returns a fully-qualified name that uniquely identifies the parameter.

Input
$key
Output
string  

line 66

getPresenter

public Presenter|NULL getPresenter ([bool $need = TRUE])

Returns the presenter where this component belongs to.

Overridden in child classes as:

Input
bool $need throw exception if presenter doesn't exist?
Output
Presenter|NULL  

line 78

getUniqueId

public string getUniqueId ()

Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.

Overridden in child classes as:

Output
string  

line 128

loadState

public void loadState ($params)

Loads state informations.

Implementation of:

Input
$params
Output
void  

line 301

redirect

public void redirect (string $destination, [array $args = NULL], [int $code = IHttpResponse::S303_POST_GET])

Redirect to another presenter, view or signal.

Input
string $destination
array $args
int $code HTTP error code
Output
void  
Throws
throws RedirectingException

line 147

saveState

public void saveState (&$params, [portion $forClass = NULL])

Saves state informations for next request.

Implementation of:

Input
&$params
portion $forClass specified by class name (used by Presenter)
Output
void  

line 225

signalReceived

public void signalReceived (string $signal)

Calls signal handler method.

Input
string $signal
Output
void  
Throws
throws BadSignalException if there is not handler method

line 106

tryCall

protected bool tryCall (string $method, $params)

Calls public method if exists.

Input
string $method
$params
Output
bool does method exist?