X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=62e7b38662e6b8874f92663fe91cc35c8bdfdae1;hb=96d1dabfb3cf7a879ef9f1b3bfce3d2fe8c46954;hp=24ac87a3b163460b49f2e474b359af9a90e7aacb;hpb=aa643d0f2f5f506df2771e216af1618549d32050;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 24ac87a..62e7b38 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -20,15 +20,16 @@ */ package jalview.gui; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; -import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import javax.swing.JInternalFrame; import javax.swing.JMenu; @@ -38,18 +39,19 @@ import javax.swing.event.InternalFrameEvent; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; -import jalview.bin.Cache; +import jalview.bin.Console; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.datamodel.StructureViewerModel; +import jalview.datamodel.StructureViewerModel.StructureData; import jalview.ext.rbvi.chimera.JalviewChimeraBinding; import jalview.gui.StructureViewer.ViewerType; import jalview.io.DataSourceType; import jalview.io.StructureFile; import jalview.structures.models.AAStructureBindingModel; -import jalview.util.BrowserLauncher; +import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; import jalview.util.Platform; - /** * GUI elements for handling an external chimera display * @@ -60,6 +62,7 @@ public class ChimeraViewFrame extends StructureViewerBase { private JalviewChimeraBinding jmb; + /* * 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 @@ -67,10 +70,15 @@ public class ChimeraViewFrame extends StructureViewerBase */ private String chimeraSessionFile = null; + private int myWidth = 500; private int myHeight = 150; + private JMenuItem writeFeatures = null; + + private JMenu fetchAttributes = null; + /** * Initialise menu options. */ @@ -79,16 +87,13 @@ public class ChimeraViewFrame extends StructureViewerBase { super.initMenus(); - viewerActionMenu.setText(MessageManager.getString("label.chimera")); - - helpItem.setText(MessageManager.getString("label.chimera_help")); savemenu.setVisible(false); // not yet implemented viewMenu.add(fitToWindow); - JMenuItem writeFeatures = new JMenuItem( - MessageManager.getString("label.create_chimera_attributes")); - writeFeatures.setToolTipText(MessageManager - .getString("label.create_chimera_attributes_tip")); + writeFeatures = new JMenuItem( + MessageManager.getString("label.create_viewer_attributes")); + writeFeatures.setToolTipText( + MessageManager.getString("label.create_viewer_attributes_tip")); writeFeatures.addActionListener(new ActionListener() { @Override @@ -99,10 +104,10 @@ public class ChimeraViewFrame extends StructureViewerBase }); viewerActionMenu.add(writeFeatures); - final JMenu fetchAttributes = new JMenu( - MessageManager.getString("label.fetch_chimera_attributes")); - fetchAttributes.setToolTipText( - MessageManager.getString("label.fetch_chimera_attributes_tip")); + fetchAttributes = new JMenu(MessageManager.formatMessage( + "label.fetch_viewer_attributes", getViewerName())); + fetchAttributes.setToolTipText(MessageManager.formatMessage( + "label.fetch_viewer_attributes_tip", getViewerName())); fetchAttributes.addMouseListener(new MouseAdapter() { @@ -115,9 +120,19 @@ public class ChimeraViewFrame extends StructureViewerBase viewerActionMenu.add(fetchAttributes); } + @Override + protected void buildActionMenu() + { + super.buildActionMenu(); + // add these back in after menu is refreshed + viewerActionMenu.add(writeFeatures); + viewerActionMenu.add(fetchAttributes); + + }; + /** - * Query Chimera for its residue attribute names and add them as items off the - * attributes menu + * Query the structure viewer for its residue attribute names and add them as + * items off the attributes menu * * @param attributesMenu */ @@ -134,7 +149,11 @@ public class ChimeraViewFrame extends StructureViewerBase @Override public void actionPerformed(ActionEvent e) { - getChimeraAttributes(attName); + if (getBinding().copyStructureAttributesToFeatures(attName, + getAlignmentPanel()) > 0) + { + getAlignmentPanel().getFeatureRenderer().featuresAdded(); + } } }); attributesMenu.add(menuItem); @@ -142,28 +161,15 @@ public class ChimeraViewFrame extends StructureViewerBase } /** - * Read residues in Chimera with the given attribute name, and set as features - * on the corresponding sequence positions (if any) - * - * @param attName - */ - protected void getChimeraAttributes(String attName) - { - jmb.copyStructureAttributesToFeatures(attName, getAlignmentPanel()); - } - - /** - * Send a command to Chimera to create residue attributes for Jalview features - *
- * The syntax is: setattr r <attName> <attValue> <atomSpec> - *
- * For example: setattr r jv_chain "Ferredoxin-1, Chloroplastic" #0:94.A
+ * Sends command(s) to the structure viewer to create residue attributes for
+ * visible Jalview features
*/
protected void sendFeaturesToChimera()
{
+ // todo pull up?
int count = jmb.sendFeaturesToViewer(getAlignmentPanel());
- statusBar.setText(
- MessageManager.formatMessage("label.attributes_set", count));
+ statusBar.setText(MessageManager.formatMessage("label.attributes_set",
+ count, getViewerName()));
}
/**
@@ -233,7 +239,6 @@ public class ChimeraViewFrame extends StructureViewerBase
return new JalviewChimeraBindingModel(this,
ap.getStructureSelectionManager(), pdbentrys, seqs, null);
}
-
/**
* Create a new viewer from saved session state data including Chimera session
* file
@@ -246,22 +251,34 @@ public class ChimeraViewFrame extends StructureViewerBase
* @param colourBySequence
* @param newViewId
*/
- public ChimeraViewFrame(String chimeraSessionFile,
- AlignmentPanel alignPanel, PDBEntry[] pdbArray,
- SequenceI[][] seqsArray, boolean colourByChimera,
- boolean colourBySequence, String newViewId)
+ public ChimeraViewFrame(StructureViewerModel viewerData,
+ AlignmentPanel alignPanel, String sessionFile, String vid)
{
this();
- setViewId(newViewId);
- this.chimeraSessionFile = chimeraSessionFile;
+ setViewId(vid);
+ this.chimeraSessionFile = sessionFile;
+ Map