From f3e8d59816ef8885d1c0a857265a5738aaad70c1 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Fri, 4 Oct 2013 09:34:24 -0400 Subject: [PATCH] Added Bulk button and related code to process multiple comma seperated channel names. Added function subscribeToChannelBulk. Just splits the text string from the box and adds multiple channels at the same time. --- .../widgets/ChannelListenerPanel.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/web-app/examples/walkthrough/widgets/ChannelListenerPanel.js b/web-app/examples/walkthrough/widgets/ChannelListenerPanel.js index 964dcae1..bbbd23d2 100644 --- a/web-app/examples/walkthrough/widgets/ChannelListenerPanel.js +++ b/web-app/examples/walkthrough/widgets/ChannelListenerPanel.js @@ -127,6 +127,17 @@ Ext.define('Ozone.components.ChannelListenerPanel', { } }, '|', + { + xtype: 'button', + text: 'Add Channels (Bulk)', + //cls: 'x-btn-text-icon', + //icon: '../../../images/blue/icons/iconClearAll.gif', + scope: this, + handler: function() { + this.subscribeToChannelBulk(); + } + }, + '|', { xtype: 'button', text: 'Clear Channels', @@ -380,7 +391,23 @@ Ext.define('Ozone.components.ChannelListenerPanel', { } }, + subscribeToChannelBulk: function(channels){ + // take list and subscribe + // aventually like to this to consume a JSON doc with the channels listed. + var channelToolbarTextField = this.down('#channelToolbarTextField'); + var activeChannelGrid = this.down('#activeChannelGrid'); + var text = channel ? channel : channelToolbarTextField.getValue(); + var split = text.split(","); // not the most elegant way... + for(var i = 0; i < split.length; i = i + 1){ + text = split[i]; + if (text != null && text != '' && activeChannelGrid.getStore().findExact('channel', text) == -1) { + var channelName = text; + activeChannelGrid.getStore().insert(0, {channel:Ext.htmlEncode(text)}); + OWF.Eventing.subscribe(channelName, owfdojo.hitch(this, this.addToGrid)); + } + } + }, clearAllChannels: function() { //check number of channels var activeChannelGrid = this.down('#activeChannelGrid');