AppControl

The root of a control hierarchy on the page.

Remarks

AppControl is an "application" on the page - it acts as the root of a control hierarchy, and owns datasets.

Jitsu HTML source pages typically have a single App control, which is called ID_app0 by default.

AppControl outputs a a <div> element in the compiled page.

The AppControl.init()() static method creates all applications on the page, replacing the <divgt; contents with dynamic content generated by the app.

Properties

ID_animators (inherited from Control)A SitedList of animators.
ID_appBaseUrl
ID_appName
ID_childControls (inherited from ContainerControl)A SitedList of child controls.
ID_controlId (inherited from Control)The ID this control is known in the nearest binding container parent.
ID_data
ID_documentTitle
ID_eventMask (inherited from Control)(Advanced) A comma-separated list of peer events this control should receive.
ID_isBindingContainer (inherited from Control)(Advanced) Force this control to act as a binding container.
ID_isPeerless (inherited from Control)(Advanced) Set this to true to prevent this control from generating a peer element in the rendered HTML.
ID_script
ID_snaps
ID_submitters (inherited from Control)A SitedList of submitters.
ID_tagName (inherited from Control)Overrides the default HTML tag name used for this control.
ID_visible (inherited from Control)True if this control is visible, false if it is hidden.

Events

ID_mouseDown (inherited from Control)Event handler called when a mouse button is pressed down.
ID_mouseMove (inherited from Control)Event handler called when the mouse is moved.
ID_mouseOut (inherited from Control)Event handler called when a leaves a control.
ID_mouseOver (inherited from Control)Event handler called when a mouse moves over a control.
ID_mouseUp (inherited from Control)Event handler called when a mouse button is released.

Methods

