Class P4A_Widget

Description

Base class for objects that permit user interation with the application.

Every P4A objects thats can be rendered should use WIDGET as base class. This class have all the basic methods to build complex widgets that must be P4A compatible.

Located in /p4a/objects/widget.php (line 48)

P4A_Object
   |
   --P4A_Widget
Direct descendents
Class Description
 class P4A_Frame The frame widget A frame is a panel where we anchor widgets.
 class P4A_Link "A" HTML tag.
 class P4A_DB_Navigator This widget allows a tree navigation within a P4A_DB_Source.
 class P4A_Toolbar A toolbar is a buttons/images set.
 class P4A_Menu p4a menu system.
 class P4A_Menu_Item Rapresents every menu item.
 class P4A_Sheet Sheets is the way to manage layouts in MerliWork masks.
 class P4A_Sheet_Cell The basic element of sheets: SHEET CELL.
 class P4A_Tab_Pane The tab pane widget A tab pane is a set of pages.
 class P4A_Canvas The canvas widget A cancas is a panel where we anchor widgets.
 class P4A_Button HTML "button".
 class P4A_Label The label is associated to an input field, do not use it otherwise.
 class P4A_Image Use this whan you want to put an image in your application.
 class P4A_Field A fields is a GUI element that shows its value, and this value can be changed.
 class P4A_Message P4A - PHP For Applications.
 class P4A_Href "HREF" part on a "A" tag.
 class P4A_Line Line
 class P4A_Table Tabular rapresentation of a data source.
 class P4A_Table_Col Keeps the data for a single table column.
 class P4A_Table_Rows Keeps all the data for all the rows.
 class P4A_Icon The icon widget
 class P4A_Box The box: renders raw HTML.
Variable Summary
 array $actions
 boolean $enabled
 mixed $label
 array $map_actions
 array $properties
 array $style
 boolean $use_template
 string $value
 boolean $visible
 array $_temp_vars
 array $_tpl_vars
Method Summary
 void addAction (string $action, [string $event = null], [boolean $require_confirmation = false], [string $confirmation_text = null], [string $confirmation_text_handler = 'confirm_general'], [boolean $ajax = false])
 void addAjaxAction (string $action, [string $event = null], [boolean $require_confirmation = false], [string $confirmation_text = null], [string $confirmation_text_handler = 'confirm_general'])
 void addTempVar (string $name,  $value)
 void changeEvent (string $action, [string $event = NULL])
 void clearTempVars ()
 string composeStringActions ([array $params = null], [ $check_enabled_state = true])
 string composeStringStyle ()
 void disable ()
 void display (string $var_name, string $var_value)
 void dropAction (string $action)
 void dropTempVar (string $name)
 void enable ([boolean $enabled = TRUE])
 string fetchTemplate ()
 void getAccessKey ()
 void getAsString ()
 void getHeight ()
 string getLabel ()
 string getProperty (string $property)
 string getStyleProperty (string $property)
 string getValue ()
 string getWidth ()
 void isEnabled ()
 boolean isVisible ()
 void onBlur ([ $params = NULL])
 void onChange ([ $params = NULL])
 void onClick ([ $params = NULL])
 void onDblClick ([ $params = NULL])
 void onFocus ([ $params = NULL])
 void onKeyDown ([ $params = NULL])
 void onKeyPress ([ $params = NULL])
 void onKeyUp ([ $params = NULL])
 void onMouseDown ([ $params = NULL])
 void onMouseMove ([ $params = NULL])
 void onMouseOver ([ $params = NULL])
 void onMouseUp ([ $params = NULL])
 void onReturnPress ([ $params = NULL])
 void onSelect ([ $params = NULL])
 void p4a_widget ([string $name = NULL], [string $prefix = 'wdg'], [string $id = NULL])
 void raise ()
 void redesign ()
 void requireConfirmation (string $action, [string $confirmation_text = null], [string $confirmation_text_handler = 'confirm_general'])
 void setAccessKey ( $key)
 void setBgcolor (string $value)
 void setBgimage (string $value)
 void setDefaultLabel (string 0)
 void setFontColor (string $value)
 void setFontWeight (string $value)
 void setHeight ([integer $value = null], [string $unit = 'px'])
 void setInvisible ()
 void setLabel (string $label)
 void setProperty (string $property, string $value)
 void setStyleProperty (string $property, string $value)
 void setValue (string $value)
 void setVisible ([boolean $visible = TRUE])
 void setWidth ([integer $value = null], [string $unit = 'px'])
 void unrequireConfirmation (string $action)
 void unsetProperty (string $property)
 void unsetStyleProperty (string $property)
 void useTemplate (string $template_name)
