kopia lustrzana https://github.com/c9/core
remove many things
rodzic
2770dde453
commit
375decdae3
|
@ -1,10 +1,4 @@
|
||||||
<a:application xmlns:a="http://ajax.org/2005/aml">
|
<a:application xmlns:a="http://ajax.org/2005/aml">
|
||||||
<a:appsettings name="ide" debug="false"
|
|
||||||
disable-space = "true"
|
|
||||||
allow-select = "false"
|
|
||||||
allow-blur = "true"
|
|
||||||
initdelay = "false"/>
|
|
||||||
|
|
||||||
<a:vsplitbox id="root" anchors="0 0 0 0">
|
<a:vsplitbox id="root" anchors="0 0 0 0">
|
||||||
<a:bar id="barQuestion" height="0" visible="false">
|
<a:bar id="barQuestion" height="0" visible="false">
|
||||||
</a:bar>
|
</a:bar>
|
||||||
|
|
|
@ -94,7 +94,6 @@ define(function(require, exports, module) {
|
||||||
if (e.node.tagName == "variable") {
|
if (e.node.tagName == "variable") {
|
||||||
if (!e.node.children) return e.expand();
|
if (!e.node.children) return e.expand();
|
||||||
|
|
||||||
//<a:insert match="[item[@children='true']]" get="{adbg.loadObject(dbg, %[.])}" />
|
|
||||||
dbg.getProperties(e.node, function(err, properties) {
|
dbg.getProperties(e.node, function(err, properties) {
|
||||||
if (err) return console.error(err);
|
if (err) return console.error(err);
|
||||||
|
|
||||||
|
|
|
@ -54,327 +54,6 @@ apf.aml.setElement("model", apf.model);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apf.__DATABINDING__ = 1 << 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a baseclass that adds data binding features to this element.
|
|
||||||
* Databinding takes care of automatically going from data to representation and establishing a
|
|
||||||
* permanent link between the two. In this way data that is changed will
|
|
||||||
* change the representation as well. Furthermore, actions that are executed on
|
|
||||||
* the representation will change the underlying data.
|
|
||||||
*
|
|
||||||
* #### Example
|
|
||||||
*
|
|
||||||
* ```xml
|
|
||||||
* <a:list>
|
|
||||||
* <a:model>
|
|
||||||
* <data>
|
|
||||||
* <item icon="ajax_org.gif">Item 1</item>
|
|
||||||
* <item icon="ajax_org.gif">Item 2</item>
|
|
||||||
* </data>
|
|
||||||
* </a:model>
|
|
||||||
* <a:bindings>
|
|
||||||
* <a:icon match="[@icon]" />
|
|
||||||
* <a:caption match="[text()]" />
|
|
||||||
* <a:each match="[item]" />
|
|
||||||
* </a:bindings>
|
|
||||||
* </a:list>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @class apf.DataBinding
|
|
||||||
* @inherits apf.Presentation
|
|
||||||
* @baseclass
|
|
||||||
* @author Ruben Daniels (ruben AT ajax DOT org)
|
|
||||||
* @version %I%, %G%
|
|
||||||
* @since 0.4
|
|
||||||
* @default_private
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @event error Fires when a communication error has occured while
|
|
||||||
* making a request for this element.
|
|
||||||
* @cancelable Prevents the error from being thrown.
|
|
||||||
* @bubbles
|
|
||||||
* @param {Object} e The standard event object. It contains the following properties:
|
|
||||||
* - error ([[Error]]): the error object that is thrown when the event callback doesn't return false.
|
|
||||||
* - state ([[Number]]): the state of the call
|
|
||||||
* - `apf.SUCCESS`: The request was successfull
|
|
||||||
* - `apf.TIMEOUT`: The request has timed out.
|
|
||||||
* - `apf.ERROR `: An error has occurred while making the request.
|
|
||||||
* - `apf.OFFLINE`: The request was made while the application was offline.
|
|
||||||
* - userdata (`Mixed`): Data that the caller wanted to be available in the callback of the http request.
|
|
||||||
* - http ([[XMLHttpRequest]]): The object that executed the actual http request.
|
|
||||||
* - url ([[String]]): The url that was requested.
|
|
||||||
* - tpModule ([[apf.http]]): The teleport module that is making the request.
|
|
||||||
* - id ([[Number]]): The ID of the request.
|
|
||||||
* - message ([[String]]): The error message.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @event beforeretrieve Fires before a request is made to retrieve data.
|
|
||||||
* @cancelable Prevents the data from being retrieved.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @event afterretrieve Fires when the request to retrieve data returns both
|
|
||||||
* on success and failure.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @event receive Fires when data is successfully retrieved
|
|
||||||
* @param {Object} e The standard event object. It contains the following properties:
|
|
||||||
* - data ([[String]]): the retrieved data
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
apf.DataBinding = function() {
|
|
||||||
this.$init(true);
|
|
||||||
|
|
||||||
this.$loadqueue =
|
|
||||||
this.$dbTimer = null;
|
|
||||||
this.$regbase = this.$regbase | apf.__DATABINDING__;
|
|
||||||
this.$mainBind = "value";
|
|
||||||
|
|
||||||
this.$bindings =
|
|
||||||
this.$cbindings =
|
|
||||||
this.$attrBindings = false;
|
|
||||||
|
|
||||||
//1 = force no bind rule, 2 = force bind rule
|
|
||||||
this.$attrExcludePropBind = apf.extend({
|
|
||||||
model: 1,
|
|
||||||
each: 1
|
|
||||||
//eachvalue : 1 //disabled because of line 1743 valueRule = in multiselect.js
|
|
||||||
}, this.$attrExcludePropBind);
|
|
||||||
|
|
||||||
// *** Public Methods *** //
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a value of an XMLNode based on an xpath statement executed on the data of this model.
|
|
||||||
*
|
|
||||||
* @param {String} xpath The xpath used to select a XMLNode
|
|
||||||
* @param {String} value The value to set
|
|
||||||
* @return {XMLNode} The changed XMLNode
|
|
||||||
*/
|
|
||||||
this.setQueryValue = function(xpath, value, type) {
|
|
||||||
var node = apf.createNodeFromXpath(this[type || 'xmlRoot'], xpath);
|
|
||||||
if (!node)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
apf.setNodeValue(node, value, true);
|
|
||||||
//apf.xmldb.setTextNode(node, value);
|
|
||||||
return node;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Queries the bound data for a string value
|
|
||||||
*
|
|
||||||
* @param {String} xpath The XPath statement which queries on the data this element is bound on.
|
|
||||||
* @param {String} type The node that is used as the context node for the query. It can be one of the following possible values:
|
|
||||||
* - `"selected"`: The selected data anode of this element.
|
|
||||||
* - `"xmlRoot"`: The root data node that this element is bound on.
|
|
||||||
* - `"indicator"`: The data node that is highlighted for keyboard navigation.
|
|
||||||
* @return {String} The value of the selected XML Node
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
this.queryValue = function(xpath, type) {
|
|
||||||
/* @todo
|
|
||||||
* lstRev.query('revision/text()', 'selected');
|
|
||||||
* lstRev.query('revision/text()', 'xmlRoot');
|
|
||||||
* lstRev.query('revision/text()', 'indicator');
|
|
||||||
*/
|
|
||||||
return apf.queryValue(this[type || 'xmlRoot'], xpath);
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Queries the bound data for an array of string values
|
|
||||||
*
|
|
||||||
* @param {String} xpath The XPath statement which queries on the data this element is bound on.
|
|
||||||
* @param {String} type The node that is used as the context node for the query. It can be one of the following possible values:
|
|
||||||
* - `"selected"`: The selected data anode of this element.
|
|
||||||
* - `"xmlRoot"`: The root data node that this element is bound on.
|
|
||||||
* - `"indicator"`: The data node that is highlighted for keyboard navigation.
|
|
||||||
* @return {String} The value of the selected XML Node
|
|
||||||
*/
|
|
||||||
this.queryValues = function(xpath, type) {
|
|
||||||
return apf.queryValues(this[type || 'xmlRoot'], xpath);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes an XPath statement on the data of this model
|
|
||||||
*
|
|
||||||
* @param {String} xpath The XPath statement which queries on the data this element is bound on.
|
|
||||||
* @param {String} type The node that is used as the context node for the query. It can be one of the following possible values:
|
|
||||||
* - `"selected"`: The selected data anode of this element.
|
|
||||||
* - `"xmlRoot"`: The root data node that this element is bound on.
|
|
||||||
* - `"indicator"`: The data node that is highlighted for keyboard navigation.
|
|
||||||
* @return {Mixed} An [[XMLNode]] or [[NodeList]] with the result of the selection
|
|
||||||
*/
|
|
||||||
this.queryNode = function(xpath, type) {
|
|
||||||
var n = this[type || 'xmlRoot'];
|
|
||||||
return n ? n.selectSingleNode(xpath) : null;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes an XPath statement on the data of this model
|
|
||||||
*
|
|
||||||
* @param {String} xpath The XPath used to select the XMLNode(s)
|
|
||||||
* @param {String} type The node that is used as the context node for the query. It can be one of the following possible values:
|
|
||||||
* - `"selected"`: The selected data anode of this element.
|
|
||||||
* - `"xmlRoot"`: The root data node that this element is bound on.
|
|
||||||
* - `"indicator"`: The data node that is highlighted for keyboard navigation.
|
|
||||||
* @return {Mixed} An [[XMLNode]] or [[NodeList]] with the result of the selection
|
|
||||||
*/
|
|
||||||
this.queryNodes = function(xpath, type) {
|
|
||||||
debugger
|
|
||||||
var n = this[type || 'xmlRoot'];
|
|
||||||
return n ? n.selectNodes(xpath) : [];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @attribute {String} model Sets or gets the name of the model to load data from, or a
|
|
||||||
* datainstruction to load data.
|
|
||||||
*
|
|
||||||
* #### Example
|
|
||||||
*
|
|
||||||
* ```xml
|
|
||||||
* <a:model id="mdlExample" src="filesystem.xml" />
|
|
||||||
* <a:tree
|
|
||||||
* height = "200"
|
|
||||||
* width = "250"
|
|
||||||
* model = "mdlExample">
|
|
||||||
* <a:each match="[folder|drive]">
|
|
||||||
* <a:caption match="[@caption]" />
|
|
||||||
* <a:icon value="Famfolder.gif" />
|
|
||||||
* </a:each>
|
|
||||||
* </a:tree>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* #### Example
|
|
||||||
*
|
|
||||||
* Here's an example loading from an XML source:
|
|
||||||
*
|
|
||||||
* ```xml
|
|
||||||
* <a:tree
|
|
||||||
* height = "200"
|
|
||||||
* width = "250"
|
|
||||||
* model = "filesystem.xml">
|
|
||||||
* <a:each match="[folder|drive]">
|
|
||||||
* <a:caption match="[@caption]" />
|
|
||||||
* <a:icon value="Famfolder.gif" />
|
|
||||||
* </a:each>
|
|
||||||
* </a:tree>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* #### Example
|
|
||||||
*
|
|
||||||
* ```xml
|
|
||||||
* <a:tree
|
|
||||||
* id = "tree"
|
|
||||||
* height = "200"
|
|
||||||
* width = "250"
|
|
||||||
* model = "filesystem.xml">
|
|
||||||
* <a:each match="[folder|drive]">
|
|
||||||
* <a:caption match="[@caption]" />
|
|
||||||
* <a:icon value="Famfolder.gif" />
|
|
||||||
* </a:each>
|
|
||||||
* </a:tree>
|
|
||||||
* <a:text
|
|
||||||
* model = "{tree.selected}"
|
|
||||||
* value = "[@caption]"
|
|
||||||
* width = "250"
|
|
||||||
* height = "100" />
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* #### Example
|
|
||||||
*
|
|
||||||
* This example shows a dropdown from which the user can select a country.
|
|
||||||
* The list of countries is loaded from a model. Usually this would be loaded
|
|
||||||
* from a separate url, but for clarity it's inlined. When the user selects
|
|
||||||
* a country in the dropdown the value of the item is stored in the second
|
|
||||||
* model (mdlForm) at the position specified by the ref attribute. In this
|
|
||||||
* case this is the country element.
|
|
||||||
*
|
|
||||||
* ```xml
|
|
||||||
* <a:label>Name</a:label>
|
|
||||||
* <a:textbox value="[name]" model="mdlForm" />
|
|
||||||
*
|
|
||||||
* <a:label>Country</a:label>
|
|
||||||
* <a:dropdown
|
|
||||||
* value = "[mdlForm::country]"
|
|
||||||
* each = "[mdlCountries::country]"
|
|
||||||
* caption = "[text()]">
|
|
||||||
* </a:dropdown>
|
|
||||||
*
|
|
||||||
* <a:model id="mdlCountries">
|
|
||||||
* <countries>
|
|
||||||
* <country value="USA">USA</country>
|
|
||||||
* <country value="GB">Great Britain</country>
|
|
||||||
* <country value="NL">The Netherlands</country>
|
|
||||||
* </countries>
|
|
||||||
* </a:model>
|
|
||||||
*
|
|
||||||
* <a:model id="mdlForm">
|
|
||||||
* <data>
|
|
||||||
* <name />
|
|
||||||
* <country />
|
|
||||||
* </data>
|
|
||||||
* </a:model>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* #### Remarks
|
|
||||||
*
|
|
||||||
* This attribute is inherited from a parent when not set. You can use this
|
|
||||||
* to tell sets of elements to use the same model.
|
|
||||||
*
|
|
||||||
* ```xml
|
|
||||||
* <a:bar model="mdlForm">
|
|
||||||
* <a:label>Name</a:label>
|
|
||||||
* <a:textbox value="[name]" />
|
|
||||||
*
|
|
||||||
* <a:label>Happiness</a:label>
|
|
||||||
* <a:slider value="[happiness]" min="0" max="10" />
|
|
||||||
* </a:bar>
|
|
||||||
*
|
|
||||||
* <a:model id="mdlForm">
|
|
||||||
* <data />
|
|
||||||
* </a:model>
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* When no model is specified the default model is chosen. The default
|
|
||||||
* model is the first model that is found without a name, or if all models
|
|
||||||
* have a name, the first model found.
|
|
||||||
*
|
|
||||||
* @see apf.DataBinding.model
|
|
||||||
*/
|
|
||||||
this.$propHandlers["model"] = function(value) {
|
|
||||||
this.model = value;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @attribute {String} viewport Sets or gets the way this element renders its data.
|
|
||||||
*
|
|
||||||
* The possible values include:
|
|
||||||
* - `"virtual"`: this element only renders data that it needs to display.
|
|
||||||
* - `"normal`"`: this element renders all data at startup.
|
|
||||||
* @experimental
|
|
||||||
*/
|
|
||||||
this.$propHandlers["viewport"] = function(value) {
|
|
||||||
debugger
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
apf.DataBinding.prototype = new apf[apf.Presentation ? "Presentation" : "AmlElement"]();
|
|
||||||
|
|
||||||
|
|
||||||
apf.config.$inheritProperties["model"] = 1;
|
|
||||||
apf.config.$inheritProperties["empty-message"] = 1;
|
|
||||||
apf.config.$inheritProperties["loading-message"] = 1;
|
|
||||||
apf.config.$inheritProperties["offline-message"] = 1;
|
|
||||||
apf.config.$inheritProperties["noloading"] = 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The baseclass for all standard data binding rules.
|
* The baseclass for all standard data binding rules.
|
||||||
|
@ -384,21 +63,7 @@ apf.config.$inheritProperties["noloading"] = 1;
|
||||||
* @baseclass
|
* @baseclass
|
||||||
* @inherits apf.DataBinding
|
* @inherits apf.DataBinding
|
||||||
*/
|
*/
|
||||||
apf.StandardBinding = function() {
|
apf.StandardBinding = apf.Presentation;
|
||||||
this.$init(true);
|
|
||||||
|
|
||||||
|
|
||||||
if (apf.Validation)
|
|
||||||
this.implement(apf.Validation);
|
|
||||||
|
|
||||||
|
|
||||||
if (!this.setQueryValue)
|
|
||||||
this.implement(apf.DataBinding);
|
|
||||||
|
|
||||||
if (!this.defaultValue) //@todo please use this in a sentence
|
|
||||||
this.defaultValue = "";
|
|
||||||
};
|
|
||||||
apf.StandardBinding.prototype = new apf.DataBinding();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -702,7 +367,6 @@ apf.BaseList = function() {
|
||||||
this.$mode = this.multicheck ? 1 : 2;
|
this.$mode = this.multicheck ? 1 : 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//@todo undo actionRules setting
|
|
||||||
this.removeEventListener("afterrename", $afterRenameMode);
|
this.removeEventListener("afterrename", $afterRenameMode);
|
||||||
//@todo unimplement??
|
//@todo unimplement??
|
||||||
this.$mode = 0;
|
this.$mode = 0;
|
||||||
|
|
|
@ -1147,11 +1147,6 @@ apf.item = function(struct, tagName) {
|
||||||
|
|
||||||
// *** Properties and Attributes *** //
|
// *** Properties and Attributes *** //
|
||||||
|
|
||||||
//1 = force no bind rule, 2 = force bind rule
|
|
||||||
this.$attrExcludePropBind = apf.extend({
|
|
||||||
"match": 1
|
|
||||||
}, this.$attrExcludePropBind);
|
|
||||||
|
|
||||||
this.$booleanProperties["checked"] = true;
|
this.$booleanProperties["checked"] = true;
|
||||||
this.$booleanProperties["selected"] = true;
|
this.$booleanProperties["selected"] = true;
|
||||||
|
|
||||||
|
|
Plik diff jest za duży
Load Diff
|
@ -774,11 +774,6 @@ define(function(require, module, exports) {
|
||||||
*/
|
*/
|
||||||
isFalse: apf.isFalse,
|
isFalse: apf.isFalse,
|
||||||
|
|
||||||
/**
|
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
xmldb: apf.xmldb,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
|
Ładowanie…
Reference in New Issue