~smaioli/azureus/ubuntu-experimental

« back to all changes in this revision

Viewing changes to com/aelitis/azureus/ui/swt/views/skin/MiniRecentList.java

MergedĀ VuzeĀ 4.2.0.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * Copyright (C) 2006 Aelitis, All Rights Reserved.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version.
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
 
 * GNU General Public License for more details.
12
 
 * You should have received a copy of the GNU General Public License
13
 
 * along with this program; if not, write to the Free Software
14
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15
 
 *
16
 
 * AELITIS, SAS au capital de 63.529,40 euros
17
 
 * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
18
 
 *
19
 
 */
20
 
 
21
 
package com.aelitis.azureus.ui.swt.views.skin;
22
 
 
23
 
import org.gudy.azureus2.core3.internat.MessageText;
24
 
 
25
 
import com.aelitis.azureus.ui.swt.skin.*;
26
 
import com.aelitis.azureus.ui.swt.skin.SWTSkinButtonUtility.ButtonListenerAdapter;
27
 
import com.aelitis.azureus.ui.swt.views.TorrentListView;
28
 
import com.aelitis.azureus.ui.swt.views.TorrentListViewListener;
29
 
import com.aelitis.azureus.ui.swt.views.skin.sidebar.SideBar;
30
 
 
31
 
/**
32
 
 * @author TuxPaper
33
 
 * @created Sep 30, 2006
34
 
 *
35
 
 * TODO Code similaries between MiniRecentList, MiniDownloadList, ManageCdList, 
36
 
 *     and ManageDlList.  Need to combine
37
 
 */
38
 
public class MiniRecentList
39
 
        extends SkinView
40
 
{
41
 
        private static String PREFIX = "minirecent-";
42
 
 
43
 
        private TorrentListView view;
44
 
 
45
 
        private SWTSkinObjectText skinHeaderText;
46
 
 
47
 
        public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
48
 
                final SWTSkin skin = skinObject.getSkin();
49
 
 
50
 
                skinObject = skin.getSkinObject(PREFIX + "header-text");
51
 
                if (skinObject instanceof SWTSkinObjectText) {
52
 
                        skinHeaderText = (SWTSkinObjectText) skinObject;
53
 
                }
54
 
 
55
 
                skinObject = skin.getSkinObject(PREFIX + "link");
56
 
                if (skinObject instanceof SWTSkinObjectText) {
57
 
                        SWTSkinButtonUtility btn = new SWTSkinButtonUtility(skinObject);
58
 
                        btn.addSelectionListener(new ButtonListenerAdapter() {
59
 
                                public void pressed(SWTSkinButtonUtility buttonUtility, SWTSkinObject skinObject, int stateMask) {
60
 
                                        SideBar sidebar = (SideBar)SkinViewManager.getByClass(SideBar.class);
61
 
                                        if (sidebar != null) {
62
 
                                                sidebar.showItemByID(SideBar.SIDEBAR_SECTION_LIBRARY);
63
 
                                        }
64
 
                                }
65
 
                        });
66
 
                }
67
 
 
68
 
                view = new TorrentListView(this, PREFIX,
69
 
                                TorrentListView.VIEW_RECENT_DOWNLOADED, true, false);
70
 
 
71
 
                if (skinHeaderText != null) {
72
 
                        view.addListener(new TorrentListViewListener() {
73
 
                                public void countChanged() {
74
 
                                        skinHeaderText.setText(MessageText.getString(
75
 
                                                        "v3.MainWindow.recentDL", new String[] {
76
 
                                                                "" + view.size(true)
77
 
                                                        }));
78
 
                                }
79
 
                        });
80
 
                }
81
 
 
82
 
                return null;
83
 
        }
84
 
}