3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * @class FeedViewer.FeedDetail
17 * @extends Ext.panel.Panel
19 * Shows the details of a particular feed
22 * Create a new Feed Detail
23 * @param {Object} config The config object
25 Ext.define('FeedViewer.FeedDetail', {
27 extend: 'Ext.panel.Panel',
28 alias: 'widget.feeddetail',
32 initComponent: function(){
33 this.display = Ext.create('widget.feedpost', {});
36 items: [this.createGrid(), this.createSouth(), this.createEast()]
38 this.relayEvents(this.display, ['opentab']);
39 this.relayEvents(this.grid, ['rowdblclick']);
40 this.callParent(arguments);
47 loadFeed: function(url){
48 this.grid.loadFeed(url);
52 * Creates the feed grid
54 * @return {FeedViewer.FeedGrid} feedGrid
56 createGrid: function(){
57 this.grid = Ext.create('widget.feedgrid', {
59 dockedItems: [this.createTopToolbar()],
68 this.loadFeed(this.url);
73 * Fires when a grid row is selected
75 * @param {FeedViewer.FeedGrid} grid
76 * @param {Ext.data.Model} rec
78 onSelect: function(grid, rec) {
79 this.display.setActive(rec);
83 * Creates top controller toolbar.
85 * @return {Ext.toolbar.Toolbar} toolbar
87 createTopToolbar: function(){
88 this.toolbar = Ext.create('widget.toolbar', {
89 cls: 'x-docked-noborder-top',
94 handler: this.onOpenAllClick
98 prependText: 'Preview: ',
101 changeHandler: this.readingPaneChange,
107 iconCls:'preview-bottom'
110 iconCls:'preview-right'
113 iconCls:'preview-hide'
122 toggleHandler: this.onSummaryToggle
129 * Reacts to the open all being clicked
132 onOpenAllClick: function(){
133 this.fireEvent('openall', this);
137 * Gets a list of titles/urls for each feed.
138 * @return {Array} The feed details
140 getFeedData: function(){
141 return this.grid.store.getRange();
146 * @param {Ext.button.Button} button The button
147 * @param {Boolean} pressed Whether the button is pressed
149 onSummaryToggle: function(btn, pressed) {
150 this.grid.getComponent('view').getPlugin('preview').toggleExpanded(pressed);
154 * Handle the checked item being changed
156 * @param {Ext.menu.CheckItem} item The checked item
158 readingPaneChange: function(cycle, activeItem){
159 switch (activeItem.text) {
163 this.south.add(this.display);
168 this.east.add(this.display);
178 * Create the south region container
180 * @return {Ext.panel.Panel} south
182 createSouth: function(){
183 this.south = Ext.create('Ext.container.Container', {
195 * Create the east region container
197 * @return {Ext.panel.Panel} east
199 createEast: function(){
200 this.east = Ext.create('Ext.panel.Panel', {