JAL-2089 patch broken merge to master for Release 2.10.0b1
[jalview.git] / src / jalview / jbgui / GStructureViewer.java
index 4471bbb..bd0f1de 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
 package jalview.jbgui;
 
 import jalview.api.structures.JalviewStructureDisplayI;
-import jalview.gui.AlignmentPanel;
 import jalview.util.MessageManager;
 
+import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.Vector;
 
 import javax.swing.ButtonGroup;
 import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
+import javax.swing.JPanel;
 import javax.swing.JRadioButtonMenuItem;
 
 public abstract class GStructureViewer extends JInternalFrame implements
@@ -51,6 +51,8 @@ public abstract class GStructureViewer extends JInternalFrame implements
 
   protected JMenuItem alignStructs = new JMenuItem();
 
+  protected JMenuItem fitToWindow = new JMenuItem();
+
   protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
 
   protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
@@ -79,23 +81,9 @@ public abstract class GStructureViewer extends JInternalFrame implements
 
   protected JMenuItem helpItem = new JMenuItem();
 
-  /**
-   * list of sequenceSet ids associated with the view
-   */
-  protected ArrayList<String> _aps = new ArrayList<String>();
+  protected JLabel statusBar = new JLabel();
 
-  /**
-   * list of alignment panels to use for superposition
-   */
-  protected Vector<AlignmentPanel> _alignwith = new Vector<AlignmentPanel>();
-
-  /**
-   * list of alignment panels that are used for colouring structures by aligned
-   * sequences
-   */
-  protected Vector<AlignmentPanel> _colourwith = new Vector<AlignmentPanel>();
-
-  private String viewId = null;
+  protected JPanel statusPanel = new JPanel();
 
   /**
    * Constructor
@@ -126,6 +114,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     pdbFile.setText(MessageManager.getString("label.pdb_file"));
     pdbFile.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         pdbFile_actionPerformed(actionEvent);
@@ -136,6 +125,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     png.setText("PNG");
     png.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         png_actionPerformed(actionEvent);
@@ -146,6 +136,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     eps.setText("EPS");
     eps.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         eps_actionPerformed(actionEvent);
@@ -156,22 +147,35 @@ public abstract class GStructureViewer extends JInternalFrame implements
     viewMapping.setText(MessageManager.getString("label.view_mapping"));
     viewMapping.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         viewMapping_actionPerformed(actionEvent);
       }
     });
     viewMenu.setText(MessageManager.getString("action.view"));
+
     chainMenu.setText(MessageManager.getString("action.show_chain"));
 
+    fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
+    fitToWindow.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent actionEvent)
+      {
+        fitToWindow_actionPerformed();
+      }
+    });
+
     JMenu colourMenu = new JMenu();
     colourMenu.setText(MessageManager.getString("label.colours"));
 
     JMenuItem backGround = new JMenuItem();
-    backGround.setText(MessageManager.getString("label.background_colour")
-            + "...");
+    backGround
+            .setText(MessageManager.getString("action.background_colour"));
     backGround.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         backGround_actionPerformed(actionEvent);
@@ -181,6 +185,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     seqColour.setText(MessageManager.getString("action.by_sequence"));
     seqColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         seqColour_actionPerformed(actionEvent);
@@ -189,6 +194,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     chainColour.setText(MessageManager.getString("action.by_chain"));
     chainColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         chainColour_actionPerformed(actionEvent);
@@ -197,6 +203,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
     chargeColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         chargeColour_actionPerformed(actionEvent);
@@ -205,6 +212,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     zappoColour.setText(MessageManager.getString("label.zappo"));
     zappoColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         zappoColour_actionPerformed(actionEvent);
@@ -213,6 +221,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     taylorColour.setText(MessageManager.getString("label.taylor"));
     taylorColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         taylorColour_actionPerformed(actionEvent);
@@ -221,6 +230,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
     hydroColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         hydroColour_actionPerformed(actionEvent);
@@ -230,6 +240,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
             .getString("label.strand_propensity"));
     strandColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         strandColour_actionPerformed(actionEvent);
@@ -238,6 +249,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     helixColour.setText(MessageManager.getString("label.helix_propensity"));
     helixColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         helixColour_actionPerformed(actionEvent);
@@ -246,6 +258,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     turnColour.setText(MessageManager.getString("label.turn_propensity"));
     turnColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         turnColour_actionPerformed(actionEvent);
@@ -254,6 +267,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     buriedColour.setText(MessageManager.getString("label.buried_index"));
     buriedColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         buriedColour_actionPerformed(actionEvent);
@@ -263,6 +277,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
             .getString("label.purine_pyrimidine"));
     purinePyrimidineColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         purinePyrimidineColour_actionPerformed(actionEvent);
@@ -272,6 +287,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     userColour.setText(MessageManager.getString("action.user_defined"));
     userColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         userColour_actionPerformed(actionEvent);
@@ -284,6 +300,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
             .getString("label.let_jmol_manage_structure_colours"));
     viewerColour.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         viewerColour_actionPerformed(actionEvent);
@@ -295,6 +312,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
     helpItem.setText(MessageManager.getString("label.jmol_help"));
     helpItem.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         showHelp_actionPerformed(actionEvent);
@@ -304,6 +322,7 @@ public abstract class GStructureViewer extends JInternalFrame implements
             .setText(MessageManager.getString("label.align_structures"));
     alignStructs.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent actionEvent)
       {
         alignStructs_actionPerformed(actionEvent);
@@ -350,11 +369,24 @@ public abstract class GStructureViewer extends JInternalFrame implements
     colourButtons.add(strandColour);
     colourButtons.add(turnColour);
     colourButtons.add(buriedColour);
+    colourButtons.add(purinePyrimidineColour);
     colourButtons.add(userColour);
     colourButtons.add(viewerColour);
 
     helpMenu.add(helpItem);
     viewerActionMenu.add(alignStructs);
+
+    statusPanel.setLayout(new GridLayout());
+    this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
+    statusPanel.add(statusBar, null);
+  }
+
+  protected void fitToWindow_actionPerformed()
+  {
+  }
+
+  protected void highlightSelection_actionPerformed()
+  {
   }
 
   protected void viewerColour_actionPerformed(ActionEvent actionEvent)
@@ -464,52 +496,4 @@ public abstract class GStructureViewer extends JInternalFrame implements
   // this.bindingModel = bindingModel;
   // }
 
-  /**
-   * 
-   * @param ap2
-   * @return true if this Jmol instance is linked with the given alignPanel
-   */
-  public boolean isLinkedWith(AlignmentPanel ap2)
-  {
-    return _aps.contains(ap2.av.getSequenceSetId());
-  }
-
-  public boolean isUsedforaligment(AlignmentPanel ap2)
-  {
-  
-    return (_alignwith != null) && _alignwith.contains(ap2);
-  }
-
-  public boolean isUsedforcolourby(AlignmentPanel ap2)
-  {
-    return (_colourwith != null) && _colourwith.contains(ap2);
-  }
-
-  /**
-   * 
-   * @return TRUE if the view is NOT being coloured by the alignment colours.
-   */
-  public boolean isColouredByViewer()
-  {
-    return !getBinding().isColourBySequence();
-  }
-
-  public String getViewId()
-  {
-    if (viewId == null)
-    {
-      viewId = System.currentTimeMillis() + "." + this.hashCode();
-    }
-    return viewId;
-  }
-
-  protected void setViewId(String viewId)
-  {
-    this.viewId = viewId;
-  }
-
-  public String getStateInfo()
-  {
-    return null;
-  }
 }