FileDocCategorySizeDatePackage
ConfigSectionQueue.javaAPI DocAzureus 3.0.3.47982Tue Nov 14 19:07:22 GMT 2006com.aelitis.azureus.plugins.startstoprules.defaultplugin.ui.swt

ConfigSectionQueue

public class ConfigSectionQueue extends Object implements org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection
General Queueing options
author
TuxPaper
created
Jan 12, 2004

Fields Summary
Constructors Summary
Methods Summary
public org.eclipse.swt.widgets.CompositeconfigSectionCreate(org.eclipse.swt.widgets.Composite parent)
Create the "Queue" Tab in the Configuration view

		GridData gridData;
		GridLayout layout;
		Label label;

		// main tab set up

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

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

		// row

		label = new Label(cSection, SWT.NULL);
		Messages.setLanguageText(label, "ConfigView.label.maxdownloads");
		gridData = new GridData();
		gridData.widthHint = 40;
		final IntParameter maxDLs = new IntParameter(cSection, "max downloads");
		maxDLs.setLayoutData(gridData);

		// row

		label = new Label(cSection, SWT.NULL);
		Messages.setLanguageText(label, "ConfigView.label.maxactivetorrents");
		gridData = new GridData();
		gridData.widthHint = 40;
		final IntParameter maxActiv = new IntParameter(cSection,
				"max active torrents");
		maxActiv.setLayoutData(gridData);

		final Composite cMaxActiveOptionsArea = new Composite(cSection, SWT.NULL);
		layout = new GridLayout();
		layout.numColumns = 3;
		layout.marginWidth = 0;
		layout.marginHeight = 0;
		cMaxActiveOptionsArea.setLayout(layout);
		gridData = new GridData();
		gridData.horizontalIndent = 15;
		gridData.horizontalSpan = 2;
		cMaxActiveOptionsArea.setLayoutData(gridData);

		label = new Label(cMaxActiveOptionsArea, SWT.NULL);
		Image img = ImageRepository.getImage("subitem");
		img.setBackground(label.getBackground());
		gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
		label.setLayoutData(gridData);
		label.setImage(img);

		gridData = new GridData();
		BooleanParameter maxActiveWhenSeedingEnabled = new BooleanParameter(
				cMaxActiveOptionsArea,
				"StartStopManager_bMaxActiveTorrentsWhenSeedingEnabled",
				"ConfigView.label.queue.maxactivetorrentswhenseeding");
		maxActiveWhenSeedingEnabled.setLayoutData(gridData);

		gridData = new GridData();
		gridData.widthHint = 40;

		final IntParameter maxActivWhenSeeding = new IntParameter(
				cMaxActiveOptionsArea, "StartStopManager_iMaxActiveTorrentsWhenSeeding");
		maxActivWhenSeeding.setLayoutData(gridData);

		// row

		label = new Label(cSection, SWT.NULL);
		Messages.setLanguageText(label, "ConfigView.label.mindownloads");
		gridData = new GridData();
		gridData.widthHint = 40;
		final IntParameter minDLs = new IntParameter(cSection, "min downloads");
		minDLs.setLayoutData(gridData);
		minDLs.setMaximumValue(maxDLs.getValue() / 2);
		
		// change controllers for above items

		maxActiveWhenSeedingEnabled.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
				maxActivWhenSeeding));

		maxDLs.addChangeListener(new ParameterChangeAdapter() {
			public void parameterChanged(Parameter p, boolean caused_internally) {
				int iMaxDLs = maxDLs.getValue();
				minDLs.setMaximumValue(iMaxDLs / 2);

				int iMinDLs = minDLs.getValue();
				int iMaxActive = maxActiv.getValue();
				
				if ((iMaxDLs == 0 || iMaxDLs > iMaxActive) && iMaxActive != 0) {
					maxActiv.setValue(iMaxDLs);
				}
			}
		});

		maxActiv.addChangeListener(new ParameterChangeAdapter() {
			public void parameterChanged(Parameter p, boolean caused_internally) {
				int iMaxDLs = maxDLs.getValue();
				int iMaxActive = maxActiv.getValue();

				if ((iMaxDLs == 0 || iMaxDLs > iMaxActive) && iMaxActive != 0) {
					maxDLs.setValue(iMaxActive);
				}
			}
		});

		
		// row

		label = new Label(cSection, SWT.NULL);
		Messages.setLanguageText(label, "ConfigView.label.minSpeedForActiveDL");
		final String activeDLLabels[] = new String[57];
		final int activeDLValues[] = new int[57];
		int pos = 0;
		for (int i = 0; i < 256; i += 64) {
			activeDLValues[pos] = i;
			activeDLLabels[pos] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
					activeDLValues[pos], true);
			pos++;
		}
		for (int i = 256; i < 1024; i += 256) {
			activeDLValues[pos] = i;
			activeDLLabels[pos] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
					activeDLValues[pos], true);
			pos++;
		}
		for (int i = 1; pos < activeDLLabels.length; i++) {
			activeDLValues[pos] = i * 1024;
			activeDLLabels[pos] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
					activeDLValues[pos], true);
			pos++;
		}
		new IntListParameter(cSection, "StartStopManager_iMinSpeedForActiveDL",
				activeDLLabels, activeDLValues);

		// row

		label = new Label(cSection, SWT.NULL);
		Messages.setLanguageText(label, "ConfigView.label.minSpeedForActiveSeeding");
		final String activeSeedingLabels[] = new String[27];
		final int activeSeedingValues[] = new int[27];
		pos = 0;

		for (int i = 0; i < 256; i += 64) {
			activeSeedingValues[pos] = i;
			activeSeedingLabels[pos] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
					activeSeedingValues[pos], true);
			pos++;
		}
		for (int i = 256; i < 1024; i += 256) {
			activeSeedingValues[pos] = i;
			activeSeedingLabels[pos] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
					activeSeedingValues[pos], true);
			pos++;
		}
		for (int i = 1; pos < activeSeedingLabels.length; i++) {
			activeSeedingValues[pos] = i * 1024;
			activeSeedingLabels[pos] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
					activeSeedingValues[pos], true);
			pos++;
		}
		new IntListParameter(cSection,
				"StartStopManager_iMinSpeedForActiveSeeding", activeSeedingLabels,
				activeSeedingValues);

		// row

		gridData = new GridData();
		gridData.horizontalSpan = 2;
		new BooleanParameter(cSection, "StartStopManager_bNewSeedsMoveTop",
				"ConfigView.label.queue.newseedsmovetop").setLayoutData(gridData);

		// row

		gridData = new GridData();
		gridData.horizontalSpan = 2;
		new BooleanParameter(cSection, "Alert on close",
				"ConfigView.label.showpopuponclose").setLayoutData(gridData);

		//row 

		gridData = new GridData();
		gridData.horizontalSpan = 2;
		new BooleanParameter(cSection, "StartStopManager_bDebugLog",
				"ConfigView.label.queue.debuglog").setLayoutData(gridData);

		return cSection;
	
public voidconfigSectionDelete()

	
public java.lang.StringconfigSectionGetName()

		return "queue";
	
public java.lang.StringconfigSectionGetParentSection()

		return ConfigSection.SECTION_ROOT;
	
public voidconfigSectionSave()