FileDocCategorySizeDatePackage
FilePanel.javaAPI DocAzureus 3.0.3.45288Mon Aug 21 05:58:28 BST 2006org.gudy.azureus2.ui.swt.config.wizard

FilePanel

public class FilePanel extends org.gudy.azureus2.ui.swt.wizard.AbstractWizardPanel
author
Olivier

Fields Summary
Constructors Summary
public FilePanel(ConfigureWizard wizard, org.gudy.azureus2.ui.swt.wizard.IWizardPanel previous)

    super(wizard, previous);
  
Methods Summary
public org.gudy.azureus2.ui.swt.wizard.IWizardPanelgetFinishPanel()

    return new FinishPanel(((ConfigureWizard)wizard),this);
  
public voidshow()

    
    wizard.setTitle(MessageText.getString("configureWizard.file.title"));
    //wizard.setCurrentInfo(MessageText.getString("configureWizard.nat.hint"));
    Composite rootPanel = wizard.getPanel();
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    rootPanel.setLayout(layout);

    Composite panel = new Composite(rootPanel, SWT.NULL);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    panel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    panel.setLayout(layout);

    Label label = new Label(panel, SWT.WRAP);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "configureWizard.file.message1");
    
    label = new Label(panel,SWT.NULL);
    label.setLayoutData(new GridData());
    Messages.setLanguageText(label, "configureWizard.file.path");
    
    final Text textPath = new Text(panel,SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 100;
    textPath.setLayoutData(gridData);
    textPath.setText(((ConfigureWizard)wizard).torrentPath);
    
    Button browse = new Button(panel,SWT.PUSH);
    Messages.setLanguageText(browse, "configureWizard.file.browse");
    browse.setLayoutData(new GridData());
    browse.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event arg0) {
        DirectoryDialog dd = new DirectoryDialog(wizard.getWizardWindow());
        dd.setFilterPath(textPath.getText());
        String path = dd.open();
        if(path != null) {
          textPath.setText(path);
        }     
      }
    });
    
    textPath.addListener(SWT.Modify, new Listener() {
      public void handleEvent(Event event) {
        String path = textPath.getText();
        ((ConfigureWizard)wizard).torrentPath = path;
        try {
          File f = new File(path);
          if(f.exists() && f.isDirectory()) {
            wizard.setErrorMessage("");
            wizard.setFinishEnabled(true);
          } else {
            wizard.setErrorMessage(MessageText.getString("configureWizard.file.invalidPath"));
            wizard.setFinishEnabled(false);
          }            
        } catch(Exception e) {
          wizard.setErrorMessage(MessageText.getString("configureWizard.file.invalidPath"));
          wizard.setFinishEnabled(false);
        }
      }
    });
    
    textPath.setText(((ConfigureWizard)wizard).torrentPath);
    
    /* during config we really shouldn't be confusing the user with questions about fast resume
     * It is extremely unlikely anyone will want to turn it off anyway
     
    label = new Label(panel, SWT.WRAP);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "configureWizard.file.message2");
    
    final Button fastResume = new Button(panel,SWT.CHECK);
    Messages.setLanguageText(fastResume, "configureWizard.file.fastResume");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    fastResume.setLayoutData(gridData);

    fastResume.setSelection(((ConfigureWizard)wizard).fastResume);
    fastResume.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event arg0) {
        ((ConfigureWizard)wizard).fastResume = fastResume.getSelection();
      }
    });
	*/