Variables
array $actions = array() (line 83)

Keeps all the actions implemented by the widget.

  • access: private
boolean $enabled = TRUE (line 62)

Object's enabled status. If the widget is visible but not enable it won't be clickable.

  • access: private
mixed $label = NULL (line 91)

Keeps the label associated with the widget.

The label will be displayed on the left of the widget.

  • access: public
array $map_actions = array() (line 76)

Keeps the association between an action and its listener.

  • access: private
array $properties = array() (line 98)

Keeps all the HTML properties for the widget.

  • access: private
array $style = array() (line 105)

Keeps all the CSS properties for the widget.

  • access: private
string $template_name = NULL (line 121)

Defines the name of the widget.

if you set it to 'menu' P4A will search for "menu/menu.tpl" in the "themes/CURRENT_THEME/widgets/" directory.

  • access: public
boolean $use_template = false (line 112)

Defines if we are going to use a template for the widget.

  • access: public
string $value = NULL (line 55)

Object's value. Used for widget with data binding.

  • access: private
boolean $visible = TRUE (line 69)

Defines object visibility.

  • access: private
array $_temp_vars = array() (line 135)

Temporary variables (destroyed after rendering)

  • access: private
array $_tpl_vars = array() (line 128)

variables used for templates

  • access: private

Inherited Variables

Inherited from P4A_Object

P4A_Object::$_helpers
P4A_Object::$_id
P4A_Object::$_map_actions
P4A_Object::$_name
P4A_Object::$_objects
P4A_Object::$_parent_id
Methods
addAction (line 485)

Adds an action to the implemented actions stack for the widget.

  • access: public
void addAction (string $action, [string $event = null], [boolean $require_confirmation = false], [string $confirmation_text = null], [string $confirmation_text_handler = 'confirm_general'], [boolean $ajax = false])
  • string $action: The action's name.
  • string $event: The JavaScript event that triggers.
  • boolean $require_confirmation: Action Requires confirmation?.
  • string $confirmation_text: Text for confirmation.
  • string $confirmation_text_handler: i18n message id for confirmation.
  • boolean $ajax: is an ajax action?
addAjaxAction (line 513)

Adds an ajax action to the implemented actions stack for the widget.

  • access: public
void addAjaxAction (string $action, [string $event = null], [boolean $require_confirmation = false], [string $confirmation_text = null], [string $confirmation_text_handler = 'confirm_general'])
  • string $action: The action's name.
  • string $event: The JavaScript event that triggers.
  • boolean $require_confirmation: Action Requires confirmation?.
  • string $confirmation_text: Text for confirmation.
  • string $confirmation_text_handler: i18n message id for confirmation.
addTempVar (line 944)

Add a temporary variable

  • access: public
void addTempVar (string $name,  $value)
  • string $name: The URI of file.
  • $value
changeEvent (line 553)

Changes the event associated to an action.

If no event is given, here we set event=action.

  • access: public
void changeEvent (string $action, [string $event = NULL])
  • string $action: The action's name.
  • string $event: The JavaScript event that triggers.
clearTemplateVars (line 743)

Empties the template engine variables' stack.

  • access: public
void clearTemplateVars ()
clearTempVars (line 965)

Clear temporary vars list

  • access: public
void clearTempVars ()
composeStringActions (line 604)

Composes a string containing all the actions implemented by the widget.

Note: it will also contain the name and the value.

  • access: public
string composeStringActions ([array $params = null], [ $check_enabled_state = true])
  • array $params: Parameters passed to the action handler.
  • $check_enabled_state

Redefined in descendants as:
composeStringClassStyle (line 692)

Composes a string contaning the CSS class property for the widget.

  • access: public
string composeStringClassStyle ()
composeStringProperties (line 586)

Composes a string containing all the HTML properties of the widget.

Note: it will also contain the name and the value.

  • access: public
string composeStringProperties ()

Redefined in descendants as:
composeStringStyle (line 674)

Composes a string containing the CSS properties for the widget.

  • access: public
string composeStringStyle ()
disable (line 188)

Sets the widget disabled.

void disable ()

Redefined in descendants as:
display (line 723)

Adds this variable (name and value) to the template engine variables' stack.

void display (string $var_name, string $var_value)
  • string $var_name: The variable name.
  • string $var_value: The variable value.
dropAction (line 574)

Removes an action from the implemented actions stack for the widget.

  • access: public
void dropAction (string $action)
  • string $action: The action's name.
