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:

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Abstract:
Located: in /Application/PresenterComponent.php (line 42)
Public Method Summary
PresenterComponent
__construct ([$parent = NULL], [$name = NULL])
void
ajaxLink ($destination, [$args = array()])
string
formatSignalMethod (string $signal)
Formats signal handler method name -> case sensitivity doesn't matter.
mixed
getParam ([string $name = NULL], [mixed $default = NULL])
Returns component param.
string
getParamId ($name)
Returns a fully-qualified name that uniquely identifies the parameter.
static array
Returns array of classes persistent parameters. They have public visibility and are non-static.
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, action or signal.
void
loadState ($params)
Loads state informations.
void
redirect (int $code, [string $destination = NULL], [array|mixed $args = array()])
Redirect to another presenter, action or signal.
void
saveState (&$params, [portion $forClass = NULL])
Saves state informations for next request.
void
signalReceived (string $signal)
Calls signal handler method.
Protected Method Summary
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 bool
tryCall (string $method, $params)
Calls public method if exists.
Methods Inherited From ComponentContainer
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone()
Methods Inherited From Component
__construct(), attached(), detached(), getName(), getParent(), getService(), getServiceLocator(), lookup(), lookupPath(), monitor(), setParent(), setServiceLocator(), validateParent(), __clone(), __wakeup()
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Variable Summary
protected array $params array()

line 45


Method Details

line 51

__construct

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

Overridden in child classes as:

Input
$parent
$name
Output
PresenterComponent  

line 89

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 259

formatSignalMethod

public string formatSignalMethod (string $signal)

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

Input
string $signal
Output
string  

line 189

getParam

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

Returns component param.

If no key is passed, returns the entire array.

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

line 208

getParamId

public string getParamId ($name)

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

Input
$name
Output
string  

line 221

getPersistentParams

public static array getPersistentParams ()

Returns array of classes persistent parameters. They have public visibility and are non-static.

This default implementation detects persistent parameters by annotation @persistent.

Output
array  

line 64

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 76

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 126

loadState

public void loadState ($params)

Loads state informations.

Implementation of:

Input
$params
Output
void  

line 321

redirect

public void redirect (int $code, [string $destination = NULL], [array|mixed $args = array()])

Redirect to another presenter, action or signal.

Input
int $code [optional] HTTP error code
string $destination destination in format "[[module:]presenter:]view" or "signal!"
array|mixed $args
Output
void  
Throws
throws RedirectingException

line 148

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 245

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 104

tryCall

protected bool tryCall (string $method, $params)

Calls public method if exists.

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