X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=f13e151daa3c997cd8427b7cb94f62d95b1ee96e;hb=155a17a423e980849fd4dc5f857da1a72b0010b9;hp=a6e479d0a784136b236fa435644e4af357f7a95b;hpb=42f4227ed213d422a87d3b22fc9e85d14ffaf53f;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index a6e479d..f13e151 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -20,31 +20,15 @@ */ package jalview.gui; -import jalview.api.AlignmentViewPanel; -import jalview.api.FeatureRenderer; -import jalview.bin.Cache; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -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.MessageManager; -import jalview.util.Platform; - 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.FileInputStream; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import javax.swing.JInternalFrame; import javax.swing.JMenu; @@ -52,6 +36,22 @@ import javax.swing.JMenuItem; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; +import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureRenderer; +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.ImageMaker.TYPE; +import jalview.util.MessageManager; +import jalview.util.Platform; + /** * GUI elements for handling an external chimera display * @@ -73,6 +73,10 @@ public class ChimeraViewFrame extends StructureViewerBase private int myHeight = 150; + private JMenuItem writeFeatures = null; + + private JMenu fetchAttributes = null; + /** * Initialise menu options. */ @@ -81,21 +85,13 @@ public class ChimeraViewFrame extends StructureViewerBase { super.initMenus(); - viewerActionMenu.setText(MessageManager.getString("label.chimera")); - - viewerColour - .setText(MessageManager.getString("label.colour_with_chimera")); - viewerColour.setToolTipText(MessageManager - .getString("label.let_chimera_manage_structure_colours")); - - 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 @@ -106,10 +102,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() { @@ -122,9 +118,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 */ @@ -141,7 +147,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); @@ -149,28 +159,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()));
}
/**
@@ -253,22 +250,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