JAL-3187 first stab at ‘show CDS/Protein Settings’ for convenient switching between...
[jalview.git] / src / jalview / gui / FeatureSettings.java
index 11d5e39..8ce090f 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.gui;
 
+import jalview.api.AlignViewControllerGuiI;
 import jalview.api.AlignViewportI;
 import jalview.api.FeatureColourI;
 import jalview.api.FeatureSettingsControllerI;
@@ -47,7 +48,6 @@ import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Dimension;
-import java.awt.FlowLayout;
 import java.awt.Font;
 import java.awt.Graphics;
 import java.awt.GridLayout;
@@ -1310,7 +1310,38 @@ public class FeatureSettings extends JPanel
         refreshDisplay();
       }
     });
-
+    JButton viewComplementSettings = new JButton(MessageManager
+            .formatMessage("label.show_linked_feature_settings",
+                    nucleotide
+                            ? MessageManager.getString("label.protein")
+                                    .toLowerCase()
+                            : "CDS"));
+    viewComplementSettings.addActionListener(new ActionListener()
+    {
+      
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        AlignViewControllerGuiI complAf = af.getSplitViewContainer()
+                .getComplementAlignFrame(af);
+        FeatureSettings complFeatureSettings = (FeatureSettings) complAf
+                .getFeatureSettingsUI();
+        if (complFeatureSettings != null)
+        {
+          complFeatureSettings.frame.setVisible(true);
+          try
+          {
+            complFeatureSettings.frame.setSelected(true);
+            return;
+          } catch (Exception q)
+          {
+          }
+        }
+        {
+          complAf.showFeatureSettingsUI();
+        }
+      }
+    });
     JPanel lowerPanel = new JPanel(new GridLayout(1, 2));
     bigPanel.add(lowerPanel, BorderLayout.SOUTH);
 
@@ -1323,14 +1354,15 @@ public class FeatureSettings extends JPanel
 
     boolean hasComplement = af.getViewport().getCodingComplement() != null;
     JPanel transPanelLeft = new JPanel(
-            new GridLayout(hasComplement ? 3 : 2, 1));
+            new GridLayout(hasComplement ? 4 : 2, 1));
     transPanelLeft.add(new JLabel(" Colour transparency" + ":"));
     transPanelLeft.add(transparency);
     if (hasComplement)
     {
-      JPanel cp = new JPanel(new FlowLayout(FlowLayout.LEFT));
+      JPanel cp = new JPanel(new GridLayout(3, 2));
       cp.add(showComplement);
       cp.add(showComplementOnTop);
+      cp.add(viewComplementSettings);
       transPanelLeft.add(cp);
     }
     lowerPanel.add(transPanelLeft);