- this.add(jLabel1, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
- , GridBagConstraints.WEST,
- GridBagConstraints.NONE,
- new Insets(7, 4, 0, 6), 77, 6));
- this.add(jPanel1, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0
- , GridBagConstraints.WEST,
- GridBagConstraints.BOTH,
- new Insets(7, -2, 7, 12), 241, -2));
- this.add(database, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
- , GridBagConstraints.WEST,
- GridBagConstraints.NONE,
- new Insets(0, 4, 0, 0), 1, 0));
- this.add(textfield, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
- , GridBagConstraints.CENTER,
- GridBagConstraints.NONE,
- new Insets(0, 0, 0, 6), 211, 1));
+ jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER);
+ jPanel2.setLayout(borderLayout3);
+ databaseButt = /*database.getDatabaseSelectorButton();
+ final JButton viewdbs =*/new JButton(
+ MessageManager.getString("action.select_ddbb"));
+ databaseButt.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ hidePanel();
+ database.showDialog();
+ }
+ });
+ databaseButt.setFont(JvSwingUtils.getLabelFont());
+ database.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ debounceTrap++;
+ String currentSelection = database.getSelectedItem();
+ if (currentSelection == null)
+ {
+ close_actionPerformed(null);
+ }
+
+ showPanel();
+
+ if (currentSelection.equalsIgnoreCase("pdb")
+ && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) == 0)))
+ {
+ pdbSourceAction();
+ }
+ else if (currentSelection.equalsIgnoreCase("uniprot")
+ && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) == 0)))
+ {
+ uniprotSourceAction();
+ }
+ else
+ {
+ otherSourceAction();
+ }
+ database.action = -1;
+ }
+ });
+
+ dbeg.setText("");
+ jPanel2.add(databaseButt, java.awt.BorderLayout.NORTH);
+ jPanel2.add(dbeg, java.awt.BorderLayout.CENTER);
+ JPanel jPanel2a = new JPanel(new BorderLayout());
+ jPanel2a.add(jLabel1, java.awt.BorderLayout.NORTH);
+ jPanel2a.add(replacePunctuation, java.awt.BorderLayout.SOUTH);
+ jPanel2.add(jPanel2a, java.awt.BorderLayout.SOUTH);
+ // jPanel2.setPreferredSize(new Dimension())
+ jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER);
+ this.add(jPanel1, java.awt.BorderLayout.SOUTH);
+ this.add(jPanel3, java.awt.BorderLayout.CENTER);
+ this.add(jPanel2, java.awt.BorderLayout.NORTH);
+ jScrollPane1.getViewport().add(textArea);
+
+ /*
+ * open the database tree
+ */
+ database.waitForInput();
+ }
+
+ private void pdbSourceAction()
+ {
+ databaseButt.setText(database.getSelectedItem());
+ new PDBFTSPanel(this);
+ frame.dispose();
+ }
+
+ private void uniprotSourceAction()
+ {
+ databaseButt.setText(database.getSelectedItem());
+ new UniprotFTSPanel(this);
+ frame.dispose();
+ }
+ private void otherSourceAction()
+ {
+ try
+ {
+ databaseButt.setText(database.getSelectedItem()
+ + (database.getSelectedSources().size() > 1 ? " (and "
+ + database.getSelectedSources().size() + " others)"
+ : ""));
+ String eq = database.getExampleQueries();
+ dbeg.setText(MessageManager.formatMessage(
+ "label.example_query_param", new String[] { eq }));
+ boolean enablePunct = !(eq != null && eq.indexOf(",") > -1);
+ for (DbSourceProxy dbs : database.getSelectedSources())
+ {
+ if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ {
+ enablePunct = false;
+ break;
+ }
+ }
+ replacePunctuation.setEnabled(enablePunct);
+
+ } catch (Exception ex)
+ {
+ dbeg.setText("");
+ replacePunctuation.setEnabled(true);
+ }
+ jPanel2.repaint();
+ }
+
+ protected void example_actionPerformed()
+ {
+ DbSourceProxy db = null;
+ try
+ {
+ textArea.setText(database.getExampleQueries());
+ } catch (Exception ex)
+ {
+ }
+ jPanel3.repaint();
+ }
+
+ protected void clear_actionPerformed()
+ {
+ textArea.setText("");
+ jPanel3.repaint();