*/
void stopProgressBar(String msg, long handle);
+ /**
+ *
+ * @return true if the actions menu is shown for this viewer
+ */
+ boolean hasViewerActionsMenu();
+
}
"Response from command ('" + cmd + "') was:\n" + lastReply);
}
}
+ else
+ {
+ if (Cache.log.isDebugEnabled())
+ {
+ Cache.log.debug("Command executed: " + cmd);
+ }
+ }
return reply;
}
{
return;
}
-
+ if (!found)
+ {
+ // not a valid residue label command, so clear
+ cmd.setLength(0);
+ }
/*
- * unshow the label for the previous residue
+ * prepend with command
+ * to unshow the label for the previous residue
*/
if (lastHighlightCommand != null)
{
- executeCommand(false, null, new StructureCommand("~" + lastHighlightCommand));
+ cmd.insert(0, ";");
+ cmd.insert(0,lastHighlightCommand);
+ cmd.insert(0,"~");
+
}
- if (found)
- {
- executeCommand(false, null, new StructureCommand(command));
+ if (cmd.length()>0) {
+ executeCommand(true, null, new StructureCommand(cmd.toString()));
+ }
+
+ if (found) {
+ this.lastHighlightCommand = command;
}
- this.lastHighlightCommand = command;
}
/**
private int myHeight = 150;
- /**
+ private JMenuItem writeFeatures=null;
+
+ private JMenu fetchAttributes=null;
+/**
* Initialise menu options.
*/
@Override
savemenu.setVisible(false); // not yet implemented
viewMenu.add(fitToWindow);
- JMenuItem writeFeatures = new JMenuItem(
+ writeFeatures = new JMenuItem(
MessageManager.getString("label.create_viewer_attributes"));
writeFeatures.setToolTipText(MessageManager
.getString("label.create_viewer_attributes_tip"));
});
viewerActionMenu.add(writeFeatures);
- final JMenu fetchAttributes = new JMenu(
+ fetchAttributes = new JMenu(
MessageManager.getString("label.fetch_chimera_attributes"));
fetchAttributes.setToolTipText(
MessageManager.getString("label.fetch_chimera_attributes_tip"));
});
viewerActionMenu.add(fetchAttributes);
}
-
+ @Override
+ protected void buildActionMenu()
+ {
+ super.buildActionMenu();
+ // add these back in after menu is refreshed
+ viewerActionMenu.add(writeFeatures);
+ viewerActionMenu.add(fetchAttributes);
+
+ };
/**
* Query the structure viewer for its residue attribute names and add them as
* items off the attributes menu
{
return "PyMOL";
}
-
+ JMenuItem writeFeatures = null;
@Override
protected void initMenus()
{
savemenu.setVisible(false); // not yet implemented
viewMenu.add(fitToWindow);
- JMenuItem writeFeatures = new JMenuItem(
+ writeFeatures = new JMenuItem(
MessageManager.getString("label.create_viewer_attributes"));
writeFeatures.setToolTipText(MessageManager
.getString("label.create_viewer_attributes_tip"));
});
viewerActionMenu.add(writeFeatures);
}
+
+ @Override
+ protected void buildActionMenu()
+ {
+ super.buildActionMenu();
+ viewerActionMenu.add(writeFeatures);
+ }
protected void sendFeaturesToPymol()
{
_alignwith.add(ap);
}
;
+ // TODO: refactor to allow concrete classes to register buttons for adding
+ // here
+ // currently have to override to add buttons back in after they are cleared
+ // in this loop
for (Component c : viewerActionMenu.getMenuComponents())
{
if (c != alignStructs)
+ ex.getMessage());
}
}
-
+ @Override
+ public boolean hasViewerActionsMenu()
+ {
+ return viewerActionMenu != null && viewerActionMenu.isEnabled()
+ && viewerActionMenu.getItemCount() > 0
+ && viewerActionMenu.isVisible();
+ }
}
* executed.
* <p>
* If a reply is wanted, the execution is done synchronously (waits),
- * otherwise it is done in a separate thread (doesn't wait).
+ * otherwise it is done in a separate thread (doesn't wait). WARNING: if you
+ * are sending commands that need to execute before later calls to
+ * executeCommand (e.g. mouseovers, which clean up after previous ones) then
+ * set getReply true to ensure that commands are not executed out of order.
*
* @param getReply
* @param msg
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
@Test(groups = { "External" })
public void testSingleSeqViewChimera()
{
+
String inFile = "examples/1gaq.txt";
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
DataSourceType.FILE);
/*
* Wait for viewer load thread to complete
*/
- while (!binding.isFinishedInit())
+ do
{
try
{
} catch (InterruptedException e)
{
}
- }
+ } while (!binding.isFinishedInit() || !chimeraViewer.isVisible());
assertTrue(binding.isViewerRunning(), "Failed to start Chimera");
assertEquals(chimeraViewer.getBinding().getPdbCount(), 1);
+ assertTrue(chimeraViewer.hasViewerActionsMenu());
+
+ // now add another sequence and bind to view
+ //
+ AlignmentI al = af.getViewport().getAlignment();
+ PDBEntry xpdb = al.getSequenceAt(0).getPDBEntry("1GAQ");
+ sq = new Sequence("1GAQ", al.getSequenceAt(0).getSequence(25, 95).toString());
+ al.addSequence(sq);
+ structureViewer.viewStructures(new PDBEntry[] { xpdb }, new SequenceI[] { sq }, af.getCurrentView().getAlignPanel());
+
+ /*
+ * Wait for viewer load thread to complete
+ */
+ do
+ {
+ try {
+ Thread.sleep(1500);
+ } catch (InterruptedException q) {};
+ } while (!binding.isLoadingFinished());
+
+ // still just one PDB structure shown
+ assertEquals(chimeraViewer.getBinding().getPdbCount(), 1);
+ // and the viewer action menu should still be visible
+ assertTrue(chimeraViewer.hasViewerActionsMenu());
+
chimeraViewer.closeViewer(true);
chimeraViewer = null;
return;