dropTempVar (line 954)

Drop a temporary variable

  • access: public
void dropTempVar (string $name)
  • string $name: The URI of CSS.
enable (line 178)

Sets the widget enabled.

  • see: $enable
  • access: public
void enable ([boolean $enabled = TRUE])
  • boolean $enabled: Visibility flag

Redefined in descendants as:
fetchTemplate (line 753)

Returns the HTML rendered template.

  • access: public
string fetchTemplate ()
getAccessKey (line 345)
void getAccessKey ()
getAsString (line 796)

Returns the HTML rendered widget.

This method MUST be overridden by every widget that extends P4A_this class.

  • access: public
void getAsString ()

Redefined in descendants as:
getHeight (line 422)

Returns the height for the widget.

It's a wrapper for get_style_property().

  • see: get_style_property()
  • access: public
void getHeight ()
getLabel (line 278)

Returns the label for the widget.

  • access: public
string getLabel ()

Redefined in descendants as:
getProperty (line 310)

Returns the value of a property.

  • access: public
string getProperty (string $property)
  • string $property: The property's name.
getStyleProperty (line 355)

Returns the value of a CSS property.

  • access: public
string getStyleProperty (string $property)
  • string $property: The property's name.
getValue (line 167)

Retuns the value of the widget.

string getValue ()

Redefined in descendants as:
getWidth (line 391)

Returns the width for the widget.

It's a wrapper for get_style_property().

  • see: get_style_property()
  • access: public
string getWidth ()
isEnabled (line 198)

Returns true if the widget is enabled.

  • see: $enable
  • access: public
void isEnabled ()
isVisible (line 227)

Returns true if the widget is visible.

  • access: public
boolean isVisible ()
onBlur (line 815)

Wrapper used to add the handling of OnBlur action.

  • see: action_handler()
void onBlur ([ $params = NULL])
  • $params
onChange (line 833)

Wrapper used to add the handling of OnChange action.

  • see: action_handler()
void onChange ([ $params = NULL])
  • $params
onClick (line 824)

Wrapper used to add the handling of OnClick action.

  • see: action_handler()
void onClick ([ $params = NULL])
  • $params

Redefined in descendants as:
onDblClick (line 842)

Wrapper used to add the handling of onDblClick action.

  • see: action_handler()
void onDblClick ([ $params = NULL])
  • $params
onFocus (line 851)

Wrapper used to add the handling of onFocus action.

  • see: action_handler()
void onFocus ([ $params = NULL])
  • $params
onKeyDown (line 914)

Wrapper used to add the handling of OnKeyDown action.

  • see: action_handler()
void onKeyDown ([ $params = NULL])
  • $params
onKeyPress (line 896)

Wrapper used to add the handling of OnKeyPress action.

  • see: action_handler()
void onKeyPress ([ $params = NULL])
  • $params
onKeyUp (line 905)

Wrapper used to add the handling of OnKeyUp action.

  • see: action_handler()
void onKeyUp ([ $params = NULL])
  • $params
onMouseDown (line 860)

Wrapper used to add the handling of onMouseDown action.

  • see: action_handler()
void onMouseDown ([ $params = NULL])
  • $params
onMouseMove (line 869)

Wrapper used to add the handling of onMouseMove action.

  • see: action_handler()
void onMouseMove ([ $params = NULL])
  • $params
onMouseOver (line 878)

Wrapper used to add the handling of onMouseOver action.

  • see: action_handler()
void onMouseOver ([ $params = NULL])
  • $params
onMouseUp (line 887)

Wrapper used to add the handling of onMouseUp action.

  • see: action_handler()
void onMouseUp ([ $params = NULL])
  • $params
onReturnPress (line 925)

Wrapper used to add the handling of onReturnPress action.

The onReturnPress action is an onKeyPress with checking if the pressed key is return.

  • see: action_handler()
void onReturnPress ([ $params = NULL])
  • $params
onSelect (line 934)

Wrapper used to add the handling of onSelect action.

  • see: action_handler()
void onSelect ([ $params = NULL])
  • $params
p4a_widget (line 145)

Class constructor.

Sets default properties and store the object in the application object stack.

  • access: private
void p4a_widget ([string $name = NULL], [string $prefix = 'wdg'], [string $id = NULL])
  • string $name: Widget identifier, when you add an object to another object (such as $p4a) you can access to it by $p4a->object_name.
  • string $prefix: Prefix string for ID generation.
  • string $id: Object ID identifies an object in the $p4a's object collection. You can set a static ID if you want that all clients uses the same ID (tipically for web sites).
