private void initialiseUI()

in taverna-perspective-myexperiment/src/main/java/org/apache/taverna/ui/perspectives/myexperiment/SearchOptionsPanel.java [91:195]


  private void initialiseUI() {
	this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Search Settings "), BorderFactory.createEmptyBorder(5, 5, 5, 5)));

	this.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();

	c.gridx = 0;
	c.gridy = 0;
	c.anchor = GridBagConstraints.WEST;
	this.add(new JLabel("Query"), c);

	c.gridx = 0;
	c.gridy = 1;
	c.gridwidth = 4;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.weightx = 1.0;
	tfSearchQuery = new JTextField();
	tfSearchQuery.setToolTipText("<html>Tips for creating search queries:<br>1) Use wildcards to make more "
		+ "flexible queries. Asterisk (<b>*</b>) matches any zero or more<br>&nbsp;&nbsp;&nbsp;&nbsp;characters (e.g. "
		+ "<b><i>Seq*</i></b> would match <b><i>Sequence</i></b>), question mark (<b>?</b>) matches any single<br>"
		+ "&nbsp;&nbsp;&nbsp;&nbsp;character (e.g. <b><i>Tave?na</i></b> would match <b><i>Taverna</i></b>).<br>"
		+ "2) Enclose the <b><i>\"search query\"</i></b> in double quotes to make exact phrase matching, otherwise<br>"
		+ "&nbsp;&nbsp;&nbsp;&nbsp;items that contain any (or all) words in the <b><i>search query</i></b> will be found.</html>");
	tfSearchQuery.addKeyListener(this);
	this.add(tfSearchQuery, c);

	c.gridx = 4;
	c.gridy = 1;
	c.gridwidth = 1;
	c.fill = GridBagConstraints.NONE;
	c.weightx = 0;
	c.insets = new Insets(0, 5, 0, 0);
	bSearch = new JButton("Search", WorkbenchIcons.searchIcon);
	bSearch.addActionListener(this.clickHandler);
	bSearch.addKeyListener(this);
	this.add(bSearch, c);

	c.gridx = 0;
	c.gridy = 2;
	c.insets = new Insets(10, 0, 3, 0);
	this.add(new JLabel("Search for..."), c);

	c.gridx = 0;
	c.gridy = 3;
	c.gridwidth = 2;
	c.insets = new Insets(0, 0, 0, 0);
	cbSearchAllTypes = new JCheckBox("all resource types", true);
	cbSearchAllTypes.addItemListener(this);
	cbSearchAllTypes.addKeyListener(this);
	this.add(cbSearchAllTypes, c);

	c.gridx = 0;
	c.gridy = 4;
	c.gridwidth = 1;
	c.ipady = 0;
	cbWorkflows = new JCheckBox("workflows", true);
	cbWorkflows.addItemListener(this);
	cbWorkflows.addKeyListener(this);
	this.add(cbWorkflows, c);

	c.gridx = 0;
	c.gridy = 5;
	cbFiles = new JCheckBox("files", true);
	cbFiles.addItemListener(this);
	cbFiles.addKeyListener(this);
	this.add(cbFiles, c);

	c.gridx = 0;
	c.gridy = 6;
	cbPacks = new JCheckBox("packs", true);
	cbPacks.addItemListener(this);
	cbPacks.addKeyListener(this);
	this.add(cbPacks, c);

	c.gridx = 1;
	c.gridy = 4;
	cbUsers = new JCheckBox("users", true);
	cbUsers.addItemListener(this);
	cbUsers.addKeyListener(this);
	this.add(cbUsers, c);

	c.gridx = 1;
	c.gridy = 5;
	cbGroups = new JCheckBox("groups", true);
	cbGroups.addItemListener(this);
	cbGroups.addKeyListener(this);
	this.add(cbGroups, c);

	c.gridx = 3;
	c.gridy = 2;
	c.insets = new Insets(10, 25, 3, 0);
	JLabel jlResultLimit = new JLabel("Result limit");
	this.add(jlResultLimit, c);

	c.gridx = 3;
	c.gridy = 3;
	c.insets = new Insets(0, 25, 0, 0);
	jsResultLimit = new JSpinner(new SpinnerNumberModel(SEARCH_RESULT_LIMIT_INIT, SEARCH_RESULT_LIMIT_MIN, SEARCH_RESULT_LIMIT_MAX, 1));
	jsResultLimit.setPreferredSize(new Dimension(jlResultLimit.getPreferredSize().width, jsResultLimit.getPreferredSize().height));
	this.add(jsResultLimit, c);

	// adding KeyListener to JSpinner directly doesn't make sense; need to attach KeyListener to the text field that is associated with spinner
	tfResultLimitTextField = ((JSpinner.DefaultEditor) this.jsResultLimit.getEditor()).getTextField();
	tfResultLimitTextField.addKeyListener(this);
  }