JAL-1713 save Overview title in project, don't save Overview on New View
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 10 Dec 2020 15:53:11 +0000 (15:53 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 10 Dec 2020 15:53:11 +0000 (15:53 +0000)
schemas/jalview.xsd
src/jalview/project/Jalview2XML.java
src/jalview/xml/binding/jalview/JalviewModel.java
src/jalview/xml/binding/jalview/package-info.java

index 5c3e1c7..cd05e5f 100755 (executable)
                                                                <xs:attribute name="residueColour" type="xs:int" />
                                                                <xs:attribute name="gapColour" type="xs:int" />
                                                                <xs:attribute name="hiddenColour" type="xs:int" />
+                                                               <xs:attribute name="title" type="xs:string" />
                                                          </xs:complexType>
                                                        </xs:element>
                                                </xs:sequence>
index 6452644..16c324d 100644 (file)
@@ -1463,6 +1463,9 @@ public class Jalview2XML
         overview.setGapColour(ov.getCanvas().getGapColour().getRGB());
         overview.setResidueColour(ov.getCanvas().getResidueColour().getRGB());
         overview.setHiddenColour(ov.getCanvas().getHiddenColour().getRGB());
+        String title = ((JInternalFrame) SwingUtilities
+                .getAncestorOfClass(JInternalFrame.class, ov)).getTitle();
+        overview.setTitle(title);
         view.setOverview(overview);
       }
       if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)
@@ -4042,7 +4045,7 @@ public class Jalview2XML
     }
 
     /*
-     * Load any trees, PDB structures and viewers
+     * Load any trees, PDB structures and viewers, Overview
      * 
      * Not done if flag is false (when this method is used for New View)
      */
@@ -4052,12 +4055,41 @@ public class Jalview2XML
       loadPCAViewers(jalviewModel, ap);
       loadPDBStructures(jprovider, jseqs, af, ap);
       loadRnaViewers(jprovider, jseqs, ap);
