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. YUI did this in 2.7? Can't tell....
  • todo: Add loading indicator
  • todo: Add indicator in case of NO ITEMS FOUND... need to say something.
  • todo: Bug; if hit enter then esc quickly, things get fouled up. no idea why. even happens with autoExpandUntilChoices = false. jwatts?
  • todo: Re-implement dragdrop directly correctly; make every node a DDTarget, set up a DDProxy,

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

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 (object WFPage $page, array $params, string $path, [string $query = NULL])
void initJS ( $blockcontent)
void render ([ $blockContent = NULL])
void setDynamicCallback (string $url)
array setDynamicDataLoader (mixed $callback)
Variables
boolean $autoExpandUntilChoices (line 48)
  • var: TRUE to automatically expand any node that has exactly 1 child, FALSE to make everything manual. Default: TRUE
  • access: protected
string $bcCallback (line 36)
  • 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 40)
boolean $enableDragDropTree (line 60)
  • var: TRUE to enable drag & drop of tree items among the tree. Use document.observe('yuitreeview:drop', function(o) {}) to handle; o.memo.itemId and o.memo.droppedOnId provide access to the relevant nodes. Use tree.getNodeByElement(YAHOO.util.Dom.get(o.memo.itemId)) to get the actual content element for the node.
  • access: protected
boolean $expandOnClick (line 52)
  • var: TRUE to automatically expand any node when the label is clicked. Default: TRUE
  • access: protected
string $queryFieldId (line 56)
  • var: The ID of a WFSearchField that can contain a "query" to filter the tree data on.
  • access: protected

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 78)
  • access: public
static void exposedProperties ()

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

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 420)

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 65)

Constructor.

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

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

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 (object WFPage $page, array $params, string $path, [string $query = NULL])
  • object WFPage $page
  • array $params: Paramter hash.
  • string $path: The "path" to the node that child data is being requested for
  • string $query: The "query" that is active on the tree.
canPushValueBinding (line 408)
void canPushValueBinding ()

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

Are we in dynamic data loading mode?

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

Redefinition of:
WFYAHOO::initJS()
The initJS function is where YUI widgets perform their bootstrap/initialization.
render (line 168)
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 444)

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 113)

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::addErrors()
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::setValuesForKeys()
WFObject::validatedSetValueForKey()
WFObject::validatedSetValueForKeyPath()
WFObject::validateObject()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForStaticKey()
WFObject::valueForStaticKeyPath()
WFObject::valueForTargetAndKeyPath()
WFObject::valueForUndefinedKey()
WFObject::valueForUndefinedStaticKey()
WFObject::valuesForKeyPaths()
WFObject::valuesForKeys()
WFObject::_valueForStaticKey()
WFObject::__toString()

Documentation generated on Thu, 14 May 2009 16:20:56 -0400 by phpDocumentor 1.4.2