FileDocCategorySizeDatePackage
MiniBarManager.javaAPI DocAzureus 3.0.3.44127Sat May 12 17:45:54 BST 2007org.gudy.azureus2.ui.swt.minibar

MiniBarManager

public class MiniBarManager extends Object
author
Allan Crooks

Fields Summary
private boolean
global
private String
type
private ArrayList
minibars
private static final org.gudy.azureus2.core3.util.AEMonitor
minibars_mon
private final org.gudy.azureus2.ui.swt.components.shell.ShellManager
shellManager
private static MiniBarManager
global_instance
Constructors Summary
MiniBarManager(String type)

		this.global = false;
		this.type = type;
	
private MiniBarManager()

		this.global = true;
		this.type = null;
	
Methods Summary
public voidclose(MiniBar mini_bar)

		  	if (mini_bar != null) {
		  		mini_bar.close();
		  	}
		  
public voidclose(java.lang.Object context)

			  MiniBar bar = this.getMiniBarForObject(context);
			  if (bar != null) {bar.close();}
			
public voidcloseAll()

				try {
					minibars_mon.enter();
					for (Iterator iter = new ArrayList(minibars).iterator(); iter.hasNext();) {
						MiniBar bar = (MiniBar) iter.next();
						bar.close();
					}
				}
				finally {
					minibars_mon.exit();
				} 
			
public intcountMiniBars()

		return this.minibars.size();
	
public static org.gudy.azureus2.ui.swt.minibar.MiniBarManagergetManager()

	 
		global_instance = new MiniBarManager();
	
		return global_instance;
	
public MiniBargetMiniBarForObject(java.lang.Object context)

			try {
				minibars_mon.enter();
				for (Iterator iter = minibars.iterator(); iter.hasNext();) {
					MiniBar bar = (MiniBar) iter.next();
					if (bar.hasContext(context)) {return bar;}
				}
				return null;
			}
			finally {
				minibars_mon.exit();
			} 
	  
public java.util.ListIteratorgetMiniBarIterator()

		return this.minibars.listIterator();
	
public org.gudy.azureus2.core3.util.AEMonitorgetMiniBarMonitor()

		return minibars_mon;
	
public org.gudy.azureus2.ui.swt.components.shell.ShellManagergetShellManager()

		return shellManager;
	
public booleanisOpen(java.lang.Object context)

				return this.getMiniBarForObject(context) != null;
			
public booleanrefreshAll()

				try {
					minibars_mon.enter();

					for (Iterator iter = minibars.iterator(); iter.hasNext();) {
						MiniBar bar = (MiniBar) iter.next();
						bar.refresh();
					}
				} finally {
					minibars_mon.exit();
				}
				return false;
			
public voidregister(MiniBar bar)

		shellManager.addWindow(bar.getShell());
	    try {
	    	minibars_mon.enter();
	    	minibars.add(bar);
	    	if (!global) {global_instance.register(bar);}
	    } finally {
	    	minibars_mon.exit();
	    }
	
public voidsetAllVisible(boolean visible)

		try {
			minibars_mon.enter();

			for (Iterator iter = minibars.iterator(); iter.hasNext();) {
				MiniBar bar = (MiniBar) iter.next();
				bar.setVisible(visible);
			}
		}
		finally {
			minibars_mon.exit();
		}
	
public voidunregister(MiniBar bar)

	    try {
	    	minibars_mon.enter();
	    	minibars.remove(bar);
	    	if (!global) {global_instance.unregister(bar);}
	    } finally {
	    	minibars_mon.exit();
	    }