X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=1a5e90134601619cdc92c33e63b122f0c66e89dd;hb=9c1a9d682a2664d525bfd0f38bae861292dc3921;hp=430d3024c4087302f3bab6afeb23b798d22c9c23;hpb=34567bb79dfa8f163f44c3f3448083fcd145f308;p=jalview.git
diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java
index 430d302..1a5e901 100644
--- a/src/jalview/gui/ChimeraViewFrame.java
+++ b/src/jalview/gui/ChimeraViewFrame.java
@@ -20,6 +20,7 @@
*/
package jalview.gui;
+import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
@@ -46,9 +47,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Random;
-import javax.swing.JCheckBoxMenuItem;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
@@ -65,8 +64,6 @@ public class ChimeraViewFrame extends StructureViewerBase
{
private JalviewChimeraBinding jmb;
- private IProgressIndicator progressBar = null;
-
/*
* Path to Chimera session file. This is set when an open Jalview/Chimera
* session is saved, or on restore from a Jalview project (if it holds the
@@ -74,8 +71,6 @@ public class ChimeraViewFrame extends StructureViewerBase
*/
private String chimeraSessionFile = null;
- private Random random = new Random();
-
private int myWidth = 500;
private int myHeight = 150;
@@ -169,9 +164,9 @@ public class ChimeraViewFrame extends StructureViewerBase
/**
* Send a command to Chimera to create residue attributes for Jalview features
*
- * The syntax is: setattr r
+ * The syntax is: setattr r <attName> <attValue> <atomSpec>
*
- * For example: setattr r jv:chain "Ferredoxin-1, Chloroplastic" #0:94.A
+ * For example: setattr r jv_chain "Ferredoxin-1, Chloroplastic" #0:94.A
*/
protected void sendFeaturesToChimera()
{
@@ -203,9 +198,9 @@ public class ChimeraViewFrame extends StructureViewerBase
*/
protected void createProgressBar()
{
- if (progressBar == null)
+ if (getProgressIndicator() == null)
{
- progressBar = new ProgressBar(statusPanel, statusBar);
+ setProgressIndicator(new ProgressBar(statusPanel, statusBar));
}
}
@@ -213,8 +208,7 @@ public class ChimeraViewFrame extends StructureViewerBase
SequenceI[][] seqs)
{
createProgressBar();
- jmb = new JalviewChimeraBindingModel(this,
- ap.getStructureSelectionManager(), pdbentrys, seqs, null);
+ jmb = newBindingModel(ap, pdbentrys, seqs);
addAlignmentPanel(ap);
useAlignmentPanelForColourbyseq(ap);
@@ -242,6 +236,13 @@ public class ChimeraViewFrame extends StructureViewerBase
}
+ protected JalviewChimeraBindingModel newBindingModel(AlignmentPanel ap,
+ PDBEntry[] pdbentrys, SequenceI[][] seqs)
+ {
+ return new JalviewChimeraBindingModel(this,
+ ap.getStructureSelectionManager(), pdbentrys, seqs, null);
+ }
+
/**
* Create a new viewer from saved session state data including Chimera session
* file
@@ -343,27 +344,6 @@ public class ChimeraViewFrame extends StructureViewerBase
}
/**
- * Show only the selected chain(s) in the viewer
- */
- @Override
- void showSelectedChains()
- {
- List toshow = new ArrayList<>();
- for (int i = 0; i < chainMenu.getItemCount(); i++)
- {
- if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
- {
- JCheckBoxMenuItem item = (JCheckBoxMenuItem) chainMenu.getItem(i);
- if (item.isSelected())
- {
- toshow.add(item.getText());
- }
- }
- }
- jmb.showChains(toshow);
- }
-
- /**
* Close down this instance of Jalview's Chimera viewer, giving the user the
* option to close the associated Chimera window (process). They may wish to
* keep it open until they have had an opportunity to save any work.
@@ -535,7 +515,7 @@ public class ChimeraViewFrame extends StructureViewerBase
pdb = jmb.getSsm().setMapping(jmb.getSequence()[pos],
jmb.getChains()[pos], pe.getFile(), protocol,
- progressBar);
+ getProgressIndicator());
stashFoundChains(pdb, pe.getFile());
} catch (OutOfMemoryError oomerror)
@@ -570,7 +550,7 @@ public class ChimeraViewFrame extends StructureViewerBase
}
// refresh the sequence colours for the new structure(s)
- for (AlignmentPanel ap : _colourwith)
+ for (AlignmentViewPanel ap : _colourwith)
{
jmb.updateColours(ap);
}
@@ -582,7 +562,7 @@ public class ChimeraViewFrame extends StructureViewerBase
@Override
public void run()
{
- alignStructs_withAllAlignPanels();
+ alignStructsWithAllAlignPanels();
}
}).start();
}
@@ -608,7 +588,7 @@ public class ChimeraViewFrame extends StructureViewerBase
String chid = new String(
pdb.getId() + ":" + pdb.getChains().elementAt(i).id);
jmb.getChainNames().add(chid);
- jmb.getChainFile().put(chid, file);
+ jmb.addChainFile(chid, file);
}
}
@@ -657,63 +637,31 @@ public class ChimeraViewFrame extends StructureViewerBase
return filePath;
}
- /**
- * Convenience method to update the progress bar if there is one. Be sure to
- * call stopProgressBar with the returned handle to remove the message.
- *
- * @param msg
- * @param handle
- */
- public long startProgressBar(String msg)
- {
- // TODO would rather have startProgress/stopProgress as the
- // IProgressIndicator interface
- long tm = random.nextLong();
- if (progressBar != null)
- {
- progressBar.setProgressBar(msg, tm);
- }
- return tm;
- }
-
- /**
- * End the progress bar with the specified handle, leaving a message (if not
- * null) on the status bar
- *
- * @param msg
- * @param handle
- */
- public void stopProgressBar(String msg, long handle)
- {
- if (progressBar != null)
- {
- progressBar.setProgressBar(msg, handle);
- }
- }
-
@Override
- public void eps_actionPerformed(ActionEvent e)
+ public void eps_actionPerformed()
{
throw new Error(MessageManager
.getString("error.eps_generation_not_implemented"));
}
@Override
- public void png_actionPerformed(ActionEvent e)
+ public void png_actionPerformed()
{
throw new Error(MessageManager
.getString("error.png_generation_not_implemented"));
}
@Override
- public void showHelp_actionPerformed(ActionEvent actionEvent)
+ public void showHelp_actionPerformed()
{
try
{
- BrowserLauncher
- .openURL("https://www.cgl.ucsf.edu/chimera/docs/UsersGuide");
+ String url = jmb.getHelpURL();
+ BrowserLauncher.openURL(url);
} catch (IOException ex)
{
+ System.err
+ .println("Show Chimera help failed with: " + ex.getMessage());
}
}
@@ -738,7 +686,8 @@ public class ChimeraViewFrame extends StructureViewerBase
{
if (pathUsed == null)
{
- File tempFile = File.createTempFile("chimera", ".py");
+ String suffix = jmb.getSessionFileExtension();
+ File tempFile = File.createTempFile("chimera", suffix);
tempFile.deleteOnExit();
pathUsed = tempFile.getPath();
}
@@ -810,26 +759,4 @@ public class ChimeraViewFrame extends StructureViewerBase
{
return "Chimera";
}
-
- /**
- * Sends commands to align structures according to associated alignment(s).
- *
- * @return
- */
- @Override
- protected String alignStructs_withAllAlignPanels()
- {
- String reply = super.alignStructs_withAllAlignPanels();
- if (reply != null)
- {
- statusBar.setText("Superposition failed: " + reply);
- }
- return reply;
- }
-
- @Override
- protected IProgressIndicator getIProgressIndicator()
- {
- return progressBar;
- }
}