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

📄 applicationrender.js

📁 一个ajax富客户端的ajax类库
💻 JS
📖 第 1 页 / 共 3 页
字号:
        }        return "";    },    toPixels: function(extent, horizontal) {        if (extent == null) {            return 0;        } else if (typeof(extent) == "number") {            return extent;        } else {            var parts = this._PARSER.exec(extent);            if (!parts) {                throw new Error("Invalid Extent: " + extent);            }            var value = parseFloat(parts[1]);            var units = parts[2] ? parts[2] : "px";            return WebCore.Measure.extentToPixels(value, units, horizontal);        }    }};EchoAppRender.FillImage = {     _REPEAT_VALUES: {        "0": "no-repeat",        "x": "repeat-x",        "y": "repeat-y",        "xy": "repeat",        "no-repeat": "no-repeat",        "repeat-x": "repeat-x",        "repeat-y": "repeat-y",        "repeat": "repeat"    },    FLAG_ENABLE_IE_PNG_ALPHA_FILTER: 0x1,        render: function(fillImage, element, flags) {        if (fillImage == null) {            // No image specified, do nothing.            return;        }                var isObject = typeof(fillImage) == "object";        var url = isObject ? fillImage.url : fillImage;        if (WebCore.Environment.PROPRIETARY_IE_PNG_ALPHA_FILTER_REQUIRED &&                flags && (flags & this.FLAG_ENABLE_IE_PNG_ALPHA_FILTER)) {            // IE6 PNG workaround required.            element.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"                 + url + "', sizingMethod='scale')";        } else {            // IE6 PNG workaround not required.            element.style.backgroundImage = "url(" + url + ")";        }                if (isObject) {            if (this._REPEAT_VALUES[fillImage.repeat]) {                element.style.backgroundRepeat = this._REPEAT_VALUES[fillImage.repeat];             }                        if (fillImage.x || fillImage.y) {                var x, y;                if (EchoAppRender.Extent.isPercent(fillImage.x)) {                    x = fillImage.x;                } else {                    x = EchoAppRender.Extent.toPixels(fillImage.x, true) + "px";                }                if (EchoAppRender.Extent.isPercent(fillImage.y)) {                    y = fillImage.y;                } else {                    y = EchoAppRender.Extent.toPixels(fillImage.y, false) + "px";                }                element.style.backgroundPosition = x + " " + y;            }        }            },        renderClear: function(fillImage, element, flags) {        if (fillImage) {            this.render(fillImage, element, flags);        } else {            element.style.backgroundImage = "";            element.style.backgroundPosition = "";            element.style.backgroundRepeat = "";        }    }};EchoAppRender.Font = {     render: function(font, element) {        if (!font) {            return;        }        if (font.typeface) {            if (font.typeface instanceof Array) {                element.style.fontFamily = font.typeface.join(",");            } else {                element.style.fontFamily = font.typeface;            }        }        if (font.size) {            element.style.fontSize = EchoAppRender.Extent.toCssValue(font.size);        }        if (font.bold) {            element.style.fontWeight = "bold";        }        if (font.italic) {            element.style.fontStyle = "italic";        }        if (font.underline) {            element.style.textDecoration = "underline";        } else if (font.overline) {            element.style.textDecoration = "overline";        } else if (font.lineThrough) {            element.style.textDecoration = "line-through";        }    },        renderClear: function(font, element) {        if (font) {            this.render(font, element);        } else {            element.style.fontFamily = "";            element.style.fontSize = "";            element.style.fontWeight = "";            element.style.fontStyle = "";            element.style.textDecoration = "";        }    }};EchoAppRender.ImageReference = {    getUrl: function(imageReference) {        return imageReference ? (typeof(imageReference) == "string" ? imageReference : imageReference.url) : null;    },    renderImg: function(imageReference, imgElement) {        if (!imageReference) {            return;        }                if (typeof(imageReference) == "string") {            imgElement.src = imageReference;        } else {            imgElement.src = imageReference.url;            if (imageReference.width) {                imgElement.style.width = EchoAppRender.Extent.toCssValue(imageReference.width, true);            }            if (imageReference.height) {                imgElement.style.height = EchoAppRender.Extent.toCssValue(imageReference.height, false);            }        }    }};EchoAppRender.Insets = {    /**     * Regular expression to test extents which are entirely presented in pixels     * and may thus be directly added to CSS.     */    _FORMATTED_PIXEL_INSETS: /^(-?\d+px *){1,4}$/,    _ZERO: { top: 0, right: 0, bottom: 0, left: 0 },        /**     * Mapping between number of inset values provided and arrays which represent the     * inset value index for the top, right, bottom, and left value.      */    _INDEX_MAPS: {        1: [0, 0, 0, 0],         2: [0, 1, 0, 1],         3: [0, 1, 2, 1],         4: [0, 1, 2, 3]     },    render: function(insets, element, styleAttribute) {        switch(typeof(insets)) {            case "number":                element.style[styleAttribute] = insets + "px";                break;            case "string":                if (this._FORMATTED_PIXEL_INSETS.test(insets)) {                    element.style[styleAttribute] = insets;                } else {                    var pixelInsets = this.toPixels(insets);                    element.style[styleAttribute] = pixelInsets.top + "px " + pixelInsets.right + "px "                            + pixelInsets.bottom + "px " + pixelInsets.left + "px";                }                break;        }    },        toCssValue: function(insets) {        switch(typeof(insets)) {            case "number":                return insets + "px";                break;            case "string":                if (this._FORMATTED_PIXEL_INSETS.test(insets)) {                    return insets;                } else {                    var pixelInsets = this.toPixels(insets);                    return pixelInsets.top + "px " + pixelInsets.right + "px "                            + pixelInsets.bottom + "px " + pixelInsets.left + "px";                }                break;        }        return "";    },        toPixels: function(insets) {        if (insets == null) {            return this._ZERO;        } else if (typeof(insets) == "number") {            return { top: insets, right: insets, bottom: insets, left: insets };        }                insets = insets.split(" ");        var map = this._INDEX_MAPS[insets.length];        return {            top: EchoAppRender.Extent.toPixels(insets[map[0]], false),            right: EchoAppRender.Extent.toPixels(insets[map[1]], true),            bottom: EchoAppRender.Extent.toPixels(insets[map[2]], false),            left: EchoAppRender.Extent.toPixels(insets[map[3]], true)        };    }};/** * @class Manages floating windows, e.g., window panes in a content pane. * Provides listener facility to receive notifications when the panes are raised or lowered, * such that floating panes may adjust their z-indices appropriately for correct display. * Registered listeners will be notified when one or more z-indices have changed. */EchoAppRender.FloatingPaneManager = Core.extend({    /**     * Creates a new Floating Pane Manager.     */    $construct: function() {        this._floatingPanes = null;        this._listeners = null;    },        /**     * Adds a floating pane to be managed, or, if the floating pane already exists,     * raises it to the top.     * The floating pane will be placed above all others, at the highest z-index.     *      * @param {String} renderId the id of the floating pane     * @return the initial z-index of the added floating pane     */    add: function(renderId) {        if (!this._floatingPanes) {            this._floatingPanes = [];        }        Core.Arrays.remove(this._floatingPanes, renderId);        this._floatingPanes.push(renderId);        this._fireZIndexEvent();        return this._floatingPanes.length;    },        /**     * Adds a z-index listener.       *      * @param {Function} the listener to add     */    addZIndexListener: function(l) {        if (!this._listeners) {            this._listeners = new Core.ListenerList();        }        this._listeners.addListener("zIndex", l);    },        /**     * Notifies listeners of a z-index change.     * @private     */    _fireZIndexEvent: function() {        if (this._listeners) {            this._listeners.fireEvent({type: "zIndex", source: this});        }    },        /**     * Returns the z-index of the floating pane with the specified id.     * -1 is returned if the pane is not registered.     *      * @param {String} renderId the id of the floating pane     * @return the z-index     */    getIndex: function(renderId) {        if (this._floatingPanes) {            var index = Core.Arrays.indexOf(this._floatingPanes, renderId);            return index == -1 ? -1 : index + 1;        } else {            return -1;        }    },        /**     * Removes a floating pane from being managed.     *      * @param {String} renderId the id of the floating pane     */    remove: function(renderId) {        if (!this._floatingPanes) {            return;        }        Core.Arrays.remove(this._floatingPanes, renderId);        this._fireZIndexEvent();    },        /**     * Removes a z-index listener.     *      * @param {Function} the listener to remove     */    removeZIndexListener: function(l) {        if (!this._listeners) {            return;        }        this._listeners.removeListener("zIndex", l);    }});EchoAppRender.TriCellTable = Core.extend({    $static: {                INVERTED: 1,        VERTICAL: 2,        

⌨️ 快捷键说明

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