*/
package jalview.gui;
-import jalview.bin.Cache;
import jalview.util.MessageManager;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.Vector;
import javax.swing.JButton;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
* identical DB sources, and should be collapsed.
*/
DefaultMutableTreeNode tn = null, root = new DefaultMutableTreeNode();
- Hashtable<String, DefaultMutableTreeNode> source = new Hashtable<String, DefaultMutableTreeNode>();
+ Hashtable<String, DefaultMutableTreeNode> source = new Hashtable<>();
sfetcher = sfetch;
String dbs[] = sfetch.getSupportedDb();
- Hashtable<String, String> ht = new Hashtable<String, String>();
+ Hashtable<String, String> ht = new Hashtable<>();
for (int i = 0; i < dbs.length; i++)
{
tn = source.get(dbs[i]);
tsel = dbviews.getSelectionPaths();
boolean forcedFirstChild = false;
- List<DbSourceProxy> srcs = new ArrayList<DbSourceProxy>();
+ List<DbSourceProxy> srcs = new ArrayList<>();
if (tsel != null)
{
for (TreePath tp : tsel)
return null;
}
StringBuffer sb = new StringBuffer();
- HashSet<String> hs = new HashSet<String>();
+ HashSet<String> hs = new HashSet<>();
for (DbSourceProxy dbs : getSelectedSources())
{
String tq = dbs.getTestQuery();
return sb.toString();
}
- List<ActionListener> lstners = new Vector<ActionListener>();
+ List<ActionListener> lstners = new Vector<>();
public void addActionListener(ActionListener actionListener)
{
lstners.remove(actionListener);
}
- public static void main(String args[])
- {
- Cache.getDasSourceRegistry();
- JDatabaseTree jdt = new JDatabaseTree(new jalview.ws.SequenceFetcher());
- JFrame foo = new JFrame();
- foo.setLayout(new BorderLayout());
- foo.add(jdt.getDatabaseSelectorButton(), BorderLayout.CENTER);
- foo.pack();
- foo.setVisible(true);
- int nultimes = 5;
- final Thread us = Thread.currentThread();
- jdt.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- us.interrupt();
- }
- });
- do
- {
- try
- {
- Thread.sleep(50);
- } catch (InterruptedException x)
- {
- nultimes--;
- if (!jdt.hasSelection())
- {
- System.out.println("No Selection");
- }
- else
- {
- System.out.println("Selection: " + jdt.getSelectedItem());
- int s = 1;
- for (DbSourceProxy pr : jdt.getSelectedSources())
- {
- System.out.println("Source " + s++ + ": " + pr.getDbName()
- + " (" + pr.getDbSource() + ") Version "
- + pr.getDbVersion() + ". Test:\t" + pr.getTestQuery());
- }
- System.out.println("Test queries: " + jdt.getExampleQueries());
- }
- }
- } while (nultimes > 0 && foo.isVisible());
- foo.setVisible(false);
- }
@Override
public void keyPressed(KeyEvent arg0)
// TODO Auto-generated method stub
}
+
+ @Override
+ public void setVisible(boolean arg0)
+ {
+ System.out.println("setVisible: " + arg0);
+ super.setVisible(arg0);
+ }
}