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

📄 sync.js

📁 echo3 很炫的ajax框架技术 js 演示demo ajax j2ee 里面有jsp演示代码
💻 JS
📖 第 1 页 / 共 4 页
字号:
            element.style.backgroundImage = "url(" + url + ")";        }                if (isObject) {            var position = Echo.Sync.FillImage.getPosition(fillImage);            element.style.backgroundPosition = position ? position : "";            element.style.backgroundRepeat = this._REPEAT_VALUES[fillImage.repeat] ? this._REPEAT_VALUES[fillImage.repeat]: "";         }    },        /**     * Renders a FillImage to an element, clearing any existing value.     *      * @param {#FillImage} fillImage the FillImage (may be null)     * @param {Element} element the target element     * @param {Number} flags (optional) the rendering flags, one or more of the following values:     *        <ul>     *         <li><code>FLAG_ENABLE_IE_PNG_ALPHA_FILTER</code></li>     *        <ul>     */    renderClear: function(fillImage, element, flags) {        if (fillImage) {            this.render(fillImage, element, flags);        } else {            if (Core.Web.Env.PROPRIETARY_IE_PNG_ALPHA_FILTER_REQUIRED) {                element.style.filter = "";            }            element.style.backgroundImage = "";            element.style.backgroundPosition = "";            element.style.backgroundRepeat = "";        }    }};/** * Provides tools for rendering font properties. * @class */Echo.Sync.Font = {     /**     * Renders a Font property to an element.     *      * @param {#Font} font the font     * @param {Element} element the target element     */    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 = Echo.Sync.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";        }    },        /**     * Renders a Font property to an element, clearing any previously set font first.     *      * @param {#Font} font the font     * @param {Element} element the target element     */    renderClear: function(font, element) {        if (font) {            this.render(font, element);            if (!font.typeface) {                element.style.fontFamily = "";            }            if (!font.underline) {                element.style.textDecoration = "";            }            if (!font.bold) {                element.style.fontWeight = "";            }            if (!font.size) {                element.style.fontSize = "";            }            if (!font.italic) {                element.style.fontStyle = "";            }        } else {            element.style.fontFamily = "";            element.style.fontSize = "";            element.style.fontWeight = "";            element.style.fontStyle = "";            element.style.textDecoration = "";        }    }};/** * Provides tools for rendering image properties. * @class */Echo.Sync.ImageReference = {    /**     * Returns the URL of an image reference object.     *      * @param {#ImageReference} imageReference the image reference (may be null)     * @return the URL     * @type String     */    getUrl: function(imageReference) {        return imageReference ? (typeof(imageReference) == "string" ? imageReference : imageReference.url) : null;    },    /**     * Renders an image reference object to an IMG element.     *      * @param {#ImageReference} imageReference the image reference     * @param {Element} imgElement the IMG element.     */    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 = Echo.Sync.Extent.toCssValue(imageReference.width, true);            }            if (imageReference.height) {                imgElement.style.height = Echo.Sync.Extent.toCssValue(imageReference.height, false);            }        }    }};/** * Provides tools for rendering insets/margin/padding properties. * @class */Echo.Sync.Insets = {    /**     * Regular expression to test extents which are entirely presented in pixels     * and may thus be directly added to CSS.     * @type RegExp     */    _FORMATTED_PIXEL_INSETS: /^(-?\d+px *){1,4}$/,    /** toPixels() return value when insets are 0/null. */    _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]     },    /**     * Renders an insets property to an element.     *      * @param {#Insets} insets the insets property     * @param {Element} the target element     * @param {String} the style attribute name, e.g., "padding" or "margin"      */    render: function(insets, element, styleAttribute) {        switch(typeof(insets)) {        case "number":            element.style[styleAttribute] = Math.round(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;        }    },        /**     * Generates a CSS value for an insets property.     *      * @param {#Insets} insets the insets property     * @return the CSS value     * @type String     */    toCssValue: function(insets) {        switch(typeof(insets)) {        case "number":            return insets + "px";        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 "";    },        /**     * Returns an object representing the pixel dimensions of a insets property.     *      * @param {#Insets} insets the insets property     * @return an object containing top, bottom, left, and right values representing the pixel sizes of the insets property     */    toPixels: function(insets) {        if (insets == null) {            return this._ZERO;        } else if (typeof(insets) == "number") {            insets = Math.round(insets);            return { top: insets, right: insets, bottom: insets, left: insets };        }                insets = insets.split(" ");        var map = this._INDEX_MAPS[insets.length];        return {            top: Echo.Sync.Extent.toPixels(insets[map[0]], false),            right: Echo.Sync.Extent.toPixels(insets[map[1]], true),            bottom: Echo.Sync.Extent.toPixels(insets[map[2]], false),            left: Echo.Sync.Extent.toPixels(insets[map[3]], true)        };    }};/** * Provides tools for rendering layout direction properties.  */Echo.Sync.LayoutDirection = {    /**     * Renders a layout direction property to an element.     *      * @param {Echo.LayoutDirection} layoutDirection the layoutDirection property (may be null)     * @param {Element} element the target element     */    render: function(layoutDirection, element) {        if (layoutDirection) {            element.dir = layoutDirection.isLeftToRight() ? "ltr" : "rtl";        }    }};/** * Renders a table with two or three cells, suitable for laying out buttons, labels,  * and similar components. */Echo.Sync.TriCellTable = Core.extend({    $static: {                /**          * Orientation flag indicating inverted (trailing-leading or bottom-top) orientation.         * @type Number          */        INVERTED: 1,                /**          * Orientation flag indicating vertical (top-bottom or bottom-top) orientation.          * @type Number          */        VERTICAL: 2,                /**          * Orientation value indicating horizontal orientation, leading first, trailing second.          * @type Number          */        LEADING_TRAILING: 0,                /**          * Orientation value indicating horizontal orientation, trailing first, leading second.         * @type Number          */        TRAILING_LEADING: 1, // INVERTED                /**          * Orientation value indicating vertical orientation, top first, bottom second.          * @type Number          */        TOP_BOTTOM: 2,       // VERTICAL                /**          * Orientation value indicating vertical orientation, bottom first, top second.         * @type Number          */        BOTTOM_TOP: 3,       // VERTICAL | INVERTED                /**         * Creates a prototype DOM element hierarchy for a TriCellTable, which may         * be cloned for purposes of performance enhancement.         *          * @return the prototype DOM element hierarchy         * @type Element         */        _createTablePrototype: function() {            var table = document.createElement("table");            table.style.borderCollapse = "collapse";            table.style.padding = "0";                        var tbody = document.createElement("tbody");            table.appendChild(tbody);                        return table;        },                /**         * Returns the inverted orientation value which should be used for a component (the opposite of that which         * would be returned by getOrientation().         * The rendered layout direction of the component will be factored when determining horizontal orientations.         *          * @param {Echo.Component} component the component         * @param {String} propertyName the alignment property name         * @param {#Alignment} defaultValue default alignment value to use if component does not have specified property         * @return the (inverted) orientation         * @type Number         */        getInvertedOrientation: function(component, propertyName, defaultValue) {            return this.getOrientation(component, propertyName, defaultValue) ^ this.INVERTED;        },        /**         * Determines the orientation value which should be used to a component.         * The rendered layout direction of the component will be factored when determining horizontal orientations.         * 

⌨️ 快捷键说明

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