raise (line 806)

Prints the value returned by get_as_string().

It Should never be used by "normal" p4a users.

  • see: get_as_string()
  • access: public
void raise ()
redesign (line 970)
void redesign ()
requireConfirmation (line 526)

Requires confirmation for an action.

  • access: public
void requireConfirmation (string $action, [string $confirmation_text = null], [string $confirmation_text_handler = 'confirm_general'])
  • string $action: The action.
  • string $confirmation_text: Text for confirmation.
  • string $confirmation_text_handler: i18n message id for confirmation.
setAccessKey (line 341)
void setAccessKey ( $key)
  • $key

Redefined in descendants as:
setBgcolor (line 434)

Sets the background color for the widget.

It's a wrapper for set_style_property().

  • see: set_style_property()
  • access: public
void setBgcolor (string $value)
  • string $value: The value to be used as color.
setBgimage (line 446)

Sets the background image for the widget.

It's a wrapper for set_style_property().

  • see: set_style_property()
  • access: public
void setBgimage (string $value)
  • string $value: The url of the image.
setDefaultLabel (line 261)

Create from name a default label for the widget In rendering phase it will be added with ': '.

void setDefaultLabel (string 0)
  • string 0: The string to set as label.
setFontColor (line 470)

Sets the font color for the widget It's a wrapper for set_style_property().

  • see: set_style_property()
  • access: public
void setFontColor (string $value)
  • string $value: The url of the image.
setFontWeight (line 458)

Sets the font weight for the widget It's a wrapper for set_style_property().

  • see: set_style_property()
  • access: public
void setFontWeight (string $value)
  • string $value: The url of the image.
setHeight (line 404)

Sets the height for the widget.

It's a wrapper for set_style_property().

  • see: set_style_property()
  • access: public
void setHeight ([integer $value = null], [string $unit = 'px'])
  • integer $value: The value to be used as height.
  • string $unit: The measure unit (px|pt|%) etc...
setInvisible (line 217)

Sets the widget invisible.

  • access: public
void setInvisible ()
setLabel (line 239)

Sets the label for the widget.

In rendering phase it will be added with ': '.

void setLabel (string $label)
  • string $label: The string to set as label.

Redefined in descendants as:
setProperty (line 289)

Sets an HTML property for the widget.

  • access: public
void setProperty (string $property, string $value)
  • string $property: The property's name.
  • string $value: The property's value.
setStyleProperty (line 326)

Sets a CSS property for the widget.

  • access: public
void setStyleProperty (string $property, string $value)
  • string $property: The property's name.
  • string $value: The property's value.
setValue (line 156)

Sets the value of the widget.

void setValue (string $value)
  • string $value: The value to be setted.

Redefined in descendants as:
setVisible (line 208)

Sets the widget visible.

  • access: public
void setVisible ([boolean $visible = TRUE])
  • boolean $visible: Visibility flag

Redefined in descendants as:
setWidth (line 372)

Sets the width for the widget.

It's a wrapper for set_style_property().

  • see: set_style_property()
  • access: public
void setWidth ([integer $value = null], [string $unit = 'px'])
  • integer $value: The value to be used as width.
  • string $unit: The measure unit (px|pt|%) etc...
unrequireConfirmation (line 539)

Removes confirmation for an action.

  • access: public
void unrequireConfirmation (string $action)
  • string $action: The action.
unsetProperty (line 299)

Unsets an HTML property for the widget.

  • access: public
void unsetProperty (string $property)
  • string $property: The property's name.
unsetStyleProperty (line 336)

Unset a CSS property for the widget.

  • access: public
void unsetStyleProperty (string $property)
  • string $property: The property's name.
useTemplate (line 707)

Defines the template used by the widget.

void useTemplate (string $template_name)
  • string $template_name: Template name

Inherited Methods

Inherited From P4A_Object

 P4A_Object::actionHandler()
 P4A_Object::build()
 P4A_Object::destroy()
 P4A_Object::dropIntercept()
 P4A_Object::errorHandler()
 P4A_Object::getId()
 P4A_Object::getName()
 P4A_Object::getObjectType()
 P4A_Object::getParentID()
 P4A_Object::implementMethod()
 P4A_Object::intercept()
 P4A_Object::isActionTriggered()
 P4A_Object::p4a_object()
 P4A_Object::setName()
 P4A_Object::setParentID()
 P4A_Object::void()
 P4A_Object::_loadHelper()
 P4A_Object::__call()

Documentation generated on Mon, 07 Jan 2008 11:29:38 +0100 by phpDocumentor 1.4.0