How to use the ext/splitview/splits.indexOf function in ext

To help you get started, we’ve selected a few ext examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
mergeTab: function(dir) {
        var bRight   = dir == "right";
        var tabs     = tabEditors;
        var pages    = tabs.getPages();
        var curr     = tabs.getPage();
        var split    = Splits.getActive();
        var splitLen = split ? split.pairs.length : 0;
        if (split && Splits.indexOf(split, curr) > -1)
            curr = split.pairs[bRight ? splitLen - 1 : 0].page;
        if (!curr || pages.length == 1)
            return;
        
        var idx;
        if (splitLen == 3) {
            // if the max amount of tabs has been reached inside a split view,
            // then the user may remove the last or first tab from it.
            idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
        }
        else {
            var currIdx = pages.indexOf(curr);
            idx = currIdx + (bRight ? 1 : -1);
        }
        if (idx < 0 || idx > pages.length - 1)
            return;
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
onCycleTab: function(e) {
        var pages  = e.pages;
        var split = Splits.getActive();
        if (!split)
            return;
        if (split.pairs.length == pages.length)
            return (e.returnValue = false);

        var maxIdx = pages.length - 1;
        var bRight = e.dir == "right";
        var idx = pages.indexOf(split.pairs[bRight ? split.pairs.length - 1 : 0].page) + (bRight ? 1 : -1);
        idx = idx < 0 ? maxIdx : idx > maxIdx ? 0 : idx;
        if (Splits.indexOf(split, pages[idx]) > -1)
            return (e.returnValue = false);

        // check if the next tab is inside a split as well:
        split = Splits.get(pages[idx])[0];
        if (split)
            e.returnValue = pages.indexOf(split.pairs[0].page);
        else
            e.returnValue = idx;
    },
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
mergeTab: function(dir) {
        var bRight   = dir == "right";
        var tabs     = tabEditors;
        var pages    = tabs.getPages();
        var curr     = tabs.getPage();
        var split    = splits.getActive();
        var splitLen = split ? split.pairs.length : 0;
        if (split && splits.indexOf(split, curr) > -1)
            curr = split.pairs[bRight ? splitLen - 1 : 0].page;
        if (!curr || pages.length == 1)
            return;

        var idx;
        if (splitLen == 3) {
            // if the max amount of tabs has been reached inside a split view,
            // then the user may remove the last or first tab from it.
            idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
        }
        else {
            var currIdx = pages.indexOf(curr);
            idx = currIdx + (bRight ? 1 : -1);
        }
        if (idx < 0 || idx > pages.length - 1)
            return;
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
onCycleTab: function(e) {
        var pages  = e.pages;
        var split = splits.getActive();
        if (!split)
            return;
        if (split.pairs.length == pages.length)
            return (e.returnValue = false);

        var maxIdx = pages.length - 1;
        var bRight = e.dir == "right";
        var idx = pages.indexOf(split.pairs[bRight ? split.pairs.length - 1 : 0].page) + (bRight ? 1 : -1);
        idx = idx < 0 ? maxIdx : idx > maxIdx ? 0 : idx;
        if (splits.indexOf(split, pages[idx]) > -1)
            return (e.returnValue = false);

        // check if the next tab is inside a split as well:
        split = splits.get(pages[idx])[0];
        if (split)
            e.returnValue = pages.indexOf(split.pairs[0].page);
        else
            e.returnValue = idx;
    },
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
mergeTab: function(dir) {
        var bRight   = dir == "right";
        var tabs     = tabEditors;
        var pages    = tabs.getPages();
        var curr     = tabs.getPage();
        var split    = Splits.getActive();
        var splitLen = split ? split.pairs.length : 0;
        if (split && Splits.indexOf(split, curr) > -1)
            curr = split.pairs[bRight ? splitLen - 1 : 0].page;
        if (!curr || pages.length == 1)
            return;

        var idx;
        if (splitLen == 3) {
            // if the max amount of tabs has been reached inside a split view,
            // then the user may remove the last or first tab from it.
            idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
        }
        else {
            var currIdx = pages.indexOf(curr);
            idx = currIdx + (bRight ? 1 : -1);
        }
        if (idx < 0 || idx > pages.length - 1)
            return;
github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
if (!pageSet) {
                            tabs.set(page);
                            pageSet = true;
                        }
                        Splits.mutate(null, page);
                    }
                }
            }
            if (gridLayout)
                Splits.update(null, gridLayout);

            if (apf.isTrue(nodes[i].getAttribute("active")))
                active = Splits.getActive();
        }
        
        if (!active || Splits.indexOf(active, activePage) == -1)
            tabs.set(activePage);
        else
            Splits.show(active);
    },
github pylonide / pylon / client / ext / splitview / splitview.js View on Github external
ide.addEventListener("correctactivepage", function(e) {
            var split = Splits.getActive();
            var editor = Editors.currentEditor && Editors.currentEditor.amlEditor;
            if (!split || !editor)
                return;
            var idx = Splits.indexOf(split, editor);
            if (idx == -1)
                return;
            e.returnValue = split.pairs[idx].page;
        });
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
editor.setProperty("value", page.acesession);

                var split = splits.create(origPage);
                split.clone = true;
                split.pairs.push({
                    page: page,
                    editor: editor
                });

                if (settings) {
                    var addPage;
                    for (i = 0, l = pages.length; i < l; ++i) {
                        if (pages[i] == origPage.id)
                            continue;
                        addPage = tabs.getPage(pages[i]);
                        if (!addPage || splits.indexOf(split, addPage) > -1)
                            continue;
                        split.pairs.splice(i, 0, {
                            page: addPage,
                            editor: splits.getEditor(split, addPage)
                        });
                    }
                    split.activePage = parseInt(settings.getAttribute("activepage"), 10) || 0;
                    split.gridLayout = settings.getAttribute("layout");
                }
                splits.consolidateEditorSession(page, editor);

                page.addEventListener("DOMNodeRemovedFromDocument", function() {
                    _self.endCloneView(page);
                });

                origPage.addEventListener("DOMNodeRemovedFromDocument", function() {
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
var split = Splits.create(origPage);
                split.clone = true;
                split.pairs.push({
                    page: page,
                    editor: editor
                });

                page.$clone = true;

                if (settings) {
                    var addPage;
                    for (i = 0, l = pages.length; i < l; ++i) {
                        if (pages[i] == origPage.id)
                            continue;
                        addPage = tabs.getPage(pages[i]);
                        if (!addPage || Splits.indexOf(split, addPage) > -1)
                            continue;
                        split.pairs.splice(i, 0, {
                            page: addPage,
                            editor: Splits.getEditor(split, addPage)
                        });
                    }
                    split.activePage = parseInt(settings.getAttribute("activepage"), 10) || 0;
                    split.gridLayout = settings.getAttribute("layout");
                }

                function syntaxListener(e) {
                    editor.setAttribute("syntax", e.value);
                }
                origEditor.addEventListener("prop.syntax", syntaxListener);
                editor.setAttribute("syntax", origEditor.syntax);
github pylonide / pylon / plugins-client / ext.splitview / splitview.js View on Github external
ide.addEventListener("correctactivepage", function(e) {
            var split = Splits.getActive();
            var editor = Editors.currentEditor && Editors.currentEditor.amlEditor;
            if (!split || !editor)
                return;
            var idx = Splits.indexOf(split, editor);
            if (idx == -1)
                return;
            e.returnValue = split.pairs[idx].page;
        });