A Dynamic widget for our framework. The dynamic widget is a meta-widget that automatically creates multple widgets for you, based on an array controller.
It's perfect for repeating data, tabular data, etc. You can also use multiple ones on the same page.
There are two modes of operation for WFDynamic. These two modes allow for great flexibility in layout of the managed widgets.
PROTOTYPES
Oftentimes you want to have customized attributes on the widget you are creating via WFDynamic. For instance, using formatters, setting default options, or other properties. WFDynamic now supports "prototypes". Simply add a child to the WFDynamic named "<id of WFDynamic>Prototype" and configure it as you would normally. WFDynamic will use this prototype object as the basis for all objects created. If you do use a prototype, there is no need to supply the widgetClass.
BINDINGS VIA PROTOTYPES
You can specify "simpleBindKeyPath" style bindings via prototypes as well. To bind a property of the prototype to a keyPath of each object in the WFDynamic's ArrayController, simply add a binding to the prototype object, bind it to the same array controller you configured for WFDynamic, set the controller key to "#current#", and set the desired Model Key Path.
WFDYNAMIC AND THE VIEW HIERARCHY OF CREATED WIDGETS WFDynamic creates widgets. However, WFDynamic is a "magic" widget and should be transparent to its parent and the created children. WFDynamic will add its dynamic widgets to the parent WFView object of the WFDynamic, thus creating the widgets as children of that object as if they had been created normally. HOWEVER: At this time, the WFDynamic is still in the view hierarchy as another child of the parent. So, at this point, WFViews that expect children such as WFRadioGroup should skip any WFDynamics they find when processing their children.
PHOCOA Builder Setup:
Required:
Located in /framework/widgets/WFDynamic.php (line 53)
WFObject | --WFView | --WFWidget | --WFDynamic
| Class | Description |
|---|---|
| WFSelectionCheckbox | WFSelectionCheckbox is used to create numerous checkboxes representing a selection of items in an array. |
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::$page
WFView::$parent
Constructor.
To implement our prototype functionality, we need to detect when a child object named "<id>Prototype" has been added.
If a prototype object is detected, we set up the prototype for the WFDynamic.
Get the parent WFView for the WFDynamic.
The WFDynamic is basically used to dynamically add children to the parent of whatever it's under. So for things like WFRadioGroup and WFCheckboxGroup it's important that the parent "Group" widget gets directly assigned all objects created by WFDynamic.
Create the dynamic widgets.
Allows for creation of n widgets based on an WFArrayController. Various options allow you to set up nearly any type of widget that is repeated for all objects in an array. Great for managing selection, editing data from joins, etc.
Once the objects are instantiated, configured, and bound as appropriate, restoreState() will be called. You can be sure that when this function exits that your widgets are in the same state as statically instantiated widgets from the page.
This will be called AFTER the _PageDidLoad method... which is what we need to wait for before creating our widgets. WFPage makes this call.
Module code may need to call this function again, particularly if the content of they arrayController is changed by the current action.
Get the last rendered widget.
Get an array of all of the widgets managed by this WFDynamic instance.
Process the widget config.
The widgetConfig is the options to use for creating the dynamic widgets. Based on various other settings, the widgetConfig may be altered. The alteration process need happen only once per WFDynamic instance. The processing should be delayed until just before creating the widgets.
Set the WFView object to be used as the prototype for all instances created.
Set the config that will be used for the dynamic creation of widgets. See createWidgets for documentation on the config array.
The widgetConfig to use for creation of widgets. Format:
This format lets you arbitrarily configure any property of any type of widget.
For each property, you can choose to use the same 'value' for EVERY widget, or you can use a different value for each widget, the nth item in 'value' for the nth instance.
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::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 Thu, 17 Apr 2008 13:51:41 -0400 by phpDocumentor 1.4.1