package jalview.gui;
-import java.util.Locale;
-
+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.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;
.setEnabled(selectedCount > 1 || targetView.getItemCount() > 0);
}
+ @Override
+ protected boolean showPopupFor(int selectedRow)
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ String currentView = selectedFilterOpt.getView();
+ if (currentView == VIEWS_FILTER && data instanceof ThreeDBStructureChooserQuerySource)
+ {
+ TDB_FTSData row=null;
+
+ int i=1;
+ for (FTSData el:discoveredStructuresSet) {
+ if (i==selectedRow) {
+ row = (TDB_FTSData) el;
+ break;
+ }
+ i++;
+ }
+ String pageUrl = row.getModelViewUrl();
+ JMenu popup = new JMenu("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.setVisible(true); }
+ });
+ return true;
+ }
+ // event not handled by us
+ return false;
+ }
/**
* Validates inputs from the Manual PDB entry panel
*/
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
+import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
+ "...\"")
: JvSwingUtils.wrapTooltip(true, toolTipText)));
return toolTipText;
- }
+ }
};
public GStructureChooser()
tbl_summary.addMouseListener(new MouseAdapter()
{
@Override
+ public void mousePressed(MouseEvent e)
+ {
+ if (!popupAction(e))
+ {
+ super.mousePressed(e);
+ }
+ }
+ @Override
public void mouseClicked(MouseEvent e)
{
- validateSelections();
+ if (!popupAction(e))
+ {
+ validateSelections();
+ }
}
@Override
public void mouseReleased(MouseEvent e)
{
+ if (!popupAction(e))
+ {
validateSelections();
+ }
+ }
+ boolean popupAction(MouseEvent e)
+ {
+ if (e.isPopupTrigger())
+ {
+ Point pt = e.getPoint();
+ int selectedRow = tbl_summary.rowAtPoint(pt);
+ if (showPopupFor(selectedRow))
+ {
+ return true;
+ }
+ }
+ return false;
}
});
tbl_summary.addKeyListener(new KeyAdapter()
}
+protected abstract boolean showPopupFor(int selectedRow);
protected void closeAction(int preferredHeight)
{
// System.out.println(">>>>>>>>>> closing internal frame!!!");