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

📄 grids.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
        else        {            for (var i = rules.length - 1; i >= 0; i--)            {                if (rules[i].selectorText.indexOf(s) == 0)                {                    this._styleSheet.deleteRule(i);                }            }        }    }};_p.updateData = function(){    if (this.getCreated())    {        this._clearCache();        this._gridBodyElement.innerHTML = this.getGridBodyHtml();        this.updateHeadersWidth();        this._gridCreated = true;    }};_p.updateHeadersWidth = function(){    if (this.getCreated() && this._headers.getCreated())    {        this._headers.setWidth(this._gridBodyElement.clientWidth - this._getFillerWidth());    }};_p._updateHeadersWidth = function(){    var t = new BiTimer(1);    t.addEventListener("tick", function(e)    {        t.stop();        this.updateHeadersWidth();        t.dispose();    },                 this);    t.start();};_p._create = function(oDoc){    BiComponent.prototype._create.call(this, oDoc);    this._styleSheet = BiAbstractGrid._styleSheet;    if (!this._styleSheet)    {        if (BiBrowserCheck.ie)            this._styleSheet = this._document.createStyleSheet();        else        {            var el = this._document.createElement("STYLE");            el.type = "text/css";            this._document.getElementsByTagName("HEAD")[0].appendChild(el);            this._styleSheet = el.sheet;        }        BiAbstractGrid._styleSheet = this._styleSheet;    }    this._gridBodyElement = this._document.createElement("DIV");    this._gridBodyElement.className = "bi-grid-body";    this._gridBodyElement._biComponent = this;    this._gridBodyElement.onscroll = BiComponent.__oninlineevent;    this._element.appendChild(this._gridBodyElement);    this._gridBodyElement.style.paddingLeft = this._getFillerWidth() + "px";    this._gridBodyElement.style.paddingTop = this._getFillerHeight() + "px";    this._gridBodyElement.style.overflowX = this._overflowX;    this._gridBodyElement.style.overflowY = this._overflowY;};_p.dispose = function(){    if (this._disposed)        return;    this._removeStyleRules();    BiComponent.prototype.dispose.call(this);    this._selectionModel.dispose();    this._selectionModel = null;    for (var i = this._rows.length - 1; i >= 0; i--)        this._rows[i].dispose();    this._clearCache();    this._styleSheet = null    if (this._gridBodyElement)    {        this._gridBodyElement._biComponent = null;        this._gridBodyElement.onscroll = null;    }    this._gridBodyElement = null;    if (this._dataSource)    {        this._dataSource.dispose();        this._dataSource = null;    }};_p._getAllNodes = function(){    if (this._allNodes == null)    {        this._allNodes = {        };        var cs = this._rows;        var l = cs.length;        for (var i = 0; i < l; i++)            cs[i]._getAllNodes(this._allNodes);    }    return this._allNodes;};_p._getGridElement = function(oNode){    if (!this._created)        return null;    var hc = oNode.toHashCode();    if (!this._gridElements[hc])    {        this._gridElements[hc] = this._document.getElementById(hc);    }    return this._gridElements[hc];};_p._clearCache = function(){    this._depth = null;    this._allNodes = null;    for (var hc in this._gridElements)        delete this._gridElements[hc];};_p.getGridBodyHtml = function(){    var cs = this._rows;    var l = cs.length;    var sb = new Array(l);    for (var i = 0; i < l; i++)        sb[i] = cs[i].getHtml();    return sb.join("");};_p.getSelectedNode = _p.getSelectedRow = function(){    return this.getSelectedRows()[0];} ;_p.getSelectedNodes = _p.getSelectedRows = function(){    return this._selectionModel.getSelectedItems();} ;_p.setMultipleSelection = function(b){    this._selectionModel.setMultipleSelection(b);} ;_p.getMultipleSelection = function(){    return this._selectionModel.getMultipleSelection();} ;_p.setSelectionModel = function(sm){    if (this._selectionModel != sm)    {        if (this._selectionModel != null)            this._selectionModel.deselectAll();        this._selectionModel = sm;    }};_p.findString = function(sText, nStartIndex){    return this._findItem(sText, nStartIndex || 0, "String");} ;_p.findStringExact = function(sText, nStartIndex){    return this._findItem(sText, nStartIndex || 0, "StringExact");} ;_p.setScrollLeft = function(n){    if (this.getCreated())    {        this._gridBodyElement.scrollLeft = n;        if (BiBrowserCheck.moz)            this._headers.setScrollLeft(this.getScrollLeft());    }};_p.getScrollLeft = function(){    if (this.getCreated())        return this._gridBodyElement.scrollLeft;};_p.setScrollTop = function(n){    if (this.getCreated())        this._gridBodyElement.scrollTop = n;};_p.getScrollTop = function(n){    if (this.getCreated())        return this._gridBodyElement.scrollTop;};_p.getScrollWidth = function(n){    if (this.getCreated())        return this._gridBodyElement.scrollWidth;};_p.getScrollHeight = function(n){    if (this.getCreated())        return this._gridBodyElement.scrollHeight;};_p.getClientWidth = function(){    if (!this._created)        throw new Error("Visual property on non created component");    return this._gridBodyElement.clientWidth;};_p.getClientHeight = function(){    if (!this._created)        throw new Error("Visual property on non created component");    return this._gridBodyElement.clientHeight;};_p.setOverflowX = function(sOverflowX){    if (this._overflowX != sOverflowX)    {        this._overflowX = sOverflowX;        if (this._created)            this._gridBodyElement.style.overflowX = sOverflowX;    }};_p.setOverflowY = function(sOverflowY){    if (this._overflowY != sOverflowY)    {        this._overflowY = sOverflowY;        if (this._created)            this._gridBodyElement.style.overflowY = sOverflowY;    }};BiAbstractGrid.prototype.getOverflowX = function(){    return this._overflowX;} ;BiAbstractGrid.prototype.getOverflowY = function(){    return this._overflowY;} ;_p.sort = function(nCol, bAscending){    if (nCol != -1)    {        var f = this._columns[nCol].getSortFunction();    }    this._sortColumn = nCol;    this._ascending = Boolean(bAscending);    this._headers.setSortColumn(nCol);    this._headers.setAscending(bAscending);    if (nCol != -1)    {        this._sort(f, bAscending);        this.updateData();    }};_p._sort = function(fCompare, bAscending){    this._rows.sort(fCompare);    if (!bAscending)        this._rows.reverse();};_p._onFocusChange = function(e){    var items = this.getSelectedRows();    for (var i = 0; i < items.length; i++)        items[i]._updateClassName();    if (this._selectionModel._leadItem)        this._selectionModel._leadItem._updateClassName();};_p._onKeyPress = function(e){    if (new Date - this._lastKeyPress > 1000)    {        this._accumulatedKeys = "";    }    this._accumulatedKeys += String.fromCharCode(e.getKeyCode());    var item = this._findItem(this._accumulatedKeys, null, "String");    if (item)    {        var oldVal = this._selectionModel._getChangeValue();        var oldFireChange = this._selectionModel._fireChange;        this._selectionModel._fireChange = false;        this._selectionModel._deselectAll();        this._selectionModel.setItemSelected(item, true);        this._selectionModel.setAnchorItem(item);        this._selectionModel.setLeadItem(item);        item.scrollIntoView();        this._selectionModel._fireChange = oldFireChange;        if (this._selectionModel._fireChange && this._selectionModel._hasChanged(oldVal))            this._selectionModel._dispatchChange();    }    this._lastKeyPress = ( new Date).valueOf();};function BiAbstractGridRow(){    BiObject.call(this);}var _p = BiAbstractGridRow.prototype = new BiObject;_p._className = "BiAbstractGridRow";_p._grid = null;_p._icon = null;_p._selected = false;_p._anchor = false;_p._lead = false;BiAbstractGridRow.prototype.getIcon = function(){    return this._icon;} ;BiAbstractGridRow.prototype.getBackColor = function(){    return this._backColor;} ;BiAbstractGridRow.prototype.setBackColor = function(v){    this._backColor = v;} ;BiAbstractGridRow.prototype.getForeColor = function(){    return this._foreColor;} ;BiAbstractGridRow.prototype.setForeColor = function(v){    this._foreColor = v;} ;_p._getStyle = function(){    if (!this._backColor && !this._foreColor)        return "";    return " style=\"" + (this._backColor ? "background-color:" + this._backColor + ";" : "") + (this._foreColor                                                                                                    ? "color:"                                                                                                    + this._foreColor                                                                                                    + ";" : "") + "\"";};_p.setIcon = function(oIcon){    if (oIcon == null || oIcon.getIconHtml || oImage instanceof BiUri)        this._icon = oIcon;    else        this._icon = new BiUri(application.getAdfPath(), oIcon);};_p.setSelected = function(bSelected){    if (this._selected != bSelected)    {        var g = this.getGrid();        if (g != null)        {            g._selectionModel.setItemSelected(this, bSelected);        }        this._setSelected(bSelected);    }};BiAbstractGridRow.prototype.getSelected = function(){    return this._selected;} ;_p._setSelected = function(bSelected){    this._selected = bSelected;    this._updateClassName();};_p._setAnchor = function(bAnchor){    this._anchor = bAnchor;    this._updateClassName();};_p._setLead = function(bLead){    this._lead = bLead;    this._updateClassName();};_p.getCreated = function(){    var t = this.getGrid();    if (!t || !t._gridCreated)        return false;    this._element = t._getGridElement(this);    return this._element != null;};_p._updateClassName = function(){    if (!this.getCreated())        return;    this._element.firstChild.className = this.getCssClassName();};_p.update = function(){    var g = this.getGrid()    if (!this.getCreated() || !g)        return;    if (BiBrowserCheck.ie)        this._element.outerHTML = this.getHtml();    else    {        var dummy = g._document.createElement("DIV");        dummy.innerHTML = this.getHtml();        this._element.parentNode.replaceChild(dummy.firstChild, this._element);    }    g._clearCache();};_p.scrollIntoView = function(bTopLeft){    this.scrollIntoViewY(bTopLeft);} ;_p.getHeight = function(){    return this.getGrid().getRowHeight();} ;_p.getTop = function(){    if (this.getCreated())    {        var grid = this.getGrid();        if (BiBrowserCheck.ie)        {            return this._element.getBoundingClientRect().top - grid.getClientTop() + grid.getScrollTop()                - grid.getInsetTop();        }        else        {            var sum = 0;            var p = this._element.parentNode;            while (p.nodeType == 1)            {                sum += p.scrollTop;                p = p.parentNode;            }            return grid._document.getBoxObjectFor(                       this._element).y - sum - grid.getClientTop() + grid.getScrollTop() - grid.getInsetTop();        }    }};_p.scrollIntoViewY = function(bTop){    if (!this.getCreated())    {        return;    }    var p = this.getGrid();    if (!p)        return;    var t = this.getTop();    var h = this.getHeight();    var st = p.getScrollTop();    var ch = p.getClientHeight();    var fh = p._getFillerHeight();    if (bTop)        p.setScrollTop(t - fh);    else if (bTop == false)        p.setScrollTop(t + h - ch);    else if (h > ch || t - fh < st)    {        p.setScrollTop(t - fh);    }    else if (t + h > st + ch)    {        p.setScrollTop(t + h - ch);    }};_p.matchesString = function(sText){    return false;} ;_p.matchesStringExact = function(sText){    return false;} ;_p.dispose = function(){

⌨️ 快捷键说明

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