Project Outline
applyUid(data)
addItem(data)
getObject(itemRender)
setData(data, ignoreEvent, ignoreDom)
dataSetBind(, bind)
addControl(, true)
triggerEvent(name, data)
setState(name, value)
getState(name)
setAttribute(key, value)
setStyle(style)
addCss(css)
setCss(css)
switchCssClass(oldClass, newClass)
hasCssClass(search)
setVisible(v, speed, type, callback)
setEnabled(e, recursive)
getHtml(markAsRendered)
setId(id)
render(control)
setPage(page)
setParent(parent)
bind(name, func, data)
hasBind(name, func)
unbind(name, func)
alterData(key, Boolean)
toggleCheckStateFrom(index, datasource, checkbox)
openNode(index, datasource)
closeNode(index, datasource)
setData(data)
toLogger(messsage)
setItemRenderByIndex(index, render, dontCreate, ignoreDataItemRenderMap)
setNodeData(nodeData)
setNodeDataByData(data, source)
createNodeInfo(datasource, parentIndex, func)
addItem(item)
addDataSource(source, targetItems, instant)
nodeClicked(int, true)
removeToggleControl(index, rerender)
createLoadMoreButton(index, limit, nodeData)
selectIndex(index, preventEvent)
selectAllFromIndex(index, datasource)
applyUid(data)
getObject(itemRender)
dataSetBind(, bind)
addControl(, true)
triggerEvent(name, data)
setState(name, value)
getState(name)
setAttribute(key, value)
setStyle(style)
addCss(css)
setCss(css)
switchCssClass(oldClass, newClass)
hasCssClass(search)
setVisible(v, speed, type, callback)
setEnabled(e, recursive)
getHtml(markAsRendered)
setId(id)
render(control)
setPage(page)
setParent(parent)
bind(name, func, data)
hasBind(name, func)
unbind(name, func)
addItem(data, render)
setItemRenderByIndex(index, render, dontCreate, ignoreDataItemRenderMap)
setItemRenderByIndices(indices, renderFactory)
hasItemRenderAt(index, itemRender)
applyUid(data)
getObject(itemRender)
setData(data, ignoreEvent, ignoreDom)
dataSetBind(, bind)
addControl(, true)
triggerEvent(name, data)
setState(name, value)
getState(name)
setAttribute(key, value)
setStyle(style)
addCss(css)
setCss(css)
switchCssClass(oldClass, newClass)
hasCssClass(search)
setVisible(v, speed, type, callback)
setEnabled(e, recursive)
getHtml(markAsRendered)
setId(id)
render(control)
setPage(page)
setParent(parent)
bind(name, func, data)
hasBind(name, func)
unbind(name, func)
addItem(data, when)
addItems(items)
addItemAt(item, index, render, preventRender)
addItemsAt(item, index, render)
setItemRenderByIndex(index, render, dontCreate, ignoreDataItemRenderMap)
setItemRenderByIndices(indices, renderFactory)
setItemRender(itemRender)
hasItemRenderAt(int, itemRender)
applyUid(data)
getObject(itemRender)
setData(data, ignoreEvent, ignoreDom)
dataSetBind(, bind)
addControl(, true)
triggerEvent(name, data)
setState(name, value)
getState(name)
setAttribute(key, value)
setStyle(style)
addCss(css)
setCss(css)
switchCssClass(oldClass, newClass)
hasCssClass(search)
setVisible(v, speed, type, callback)
setEnabled(e, recursive)
getHtml(markAsRendered)
setId(id)
render(control)
setPage(page)
setParent(parent)
bind(name, func, data)
hasBind(name, func)
unbind(name, func)
toLogger(messsage)
setItemRenderByIndex(index, render, dontCreate, ignoreDataItemRenderMap)
setNodeData(nodeData)
setNodeDataByData(data, source)
createNodeInfo(datasource, parentIndex, func)
addItem(item)
addDataSource(source, targetItems, instant)
openNode(index, datasource)
closeNode(index, datasource)
nodeClicked(int, true)
removeToggleControl(index, rerender)
createLoadMoreButton(index, limit, nodeData)
selectIndex(index, preventEvent)
selectAllFromIndex(index, datasource)
applyUid(data)
getObject(itemRender)
setData(data, ignoreEvent, ignoreDom)
dataSetBind(, bind)
addControl(, true)
triggerEvent(name, data)
setState(name, value)
getState(name)
setAttribute(key, value)
setStyle(style)
addCss(css)
setCss(css)
switchCssClass(oldClass, newClass)
hasCssClass(search)
setVisible(v, speed, type, callback)
setEnabled(e, recursive)
getHtml(markAsRendered)
setId(id)
render(control)
setPage(page)
setParent(parent)
bind(name, func, data)
hasBind(name, func)
unbind(name, func)
setData(data, ignoreEvent, ignoreDom)
setR(value)
setG(value)
setB(value)
setH(value)
setS(value)
setV(value)
setValue(either)
render(data, target)
replace(data, target)
renderHtml(data, target, dontAppend)
clear(control)
remove(control)
setData(value, control)
setTextData(value, control)
setCheckBoxData(value, control)
getData(control)
setLevel(String, Boolean)
showTimes(Boolean)
addErrorData(data, page)
write(String, type)
debug(String)
notice(String)
warning(String)
error(String)
route(String)
«
Framework jProton