acceptsDrop (inherited from Control)Called to determine if this control will accept a drop.
addAppRegisters an App to be created on the page.
addBinding (inherited from Control)Adds a databinding between a property on this object and a binding path.
addBindingEx (inherited from Control)Extended entry point for adding a binding.
addCalculatedBinding (inherited from Control)Adds a calculated binding for a property.
addChild (inherited from ContainerControl)Add a child control to this ContainerControl.
addClassName (inherited from Control)Adds a CSS class to this controls "class" attribute
addEventHandler (inherited from SitedObject)Adds a delegate to be called when the specified eventId occurs on this object.
addInitializerRegisters a delegate to be called after page initialization is complete.
animateEx (inherited from Control)Animates a property to a value.
blur (inherited from Control)Tells this control's peer to relinquish keyboard focus.
bubble (inherited from Control)Bubbles a message up the control hierarchy - calls onBubbleEvent on this control and each of its parents.
captureMouse (inherited from Control)Register a control to receive mouse move/up events
construct (inherited from Control)Used to initialize a markup control.
equals (inherited from SitedObject)Tests if two objects are equal.
fireEventHandler (inherited from SitedObject)Invokes any user event handlers registered for a particular event using SitedObject.addEventHandler().
focus (inherited from Control)Tells this control's peer to request keyboard focus.
getAppGets an AppControl with the specified name.
getBindingContainer (inherited from Control)Gets this object's nearest enclosing binding container.
getBindingStatus (inherited from SitedObject)Provides debugging information on bindings for this object.
getChild (inherited from ContainerControl)Gets the n'th child
getControlGets the control with the specified name.
getControlForElementGets the control whose peer is the specified HTML document element.
getCookieGets a cookie from the document.
getDataSetGets a dataset for an AppControl
getEventMask (inherited from Control)Gets an object indicating which peer events this control is interested in.
getParamReturns a query parameter from the document's url
getParent (inherited from Control)Gets the parent Control of this control.
getPathValue (inherited from SitedObject)Traverses a binding path and returns the value at the end of it.
getPeer (inherited from Control)Gets the peer DOM element associated with this control.
getPeerForParent (inherited from Control)Gets the peer element of this control that the parent control should use in DOM manipulations.
getPropertyInfo (inherited from SitedObject)Gets information on a property.
getResource (inherited from Control)Given the ID of a resource, returns the resource's value.
getSite (inherited from SitedObject)Gets this object's site.
getTagName (inherited from ContainerControl)Gets the HTML tag name this control will use for its peer element.
getValue (inherited from Control)Gets a property, style or attribute.
getViewState (inherited from Control) Retrieve any viewstate that has been saved for this control in a previous session.
getViewStateId (inherited from Control) Get a unique and consistent viewstateId for this control.
initThe main entry point for Jitsu applications
invalidateLayout (inherited from Control)Tells the layout system to redo layout.
modifyDOM (inherited from ContainerControl)Called to manipulate the DOM peer node of this control.
onBubbleEvent (inherited from Control)Called to handle a bubbled event.
onDragEvent (inherited from Control)Called to handle a drag drop event..
onFirstRender (inherited from Control)Called the first time a control is rendered.
onPeerCreated (inherited from Control)Called when a peer is created.
onPeerEvent (inherited from Control)Called to dispatch low level events that arise in the Dom.
onSetValue (inherited from ContainerControl)Called by SitedObject.setValue() when a property value is set on this object.
onSited (inherited from SitedObject)Called when this object is sited.
onSitedRoot (inherited from Control)Called when a control is added to the main control tree.
onUnsited (inherited from SitedObject)Called when this object is about to lose its site.
onUnsitedRoot (inherited from Control)Called when a control is removed from the main control tree.
onValueSited (inherited from ContainerControl)Called when an object is sited within this object.
onValueUnsited (inherited from ContainerControl)Called when an object is about to be unsited in this.
onViewStateChanged (inherited from Control) Overridable. Controls implement this method to update their viewstate.
rebuildInnerHtml (inherited from ContainerControl)Updates this controls innerHTML.
reflectOnBoundValue (inherited from Control)Gets runtime reflection information on an underlying bound object.
removeChild (inherited from ContainerControl)Remove a child control from this ContainerControl.
removeClassName (inherited from Control)Removes a CSS class from this controls "class" attribute
removeEventHandler (inherited from SitedObject)Remove an existing delegate from the list of delegates for the specified event.
render (inherited from Control)Places the Html representation of this control into the htmlBuilder.
renderAttributes (inherited from Control)Called by Control.render() to render attributes for this control.
renderChildren (inherited from ContainerControl)Places the Html markup for all the Control inside this control into the htmlBuilder.
setBounds (inherited from Control)Convenience method to set the left/top/width/height of an element.
setCookieAdds a cookie to the document.
setInitialValues (inherited from SitedObject)Sets multiple property values on an object (during initialization only)
setPathValue (inherited from SitedObject)Traverses a binding path and sets the value at the end of it.
setValue (inherited from Control)Sets a property, style or attribute.
setViewState (inherited from Control) Save viewstate that should persist across sessions.
startAnimator (inherited from Control)Starts an animation.
startDragDrop (inherited from Control)Start a drag drop operation.
stopAnimator (inherited from Control)Stops an animation.
toString (inherited from SitedObject)Returns a string representation of this object.

AppControl addApp static method

Registers an App to be created on the page.

JavaScript

AppControl.addApp(appId,constructorFunction)

Remarks

Call addApp to add a new application to the page. By default, the page compiler generates a single app for the page, in a class called App0.

The function passed to addApp must be the constructor for the app - calling this constructor creates the initial control hierarchy for the app. See AppControl.init() for more details of page initialization.

Example

Here's a typical usage of addApp generated by the page compiler:

function MyApp() {
   ... constructor code for the app
}
AppControl.addApp(ID_MyApp, MyApp);

AppControl addInitializer static method

Registers a delegate to be called after page initialization is complete.

JavaScript

AppControl.addInitializer(delegate)

Remarks

The specified delegate will be called by AppControl.init() once all initialization for the page (creation of datasets, first rendering etc) is complete.

See Also

AppControl getApp static method

Gets an AppControl with the specified name.

JavaScript

var appControl = AppControl.getApp(appName)

Returns

