Class WFYAHOO_widget_TreeView

Description

A tree widget for our framework. Uses Yahoo! YUI library.

PHOCOA Builder Setup:

Required:

Optional:

  • todo: Add capability for multi-selection of tree items. This one is gonna be tricky! Esp. with dynamic data; need to keep track of checked items even if they never become visisble.

Located in /framework/widgets/yahoo/WFYAHOO_widget_TreeView.php (line 24)

WFObject
   |
   --WFView
      |
      --WFWidget
         |
         --WFYAHOO
            |
            --WFYAHOO_widget_TreeView
Variable Summary
Method Summary
static void exposedProperties ()
static string itemsAsXML (array $items)
static void sendTree (array $items)
WFYAHOO_widget_TreeView __construct ( $id,  $page)
object WFActionResponseXML. ajaxLoadData (array $page,  $params,  $path)
void initJS ( $blockcontent)
void render ([ $blockContent = NULL])
void setDynamicCallback (string $url)
array setDynamicDataLoader (mixed $callback)
Variables
string $bcCallback (line 29)
  • var: an http url to serve as the "root" callback url for loading dynamic data. the "path" of the node to load data for will be passed in as the first parameter.
  • access: protected
array $dynamicDataLoader (line 33)

Inherited Variables

Inherited from WFYAHOO

WFYAHOO::$initializeWaitsForID

Inherited from WFWidget

WFWidget::$bindings
WFWidget::$class
WFWidget::$errors
WFWidget::$formatter
WFWidget::$hasRestoredState
WFWidget::$hidden
WFWidget::$name
WFWidget::$value
WFWidget::$widgetLabel

Inherited from WFView

WFView::$children
WFView::$cssImports
WFView::$enabled
WFView::$id
WFView::$importInHead
WFView::$jsActions
WFView::$jsEvents
WFView::$jsImports
WFView::$originalOnEvent
WFView::$page
WFView::$parent
Methods
static method exposedProperties (line 51)
  • access: public
static void exposedProperties ()

Redefinition of:
WFWidget::exposedProperties()
static method itemsAsXML (line 104)

Convert an array of WFYAHOO_widget_TreeViewNode objects into the XML that the UI widget expects in JS.

  • return: The XML of the items.
  • throws: object WFException On Error.
static string itemsAsXML (array $items)
  • array $items: Array of WFYAHOO_widget_TreeViewNode objects.
static method sendTree (line 324)

Helper function for the dynamicCallback page to use to send the data back to the WFYAHOO_widget_TreeView via AJAX.

This function will create the XML data representation of the node data and pass it back to the client.

NOTE: Script execution stops inside of this function.

  • deprecated:
static void sendTree (array $items)
  • array $items: An array of WFYAHOO_widget_TreeViewNode objects representing the children of the node passed in to the dynamicCallback URL.
Constructor __construct (line 42)

Constructor.

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

Redefinition of:
WFYAHOO::__construct()
Constructor.
ajaxLoadData (line 131)

AJAX callback function which will be called when the tree needs more node data.

NOTE: must be public or is_callable fails.

  • throws: object WFException On Error.
  • access: public
object WFActionResponseXML. ajaxLoadData (array $page,  $params,  $path)
  • array $page: An array of node id's to the node we need child data for.
  • $params
  • $path
canPushValueBinding (line 312)
void canPushValueBinding ()

Redefinition of:
WFYAHOO::canPushValueBinding()
dynamicallyLoadsData (line 64)

Are we in dynamic data loading mode?

boolean dynamicallyLoadsData ()
initJS (line 153)
void initJS ( $blockcontent)
  • $blockcontent

Redefinition of:
WFYAHOO::initJS()
The initJS function is where YUI widgets perform their bootstrap/initialization.
render (line 138)
void render ([ $blockContent = NULL])
  • $blockContent

Redefinition of:
WFYAHOO::render()
IMPORTANT: The subclasses should get the base class's html, then add the needed code.
setDynamicCallback (line 348)

