FileDocCategorySizeDatePackage
ConfigSectionTransferAutoSpeed.javaAPI DocAzureus 3.0.3.47100Wed Jun 13 14:43:26 BST 2007org.gudy.azureus2.ui.swt.views.configsections

ConfigSectionTransferAutoSpeed

public class ConfigSectionTransferAutoSpeed extends Object implements org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection

Fields Summary
private final String
CFG_PREFIX
Constructors Summary
Methods Summary
public org.eclipse.swt.widgets.CompositeconfigSectionCreate(org.eclipse.swt.widgets.Composite parent)

		GridData gridData;

		Composite cSection = new Composite(parent, SWT.NULL);

		gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
		cSection.setLayoutData(gridData);
		GridLayout advanced_layout = new GridLayout();
		advanced_layout.numColumns = 2;
		cSection.setLayout(advanced_layout);

		int userMode = COConfigurationManager.getIntParameter("User Mode");

		
		Label linfo = new Label(cSection, SWT.WRAP);
		Messages.setLanguageText( linfo, CFG_PREFIX + "info" );
		gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 300;
		gridData.horizontalSpan = 2;
		linfo.setLayoutData(gridData);
		
		gridData = new GridData();
		gridData.horizontalSpan = 2;
		new LinkLabel(cSection, gridData, "ConfigView.label.please.visit.here",
				"http://azureus.aelitis.com/wiki/index.php/Auto_Speed");

		
		String[]	units = { DisplayFormatters.getRateUnit( DisplayFormatters.UNIT_KB )};

			// min up
		
		Label llmux = new Label(cSection, SWT.NULL);
		Messages.setLanguageText( llmux, CFG_PREFIX + "minupload", units );
		IntParameter min_upload = new IntParameter(cSection,
				"AutoSpeed Min Upload KBs");
		gridData = new GridData();
		gridData.widthHint = 40;
		min_upload.setLayoutData(gridData);
		
			// max up
		
		Label llmdx = new Label(cSection, SWT.NULL);
		Messages.setLanguageText( llmdx, CFG_PREFIX + "maxupload", units );
		IntParameter max_upload = new IntParameter(cSection,
				"AutoSpeed Max Upload KBs");
		gridData = new GridData();
		gridData.widthHint = 40;
		max_upload.setLayoutData(gridData);

        
        if ( userMode > 0 ){
			
			BooleanParameter enable_down_adj = new BooleanParameter(
					cSection, "AutoSpeed Download Adj Enable",
					CFG_PREFIX + "enabledownadj" );
			gridData = new GridData();
			gridData.horizontalSpan = 2;
			enable_down_adj.setLayoutData(gridData);

			
			Label label = new Label(cSection, SWT.NULL);
			Messages.setLanguageText( label, CFG_PREFIX + "downadjratio" );
			
			FloatParameter down_adj = new FloatParameter( cSection, "AutoSpeed Download Adj Ratio", 0, Float.MAX_VALUE, false, 2  );
			gridData = new GridData();
			gridData.widthHint = 40;
			down_adj.setLayoutData(gridData);
			

			enable_down_adj.setAdditionalActionPerformer(
		    		new ChangeSelectionActionPerformer( new Control[]{ down_adj.getControl()}));
		}
		
		if ( userMode > 1 ){
			
				// max inc
			
			Label label = new Label(cSection, SWT.NULL);
			Messages.setLanguageText( label, CFG_PREFIX + "maxinc", units );
			
			final IntParameter max_increase = new IntParameter(cSection,
					"AutoSpeed Max Increment KBs");
			gridData = new GridData();
			gridData.widthHint = 40;
			max_increase.setLayoutData(gridData);
			
				// max dec
			
			label = new Label(cSection, SWT.NULL);
			Messages.setLanguageText( label, CFG_PREFIX + "maxdec", units );
			
			final IntParameter max_decrease = new IntParameter(cSection,
					"AutoSpeed Max Decrement KBs");
			gridData = new GridData();
			gridData.widthHint = 40;
			max_decrease.setLayoutData(gridData);
			

				// choking ping
			
			label = new Label(cSection, SWT.NULL);
			Messages.setLanguageText( label, CFG_PREFIX + "chokeping" );

			final IntParameter choke_ping = new IntParameter(cSection,
					"AutoSpeed Choking Ping Millis");
			gridData = new GridData();
			gridData.widthHint = 40;
			choke_ping.setLayoutData(gridData);
			
				// forced min
			
			label = new Label(cSection, SWT.NULL);
			Messages.setLanguageText( label, CFG_PREFIX + "forcemin", units );
			
			final IntParameter forced_min = new IntParameter(cSection,
					"AutoSpeed Forced Min KBs");
			gridData = new GridData();
			gridData.widthHint = 40;
			forced_min.setLayoutData(gridData);

				// latency
			
			label = new Label(cSection, SWT.NULL);
			Messages.setLanguageText( label, CFG_PREFIX + "latencyfactor" );

			final IntParameter latency_factor = new IntParameter(cSection,
					"AutoSpeed Latency Factor", 1, Integer.MAX_VALUE);
			gridData = new GridData();
			gridData.widthHint = 40;
			latency_factor.setLayoutData(gridData);

		    Label reset_label = new Label(cSection, SWT.NULL );
		    Messages.setLanguageText(reset_label, CFG_PREFIX + "reset");

		    Button reset_button = new Button(cSection, SWT.PUSH);

		    Messages.setLanguageText(reset_button, CFG_PREFIX + "reset.button" );

		    reset_button.addListener(SWT.Selection, 
		    		new Listener() 
					{
				        public void 
						handleEvent(Event event) 
				        {
				        	max_increase.resetToDefault();
				        	max_decrease.resetToDefault();
				        	choke_ping.resetToDefault();
				        	latency_factor.resetToDefault();
				        	forced_min.resetToDefault();
				        }
				    });
		    
			BooleanParameter debug_au = new BooleanParameter(
					cSection, "Auto Upload Speed Debug Enabled",
					CFG_PREFIX + "enabledebug" );
			gridData = new GridData();
			gridData.horizontalSpan = 2;
			debug_au.setLayoutData(gridData);			
		}

		return cSection;

	
public voidconfigSectionDelete()

	
public java.lang.StringconfigSectionGetName()

		return "transfer.autospeed";
	
public java.lang.StringconfigSectionGetParentSection()

	
	   
        return "transfer.select";
    
public voidconfigSectionSave()