FileDocCategorySizeDatePackage
MiniRecentList.javaAPI DocAzureus 3.0.3.45137Thu May 17 12:19:48 BST 2007com.aelitis.azureus.ui.swt.views.skin

MiniRecentList

public class MiniRecentList extends SkinView
author
TuxPaper
created
Sep 30, 2006 TODO Code similaries between MiniRecentList, MiniDownloadList, ManageCdList, and ManageDlList. Need to combine

Fields Summary
private static String
PREFIX
private com.aelitis.azureus.ui.swt.views.TorrentListView
view
private SWTSkinButtonUtility
btnShare
private SWTSkinButtonUtility
btnStop
private SWTSkinButtonUtility
btnDelete
private SWTSkinButtonUtility
btnDetails
private SWTSkinButtonUtility
btnComments
private SWTSkinObjectText
skinHeaderText
private SWTSkinButtonUtility
btnPlay
Constructors Summary
Methods Summary
public java.lang.ObjectshowSupport(SWTSkinObject skinObject, java.lang.Object params)


	      
		final SWTSkin skin = skinObject.getSkin();
		AzureusCore core = AzureusCoreFactory.getSingleton();

		final Composite cData = (Composite) skinObject.getControl();
		Composite cHeaders = null;
		SWTSkinObjectText lblCountArea = null;

		skinObject = skin.getSkinObject(PREFIX + "list-headers");
		if (skinObject != null) {
			cHeaders = (Composite) skinObject.getControl();
		}

		skinObject = skin.getSkinObject(PREFIX + "xOfx");
		if (skinObject instanceof SWTSkinObjectText) {
			lblCountArea = (SWTSkinObjectText) skinObject;
		}

		skinObject = skin.getSkinObject(PREFIX + "header-text");
		if (skinObject instanceof SWTSkinObjectText) {
			skinHeaderText = (SWTSkinObjectText) skinObject;
		}

		skinObject = skin.getSkinObject(PREFIX + "link");
		if (skinObject instanceof SWTSkinObjectText) {
			SWTSkinButtonUtility btn = new SWTSkinButtonUtility(skinObject);
			btn.addSelectionListener(new ButtonListenerAdapter() {
				public void pressed(SWTSkinButtonUtility buttonUtility) {
					skin.setActiveTab(SkinConstants.TABSET_MAIN, "maintabs.library");
				}
			});
		}

		view = new TorrentListView(core, skin, skin.getSkinProperties(), cHeaders,
				lblCountArea, cData, TorrentListView.VIEW_RECENT_DOWNLOADED, true,
				false);

		btnShare = TorrentListViewsUtils.addShareButton(skin, PREFIX, view);
		btnStop = TorrentListViewsUtils.addStopButton(skin, PREFIX, view);
		btnDetails = TorrentListViewsUtils.addDetailsButton(skin, PREFIX, view);
		btnComments = TorrentListViewsUtils.addCommentsButton(skin, PREFIX, view);
		btnPlay = TorrentListViewsUtils.addPlayButton(skin, PREFIX, view, false,
				true);

		skinObject = skin.getSkinObject(PREFIX + "delete");
		if (skinObject instanceof SWTSkinObjectContainer) {
			btnDelete = new SWTSkinButtonUtility(skinObject);

			btnDelete.addSelectionListener(new ButtonListenerAdapter() {
				public void pressed(SWTSkinButtonUtility buttonUtility) {
					TableRowCore[] selectedRows = view.getSelectedRows();
					for (int i = 0; i < selectedRows.length; i++) {
						DownloadManager dm = (DownloadManager) selectedRows[i].getDataSource(true);
						TorrentListViewsUtils.removeDownload(dm, view, true, true);
					}
				}
			});
		}

		SWTSkinButtonUtility[] buttonsNeedingRow = {
			btnDelete,
			btnStop,
		};
		SWTSkinButtonUtility[] buttonsNeedingPlatform = {
			btnDetails,
			btnComments,
			btnShare
		};
		SWTSkinButtonUtility[] buttonsNeedingSingleSelection = {
			btnDetails,
			btnComments,
			btnShare,
		};
		TorrentListViewsUtils.addButtonSelectionDisabler(view, buttonsNeedingRow,
				buttonsNeedingPlatform, buttonsNeedingSingleSelection, btnStop);

		if (skinHeaderText != null) {
			view.addListener(new TorrentListViewListener() {
				public void countChanged() {
					skinHeaderText.setText(MessageText.getString(
							"v3.MainWindow.recentDL", new String[] {
								"" + view.size(true)
							}));
				}
			});
		}

		return null;