private void initialiseUI()

in taverna-perspective-myexperiment/src/main/java/org/apache/taverna/workbench/myexperiment/config/MyExperimentConfigurationPanel.java [87:234]


  private void initialiseUI() {
	// this constraints instance will be shared among all components in the window
	GridBagConstraints c = new GridBagConstraints();

	// create the myExperiment API address box
	JPanel jpApiLocation = new JPanel();
	jpApiLocation.setLayout(new GridBagLayout());

	Insets insLabel = new Insets(0, 0, 0, 10);
	Insets insParam = new Insets(0, 3, 5, 3);

	// Title describing what kind of settings we are configuring here
	JTextArea descriptionText = new JTextArea("Configure the myExperiment integration functionality");
	descriptionText.setLineWrap(true);
	descriptionText.setWrapStyleWord(true);
	descriptionText.setEditable(false);
	descriptionText.setFocusable(false);
	descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
	c.anchor = GridBagConstraints.WEST;
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1.0;
	c.weighty = 0.0;
	c.fill = GridBagConstraints.HORIZONTAL;
	jpApiLocation.add(descriptionText, c);

	c.gridx = 0;
	c.gridy = 1;
	c.weightx = 1.0;
	//c.insets = insLabel;
	c.anchor = GridBagConstraints.WEST;
	c.insets = new Insets(10, 0, 0, 10);
	jpApiLocation.add(new JLabel("Base URL of myExperiment instance to connect to"), c);

	c.gridy = 2;
	//c.insets = insParam;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.insets = new Insets(0, 0, 0, 0);
	this.tfMyExperimentURL = new JTextField();
	this.tfMyExperimentURL.setToolTipText("<html>Here you can specify the base URL of the myExperiment "
		+ "instance that you wish to connect to.<br>This allows the plugin to connect not only to the "
		+ "<b>main myExperiment website</b> (default value:<br><b>http://www.myexperiment.org</b>) but "
		+ "also to any other myExperiment instance that might<br>exist elsewhere.<br><br>It is recommended "
		+ "that you only change this setting if you are certain in your actions.</html>");
	jpApiLocation.add(this.tfMyExperimentURL, c);

	// create startup tab choice box
	JPanel jpStartupTabChoice = new JPanel();
	jpStartupTabChoice.setLayout(new GridBagLayout());

	c.gridy = 0;
	c.insets = insLabel;
	jpStartupTabChoice.add(new JLabel("Default startup tab for anonymous user"), c);

	c.gridx = 1;
	c.insets = insParam;
	this.cbDefaultNotLoggedInTab = new JComboBox(this.alPluginTabComponentNames.toArray());
	this.cbDefaultNotLoggedInTab.setToolTipText("<html>This tab will be automatically opened at plugin start up time if you are <b>not</b> logged id to myExperiment.</html>");
	jpStartupTabChoice.add(this.cbDefaultNotLoggedInTab, c);

	c.gridy = 1;
	c.gridx = 0;
	c.insets = insLabel;
	jpStartupTabChoice.add(new JLabel("Default startup tab after successful auto-login"), c);

	c.gridx = 1;
	c.insets = insParam;
	this.cbDefaultLoggedInTab = new JComboBox(this.alPluginTabComponentNames.toArray());
	this.cbDefaultLoggedInTab.setToolTipText("<html>This tab will be automatically opened at plugin start up time if you have chosen to use <b>auto logging in</b> to myExperiment.</html>");
	jpStartupTabChoice.add(this.cbDefaultLoggedInTab, c);

	// create 'my stuff' tab preference box
	JPanel jpMyStuffPrefs = new JPanel();
	jpMyStuffPrefs.setLayout(new GridBagLayout());

	c.gridx = 0;
	c.gridy = 0;
	c.insets = insLabel;
	jpMyStuffPrefs.add(new JLabel("Sections to show in this tab:"), c);

	c.gridx = 1;
	c.gridy = 0;
	c.weightx = 1.0;
	c.insets = new Insets(insParam.top, 100, insParam.bottom / 3, insParam.right);
	this.cbMyStuffWorkflows = new JCheckBox("My Workflows");
	jpMyStuffPrefs.add(this.cbMyStuffWorkflows, c);

	c.gridy = 1;
	this.cbMyStuffFiles = new JCheckBox("My Files");
	jpMyStuffPrefs.add(this.cbMyStuffFiles, c);

	c.gridy = 2;
	this.cbMyStuffPacks = new JCheckBox("My Packs");
	jpMyStuffPrefs.add(this.cbMyStuffPacks, c);

	// create button panel
	this.bApply = new JButton("Apply");
	this.bApply.addActionListener(this);

	this.bReset = new JButton("Reset");
	this.bReset.addActionListener(this);

	this.bHelp = new JButton("Help");
	this.bHelp.addActionListener(this);

	JPanel jpButtons = new JPanel();
	jpButtons.add(bHelp, c);
	jpButtons.add(bReset, c);
	jpButtons.add(bApply, c);

	// PUT EVERYTHING TOGETHER
	JPanel jpEverything = new JPanel();
	GridBagLayout jpEverythingLayout = new GridBagLayout();
	jpEverything.setLayout(jpEverythingLayout);

	GridBagConstraints gbConstraints = new GridBagConstraints();
	gbConstraints.fill = GridBagConstraints.BOTH;
	c.anchor = GridBagConstraints.NORTHWEST;

	gbConstraints.weightx = 1;
	gbConstraints.gridx = 0;

	gbConstraints.gridy = 0;
	jpEverything.add(jpApiLocation, gbConstraints);

	gbConstraints.gridy++;
	jpEverything.add(jpStartupTabChoice, gbConstraints);

	gbConstraints.gridy++;
	jpEverything.add(jpMyStuffPrefs, gbConstraints);

	gbConstraints.gridy++;
	c.insets = new Insets(10, 0, 0, 0);
	jpEverything.add(jpButtons, gbConstraints);

	BorderLayout layout = new BorderLayout();
	this.setLayout(layout);
	this.add(jpEverything, BorderLayout.NORTH);

	if (MyExperimentClient.baseChangedSinceLastStart) {
	  JPanel jpInfo = new JPanel();
	  jpInfo.setLayout(new BoxLayout(jpInfo, BoxLayout.Y_AXIS));
	  String info = "<html>Your myExperiment base url has been modified since Taverna was started;<br>"
		  + "this change will not take effect until you restart Taverna.</html>";
	  jpInfo.add(new JLabel(info, WorkbenchIcons.leafIcon, SwingConstants.LEFT));
	  this.add(jpInfo, BorderLayout.SOUTH);
	}
  }