3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
7 FeedPanel = function() {
8 FeedPanel.superclass.constructor.call(this, {
22 root: new Ext.tree.TreeNode('My Feeds'),
27 handler: this.showWindow,
31 iconCls:'delete-icon',
34 var s = this.getSelectionModel().getSelectedNode();
36 this.removeFeed(s.attributes.url);
43 this.feeds = this.root.appendChild(
44 new Ext.tree.TreeNode({
51 this.getSelectionModel().on({
52 'beforeselect' : function(sm, node){
55 'selectionchange' : function(sm, node){
57 this.fireEvent('feedselect', node.attributes);
59 this.getTopToolbar().items.get('delete').setDisabled(!node);
64 this.addEvents({feedselect:true});
66 this.on('contextmenu', this.onContextMenu, this);
69 Ext.extend(FeedPanel, Ext.tree.TreePanel, {
71 onContextMenu : function(node, e){
72 if(!this.menu){ // create context menu on first right click
73 this.menu = new Ext.menu.Menu({
81 this.ctxNode.select();
85 iconCls:'delete-icon',
88 this.ctxNode.ui.removeClass('x-node-ctx');
89 this.removeFeed(this.ctxNode.attributes.url);
95 handler: this.showWindow,
99 this.menu.on('hide', this.onContextHide, this);
102 this.ctxNode.ui.removeClass('x-node-ctx');
107 this.ctxNode.ui.addClass('x-node-ctx');
108 this.menu.items.get('load').setDisabled(node.isSelected());
109 this.menu.showAt(e.getXY());
113 onContextHide : function(){
115 this.ctxNode.ui.removeClass('x-node-ctx');
120 showWindow : function(btn){
122 this.win = new FeedWindow();
123 this.win.on('validfeed', this.addFeed, this);
128 selectFeed: function(url){
129 this.getNodeById(url).select();
132 removeFeed: function(url){
133 var node = this.getNodeById(url);
136 Ext.fly(node.ui.elNode).ghost('l', {
137 callback: node.remove, scope: node, duration: .4
142 addFeed : function(attrs, inactive, preventAnim){
143 var exists = this.getNodeById(attrs.url);
147 exists.ui.highlight();
152 iconCls: 'feed-icon',
157 var node = new Ext.tree.TreeNode(attrs);
158 this.feeds.appendChild(node);
161 Ext.fly(node.ui.elNode).slideIn('l', {
162 callback: node.select, scope: node, duration: .4
171 // prevent the default context menu when you miss the node
172 afterRender : function(){
173 FeedPanel.superclass.afterRender.call(this);
174 this.el.on('contextmenu', function(e){
180 Ext.reg('appfeedpanel', FeedPanel);