private void initialiseUI()

in taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/PluginPreferencesDialog.java [101:254]


  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.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " myExperiment Location "), BorderFactory.createEmptyBorder(0, 5, 5, 5)));
	jpApiLocation.setLayout(new GridBagLayout());

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

	c.gridy = 1;
	c.fill = GridBagConstraints.HORIZONTAL;
	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.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Plugin Start-up Settings "), BorderFactory.createEmptyBorder(0, 5, 5, 5)));
	jpStartupTabChoice.setLayout(new GridBagLayout());

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

	c.gridx = 1;
	c.weightx = 1.0;
	c.insets = new Insets(0, 0, 2, 0);
	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.gridx = 0;
	c.gridy = 1;
	c.weightx = 0;
	c.insets = new Insets(0, 0, 0, 10);
	jpStartupTabChoice.add(new JLabel("Default startup tab after successful auto-login"), c);

	c.gridx = 1;
	c.weightx = 1.0;
	c.insets = new Insets(2, 0, 0, 0);
	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.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " 'My Stuff' Tab Settings "), BorderFactory.createEmptyBorder(0, 5, 5, 5)));
	jpMyStuffPrefs.setLayout(new GridBagLayout());

	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 0;
	c.insets = new Insets(0, 0, 0, 0);
	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(0, 10, 0, 0);
	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 privacy settings box
	JPanel jpPrivacySettings = new JPanel();
	jpPrivacySettings.setLayout(new BoxLayout(jpPrivacySettings, BoxLayout.Y_AXIS));
	jpPrivacySettings.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Privacy Settings "), BorderFactory.createEmptyBorder(0, 7, 5, 5)));

	this.jclClearPreviewHistory = new JClickableLabel("Clear browsing history", "clear_preview_history", this);
	jpPrivacySettings.add(this.jclClearPreviewHistory);

	this.jclClearSearchHistory = new JClickableLabel("Clear search history", "clear_search_history", this);
	this.jclClearSearchHistory.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
	jpPrivacySettings.add(this.jclClearSearchHistory);

	this.jclClearFavouriteSearches = new JClickableLabel("Clear favourite searches", "clear_favourite_searches", this);
	this.jclClearFavouriteSearches.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
	jpPrivacySettings.add(this.jclClearFavouriteSearches);

	// create button panel
	this.bSave = new JButton("Save");
	this.bSave.addActionListener(this);

	this.bCancel = new JButton("Cancel");
	this.bCancel.addActionListener(this);

	JPanel jpButtons = new JPanel();
	jpButtons.setLayout(new GridBagLayout());

	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 0;
	c.insets = new Insets(0, 0, 0, 2);
	jpButtons.add(bSave, c);

	c.gridx = 1;
	c.insets = new Insets(0, 2, 0, 0);
	jpButtons.add(bCancel, c);

	// PUT EVERYTHING TOGETHER
	this.setTitle("myExperiment Plugin Preferences");
	BorderLayout layout = new BorderLayout();
	JPanel jpEverything = new JPanel();
	GridBagLayout jpEverythingLayout = new GridBagLayout();
	jpEverything.setLayout(jpEverythingLayout);
	this.getContentPane().setLayout(layout);

	GridBagConstraints gbConstraints = new GridBagConstraints();
	gbConstraints.fill = GridBagConstraints.BOTH;
	gbConstraints.weightx = 1;
	gbConstraints.gridx = 0;

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

	gbConstraints.gridy = 1;
	jpEverything.add(jpStartupTabChoice, gbConstraints);

	gbConstraints.gridy = 2;
	jpEverything.add(jpMyStuffPrefs, gbConstraints);

	gbConstraints.gridy = 3;
	jpEverything.add(jpPrivacySettings, gbConstraints);

	gbConstraints.gridy = 4;
	jpEverything.add(jpButtons, gbConstraints);

	this.add(jpEverything);
	this.setResizable(false);

	// pack() sets preferred size of the dialog box;
	// after this, can set the minimum size to that value too
	this.pack();
	this.setMinimumSize(this.getPreferredSize());
  }