JAL-3187 JAL-3533 JAL-3535 set feature settings dialog title from view, and stash...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 17 Feb 2020 14:41:43 +0000 (14:41 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 17 Feb 2020 14:42:54 +0000 (14:42 +0000)
resources/lang/Messages.properties
src/jalview/api/AlignViewControllerGuiI.java
src/jalview/appletgui/AlignFrame.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/FeatureSettings.java

index 05f05ea..470cd4b 100644 (file)
@@ -765,6 +765,7 @@ label.generating_features_for_params = Generating features for - {0}
 label.generating_annotations_for_params = Generating annotations for - {0}
 label.varna_params = VARNA - {0}
 label.sequence_feature_settings = Sequence Feature Settings
+label.sequence_feature_settings_for_view = Sequence Feature Settings for view "{0}"
 label.pairwise_aligned_sequences = Pairwise Aligned Sequences
 label.original_data_for_params = Original Data for {0}
 label.points_for_params = Points for {0}
index 56414d8..6549d64 100644 (file)
@@ -23,6 +23,8 @@ package jalview.api;
 import jalview.commands.CommandI;
 import jalview.schemes.ColourSchemeI;
 
+import java.awt.Rectangle;
+
 /**
  * Interface implemented by gui implementations managing a Jalview Alignment
  * View
@@ -70,4 +72,17 @@ public interface AlignViewControllerGuiI
    * @return the current feature settings controller
    */
   FeatureSettingsControllerI showFeatureSettingsUI();
+
+  /**
+   * record the last position of a feature settings dialog before it was closed
+   * 
+   * @param bounds
+   */
+  void setFeatureSettingsGeometry(Rectangle bounds);
+
+  /**
+   * 
+   * @return last position of feature settings for this alignment view GUI
+   */
+  Rectangle getFeatureSettingsGeometry();
 }
index f6bbe14..0bc45e2 100644 (file)
@@ -95,6 +95,7 @@ import java.awt.Menu;
 import java.awt.MenuBar;
 import java.awt.MenuItem;
 import java.awt.Panel;
+import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.FocusEvent;
@@ -4344,4 +4345,18 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     return new FeatureSettings(alignPanel);
   }
 
+  private Rectangle fs_bounds = null;
+
+  @Override
+  public void setFeatureSettingsGeometry(Rectangle bounds)
+  {
+    fs_bounds = bounds;
+  }
+
+  @Override
+  public Rectangle getFeatureSettingsGeometry()
+  {
+    return fs_bounds;
+  }
+
 }
index f05c118..2559a91 100644 (file)
@@ -5665,6 +5665,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
 
   }
+
+  private Rectangle lastFeatureSettingsBounds = null;
+  @Override
+  public void setFeatureSettingsGeometry(Rectangle bounds)
+  {
+    lastFeatureSettingsBounds = bounds;
+  }
+
+  @Override
+  public Rectangle getFeatureSettingsGeometry()
+  {
+    return lastFeatureSettingsBounds;
+  }
 }
 
 class PrintThread extends Thread
index 61b0d1b..c77d9e3 100644 (file)
@@ -79,9 +79,9 @@ public class AlignViewport extends AlignmentViewport
 
   boolean antiAlias = false;
 
-  private Rectangle explodedGeometry;
+  private Rectangle explodedGeometry = null;
 
-  private String viewName;
+  private String viewName = null;
 
   /*
    * Flag set true on the view that should 'gather' multiple views of the same
index 961ff14..4b0a0bc 100644 (file)
@@ -385,17 +385,36 @@ public class FeatureSettings extends JPanel
     {
       frame = new JInternalFrame();
       frame.setContentPane(this);
-      if (Platform.isAMac())
+      Rectangle bounds = af.getFeatureSettingsGeometry();
+      String title;
+      if (af.getAlignPanels().size() > 1 || Desktop.getAlignmentPanels(
+              af.alignPanel.av.getSequenceSetId()).length > 1)
       {
-        Desktop.addInternalFrame(frame,
-                MessageManager.getString("label.sequence_feature_settings"),
-                600, 480);
+        title = MessageManager.formatMessage(
+                "label.sequence_feature_settings_for_view",
+                af.alignPanel.getViewName());
       }
       else
       {
-        Desktop.addInternalFrame(frame,
-                MessageManager.getString("label.sequence_feature_settings"),
-                600, 450);
+        title = MessageManager.getString("label.sequence_feature_settings");
+      }
+      if (bounds == null)
+      {
+        if (Platform.isAMac())
+        {
+          Desktop.addInternalFrame(frame, title, 600, 480);
+        }
+        else
+        {
+          Desktop.addInternalFrame(frame, title, 600, 450);
+        }
+      }
+      else
+      {
+        Desktop.addInternalFrame(frame, title,
+                false, bounds.width, bounds.height);
+        frame.setBounds(bounds);
+        frame.setVisible(true);
       }
       frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
 
@@ -1110,12 +1129,13 @@ public class FeatureSettings extends JPanel
     {
       if (frame != null)
       {
+        af.setFeatureSettingsGeometry(frame.getBounds());
         frame.setClosed(true);
       }
       else
       {
         SplitContainerI sc = af.getSplitViewContainer();
-        sc.closeFeatureSettings(this);
+        sc.closeFeatureSettings(this, closeContainingFrame);
         af.featureSettings = null;
       }
     } catch (Exception exe)