FileDocCategorySizeDatePackage
ConfigSectionFileMove.javaAPI DocAzureus 3.0.3.46576Thu Jan 11 10:20:24 GMT 2007org.gudy.azureus2.ui.swt.views.configsections

ConfigSectionFileMove

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

Fields Summary
Constructors Summary
Methods Summary
public CompositeconfigSectionCreate(Composite parent)

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

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

		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		layout.marginHeight = 0;
		gFile.setLayout(layout);

		// Move on complete / deletion.
		createMoveOnEventGrouping(gFile, "ConfigView.label.movecompleted",
				"Move Completed When Done", "Completed Files Directory",
				"Move Torrent When Done", "Move Only When In Default Save Dir", null);
		createMoveOnEventGrouping(gFile, "ConfigView.label.moveremoved",
				"File.move.download.removed.enabled",
				"File.move.download.removed.path",
				"File.move.download.removed.move_torrent",
				"File.move.download.removed.only_in_default",
				"File.move.download.removed.move_partial");

		if (userMode > 0) {
			// copy rather than move

			BooleanParameter copyDontMove = new BooleanParameter(gFile,
					"Copy And Delete Data Rather Than Move",
					"ConfigView.label.copyanddeleteratherthanmove");
			gridData = new GridData();
			gridData.horizontalSpan = 2;
			copyDontMove.setLayoutData(gridData);
		}
		
		BooleanParameter subdirIsDefault = new BooleanParameter(gFile,
				"File.move.subdir_is_default", "ConfigView.label.subdir_is_in_default");
		gridData = new GridData();
		gridData.horizontalSpan = 2;
		subdirIsDefault.setLayoutData(gridData);
		
		return gFile;
	
public voidconfigSectionDelete()

	
public java.lang.StringconfigSectionGetName()

		return ConfigSection.SECTION_FILES + ".move";
	
public java.lang.StringconfigSectionGetParentSection()

		return ConfigSection.SECTION_FILES;
	
public voidconfigSectionSave()

	
private voidcreateMoveOnEventGrouping(Composite gFile, java.lang.String enable_section_label, java.lang.String move_when_done_setting, java.lang.String move_path_setting, java.lang.String move_torrent_setting, java.lang.String move_when_in_save_dir_setting, java.lang.String move_partial_downloads_setting)


		Image imgOpenFolder = ImageRepository.getImage("openFolderButton");

		BooleanParameter moveCompleted = new BooleanParameter(gFile,
				move_when_done_setting, enable_section_label);
		GridData gridData = new GridData();
		GridLayout layout = null;
		gridData.horizontalSpan = 2;
		moveCompleted.setLayoutData(gridData);

		Composite gMoveCompleted = new Composite(gFile, SWT.NULL);
		gridData = new GridData(GridData.FILL_HORIZONTAL);
		gridData.horizontalIndent = 25;
		gridData.horizontalSpan = 2;
		gMoveCompleted.setLayoutData(gridData);
		layout = new GridLayout();
		layout.marginHeight = 0;
		layout.marginWidth = 4;
		layout.numColumns = 3;
		gMoveCompleted.setLayout(layout);

		Label lDir = new Label(gMoveCompleted, SWT.NULL);
		Messages.setLanguageText(lDir, "ConfigView.label.directory");

		gridData = new GridData(GridData.FILL_HORIZONTAL);
		final StringParameter movePath = new StringParameter(gMoveCompleted, move_path_setting);
		movePath.setLayoutData(gridData);

		Button browse3 = new Button(gMoveCompleted, SWT.PUSH);
		browse3.setImage(imgOpenFolder);
		imgOpenFolder.setBackground(browse3.getBackground());
		browse3.setToolTipText(MessageText.getString("ConfigView.button.browse"));

		browse3.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				DirectoryDialog dialog = new DirectoryDialog(gFile.getShell(),
						SWT.APPLICATION_MODAL);
				dialog.setFilterPath(movePath.getValue());
				dialog.setText(MessageText.getString("ConfigView.dialog.choosemovepath"));
				String path = dialog.open();
				if (path != null) {
					movePath.setValue(path);
				}
			}
		});

		// move when done

		BooleanParameter moveTorrent = new BooleanParameter(gMoveCompleted,
				move_torrent_setting, "ConfigView.label.movetorrent");
		gridData = new GridData();
		gridData.horizontalSpan = 2;
		moveTorrent.setLayoutData(gridData);

		// only in default

		BooleanParameter moveOnly = new BooleanParameter(gMoveCompleted,
				move_when_in_save_dir_setting, "ConfigView.label.moveonlyusingdefaultsave");
		gridData = new GridData();
		gridData.horizontalSpan = 2;
		moveOnly.setLayoutData(gridData);

		// move if partially finished.
		if (move_partial_downloads_setting != null) {
			BooleanParameter movePartial = new BooleanParameter(gMoveCompleted,
					move_partial_downloads_setting, "ConfigView.label.movepartialdownloads");
			gridData = new GridData();
			gridData.horizontalSpan = 2;
			movePartial.setLayoutData(gridData);
		}

		Control[] controls3 = new Control[] { gMoveCompleted };
		IAdditionalActionPerformer grayPathAndButton2 = new ChangeSelectionActionPerformer(
				controls3);
		moveCompleted.setAdditionalActionPerformer(grayPathAndButton2);