+      loadOverview(view, af);
     }
     // and finally return.
     return af;
   }
 
   /**
+   * Load Overview window, restoring colours, 'show hidden regions' flag, title
+   * and geometry as saved
+   * 
+   * @param view
+   * @param af
+   */
+  protected void loadOverview(Viewport view, AlignFrame af)
+  {
+    Overview overview = view.getOverview();
+    if (overview != null)
+    {
+      OverviewPanel overviewPanel = af
+              .openOverviewPanel(overview.isShowHidden());
+      overviewPanel.setBounds(overview.getXpos(), overview.getYpos(),
+              overview.getWidth(), overview.getHeight());
+      overviewPanel.setPreferredSize(
+              new Dimension(overview.getWidth(), overview.getHeight()));
+      Color gap = new Color(overview.getGapColour());
+      Color residue = new Color(overview.getResidueColour());
+      Color hidden = new Color(overview.getHiddenColour());
+      overviewPanel.getCanvas().setColours(gap, residue, hidden);
+      ((JInternalFrame) SwingUtilities
+              .getAncestorOfClass(JInternalFrame.class, overviewPanel))
+                      .setTitle(overview.getTitle());
+    }
+  }
+
+  /**
    * Instantiate and link any saved RNA (Varna) viewers. The state of the Varna
    * panel is restored from separate jar entries, two (gapped and trimmed) per
    * sequence and secondary structure.
@@ -4984,20 +5016,7 @@ public class Jalview2XML
     {
       splitFrameCandidates.put(view, af);
     }
-    
-    Overview overview = view.getOverview();
-    if (overview != null)
-    {
-      OverviewPanel overviewPanel = af.openOverviewPanel(overview.isShowHidden());
-      overviewPanel.setBounds(overview.getXpos(), overview.getYpos(),
-              overview.getWidth(), overview.getHeight());
-      overviewPanel.setPreferredSize(new Dimension(
-              overview.getWidth(), overview.getHeight()));
-      Color gap = new Color(overview.getGapColour());
-      Color residue = new Color(overview.getResidueColour());
-      Color hidden = new Color(overview.getHiddenColour());
-      overviewPanel.getCanvas().setColours(gap, residue, hidden);
-    }
+
     return af;
   }
 
index e73604d..59bdb05 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2020.12.10 at 10:15:41 AM GMT 
+// Generated on: 2020.12.10 at 03:00:06 PM GMT 
 //
 
 
@@ -174,6 +174,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
  *                             &lt;attribute name="residueColour" type="{http://www.w3.org/2001/XMLSchema}int" />
  *                             &lt;attribute name="gapColour" type="{http://www.w3.org/2001/XMLSchema}int" />
  *                             &lt;attribute name="hiddenColour" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *                             &lt;attribute name="title" type="{http://www.w3.org/2001/XMLSchema}string" />
  *                           &lt;/restriction>
  *                         &lt;/complexContent>
  *                       &lt;/complexType>
@@ -307,8 +308,8 @@ import javax.xml.datatype.XMLGregorianCalendar;
  *                     &lt;/element>
  *                     &lt;element name="pcaData" type="{www.jalview.org}PcaDataType"/>
  *                   &lt;/sequence>
- *                   &lt;attGroup ref="{www.jalview.org}swingwindow"/>
  *                   &lt;attGroup ref="{www.jalview.org}SimilarityParams"/>
+ *                   &lt;attGroup ref="{www.jalview.org}swingwindow"/>
  *                   &lt;attribute name="title" type="{http://www.w3.org/2001/XMLSchema}string" />
  *                   &lt;attribute name="scoreModelName" type="{http://www.w3.org/2001/XMLSchema}string" />
  *                   &lt;attribute name="xDim" type="{http://www.w3.org/2001/XMLSchema}int" />
@@ -3121,8 +3122,8 @@ public class JalviewModel {
      *         &lt;/element>
      *         &lt;element name="pcaData" type="{www.jalview.org}PcaDataType"/>
      *       &lt;/sequence>
-     *       &lt;attGroup ref="{www.jalview.org}swingwindow"/>
      *       &lt;attGroup ref="{www.jalview.org}SimilarityParams"/>
+     *       &lt;attGroup ref="{www.jalview.org}swingwindow"/>
      *       &lt;attribute name="title" type="{http://www.w3.org/2001/XMLSchema}string" />
      *       &lt;attribute name="scoreModelName" type="{http://www.w3.org/2001/XMLSchema}string" />
      *       &lt;attribute name="xDim" type="{http://www.w3.org/2001/XMLSchema}int" />
@@ -3177,14 +3178,6 @@ public class JalviewModel {
         protected Boolean showLabels;
         @XmlAttribute(name = "linkToAllViews")
         protected Boolean linkToAllViews;
-        @XmlAttribute(name = "width")
-        protected Integer width;
-        @XmlAttribute(name = "height")
-        protected Integer height;
-        @XmlAttribute(name = "xpos")
-        protected Integer xpos;
-        @XmlAttribute(name = "ypos")
-        protected Integer ypos;
         @XmlAttribute(name = "includeGaps")
         protected Boolean includeGaps;
         @XmlAttribute(name = "matchGaps")
@@ -3193,6 +3186,14 @@ public class JalviewModel {
         protected Boolean includeGappedColumns;
         @XmlAttribute(name = "denominateByShortestLength")
         protected Boolean denominateByShortestLength;
+        @XmlAttribute(name = "width")
+        protected Integer width;
+        @XmlAttribute(name = "height")
+        protected Integer height;
+        @XmlAttribute(name = "xpos")
+        protected Integer xpos;
+        @XmlAttribute(name = "ypos")
+        protected Integer ypos;
 
         /**
          * Gets the value of the sequencePoint property.
@@ -3541,195 +3542,195 @@ public class JalviewModel {
         }
 
         /**
-         * Gets the value of the width property.
+         * Gets the value of the includeGaps property.
          * 
          * @return
          *     possible object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public Integer getWidth() {
-            return width;
+        public Boolean isIncludeGaps() {
+            return includeGaps;
         }
 
         /**
-         * Sets the value of the width property.
+         * Sets the value of the includeGaps property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public void setWidth(Integer value) {
-            this.width = value;
+        public void setIncludeGaps(Boolean value) {
+            this.includeGaps = value;
         }
 
         /**
-         * Gets the value of the height property.
+         * Gets the value of the matchGaps property.
          * 
          * @return
          *     possible object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public Integer getHeight() {
-            return height;
+        public Boolean isMatchGaps() {
+            return matchGaps;
         }
 
         /**
-         * Sets the value of the height property.
+         * Sets the value of the matchGaps property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public void setHeight(Integer value) {
-            this.height = value;
+        public void setMatchGaps(Boolean value) {
+            this.matchGaps = value;
         }
 
         /**
-         * Gets the value of the xpos property.
+         * Gets the value of the includeGappedColumns property.
          * 
          * @return
          *     possible object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public Integer getXpos() {
-            return xpos;
+        public Boolean isIncludeGappedColumns() {
+            return includeGappedColumns;
         }
 
         /**
-         * Sets the value of the xpos property.
+         * Sets the value of the includeGappedColumns property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public void setXpos(Integer value) {
-            this.xpos = value;
+        public void setIncludeGappedColumns(Boolean value) {
+            this.includeGappedColumns = value;
         }
 
         /**
-         * Gets the value of the ypos property.
+         * Gets the value of the denominateByShortestLength property.
          * 
          * @return
          *     possible object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public Integer getYpos() {
-            return ypos;
+        public Boolean isDenominateByShortestLength() {
+            return denominateByShortestLength;
         }
 
         /**
-         * Sets the value of the ypos property.
+         * Sets the value of the denominateByShortestLength property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Integer }
+         *     {@link Boolean }
          *     
          */
