Class WFView

Description

The base "view" class. Views are the components that make up a WFPage. Each page has a root view, and then is made up of various subviews in a view hierarchy. There is also a well-defined class hierarchy for WFView that contains all components that are used in creating a web page.

WFView - Views are just generalized components for displaying on screen. NSView is abstract.
  |
  `-WFTabView - A tabbed view containing other pages. (NOT YET IMPLEMENTED)
  `-WFBoxView - A simple box containing content from another page. (NOT YET IMPLEMENTED)
  |
  `-WFWidget - A specialized view for dealing with displaying editale values or actionable controls.
      |                   Also abstract. Adds data get/set methods.
      |                   Add support for editable, error tracking, and formatters.
      `-WFForm - A Form object.
      `-WFTextField - A textfield item.
      `-WFCheckbox - A checkbox item.
      `-WFLabel - For displaying uneditable text, but can use bindings and formatters.
      (etc)

Since we're a web framework, all views eventually know how to render themselves into HTML.

Views have no maintained state. Anything that needs to maintain state should be a WFWidget subclass.

WFView contains the basic infrastructure support the YUI library, which is PHOCOA's Javascript and AJAX layer.

  • abstract:

Located in /framework/widgets/WFView.php (line 35)

WFObject
   |
   --WFView
Direct descendents
Class Description
WFPaginatorPageInfo A Paginator Page info widget.
WFTableView A Table widget for our framework.
WFTableColumn The base "view" class. Views are the components that make up a WFPage. Each page has a root view, and then is made up of various subviews in a view hierarchy. There is also a well-defined class hierarchy for WFView that contains all components that are used in creating a web page.
WFWidget The base "widget" class. In our framework, all html form widgets are necessarily WFWidget subclasses.
Variable Summary
assoc_array $children
assoc_array $cssImports
boolean $enabled
string $id
boolean $importInHead
array $jsActions
mixed $jsEvents
assoc_array $jsImports
object The $page
Method Summary
static void exposedProperties ()
static void yuiPath ()
WFView __construct ( $id,  $page)
void addChild (WFView $view)
array children ()
void cloneWithID ( $id)
boolean enabled ()
string getJSActions ()
string getListenerJS ()
string getWidgetDir ()
string getWidgetWWWDir ()
string id ()
void importCSS (string $path)
void importJS (string $path, [string $globalNamespace = NULL], [string $localNamespace = NULL])
string jsEndHTML ()
string jsStartHTML ()
void page ()
void removeChild (WFView $view)
string render ([string $blockContent = NULL])
void setEnabled (boolean $enabled)
void setId (string $id)
void setJSonBlur (string $js)
void setJSonClick (string $js)
void setListener ( $event)
void setOnEvent ( $str)
void setParent (object WFView $parent)
Variables
assoc_array $children (line 48)
  • var: Placeholder for additional HTML name/value pairs.
  • access: protected
assoc_array $cssImports (line 64)
  • var: An array whose keys are the paths to css files to be included.
  • access: protected
boolean $enabled (line 56)
  • var: Enabled. TRUE if the control is enabled (ie responds to input), FALSE otherwise.
  • access: protected
string $id (line 40)
  • var: The ID of the view. Used both internally outlet and externally as in the HTML id.
  • access: protected
boolean $importInHead (line 69)
  • var: TRUE to include JS and CSS files in a less-efficient, but more-debuggable way. Basically, will include with link/script tags if true, otherwise will use javascript to include the files with the PHOCOA.importCSS() javascript function.
  • access: protected
array $jsActions (line 73)
  • var: A list of the JavaScript actions for the widget. Mananged centrally; used by subclasses to allow actions to be attached. DEPRECATE FOR YAHOO JS STUFF!
  • access: protected
mixed $jsEvents (line 75)
  • access: protected
assoc_array $jsImports (line 60)
  • var: An array whose keys are the paths to javascript files to be included. The value has 3 keys; url, globalNamespace, localNamespace.
  • access: protected
object The $page (line 52)
  • var: WFPage object that contains this view.
  • access: protected
object WFView $parent (line 44)
  • var: The parent of this view, or NULL if there is no parent.
  • access: protected
Methods
static method exposedProperties (line 213)
  • access: public
static void exposedProperties ()

Redefinition of:
WFObject::exposedProperties()
Empty placeholder for exposedProperties setup.

Redefined in descendants as:
static method yuiPath (line 208)
  • access: public
static void yuiPath ()
Constructor __construct (line 82)

Constructor.

Sets up the smarty object for this module.

WFView __construct ( $id,  $page)
  • $id
  • $page

Redefinition of:
WFObject::__construct()

Redefined in descendants as:
addChild (line 498)

Add a child view to this view.

void addChild (WFView $view)
  • object A $view: WFView object to add.

Redefined in descendants as:
allConfigFinishedLoading (line 533)

After WFPage has completed the loading of all config for all widgets, it will call this function on each widget.

This function is particularly useful for widgets that have children. When called, the widget can be sure that all instances and config of its children have been loaded from the .config file.

void allConfigFinishedLoading ()

Redefined in descendants as:
children (line 508)

Get all child views of this view.

  • return: An array of WFView objects.
array children ()
cloneWithID (line 228)

Create a clone of the WFView with a new ID.

This will give you a copy of WFView that has been registered with the page.

  • throws:
void cloneWithID ( $id)
  • $id
enabled (line 418)

Is the view enabled?

boolean enabled ()
getForm (line 119)

Get the form associated with this element, if there is one.

  • return: The form that contains this element, or NULL if it is not in a form.
  • access: public
object WFForm getForm ()
getJSActions (line 403)

Get the HTML code for all JavaScript actions.

  • return: The HTML code (space at beginning, no space at end) for use in attaching JavaScript actions to views.
string getJSActions ()
getListenerJS (line 185)

Get the JS code to set up the PHOCOA-AJAX integrations. This is just the javascript, so that it can be include easily from <script> blocks that you already have.

  • return: The JS code that sets up all PHOCOA-AJAX integrations for this element.
  • access: public
string getListenerJS ()
getListenerJSInScriptTag (line 198)

Get the JS code to set up the PHOCOA-AJAX integrations. This includes the SCRIPT tags, and will be EMPTY if there are no listeners.

  • return: The <script>CODE</script> for setting up the PHOCOA-AJAX integrations for this element.
  • access: public
string getListenerJSInScriptTag ()
getWidgetDir (line 448)

Get an absolute filesystem path to the www dir for graphics for this widget in the current project.

  • return: The path to directory containing www items for this widget.
string getWidgetDir ()
getWidgetWWWDir (line 438)

Get a relative URL path to the public www dir for graphics for this widget.

  • return: The URL to directory containing www items for this widget.
string getWidgetWWWDir ()
id (line 255)

Get the id of this view. All id's on a single page are unique.

  • return: The unique id of this view.
string id ()
importCSS (line 293)

Import a CSS source file.

In *debug* mode, this will be imported by adding a <link> tag to the head element, for improved debug-ability. In normal mode, this will be imported by using an AJAX request to synchronously download the source file, then eval() it.

The advantage of the latter is that CSS files can be programmatically added via javascript code, even from code that is returned from AJAX calls.

  • access: protected
void importCSS (string $path)
  • string $path: The css file path to include.
importJS (line 275)

Import a JS source file.

In *debug* mode, this will be imported by adding a <script> tag to the head element, for improved debug-ability. In normal mode, this will be imported by using an AJAX request to synchronously download the source file, then eval() it.

The eval() method has improved flexibility, because it can be used even on widget code loaded from AJAX calls with prototype's Element.update + evalScripts: true, thus allowing the loading of JS files only exactly when needed.

However, it has the downside of requiring that the js code is eval-clean (that is, unless you assign your functions to variables they will not "exist").

  • access: protected
void importJS (string $path, [string $globalNamespace = NULL], [string $localNamespace = NULL])
  • string $path: The JS file path to include.
  • string $globalNamespace: When importing javascript libraries, the global variable name you want the library loaded as. Default NULL (not a library).
  • string $localNamespace: When importing javascript libraries, the local variable name that contains the library in included code. Default to same as globalNamespace.
jsEndHTML (line 373)

Helper function to get the proper "end" block for using Javascript in a web page.

string jsEndHTML ()
jsStartHTML (line 362)

Helper function to get the proper "start" block for using Javascript in a web page.

NOTE: The conventions used here are from Douglas Crockford's "Theory of DOM" video.

  • Comments not needed since Mosaic and Netscape 1.
  • type attribute IGNORED. They only trust mime-type header on actual file.
  • language attribute IGNORED.

  • return: HTML code for the "start" block of a JS script section.
string jsStartHTML ()
page (line 456)

Get the WFPage object that this view belongs to.

void page ()
parent (line 476)

Get the parent view for this view.

  • return: The parent object.
object WFView parent ()
removeChild (line 488)

Remove a child view from the view hierarchy.

  • throws:
void removeChild (WFView $view)
  • object WFView $view: The view object to remove as a child of this view.
render (line 522)

Render the view into HTML.

Subclasses need to start their output with the result of the super's render() method.

  • return: The final HTML output for the view.
string render ([string $blockContent = NULL])
  • string $blockContent: For block views (ie have open and close tags)r, the ready-to-use HTML content that goes inside this view. For non-block views (ie single tag only) will always be null.

Redefined in descendants as:
setEnabled (line 428)

Set whether or not the view is enabled. Enabled views respond to the user and accept input (widgets).

void setEnabled (boolean $enabled)
  • boolean $enabled
setId (line 243)

Set the unique ID of this widget.

ID's are unique within a page; this function will tell the page of the new instance ID so it can be registered.

void setId (string $id)
  • string $id: The ID of the WFView instance.
setJSonBlur (line 383)

Set the "onBlur" JavaScript code for the view.

void setJSonBlur (string $js)
  • string $js: JavaScript code.
setJSonClick (line 393)

Set the "onClick" JavaScript code for the view.

void setJSonClick (string $js)
  • string $js: JavaScript code.
setListener (line 104)
  • access: public
void setListener ( $event)
  • $event
setOnEvent (line 128)
  • access: public
void setOnEvent ( $str)
  • $str
setParent (line 466)

Set the parent view for this view.

void setParent (object WFView $parent)

Inherited Methods

Inherited From WFObject

WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForUndefinedKey()
WFObject::__toString()

Documentation generated on Thu, 17 Apr 2008 13:52:13 -0400 by phpDocumentor 1.4.1