The AppControl instance, or null of no such app name is available.

AppControl getControl method

Gets the control with the specified name.

JavaScript

var aControl = appControl.getControl(controlId)

Remarks

This searches down the control hierarchy for a control whose controlId property matches the specified ID_controlId.

Returns

The control, or null if no control is found.

Example

If you have a control whose controlId="mylist", use:

var listControl = AppControl.getApp("app0").getControl(ID_mylist);

AppControl getControlForElement static method

Gets the control whose peer is the specified HTML document element.

JavaScript

var aControl = AppControl.getControlForElement(element)

Remarks

Use this method to map from an HTML element on the page to the Jitsu control that uses the element as a peer.

Returns

A Control, or null if the element is not a peer of a control.

AppControl getCookie static method

Gets a cookie from the document.

JavaScript

AppControl.getCookie(name)

Remarks

This returns the value of a cookie.

AppControl getDataSet method

Gets a dataset for an AppControl

JavaScript

var dataSet = appControl.getDataSet(propertyId)

Returns

A dataset, or null if the dataset is not found.

Example

If you have created a dataset called 'notes', this retrieves the dataset from a control:

var notes = AppControl.getApp("app0").getDataSet(ID_notes);

AppControl getParam static method

Returns a query parameter from the document's url

JavaScript

AppControl.getParam(name)

Remarks

This parses location.query strings of the form ?x=1&y=2, and returns the value of the named parameter. If the parameter doesn't exist, this returns "".

AppControl ID_appBaseUrl property

JavaScript

var strVal = appControl.getValue(ID_appBaseUrl)
appControl.setValue(ID_appBaseUrl, strVal)

Xml

<j:App appBaseUrl="string"  ... >

AppControl ID_appName property

JavaScript

var strVal = appControl.getValue(ID_appName)
appControl.setValue(ID_appName, strVal)

Xml

<j:App appName="string"  ... >

AppControl ID_data property

JavaScript

var dataSetList = appControl.getValue(ID_data)
appControl.setValue(ID_data, dataSetList)

Xml

<j:App>
<j:data>
<j:DataSet ... />
<j:DataSet ... />
...
<j:/data>
</j:App>

AppControl ID_documentTitle property

JavaScript

var strVal = appControl.getValue(ID_documentTitle)
appControl.setValue(ID_documentTitle, strVal)

Xml

<j:App documentTitle="string"  ... >

AppControl ID_script property

JavaScript

var strVal = appControl.getValue(ID_script)
appControl.setValue(ID_script, strVal)

Xml

<j:App script="string"  ... >

AppControl ID_snaps property

JavaScript

var snapshotList = appControl.getValue(ID_snaps)
appControl.setValue(ID_snaps, snapshotList)

Xml

<j:App>
<j:snapshot ... />
<j:snapshot ... />
...
</j:App>

AppControl init static method

The main entry point for Jitsu applications

JavaScript

AppControl.init()

Remarks

A page containing Jitsu applications must call AppControl.init() to create the application control hierarchies, initialize datasets, and render the controls for the first time.

The page compiler automatically generates an HTML stub page that loads the Jitsu runtime and then calls AppControl.init. A typical page generated by the compiler looks like:

<html xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <script type="text/javascript" src="jitsu.core.js"/>
    <script type="text/javascript" src="jitsu.controls.js"/>
    <script type="text/javascript" src="basic_helloworld.html.js"/>
  </head>
  <body onload="init()">
  </body>
</html>
 

init() first calls AppControl.createInstance() to create a new AppControl instance.

Then, if any dataset creation functions have been registered using AppControl.addInitialDataSet(), these creation functions are called to generate the initial datasets for the page.

Next, the AppControl's Control.render() method is called to generate the Html text for the page.

Finally, any delegates registered using AppControl.addInitializer() are called.

AppControl setCookie static method

Adds a cookie to the document.

JavaScript

AppControl.setCookie(name,value,days)

Remarks

This sets document.cookie to a well formed cookie string, encoding the value as appropriate. Use a value of null to clear a cookie.