FileDocCategorySizeDatePackage
PeerSuperView.javaAPI DocAzureus 3.0.3.46238Sun Sep 23 11:30:30 BST 2007org.gudy.azureus2.ui.swt.views

PeerSuperView

public class PeerSuperView extends org.gudy.azureus2.ui.swt.views.table.impl.TableViewTab implements org.gudy.azureus2.ui.swt.views.table.TableViewSWTMenuFillListener, org.gudy.azureus2.core3.download.DownloadManagerPeerListener, org.gudy.azureus2.core3.global.GlobalManagerListener, TableLifeCycleListener
author
Olivier
author
TuxPaper 2004/Apr/20: Use TableRowImpl instead of PeerRow 2004/Apr/20: Remove need for tableItemToObject 2004/Apr/21: extends TableView instead of IAbstractView
author
MjrTom 2005/Oct/08: Add PieceItem

Fields Summary
private static final TableColumnCore[]
basicItems
private org.gudy.azureus2.core3.global.GlobalManager
g_manager
private org.gudy.azureus2.ui.swt.views.table.TableViewSWT
tv
private Shell
shell
private boolean
active_listener
Constructors Summary
public PeerSuperView(org.gudy.azureus2.core3.global.GlobalManager gm)
Initialize



      
     
		tv = new TableViewSWTImpl(TableManager.TABLE_ALL_PEERS, "AllPeersView",
				basicItems, "connected_time", SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
		setTableView(tv);
		tv.setRowDefaultHeight(16);
		tv.setEnableTabViews(true);
		tv.setCoreTabViews(new IView[] {
			new PeerInfoView(),
			new LoggerView()
		});
		tv.addLifeCycleListener(this);
		tv.addMenuFillListener(this);
		
		this.g_manager = gm; 
	
Methods Summary
private voidaddExistingDatasources()
Add datasources already in existance before we called addListener. Faster than allowing addListener to call us one datasource at a time.

		if (g_manager == null || tv.isDisposed()) {
			return;
		}

		ArrayList sources = new ArrayList();
		Iterator itr = g_manager.getDownloadManagers().iterator();
		while (itr.hasNext()) {
			Object[] peers = ((DownloadManager)itr.next()).getCurrentPeers();
			if (peers != null) {
				sources.addAll(Arrays.asList(peers));
			}
		}
		if (sources.isEmpty()) {
			return;
		}
		
		tv.addDataSources(sources.toArray());
		tv.processDataSourceQueue();
	
public voidaddThisColumnSubMenu(java.lang.String columnName, Menu menuThisColumn)

public voiddestroyInitiated()

public voiddestroyed()

public voiddownloadManagerAdded(org.gudy.azureus2.core3.download.DownloadManager dm)

		dm.addPeerListener(this, !this.active_listener);
	
public voiddownloadManagerRemoved(org.gudy.azureus2.core3.download.DownloadManager dm)

		dm.removePeerListener(this);
	
public voidfillMenu(Menu menu)

		PeersView.fillMenu(menu, tv, shell, false);
	
public voidpeerAdded(org.gudy.azureus2.core3.peer.PEPeer created)

    tv.addDataSource(created);
  
public voidpeerManagerAdded(org.gudy.azureus2.core3.peer.PEPeerManager manager)

public voidpeerManagerRemoved(org.gudy.azureus2.core3.peer.PEPeerManager manager)

public voidpeerManagerWillBeAdded(org.gudy.azureus2.core3.peer.PEPeerManager peer_manager)

public voidpeerRemoved(org.gudy.azureus2.core3.peer.PEPeer removed)

    tv.removeDataSource(removed);
  
public voidpieceAdded(org.gudy.azureus2.core3.peer.PEPiece piece)

public voidpieceRemoved(org.gudy.azureus2.core3.peer.PEPiece piece)

private voidregisterGlobalManagerListener()

		this.active_listener = false;
  		try {g_manager.addListener(this);}
  		finally {this.active_listener = true;}
		addExistingDatasources();
	
public voidseedingStatusChanged(boolean seeding_only_mode)

public voidtableViewDestroyed()

		unregisterListeners();
	
public voidtableViewInitialized()

		if (tv instanceof TableViewSWT) {
			shell = ((TableViewSWT)tv).getComposite().getShell();
		} else {
			shell = Utils.findAnyShell();
		}
		registerGlobalManagerListener();
	
private voidunregisterListeners()

		if (this.g_manager == null) {return;}
		this.g_manager.removeListener(this);
		Iterator itr = g_manager.getDownloadManagers().iterator();
		while(itr.hasNext()) {
			DownloadManager dm = (DownloadManager)itr.next();
			downloadManagerRemoved(dm);
		}