Class Banana.Control

Defined in: Control.js.

Constructor Summary
new Banana.Control () Base control class for component controls in Banana.
Method Summary
createComponents() This method is called by the page during creation of the control.
updateDisplay() The method is called by the page after the dom element is rendered.
onPreInvalidateContents() called after invalidating control with invalidateDisplay method
unload() called just before destroying object Use this method to manualy destroy other objects i.e to prevent memory leaks
onWindowResize() called on every display size change
setId(id) sets internal id
getId()
setClientId(string) sets client id used for reference to dom node
generateUniqueId() generated unique id used for dom elements
render(control) forces control to be rendered.
setPage(page) sets reference to the page control
getProxy(fn) This method is most useful for attaching event handlers to an element where the context is pointing back to a different object.
setParent(parent) Sets reference to parent control.
addControl(String) Adds a plaintext or a control to the control hierargy.
findControl(id) Recursively finds control
remove() If control is part of a collection belonging to a page it has a page defined.
clear() removes all child controls in this control
invalidateDisplay() invalidates display.
triggerEvent(name, params) Triggers an event so all listeners are getting notified.
bind(name, func, data) Binds an eventname to a method There are 2 types of events: Dom events: Events mostly fired from user actions like mouse click, keyup etc.
hasBind(name, func) Check wether a bind to a specific function in a control exists
unbind(name, func) Unbinds an eventname If funcion is given we unbind only when the bind matches the given function.
getHtml(markAsRendered) returns html string of all child controls Note that Banana.Control type classes on it self won't get rendered.
getFirstUiControl() fetches the first parent control which is an instance of Banana.UiControl
Constructor Detail
new Banana.Control()
Base control class for component controls in Banana. Provides needed methods to function well in the Banana Hierarchy. This control is suitable to use in your render hierarchy. Note that this control won't be rendered. Possible child controls can have visually different parent controls than the internal control collection would suggest.

									
									
									
										
										
										
										
										
										
										
					
								
Method Detail
createComponents()
This method is called by the page during creation of the control. This is the place to define your control hierarchy. Unlike the constructor (init) you have also access to properties 1. this.page - Reference to the page control 2. this.parent - Reference to the parent control 3. this.id - internal id 4. this.clientId - client id of the dom node Except for these properties there is no difference. It doesn't really matters if you create child controls in the init or in the createComponents methods. Only if you need access to the parent or page control. Or when you need to know what the id or client is. You will find out that in most cases createComponents is the right place to do things. Note: that createComponents is called only once. Rerendering doesn't result into a call to createComponents Another important note is that both init and createComponents methods are executed before even one thing is rendered on your screen.The clientId is already known, but you cannot access the dom node. To get access to the dom you need the updateDisplay() method.

										
									
