Main Page | Packages | Class Tree | Index | Help

xp.data

class XMLDataSource

Object
  |
  +--xp.system.DispatcherObject
        |
        +--xp.data.ItemDataSource
              |
              +--xp.data.DataSource
                    |
                    +--xp.data.ListDataSource
                          |
                          +--xp.data.XMLDataSource


class XMLDataSource
extends ListDataSource

XMLDataSource
Encapsulates an XML document as a dataSource for binding


Event summary for the ListDataSource class
The following table lists events of the ListDataSource class.








EventTypeDescription
xp.events.ModelChangedEventmodelChangedBroadcast when the data model changes.
xp.events.XMLModelChangedEventmodelChangedBroadcast when the data model changes.
xp.events.EventafterLoadedBroadcast after the list has loaded.
xp.events.AddItemEventaddItemBroadcast before an item is added.
xp.events.RemoveItemEventremoveItemBroadcast before an item is removed.
xp.events.NewItemEventnewItemBroadcast when a new item is created.
xp.events.CalcFieldsEventcalcFieldsBroadcast when the calculated fields need refreshing.
xp.events.IteratorScrolledEventiteratorScrolledBroadcast when selectedIndex changes.


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public
autoload: Boolean
Controls whether the XML document is loaded automatically when the source property is set

public static
classInfo: Object
A static class information object

public
rootNode: XMLNode
the root node of the document the parent of the currentItem/items array

Fields inherited from class xp.data.ListDataSource

canSort, classInfo, selectFirstOnLoad

Fields inherited from class xp.data.DataSource

autoCommit, autoEdit, autoInsert, calcFields, classInfo, deltaPacket, itemClassName, logChanges, newDataItem, nodeName, usesManualCommit

Fields inherited from class xp.data.ItemDataSource

classInfo, dataSourceBinding, id, name, readOnly

Fields inherited from class xp.system.DispatcherObject

parent

Property Summary

public
data: Object (read, write)
Get or set the data object encapsulated by this datasource

public
document: XMLNode (read, write)
The XML document encapsulated by this datasource

public
inline: XMLNode (read, write)
sets inline data from Fluid*

public
path: String (read, write)
The xpath into the document that this source will bind to

public
source: String (read, write)
The URL of an XML dcoument to be loaded

Properties inherited from class xp.data.ListDataSource

data, inline, items, length, list, lookupField, position, selectedIndex

Properties inherited from class xp.data.DataSource

currentItem, isEditing, isInserting, isValid, schema

Properties inherited from class xp.data.ItemDataSource

currentItem, data, isEmpty, length

Constructor

public
XMLDataSource ( source: String, path: String, autoload: Boolean)
Constructor

Method Summary

public
getClass ( ): Function
Returns a reference to the components static class

public
getDocumentElement ( ): XMLNode
Returns the document element node of the current document

public
getFieldValue ( index: Number, fieldName: String ): Object
Gets data in a user-editable format - relaxed return type

public
refresh ( ): Void
Refresh the data from its source

public
setFieldValue ( index: Number, fieldName: String, newData: Object ): Void
Edits one field

public
sortItemsOn ( fieldName: String, options: Number ): Void
Sorts the list

Methods inherited from class xp.data.ListDataSource

addDataRelation, addItem, addItemAt, addItemsAt, editField, first, getClass, getFieldValue, getItemAt, getIterator, getKeyValue, isEmpty, isFirst, isLast, last, locateById, lookup, moveBy, next, prior, removeAll, removeItem, removeItemAt, removeItemsAt, replaceItem, replaceItemAt, setFieldValue, setFilter, setKeyConstraint, sortItems, sortItemsOn

Methods inherited from class xp.data.DataSource

applyChanges, applyUpdates, cancelChanges, checkSchema, commitChanges, createItem, deleteItem, editItem, getClass, insertItem, rollbackChanges, toString, validate

Methods inherited from class xp.data.ItemDataSource

addBinding, getBinding, getClass, refresh, updateViews

Methods inherited from class xp.system.DispatcherObject

addEventListener, removeEventListener, routeEvent



Field Documentation

autoload

public var autoload: Boolean
Controls whether the XML document is loaded automatically when the source property is set

classInfo

public static var classInfo: Object
A static class information object

Every class has an associated classInfo object that holds the version and other static information. The classInfo can be accessed either directly by referencing the static class or by calling getClass() on any class instance.

rootNode

public var rootNode: XMLNode
the root node of the document the parent of the currentItem/items array


Property Documentation

data

public data: Object (read, write)
Get or set the data object encapsulated by this datasource

Overrides:

document

public document: XMLNode (read, write)
The XML document encapsulated by this datasource

inline

public inline: XMLNode (read, write)
sets inline data from Fluid*

Overrides:

path

public path: String (read, write)
The xpath into the document that this source will bind to

source

public source: String (read, write)
The URL of an XML dcoument to be loaded


Constructor Documentation

XMLDataSource

public function XMLDataSource(source: String,
 path: String,
 autoload: Boolean)
Constructor

Parameters:
source
The URL of the xml document
path
The xpath representing the location in the docuemnbt to bind to.
autoload
should the document be loaded immediatley when source is set

Method Documentation

getClass

public function getClass(): Function
Returns a reference to the components static class

Overrides:

getDocumentElement

public function getDocumentElement(): XMLNode
Returns the document element node of the current document

The document may be an XML or XMLNode object. If the document is an XML object the root is the first child otherwise if it is an XMLNode it is document itself.

getFieldValue

public function getFieldValue(index: Number,
 fieldName: String): Object
Gets data in a user-editable format - relaxed return type

Overrides:

Parameters:
index
the index of the item
fieldName
the name of the field to edit

refresh

public function refresh(): Void
Refresh the data from its source

If the source property is set this will reload the document, otherwise the xpath is re-executed on the document to refresh the list.

Overrides:

setFieldValue

public function setFieldValue(index: Number,
 fieldName: String,
 newData: Object): Void
Edits one field

Overrides:

Parameters:
index
the index of the item
fieldName
the name of the field to edit
newData
the new data for the field

sortItemsOn

public function sortItemsOn(fieldName: String,
 options: Number): Void
Sorts the list

Overrides:

Parameters:
fieldName
The name of the field to sort on
options
sort options see Array.sort

The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc