From 0e7325771ec658d66194b7abab05616681f03a57 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 17 Feb 2020 14:41:43 +0000 Subject: [PATCH] JAL-3187 JAL-3533 JAL-3535 set feature settings dialog title from view, and stash geometry for a feature settings dialog when closed, and re-use any existing geometry when dialog re-opened. --- resources/lang/Messages.properties | 1 + src/jalview/api/AlignViewControllerGuiI.java | 15 +++++++++++ src/jalview/appletgui/AlignFrame.java | 15 +++++++++++ src/jalview/gui/AlignFrame.java | 13 ++++++++++ src/jalview/gui/AlignViewport.java | 4 +-- src/jalview/gui/FeatureSettings.java | 36 ++++++++++++++++++++------ 6 files changed, 74 insertions(+), 10 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 05f05ea..470cd4b 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -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} diff --git a/src/jalview/api/AlignViewControllerGuiI.java b/src/jalview/api/AlignViewControllerGuiI.java index 56414d8..6549d64 100644 --- a/src/jalview/api/AlignViewControllerGuiI.java +++ b/src/jalview/api/AlignViewControllerGuiI.java @@ -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(); } diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index f6bbe14..0bc45e2 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -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; + } + } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f05c118..2559a91 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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 diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 61b0d1b..c77d9e3 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -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 diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 961ff14..4b0a0bc 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -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) -- 1.7.10.2