FileDocCategorySizeDatePackage
ParameterImpl.javaAPI DocAzureus 3.0.3.45415Thu Sep 06 21:59:58 BST 2007org.gudy.azureus2.pluginsimpl.local.ui.config

ParameterImpl

public class ParameterImpl extends Object implements org.gudy.azureus2.plugins.ui.config.EnablerParameter, org.gudy.azureus2.core3.config.ParameterListener
author
epall

Fields Summary
protected org.gudy.azureus2.plugins.PluginConfig
config
private String
key
private String
labelKey
private String
label
private boolean
enabled
private boolean
visible
private List
toDisable
private List
toEnable
private List
listeners
private List
impl_listeners
private ParameterGroupImpl
parameter_group
Constructors Summary
public ParameterImpl(org.gudy.azureus2.plugins.PluginConfig _config, String _key, String _label)

	
	 
	
			
		 			 
		 			 
	
		config	= _config;
		key		= _key;
		labelKey 	= _label;
		label = MessageText.getString(labelKey);
	
Methods Summary
public voidaddConfigParameterListener(ConfigParameterListener l)

		listeners.add(l);
		
		if ( listeners.size() == 1 ){
			
			COConfigurationManager.addParameterListener( key, this );
		}
	
public voidaddDisabledOnSelection(org.gudy.azureus2.plugins.ui.config.Parameter parameter)

	    toDisable.add(parameter);
	  
public voidaddEnabledOnSelection(org.gudy.azureus2.plugins.ui.config.Parameter parameter)

    
	    toEnable.add(parameter);
	  
public voidaddImplListener(ParameterImplListener l)

		impl_listeners.add(l);
	
public voidaddListener(org.gudy.azureus2.plugins.ui.config.ParameterListener l)

		listeners.add(l);
		
		if ( listeners.size() == 1 ){
			
			COConfigurationManager.addParameterListener( key, this );
		}
	
public voiddestroy()

		listeners.clear();
		impl_listeners.clear();
		toDisable.clear();
		toEnable.clear();
		
		COConfigurationManager.removeParameterListener( key, this );
	
public java.util.ListgetDisabledOnSelectionParameters()

	    return toDisable;
	  
public java.util.ListgetEnabledOnSelectionParameters()

	    return toEnable;
	  
public ParameterGroupImplgetGroup()

		return( parameter_group );
	
public java.lang.StringgetKey()

return
Returns the key.

		return key;
	
public java.lang.StringgetLabelKey()

		return labelKey;
	
public java.lang.StringgetLabelText()

		return label;
	
public booleanisEnabled()

		return( enabled );
	
public booleanisVisible()

		return( visible );
	
public voidparameterChanged(java.lang.String key)

		for (int i=0;i<listeners.size();i++){
			
			Object o = listeners.get(i);
			
			if ( o instanceof ParameterListener ){
				
				((ParameterListener)o).parameterChanged( this );
				
			}else{
				
				((ConfigParameterListener)o).configParameterChanged( this );
			}
		}
	
public voidremoveConfigParameterListener(ConfigParameterListener l)

		listeners.remove(l);
		
		if ( listeners.size() == 0 ){
			
			COConfigurationManager.removeParameterListener( key, this );
		}
	
public voidremoveImplListener(ParameterImplListener l)

		impl_listeners.remove(l);
	
public voidremoveListener(org.gudy.azureus2.plugins.ui.config.ParameterListener l)

		listeners.remove(l);
		
		if ( listeners.size() == 0 ){
			
			COConfigurationManager.removeParameterListener( key, this );
		}
	
public voidsetEnabled(boolean e)

		enabled	= e;
				
		for (int i=0;i<impl_listeners.size();i++){

			try{
				((ParameterImplListener)impl_listeners.get(i)).enabledChanged( this );
				
			}catch( Throwable f ){
				
				Debug.printStackTrace(f);
			}
		}
	
public voidsetGroup(ParameterGroupImpl _group)

		parameter_group = _group;
	
public voidsetLabelKey(java.lang.String sLabelKey)

		labelKey = sLabelKey;
		label = MessageText.getString(sLabelKey);

		for (int i = 0; i < impl_listeners.size(); i++) {
			try {
				((ParameterImplListener) impl_listeners.get(i)).labelChanged(this,
						labelKey, true);
			} catch (Throwable f) {
				Debug.printStackTrace(f);
			}
		}
	
public voidsetLabelText(java.lang.String sText)

		labelKey = null;
		label = sText;

		for (int i=0;i<impl_listeners.size();i++){

			try{
				((ParameterImplListener)impl_listeners.get(i)).labelChanged(this, sText, false);
				
			}catch( Throwable f ){
				
				Debug.printStackTrace(f);
			}
		}
	
public voidsetVisible(boolean _visible)

		visible	= _visible;