- jPanel1.add(ok);
- jPanel1.add(close);
- 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));
+
+ JPanel actionPanel = new JPanel();
+ actionPanel.add(backBtn);
+ actionPanel.add(exampleBtn);
+ actionPanel.add(clear);
+ actionPanel.add(okBtn);
+ actionPanel.add(closeBtn);
+
+ JPanel databasePanel = new JPanel();
+ databasePanel.setLayout(new BorderLayout());
+ databasePanel.add(database, BorderLayout.NORTH);
+ databasePanel.add(exampleAccession, BorderLayout.CENTER);
+ JPanel jPanel2a = new JPanel(new BorderLayout());
+ jPanel2a.add(jLabel1, BorderLayout.NORTH);
+ jPanel2a.add(replacePunctuation, BorderLayout.SOUTH);
+ databasePanel.add(jPanel2a, BorderLayout.SOUTH);
+
+ JPanel idsPanel = new JPanel();
+ idsPanel.setLayout(new BorderLayout(0, 5));
+ JScrollPane jScrollPane1 = new JScrollPane();
+ jScrollPane1.getViewport().add(textArea);
+ idsPanel.add(jScrollPane1, BorderLayout.CENTER);
+
+ this.add(actionPanel, BorderLayout.SOUTH);
+ this.add(idsPanel, BorderLayout.CENTER);
+ this.add(databasePanel, BorderLayout.NORTH);
+ }
+
+ private void setDatabaseSelectedItem(String db)
+ {
+ for (int i = 0; i < database.getItemCount(); i++)
+ {
+ StringPair sp = database.getItemAt(i);
+ if (sp != null && db != null && db.equals(sp.getKey()))
+ {
+ database.setSelectedIndex(i);
+ return;
+ }
+ }
+ }
+ /**
+ * Answers a semi-colon-delimited string with the example query or queries for
+ * the selected database
+ *
+ * @param db
+ * @return
+ */
+ protected String getExampleQueries(String db)
+ {
+ StringBuilder sb = new StringBuilder();
+ HashSet<String> hs = new HashSet<>();
+ for (DbSourceProxy dbs : sfetch.getSourceProxy(db))
+ {
+ String tq = dbs.getTestQuery();
+ if (hs.add(tq)) // not a duplicate source
+ {
+ if (sb.length() > 0)
+ {
+ sb.append(";");
+ }
+ sb.append(tq);
+ }
+ }
+ return sb.toString();