FileDocCategorySizeDatePackage
ChooseServicePanel.javaAPI DocAzureus 3.0.3.45075Thu Jan 11 09:01:02 GMT 2007org.gudy.azureus2.ui.swt.ipchecker

ChooseServicePanel

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

Fields Summary
private org.eclipse.swt.widgets.Combo
servicesList
private org.gudy.azureus2.core3.ipchecker.extipchecker.ExternalIPCheckerService[]
services
org.eclipse.swt.widgets.Label
serviceDescription
org.eclipse.swt.widgets.Label
serviceUrl
Constructors Summary
public ChooseServicePanel(IpCheckerWizard wizard, org.gudy.azureus2.ui.swt.wizard.IWizardPanel previousPanel)

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

    return new ProgressPanel((IpCheckerWizard)wizard,this);
  
public booleanisFinishEnabled()

    return true;
  
public voidshow()

    wizard.setTitle(MessageText.getString("ipCheckerWizard.service"));
    wizard.setCurrentInfo(MessageText.getString("ipCheckerWizard.chooseService"));
    Composite rootPanel = wizard.getPanel();
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    rootPanel.setLayout(layout);
    
    Label label = new Label(rootPanel,SWT.WRAP);
    GridData gridData = new GridData();
    gridData.widthHint = 380;    
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
    label.setText(MessageText.getString("ipCheckerWizard.explanations"));
    
    this.servicesList = new Combo(rootPanel,SWT.READ_ONLY);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    servicesList.setLayoutData(gridData);
    
    this.services = ExternalIPCheckerFactory.create().getServices();
    
    for(int i = 0 ; i < services.length ; i++) {
      servicesList.add(services[i].getName());
    }        
        
    label = new Label(rootPanel,SWT.NULL);
    label.setText(MessageText.getString("ipCheckerWizard.service.url"));

    Cursor handCursor = new Cursor(rootPanel.getDisplay(), SWT.CURSOR_HAND);
    
    this.serviceUrl = new Label(rootPanel,SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    serviceUrl.setLayoutData(gridData);
    serviceUrl.setForeground(Colors.blue);
    serviceUrl.setCursor(handCursor);
    serviceUrl.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
      	Utils.launch((String) ((Label) arg0.widget).getText());
      }
      public void mouseDown(MouseEvent arg0) {
      	Utils.launch((String) ((Label) arg0.widget).getText());
      }
    });
    
    servicesList.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        updateInfos();        
      }
    });
    servicesList.select(0);
    
	label = new Label(rootPanel,SWT.NULL);
	gridData = new GridData();
	gridData.heightHint = 50;
	gridData.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
	label.setLayoutData(gridData);
	label.setText(MessageText.getString("ipCheckerWizard.service.description"));
    
	this.serviceDescription = new Label(rootPanel,SWT.WRAP);
	gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 50;
    gridData.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
	serviceDescription.setLayoutData(gridData);

    updateInfos();
    
  
private voidupdateInfos()

    int selection = servicesList.getSelectionIndex();
    serviceDescription.setText(services[selection].getDescription());
    serviceUrl.setText(services[selection].getURL());
    ((IpCheckerWizard)wizard).selectedService = services[selection];
	((IpCheckerWizard)wizard).setFinishEnabled( services[selection].supportsCheck());