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

📄 sync.textcomponent.js

📁 echo3 很炫的ajax框架技术 js 演示demo ajax j2ee 里面有jsp演示代码
💻 JS
📖 第 1 页 / 共 2 页
字号:
            parentElement.appendChild(this.input);        }    },        /** @see Echo.Render.ComponentSync#renderDisplay */    renderDisplay: function() {        var width = this.component.render("width");        if (width && Echo.Sync.Extent.isPercent(width) && this.input.parentNode.offsetWidth) {            // If width is a percentage, reduce rendered percent width based on measured container size and border width,            // such that border pixels will not make the component wider than specified percentage.            var border = this.component.render("border");            var borderSize = Echo.Sync.Border.getPixelSize(this.component.render("border", "2px solid #000000"), "left") +                    Echo.Sync.Border.getPixelSize(this.component.render("border", "2px solid #000000"), "right") + 1;            if (Core.Web.Env.BROWSER_INTERNET_EXPLORER) {                // Add default windows scroll bar width to border size for Internet Explorer browsers.                if (this.container) {                    this.container.style.width = this._adjustPercentWidth(100, Core.Web.Measure.SCROLL_WIDTH,                             this.input.parentNode.offsetWidth) + "%";                } else {                    borderSize += Core.Web.Measure.SCROLL_WIDTH;                }            }            this.input.style.width = this._adjustPercentWidth(parseInt(width, 10), borderSize,                     this.input.parentNode.offsetWidth) + "%";        }    },        /** @see Echo.Render.ComponentSync#renderDispose */    renderDispose: function(update) {        Core.Web.Event.removeAll(this.input);        this._focused = false;        this.input = null;        this.container = null;    },        /** @see Echo.Render.ComponentSync#renderFocus */    renderFocus: function() {        if (this._focused) {            return;        }                    this._focused = true;        Core.Web.DOM.focusElement(this.input);    },        /** @see Echo.Render.ComponentSync#renderUpdate */    renderUpdate: function(update) {        var fullRender = !Core.Arrays.containsAll(Echo.Sync.TextComponent._supportedPartialProperties,                     update.getUpdatedPropertyNames(), true);            if (fullRender) {            var element = this.container ? this.container : this.input;            var containerElement = element.parentNode;            this.renderDispose(update);            containerElement.removeChild(element);            this.renderAdd(update, containerElement);        } else {            if (update.hasUpdatedProperties()) {                var textUpdate = update.getUpdatedProperty("text");                if (textUpdate) {                    var newValue = textUpdate.newValue == null ? "" : textUpdate.newValue;                    if (newValue != this._lastProcessedValue) {                        this.input.value = newValue;                    }                }                var editableUpdate = update.getUpdatedProperty("editable");                if (editableUpdate != null) {                    this.input.readOnly = !editableUpdate.newValue;                }            }        }                return false; // Child elements not supported: safe to return false.    },    /**     * Stores the current value of the input field, if the client will allow it.     * If the client will not allow it, but the component itself is active, registers     * a restriction listener to be notified when the client is clear of input restrictions     * to store the value later.     *      * @param keyEvent the user keyboard event which triggered the value storage request (optional)     */    _storeValue: function(keyEvent) {        if (!this.client) {            return true;        }        this.sanitizeInput();                if (!this.client.verifyInput(this.component)) {            if (!this.component.isActive()) {                // Component is unwilling to receive input, prevent the input and return.                if (keyEvent) {                    Core.Web.DOM.preventEventDefault(keyEvent);                }                return true;            }                        // Component is willing to receive input, but client is not ready:              // Register listener to be notified when client input restrictions have been removed,             // but allow the change to be reflected in the text field temporarily.            this.client.registerRestrictionListener(this.component, Core.method(this, this._processRestrictionsClear));             return true;        }        // Component and client are ready to receive input, set the component property and/or fire action event.        this.component.set("text", this.input.value);        this._lastProcessedValue = this.input.value;                if (keyEvent && keyEvent.keyCode == 13) {            this.component.doAction();        }        return true;    }});/** * Component rendering peer: TextArea */Echo.Sync.TextArea = Core.extend(Echo.Sync.TextComponent, {    $load: function() {        Echo.Render.registerPeer("TextArea", this);    },    /** @see Echo.Render.ComponentSync#renderAdd */    renderAdd: function(update, parentElement) {        this.input = document.createElement("textarea");        this.input.id = this.component.renderId;        if (!this.component.render("editable", true)) {            this.input.readOnly = true;        }        this._renderStyle(this.input);        this.input.style.overflow = "auto";        this._addEventHandlers(this.input);        if (this.component.get("text")) {            this.input.value = this.component.get("text");        }        this.renderAddToParent(parentElement);    }});/** * Component rendering peer: TextField */Echo.Sync.TextField = Core.extend(Echo.Sync.TextComponent, {        $load: function() {        Echo.Render.registerPeer("TextField", this);    },        $virtual: {                /**          * Input element type, either "text" or "password"         * @type String          */        _type: "text"    },    /** @see Echo.Render.ComponentSync#getFocusFlags */    getFocusFlags: function() {        return Echo.Render.ComponentSync.FOCUS_PERMIT_ARROW_UP | Echo.Render.ComponentSync.FOCUS_PERMIT_ARROW_DOWN;    },    /** @see Echo.Render.ComponentSync#renderAdd */    renderAdd: function(update, parentElement) {        this.input = document.createElement("input");        this.input.id = this.component.renderId;        if (!this.component.render("editable", true)) {            this.input.readOnly = true;        }        this.input.type = this._type;        var maximumLength = this.component.render("maximumLength", -1);        if (maximumLength >= 0) {            this.input.maxLength = maximumLength;        }        this._renderStyle(this.input);        this._addEventHandlers(this.input);        if (this.component.get("text")) {            this.input.value = this.component.get("text");        }                this.renderAddToParent(parentElement);    },    /**      * Allows all input.     * @see Echo.Sync.TextComponent#sanitizeInput     */    sanitizeInput: function() {        // allow all input    }});/** * Component rendering peer: PasswordField */Echo.Sync.PasswordField = Core.extend(Echo.Sync.TextField, {        $load: function() {        Echo.Render.registerPeer("PasswordField", this);    },        /** @see Echo.Sync.TextField#_type */    _type: "password"});

⌨️ 快捷键说明

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