-        public void setYpos(Integer value) {
-            this.ypos = value;
+        public void setDenominateByShortestLength(Boolean value) {
+            this.denominateByShortestLength = value;
         }
 
         /**
-         * Gets the value of the includeGaps property.
+         * Gets the value of the width property.
          * 
          * @return
          *     possible object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public Boolean isIncludeGaps() {
-            return includeGaps;
+        public Integer getWidth() {
+            return width;
         }
 
         /**
-         * Sets the value of the includeGaps property.
+         * Sets the value of the width property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public void setIncludeGaps(Boolean value) {
-            this.includeGaps = value;
+        public void setWidth(Integer value) {
+            this.width = value;
         }
 
         /**
-         * Gets the value of the matchGaps property.
+         * Gets the value of the height property.
          * 
          * @return
          *     possible object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public Boolean isMatchGaps() {
-            return matchGaps;
+        public Integer getHeight() {
+            return height;
         }
 
         /**
-         * Sets the value of the matchGaps property.
+         * Sets the value of the height property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public void setMatchGaps(Boolean value) {
-            this.matchGaps = value;
+        public void setHeight(Integer value) {
+            this.height = value;
         }
 
         /**
-         * Gets the value of the includeGappedColumns property.
+         * Gets the value of the xpos property.
          * 
          * @return
          *     possible object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public Boolean isIncludeGappedColumns() {
-            return includeGappedColumns;
+        public Integer getXpos() {
+            return xpos;
         }
 
         /**
-         * Sets the value of the includeGappedColumns property.
+         * Sets the value of the xpos property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public void setIncludeGappedColumns(Boolean value) {
-            this.includeGappedColumns = value;
+        public void setXpos(Integer value) {
+            this.xpos = value;
         }
 
         /**
-         * Gets the value of the denominateByShortestLength property.
+         * Gets the value of the ypos property.
          * 
          * @return
          *     possible object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public Boolean isDenominateByShortestLength() {
-            return denominateByShortestLength;
+        public Integer getYpos() {
+            return ypos;
         }
 
         /**
-         * Sets the value of the denominateByShortestLength property.
+         * Sets the value of the ypos property.
          * 
          * @param value
          *     allowed object is
-         *     {@link Boolean }
+         *     {@link Integer }
          *     
          */
-        public void setDenominateByShortestLength(Boolean value) {
-            this.denominateByShortestLength = value;
+        public void setYpos(Integer value) {
+            this.ypos = value;
         }
 
 
@@ -4789,6 +4790,7 @@ public class JalviewModel {
      *                 &lt;attribute name="residueColour" type="{http://www.w3.org/2001/XMLSchema}int" />
      *                 &lt;attribute name="gapColour" type="{http://www.w3.org/2001/XMLSchema}int" />
      *                 &lt;attribute name="hiddenColour" type="{http://www.w3.org/2001/XMLSchema}int" />
+     *                 &lt;attribute name="title" type="{http://www.w3.org/2001/XMLSchema}string" />
      *               &lt;/restriction>
      *             &lt;/complexContent>
      *           &lt;/complexType>
@@ -6442,6 +6444,7 @@ public class JalviewModel {
          *       &lt;attribute name="residueColour" type="{http://www.w3.org/2001/XMLSchema}int" />
          *       &lt;attribute name="gapColour" type="{http://www.w3.org/2001/XMLSchema}int" />
          *       &lt;attribute name="hiddenColour" type="{http://www.w3.org/2001/XMLSchema}int" />
+         *       &lt;attribute name="title" type="{http://www.w3.org/2001/XMLSchema}string" />
          *     &lt;/restriction>
          *   &lt;/complexContent>
          * &lt;/complexType>
@@ -6461,6 +6464,8 @@ public class JalviewModel {
             protected Integer gapColour;
             @XmlAttribute(name = "hiddenColour")
             protected Integer hiddenColour;
+            @XmlAttribute(name = "title")
+            protected String title;
             @XmlAttribute(name = "width")
             protected Integer width;
             @XmlAttribute(name = "height")
@@ -6567,6 +6572,30 @@ public class JalviewModel {
             }
 
             /**
+             * Gets the value of the title property.
+             * 
+             * @return
+             *     possible object is
+             *     {@link String }
+             *     
+             */
+            public String getTitle() {
+                return title;
+            }
+
+            /**
+             * Sets the value of the title property.
+             * 
+             * @param value
+             *     allowed object is
+             *     {@link String }
+             *     
+             */
+            public void setTitle(String value) {
+                this.title = value;
+            }
+
+            /**
              * Gets the value of the width property.
              * 
              * @return
index 2e7728f..711e7a7 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2020.12.10 at 10:15:41 AM GMT 
+// Generated on: 2020.12.10 at 03:00:06 PM GMT 
 //
 
 @javax.xml.bind.annotation.XmlSchema(namespace = "www.vamsas.ac.uk/jalview/version2", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)