updateDisplay()
The method is called by the page after the dom element is rendered. If you want to add controls to the collection don't forget to invalidate by calling invalidateDisplay()

										
									
onPreInvalidateContents()
called after invalidating control with invalidateDisplay method

										
									
unload()
called just before destroying object Use this method to manualy destroy other objects i.e to prevent memory leaks

										
									
onWindowResize()
called on every display size change

										
									
applyToChildren(fn)

										
									
Parameters:
{Function} fn function to apply to all children in control collection
setId(id) : this
sets internal id

										
									
Parameters:
{String} id of control
Returns:
{this}
getId() : String

										
									
Returns:
{String} id of control
setClientId(string)
sets client id used for reference to dom node

										
									
Parameters:
string
getClientId() : String

										
									
Returns:
{String}
generateUniqueId()
generated unique id used for dom elements

										
									
render(control)
forces control to be rendered. Only this function to bypass the page logic i.e you want to render a control which is not part of a control hierarchy

										
									
Parameters:
{Banana.Control} control
setPage(page)
sets reference to the page control

										
									
Parameters:
{Banana.Page} page
getPage() : Banana.Page

										
									
Returns:
{Banana.Page}
getProxy(fn) : Function
This method is most useful for attaching event handlers to an element where the context is pointing back to a different object.

										
									
Parameters:
fn
Returns:
{Function} fn
setParent(parent)
Sets reference to parent control. This method is automatically invoked during page construction

										
									
Parameters:
{Banana.Control} parent
getParent() : Banana.Control

										
									
Returns:
{Banana.Control} parent control
addControl(String)
Adds a plaintext or a control to the control hierargy. Adding control after render requires call to invalidateDisplay in order to get the new control rendered visible

										
									
Parameters:
{mixed} String or Banana.Control
getControls() : Array

										
									
Returns:
{Array} of collection of mixed types
findControl(id)
Recursively finds control

										
									
Parameters:
{String} id of the control
Returns:
Banana.Control
remove()
If control is part of a collection belonging to a page it has a page defined. we let the page handle the removement of the control. If it is a standalone control, we just unregister the events TODO: should maybe also remove dom in the situation where control is not part of a collection

										
									
clear()
removes all child controls in this control

										
									
invalidateDisplay()
invalidates display. triggers the page to re-render node tree beginning from this control.

										
									
triggerEvent(name, params)
Triggers an event so all listeners are getting notified. To start listening use the bind method. example: someControl.bind('test',function(){}); To Trigger an event. example someControl.triggerEvent('test',{data:'foo'});

										
									
Parameters:
{String} name of the event
params
getDomEventTypes() : Array

										
									
Returns:
{Array} of dom event types compatible with jquery
bind(name, func, data) : this
Binds an eventname to a method There are 2 types of events: Dom events: Events mostly fired from user actions like mouse click, keyup etc. Custom events: These events are manually triggered by Banana components. Important is that dom events are available after the control is rendered. Custom events are registered instantly and available at all time.

										
									
Parameters:
{String} name of the event
{Function} func callback function
{mixed} data userdata
Returns:
{this} ;
hasBind(name, func) : boolean
Check wether a bind to a specific function in a control exists

										
									
Parameters:
{String} name of event
{Function} func
Returns:
{boolean}
unbind(name, func)
Unbinds an eventname If funcion is given we unbind only when the bind matches the given function. Otherwise we unbind all binds with the specified name regardless how many.

										
									
Parameters:
{String} name of event
{Function} func optionaly
getHtml(markAsRendered) : String
returns html string of all child controls Note that Banana.Control type classes on it self won't get rendered. note Banana.control itself wont be rendered, but it chould contain child controls which are from Banana.UiControl type

										
									
Parameters:
{boolean} markAsRendered
Returns:
{String}
getFirstUiControl() : Banana.Control
fetches the first parent control which is an instance of Banana.UiControl

										
									
Returns:
{Banana.Control}
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 05 2012 21:57:47 GMT+0100 (CET)