Set the base URL used for the dynamic data loading.

The format of the callback is that WFYAHOO_widget_TreeView will add one parameter to the end of that URL which contains the "path" to the tree node that child data is needed for. For example, a parameter of "GA|Atlanta Metro|Decatur" means that the child data for the node at "GA > Atlanta Metro > Decatur" is needed.

The URL should not have a trailing slash.

The URL should be urlencoded.

The URL should perform the following action:

  1. Determine the child data for the passed path, and build an array of WFYAHOO_widget_TreeViewNode objects representing the children of that node. ONLY 1 LEVEL DEEP OF CHILDREN!
  2. Call WFYAHOO_widget_TreeView::sendTree() with an array of WFYAHOO_widget_TreeViewNode objects.

  • deprecated: Use {WFYAHOO_widget_TreeView::setDynamicDataLoader()}.
void setDynamicCallback (string $url)
  • string $url: The base URL for node data loading.
setDynamicDataLoader (line 86)

Set up a dataloader callback for dynamically loading child data.

The callback function prototype is:

(array) loadNodesCallback($path)

Where $path is a '|' separated list of ID's to the node whose child data is needed, and you return an array of WFYAHOO_widget_TreeViewNode objects.

For example, a $path of "USA|Georgia" means that the child data for the node at "USA > Georgia" is needed.

  • return: An array of WFYAHOO_widget_TreeViewNode objects.
  • throws: object WFException If the callback is invalid.
array setDynamicDataLoader (mixed $callback)
  • mixed $callback: Callback. string A method on the page delegate object to call to get the child nodes. array A php callback structure.

Inherited Methods

Inherited From WFYAHOO

WFYAHOO::__construct()
WFYAHOO::canPushValueBinding()
WFYAHOO::initJS()
WFYAHOO::jsForSimplePropertyConfig()
WFYAHOO::jsValueForValue()
WFYAHOO::render()
WFYAHOO::yuiloader()

Inherited From WFWidget

WFWidget::__construct()
WFWidget::addError()
WFWidget::bind()
WFWidget::bindingByName()
WFWidget::bindings()
WFWidget::canPushValueBinding()
WFWidget::errors()
WFWidget::exposedBindings()
WFWidget::exposedProperties()
WFWidget::formattedValue()
WFWidget::formatter()
WFWidget::hasRestoredState()
WFWidget::hidden()
WFWidget::name()
WFWidget::processBindingOptions()
WFWidget::propagateValueToBinding()
WFWidget::pullBindings()
WFWidget::pushBindings()
WFWidget::restoreState()
WFWidget::setFormatter()
WFWidget::setHidden()
WFWidget::setName()
WFWidget::setupExposedBindings()
WFWidget::setValue()
WFWidget::setWidgetLabel()
WFWidget::unbind()
WFWidget::value()
WFWidget::valueForBinding()
WFWidget::widgetLabel()

Inherited From WFView

WFView::__construct()
WFView::addChild()
WFView::allConfigFinishedLoading()
WFView::children()
WFView::cloneWithID()
WFView::enabled()
WFView::exposedProperties()
WFView::getForm()
WFView::getJSActions()
WFView::getListenerJS()
WFView::getListenerJSInScriptTag()
WFView::getOnEvent()
WFView::getWidgetDir()
WFView::getWidgetWWWDir()
WFView::id()
WFView::importCSS()
WFView::importJS()
WFView::jsEndHTML()
WFView::jsStartHTML()
WFView::page()
WFView::parent()
WFView::removeChild()
WFView::render()
WFView::setEnabled()
WFView::setId()
WFView::setJSonBlur()
WFView::setJSonClick()
WFView::setListener()
WFView::setOnEvent()
WFView::setParent()
WFView::yuiPath()

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 Wed, 12 Nov 2008 23:46:29 -0500 by phpDocumentor 1.4.1