⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 application.js

📁 一个ajax富客户端的ajax类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
        for (var i = 0; i < this._addedChildIds.length; ++i) {            components[i] = this._manager._idMap[this._addedChildIds[i]];        }        return components;    },        /**     * Returns an array containing the children removed in this update,     * or null if none were removed.     *      * @return the removed children     * @type Array     */    getRemovedChildren: function() {        if (!this._removedChildIds) {            return null;        }        var components = new Array(this._removedChildIds.length);        for (var i = 0; i < this._removedChildIds.length; ++i) {            components[i] = this._manager._removedIdMap[this._removedChildIds[i]];        }        return components;    },        /**     * Returns an array containing the descendants of any children removed in     * this update, or null if none were removed.  The removed children     * themselves are not returned by this method.     *      * @return the removed descendants     * @type Array     */    getRemovedDescendants: function() {        if (!this._removedDescendantIds) {            return null;        }        var components = new Array(this._removedDescendantIds.length);        for (var i = 0; i < this._removedDescendantIds.length; ++i) {            components[i] = this._manager._removedIdMap[this._removedDescendantIds[i]];        }        return components;    },        /**     * Returns an array containing the children of this component whose     * LayoutDatas have changed in this update, or null if no such     * changes were made.     *      * @return the updated layout data children     * @type Array     */    getUpdatedLayoutDataChildren: function() {        if (!this._updatedLayoutDataChildIds) {            return null;        }        var components = new Array(this._updatedLayoutDataChildIds.length);        for (var i = 0; i < this._updatedLayoutDataChildIds.length; ++i) {            components[i] = this._manager._idMap[this._updatedLayoutDataChildIds[i]];        }        return components;    },        /**     * Determines if any children were added during this update.     *      * @return true if any children were added     * @type Boolean     */    hasAddedChildren: function() {        return this._addedChildIds != null;    },        /**     * Determines if any children were removed during this update.     *      * @return true if any children were removed     * @type Boolean     */    hasRemovedChildren: function() {        return this._removedChildIds != null;    },        /**     * Determines if any children had their LayoutData changed during this update.     *      * @return true if any children had their LayoutData changed     * @type Boolean     */    hasUpdatedLayoutDataChildren: function() {        return this._updatedLayoutDataChildIds != null;    },        /**     * Determines if this update has any changed properties.     *      * @return true if properties are being updated     * @type Boolean     */    hasUpdatedProperties: function() {        return this._propertyUpdates != null;    },        /**     * Returns a <code>PropertyUpdate</code> describing an update to the     * property with the given <code>name</code>.     *      * @param name the name of the property being updated     * @return the <code>PropertyUpdate</code>, or null if none exists     */    getUpdatedProperty: function(name) {        if (this._propertyUpdates == null) {            return null;        }        return this._propertyUpdates[name];    },        /**     * Returns the names of all properties being updated in this update.     *      * @return the names of all updated properties, if no properties are updated an     *         empty array is returned     * @type Array     */    getUpdatedPropertyNames: function() {        if (this._propertyUpdates == null) {            return [];        }        var updatedPropertyNames = [];        for (var i in this._propertyUpdates) {            updatedPropertyNames.push(i);        }        return updatedPropertyNames;    },    /**     * Determines if the set of updated property names is contained     * within the specified set.  The provided object should have     * have keys for the desired property names and  values that evaluate      * to true, e.g. to determine if no properties other than "text" and "icon"     * changed, specify {text: true, icon: true}.      */    isUpdatedPropertySetIn: function(updatedPropertySet) {        for (var x in this._propertyUpdates) {            if (!updatedPropertySet[x]) {                return false;            }        }        return true;    },        /**     * Records the removal of a child from the parent component.     *      * @param {EchoApp.Component} child the removed child     * @private     */    _removeChild: function(child) {        this._manager._removedIdMap[child.renderId] = child;            if (this._addedChildIds) {            // Remove child from add list if found.            Core.Arrays.remove(this._addedChildIds, child.renderId);        }                if (this._updatedLayoutDataChildIds) {            // Remove child from updated layout data list if found.            Core.Arrays.remove(this._updatedLayoutDataChildIds, child.renderId);        }            if (!this._removedChildIds) {            this._removedChildIds = [];        }                this._removedChildIds.push(child.renderId);            for (var i = 0; i < child.children.length; ++i) {            this._removeDescendant(child.children[i]);        }    },        /**     * Records the removal of a descendant of the parent component.     * All children of a removed compoennt are recorded as removed     * descendants when the child is removed.     * This method will recursively invoke itself on children of     * the specified descendant.     *      * @private     * @param {EchoApp.Component} descendant the removed descendant      */    _removeDescendant: function(descendant) {        this._manager._removedIdMap[descendant.renderId] = descendant;        if (!this._removedDescendantIds) {            this._removedDescendantIds = [];        }        this._removedDescendantIds.push(descendant.renderId);        for (var i = 0; i < descendant.children.length; ++i) {            this._removeDescendant(descendant.children[i]);        }    },        /**     * Returns a string representation.     *      * @return a string representation     * @type String     */    toString: function() {        var s = "ComponentUpdate\n";        s += "- Parent: " + this.parent + "\n";        s += "- Adds: " + this._addedChildIds + "\n";        s += "- Removes: " + this._removedChildIds + "\n";        s += "- DescendantRemoves: " + this._removedDescendantIds + "\n";        s += "- Properties: " + this._propertyUpdates + "\n";        s += "- LayoutDatas: " + this._updatedLayoutDataChildIds + "\n";        return s;    },        /**     * Records the update of the LayoutData of a child component.     *      * @param the child component whose layout data was updated     * @private     */    _updateLayoutData: function(child) {        this._manager._idMap[child.renderId] = child;        if (this._updatedLayoutDataChildIds == null) {            this._updatedLayoutDataChildIds = [];        }        this._updatedLayoutDataChildIds.push(child.renderId);    },        /**     * Records the update of a property of the parent component.     *      * @param propertyName the name of the property     * @param oldValue the previous value of the property     * @param newValue the new value of the property     * @private     */   _updateProperty: function(propertyName, oldValue, newValue) {        if (this._propertyUpdates == null) {            this._propertyUpdates = { };        }        var propertyUpdate = new EchoApp.Update.ComponentUpdate.PropertyUpdate(oldValue, newValue);        this._propertyUpdates[propertyName] = propertyUpdate;    }});/** * @class Monitors and records updates made to the application between repaints. *        Provides API to determine changes to component hierarchy since last update *        in order to efficiently repaint the screen. */EchoApp.Update.Manager = Core.extend({        /**     * Associative mapping between component ids and EchoApp.Update.ComponentUpdate     * instances.     * @type Object     */    _componentUpdateMap: null,        /**     * Flag indicating whether a full refresh or incremental update will be performed.     * @type Boolean     */    _fullRefreshRequired: false,        application: null,        /**     * Flag indicating whether any updates are pending.     * @type Boolean     */    _hasUpdates: true,        _listenerList: null,        /**     * Associative mapping between component ids and component instances for all     * updates held in this manager object.     */    _idMap: null,        _removedIdMap: null,        /**      * The id of the last parent component whose child was analyzed by     * _isAncestorBeingAdded() that resulted in that method returning false.     * This id is stored for performance optimization purposes.     * @type String     */    _lastAncestorTestParentId: null,        /**     * Creates a new Update Manager.     *     * @constructor     * @param {EchoApp.Application} application the supported application     */    $construct: function(application) {        this._componentUpdateMap = { };        this.application = application;        this._listenerList = new Core.ListenerList();        this._idMap = { };        this._removedIdMap = { };    },        /**     * Adds a listener to receive notification of update events.     *      * @param {Function} l the listener to add     */    addUpdateListener: function(l) {        this._listenerList.addListener("update", l);    },        /**     * Creates a new ComponentUpdate object (or returns an existing one) for a     * specific parent component.     *      * @private     * @param {EchoApp.Component} parent the parent Component     * @return a ComponentUpdate instance for that Component     * @type EchoApp.Update.ComponentUpdate      */    _createComponentUpdate: function(parent) {        this._hasUpdates = true;        var update = this._componentUpdateMap[parent.renderId];        if (!update) {            update = new EchoApp.Update.ComponentUpdate(this, parent);            this._componentUpdateMap[parent.renderId] = update;        }        return update;    },        /**     * Permanently disposes of the Update Manager, freeing any resources.     */    dispose: function() {        this.application = null;    },        /**     * Notifies update listeners of an event.     *      * @private     */    _fireUpdate: function() {        if (!this._listenerList.isEmpty()) {            this._listenerList.fireEvent({type: "update", source: this});        }    },        /**     * Returns the current pending updates.  Returns null in the event that that no pending updates exist.     *      * @return an array containing all component updates (as EchoApp.Update.ComponentUpdates)     * @type Array     */    getUpdates: function() {        var updates = [];        for (var key in this._componentUpdateMap) {            updates.push(this._componentUpdateMap[key]);        }        return updates;    },        /**     * Determines if any updates exist in the Update Manager.     *      * @return true if any updates are present     * @type Boolean     */    hasUpdates: function() {        return this._hasUpdates;    },        /**     * Determines if an ancestor of the specified component is being added.     *      * @private     * @param {EchoApp.Component} component the component to evaluate     * @return true if the component or an ancestor of the component is being added     * @type Boolean     */    _isAncestorBeingAdded: function(component) {        var child = component;        var parent = component.parent;                var originalParentId = parent ? parent.renderId : null;        if (originalParentId && this._lastAncestorTestParentId == originalParentId) {            return false;        }                while (parent) {            var update = this._componentUpdateMap[parent.renderId];            if (update && update._addedChildIds) {                for (var i = 0; i < update._addedChildIds.length; ++i) {                    if (update._addedChildIds[i] == child.renderId) {                        return true;                    }                }            }            child = parent;            parent = parent.parent;        }                this._lastAncestorTestParentId = originalParentId;        return false;    },    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -