FileDocCategorySizeDatePackage
IPWModePanel.javaAPI DocAzureus 3.0.3.44614Thu Jul 26 14:46:30 BST 2007org.gudy.azureus2.ui.swt.pluginsinstaller

IPWModePanel

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

Fields Summary
private static final int
MODE_FROM_LIST
private static final int
MODE_FROM_FILE
private int
mode
Constructors Summary
public IPWModePanel(org.gudy.azureus2.ui.swt.wizard.Wizard wizard, org.gudy.azureus2.ui.swt.wizard.IWizardPanel previous)

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

	  switch(mode) {
	    case MODE_FROM_LIST :
	      return new IPWListPanel(wizard,this);
	    
	    case MODE_FROM_FILE :
	      return new IPWFilePanel(wizard,this);
	  }

	  return null;
	
public booleanisNextEnabled()

	   return true;
	
public voidshow()

	  
	int userMode = COConfigurationManager.getIntParameter("User Mode");
	
	wizard.setTitle(MessageText.getString("installPluginsWizard.mode.title"));
	wizard.setErrorMessage("");
	
	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 | GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
	panel.setLayoutData(gridData);
	layout = new GridLayout();
	layout.numColumns = 1;
	panel.setLayout(layout);

	Button bListMode = new Button(panel,SWT.RADIO);
	Messages.setLanguageText(bListMode,"installPluginsWizard.mode.list");
	bListMode.setData("mode",new Integer(MODE_FROM_LIST));
	if(((InstallPluginWizard)wizard).mode == MODE_FROM_LIST) bListMode.setSelection(true);
		
	Button bFileMode = new Button(panel,SWT.RADIO);
	Messages.setLanguageText(bFileMode,"installPluginsWizard.mode.file");
	bFileMode.setData("mode",new Integer(MODE_FROM_FILE));
	if(((InstallPluginWizard)wizard).mode == MODE_FROM_FILE) bFileMode.setSelection(true);
	
	Listener modeListener = new Listener() {
	  public void handleEvent(Event e) {
	    mode = ((Integer) e.widget.getData("mode")).intValue();
	    ((InstallPluginWizard)wizard).mode = mode;
	  }
	};

	bListMode.addListener(SWT.Selection,modeListener);
	bFileMode.addListener(SWT.Selection,modeListener);
	
	if(userMode < 2){
	    Group cWiki = new Group(panel, SWT.WRAP);
	    cWiki.setText(MessageText.getString("installPluginsWizard.installMode.info.title"));
	    gridData = new GridData( GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
	    gridData.verticalIndent = 15;
	    cWiki.setLayoutData(gridData);
	    layout = new GridLayout();
	    layout.numColumns = 4;
	    layout.marginHeight = 0;
	    cWiki.setLayout(layout);
	    
	    gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
	    gridData.horizontalIndent = 10;
	    gridData.horizontalSpan = 4;
	    Label label = new Label(cWiki, SWT.WRAP);
	    label.setLayoutData( gridData );
	    label.setText(MessageText.getString("installPluginsWizard.installMode.info.text"));
	}