package jalview.gui;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.concurrent.Executors;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
import jalview.fts.service.pdb.PDBFTSRestClient;
+import jalview.fts.service.threedbeacons.TDB_FTSData;
import jalview.gui.structurechooser.PDBStructureChooserQuerySource;
import jalview.gui.structurechooser.StructureChooserQuerySource;
import jalview.gui.structurechooser.ThreeDBStructureChooserQuerySource;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
import jalview.ws.DBRefFetcher;
+import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
import jalview.ws.seqfetcher.DbSourceProxy;
import jalview.ws.sifts.SiftsSettings;
}
};
+ final FetchFinishedListenerI afterDbRefFetch = new FetchFinishedListenerI()
+ {
+
+ @Override
+ public void finished()
+ {
+ // filter has been selected, so we set flag to remove ourselves
+ notQueriedTDBYet = false;
+ // new thread to discover structures - via 3d beacons
+ Executors.defaultThreadFactory().newThread(strucDiscovery).start();
+
+ }
+ };
+
// fetch db refs if OK pressed
- final Runnable discoverCanonicalDBrefs = new Runnable()
+ final Runnable discoverCanonicalDBrefs = new Runnable()
{
@Override
public void run()
final int y = seqsWithoutSourceDBRef.size();
if (y > 0)
{
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run()
- {
- updateProgressIndicator(MessageManager.formatMessage(
- "status.fetching_dbrefs_for_sequences_without_valid_refs",
- y), progressId);
-
- }
- });
-
final SequenceI[] seqWithoutSrcDBRef = seqsWithoutSourceDBRef
.toArray(new SequenceI[y]);
DBRefFetcher dbRefFetcher = new DBRefFetcher(seqWithoutSrcDBRef,
progressBar, new DbSourceProxy[]
{ new jalview.ws.dbsources.Uniprot() }, null, false);
-
+ dbRefFetcher.addListener(afterDbRefFetch);
// ideally this would also gracefully run with callbacks
dbRefFetcher.fetchDBRefs(true);
+ } else {
+ // call finished action directly
+ afterDbRefFetch.finished();
}
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run()
- {
- if (y>0) {
- updateProgressIndicator("Fetch complete.", progressId); // todo i18n
- }
- // filter has been selected, so we set flag to remove ourselves
- notQueriedTDBYet = false;
-
- Executors.defaultThreadFactory().newThread(strucDiscovery).start();
-
- }
- });
-
}
+
};
final Runnable revertview = new Runnable() {
public void run() {
.setEnabled(selectedCount > 1 || targetView.getItemCount() > 0);
}
+ @Override
+ protected boolean showPopupFor(int selectedRow, int x, int y)
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ String currentView = selectedFilterOpt.getView();
+
+ if (currentView == VIEWS_FILTER && data instanceof ThreeDBStructureChooserQuerySource)
+ {
+
+ TDB_FTSData row=((ThreeDBStructureChooserQuerySource)data).getFTSDataFor(getResultTable(), selectedRow, discoveredStructuresSet);
+ String pageUrl = row.getModelViewUrl();
+ JPopupMenu popup = new JPopupMenu("3D Beacons");
+ JMenuItem viewUrl = new JMenuItem("View model web page");
+ viewUrl.addActionListener(
+ new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Desktop.showUrl(pageUrl);
+ }
+ }
+ );
+ popup.add(viewUrl);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() { popup.show(getResultTable(), x, y); }
+ });
+ return true;
+ }
+ // event not handled by us
+ return false;
+ }
/**
* Validates inputs from the Manual PDB entry panel
*/
if (pdbIdStr.split(":").length > 1)
{
pdbEntry.setId(pdbIdStr.split(":")[0]);
- pdbEntry.setChainCode(pdbIdStr.split(":")[1].toUpperCase());
+ pdbEntry.setChainCode(pdbIdStr.split(":")[1].toUpperCase(Locale.ROOT));
}
else
{
// TODO move this pdb id search into the PDB specific
// FTSSearchEngine
// for moment, it will work fine as is because it is self-contained
- String searchTerm = text.toLowerCase();
+ String searchTerm = text.toLowerCase(Locale.ROOT);
searchTerm = searchTerm.split(":")[0];
// System.out.println(">>>>> search term : " + searchTerm);
List<FTSDataColumnI> wantedFields = new ArrayList<>();