Merge branch 'features/JAL-845splitPaneMergeDevelop' into merge_JAL-845_JAL-1640
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 9 Feb 2015 16:06:40 +0000 (16:06 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 9 Feb 2015 16:06:40 +0000 (16:06 +0000)
minimal conflicts where list accessors were used in methods where logic
also modified on Desktop

Conflicts:
.classpath
resources/lang/Messages.properties
src/jalview/api/AlignViewportI.java
src/jalview/gui/Desktop.java
src/jalview/gui/ScalePanel.java
src/jalview/gui/TreeCanvas.java
src/jalview/viewmodel/AlignmentViewport.java

23 files changed:
1  2 
.classpath
resources/lang/Messages.properties
src/jalview/analysis/AlignSeq.java
src/jalview/api/AlignViewportI.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/SeqPanel.java
src/jalview/bin/Jalview.java
src/jalview/bin/JalviewLite.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AnnotationLabels.java
src/jalview/gui/Desktop.java
src/jalview/gui/IdPanel.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/ScalePanel.java
src/jalview/gui/SeqCanvas.java
src/jalview/gui/SeqPanel.java
src/jalview/gui/TreeCanvas.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/viewmodel/AlignmentViewport.java
test/jalview/io/Jalview2xmlTests.java

diff --cc .classpath
@@@ -49,9 -49,6 +49,9 @@@
        <classpathentry kind="lib" path="lib/log4j-to-slf4j-2.0-rc2.jar"/>
        <classpathentry kind="lib" path="lib/slf4j-log4j12-1.7.7.jar"/>
        <classpathentry kind="lib" path="lib/VARNAv3-91.jar"/>
 +      <classpathentry kind="lib" path="lib/jfreesvg-2.1.jar"/>
 +      <classpathentry kind="lib" path="lib/quaqua-filechooser-only-8.0.jar"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
++      <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin"/>
        <classpathentry kind="lib" path="lib/xml-apis.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
@@@ -1191,4 -1213,4 +1213,5 @@@ label.structures_filter = Structures Fi
  label.search_filter = Search Filter
  label.display_name = Display Label
  label.description = Description
 +label.include_description= Include Description
Simple merge
@@@ -353,16 -355,26 +353,37 @@@ public interface AlignViewportI extend
    boolean hasHiddenRows();
  
    /**
 +   * 
 +   * @return a copy of this view's current display settings
 +   */
 +  public ViewStyleI getViewStyle();
 +
 +  /**
 +   * update the view's display settings with the given style set
 +   * 
 +   * @param settingsForView
 +   */
 +  public void setViewStyle(ViewStyleI settingsForView);
 +
++  /**
+    * Returns a viewport which holds the cDna for this (protein), or vice versa,
+    * or null if none is set.
+    * 
+    * @return
+    */
+   AlignViewportI getCodingComplement();
 -
+   /**
+    * Sets the viewport which holds the cDna for this (protein), or vice versa.
+    * Implementation should guarantee that the reciprocal relationship is always
+    * set, i.e. each viewport is the complement of the other.
+    */
+   void setCodingComplement(AlignViewportI sl);
+   /**
+    * Answers true if viewport hosts DNA/RNA, else false.
+    * 
+    * @return
+    */
+   boolean isNucleotide();
 -
  }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -41,9 -43,9 +43,10 @@@ import jalview.analysis.AlignmentUtils.
  import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
  import jalview.analysis.NJTree;
  import jalview.api.AlignViewportI;
 +import jalview.api.ViewStyleI;
  import jalview.bin.Cache;
  import jalview.commands.CommandI;
+ import jalview.datamodel.Alignment;
  import jalview.datamodel.AlignmentI;
  import jalview.datamodel.ColumnSelection;
  import jalview.datamodel.PDBEntry;
@@@ -58,15 -63,21 +64,21 @@@ import jalview.util.StringUtils
  import jalview.viewmodel.AlignmentViewport;
  import jalview.ws.params.AutoCalcSetting;
  
 -import java.awt.Color;
  import java.awt.Container;
 +import java.awt.Dimension;
  import java.awt.Font;
  import java.awt.Rectangle;
+ import java.io.File;
+ import java.util.ArrayDeque;
  import java.util.ArrayList;
+ import java.util.Deque;
  import java.util.Hashtable;
- import java.util.Stack;
+ import java.util.Set;
  import java.util.Vector;
  
+ import javax.swing.JInternalFrame;
+ import javax.swing.JOptionPane;
  /**
   * DOCUMENT ME!
   * 
@@@ -101,10 -141,16 +113,10 @@@ public class AlignViewport extends Alig
  
    boolean gatherViewsHere = false;
  
-   Stack<CommandI> historyList = new Stack<CommandI>();
+   private Deque<CommandI> historyList = new ArrayDeque<CommandI>();
  
-   Stack<CommandI> redoList = new Stack<CommandI>();
+   private Deque<CommandI> redoList = new ArrayDeque<CommandI>();
  
 -  int thresholdTextColour = 0;
 -
 -  Color textColour = Color.black;
 -
 -  Color textColour2 = Color.white;
 -
    private AnnotationColumnChooser annotationColumnSelectionState;
    /**
     * Creates a new AlignViewport object.
Simple merge
@@@ -683,10 -683,10 +683,10 @@@ public class AnnotationLabels extends J
          pop.addSeparator();
          // av and sequencegroup need to implement same interface for
          final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
-                       MessageManager.getString("label.ignore_gaps_consensus"),
+                         MessageManager.getString("label.ignore_gaps_consensus"),
                  (aa[selectedRow].groupRef != null) ? aa[selectedRow].groupRef
                          .getIgnoreGapsConsensus() : ap.av
 -                        .getIgnoreGapsConsensus());
 +                        .isIgnoreGapsConsensus());
          final AlignmentAnnotation aaa = aa[selectedRow];
          cbmi.addActionListener(new ActionListener()
          {
@@@ -1689,23 -1702,29 +1703,29 @@@ public class Desktop extends jalview.jb
        // TODO: verify that frames are recoverable when in headless mode
        return null;
      }
-     JInternalFrame[] frames = Desktop.desktop.getAllFrames();
-     ArrayList aps = new ArrayList();
-     for (int t = 0; t < frames.length; t++)
+     List<AlignmentPanel> aps = new ArrayList<AlignmentPanel>();
+     AlignFrame[] frames = getAlignFrames();
+     if (frames == null)
      {
-       if (frames[t] instanceof AlignFrame)
+       return null;
+     }
+     for (AlignFrame af : frames)
+     {
+       for (AlignmentPanel ap : af.alignPanels)
        {
-         AlignFrame af = (AlignFrame) frames[t];
-         for (int a = 0; a < af.alignPanels.size(); a++)
 -        if (alignmentId.equals(ap.av.getSequenceSetId()))
++        if (alignmentId==null || alignmentId.equals(ap.av.getSequenceSetId()))
          {
-           if (alignmentId == null
-                   || alignmentId.equals(((AlignmentPanel) af.alignPanels
-                   .elementAt(a)).av.getSequenceSetId()))
-           {
-             aps.add(af.alignPanels.elementAt(a));
-           }
+           aps.add(ap);
          }
        }
+       // for (int a = 0; a < af.alignPanels.size(); a++)
+       // {
+       // if (alignmentId.equals(af.alignPanels
+       // .get(a).av.getSequenceSetId()))
+       // {
+       // aps.add(af.alignPanels.get(a));
+       // }
+       // }
      }
      if (aps.size() == 0)
      {
     * get all the viewports on an alignment.
     * 
     * @param sequenceSetId
 -   *          unique alignment id
 +   *          unique alignment id (may be null - all viewports returned in that
 +   *          case)
     * @return all viewports on the alignment bound to sequenceSetId
     */
-   public static AlignViewport[] getViewports(String sequenceSetId)
+   public static AlignmentViewport[] getViewports(String sequenceSetId)
    {
-     Vector viewp = new Vector();
+     List<AlignmentViewport> viewp = new ArrayList<AlignmentViewport>();
      if (desktop != null)
      {
-       javax.swing.JInternalFrame[] frames = instance.getAllFrames();
+       AlignFrame[] frames = Desktop.getAlignFrames();
  
-       for (int t = 0; t < frames.length; t++)
+       for (AlignFrame afr : frames)
        {
-         if (frames[t] instanceof AlignFrame)
 -        if (afr.getViewport().getSequenceSetId().equals(sequenceSetId))
++        if (sequenceSetId==null || afr.getViewport().getSequenceSetId().equals(sequenceSetId))
          {
-           AlignFrame afr = ((AlignFrame) frames[t]);
-           if (sequenceSetId == null
-                   || afr.getViewport().getSequenceSetId()
-                           .equals(sequenceSetId))
+           if (afr.alignPanels != null)
            {
-             if (afr.alignPanels != null)
+             for (AlignmentPanel ap : afr.alignPanels)
              {
-               for (int a = 0; a < afr.alignPanels.size(); a++)
 -              if (sequenceSetId.equals(ap.av.getSequenceSetId()))
++              if (sequenceSetId == null
++                      || sequenceSetId.equals(ap.av.getSequenceSetId()))
                {
-                 if (sequenceSetId == null
-                         || sequenceSetId
-                                 .equals(((AlignmentPanel) afr.alignPanels
-                         .elementAt(a)).av.getSequenceSetId()))
-                 {
-                   viewp.addElement(((AlignmentPanel) afr.alignPanels
-                           .elementAt(a)).av);
-                 }
+                 viewp.add(ap.av);
                }
              }
-             else
-             {
-               viewp.addElement(((AlignFrame) frames[t]).getViewport());
-             }
+           }
+           else
+           {
+             viewp.add(afr.getViewport());
            }
          }
        }
Simple merge
Simple merge
Simple merge
@@@ -474,27 -472,22 +474,22 @@@ public class ScalePanel extends JPanel 
        {
          string = String.valueOf(av.getColumnSelection()
                  .adjustForHiddenColumns(i));
 -        if ((i - startx - 1) * av.charWidth > maxX)
 +        if ((i - startx - 1) * avCharWidth > maxX)
          {
 -          gg.drawString(string, (i - startx - 1) * av.charWidth, y);
 -          maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);
 +          gg.drawString(string, (i - startx - 1) * avCharWidth, y);
 +          maxX = (i - startx + 1) * avCharWidth + fm.stringWidth(string);
          }
  
-         gg.drawLine(
- ((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
 -        gg.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
 -                y + 2, ((i - startx - 1) * av.charWidth)
 -                        + (av.charWidth / 2), y + (fm.getDescent() * 2));
 -
++        gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
 +                y + 2,
 +                ((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
 +                y + (fm.getDescent() * 2));
        }
        else
        {
-         gg.drawLine(
- ((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
-                 y + fm.getDescent(),
-  ((i - startx - 1) * avCharWidth)
-                 + (avCharWidth / 2),
-                 y + (fm.getDescent() * 2));
 -        gg.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
 -                y + fm.getDescent(), ((i - startx - 1) * av.charWidth)
 -                        + (av.charWidth / 2), y + (fm.getDescent() * 2));
++        gg.drawLine(((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
++                y + fm.getDescent(), ((i - startx - 1) * avCharWidth)
++                + (avCharWidth / 2), y + (fm.getDescent() * 2));
        }
      }
  
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -59,105 -59,48 +61,110 @@@ import java.util.Vector
   * @author jimp
   * 
   */
 -public abstract class AlignmentViewport implements AlignViewportI
 +public abstract class AlignmentViewport implements AlignViewportI,
 +        ViewStyleI
  {
 -  /*
 +  protected ViewStyleI viewStyle = new ViewStyle();
-   
-   
++
++  /**
+    * A viewport that hosts the cDna view of this (protein), or vice versa (if
+    * set).
+    */
+   AlignViewportI codingComplement = null;
    /**
 -   * alignment displayed in the viewport. Please use get/setter
 +   * @param name
 +   * @see jalview.api.ViewStyleI#setFontName(java.lang.String)
     */
 -  protected AlignmentI alignment;
 +  public void setFontName(String name)
 +  {
 +    viewStyle.setFontName(name);
 +  }
  
 -  protected String sequenceSetID;
 +  /**
 +   * @param style
 +   * @see jalview.api.ViewStyleI#setFontStyle(int)
 +   */
 +  public void setFontStyle(int style)
 +  {
 +    viewStyle.setFontStyle(style);
 +  }
  
    /**
 -   * probably unused indicator that view is of a dataset rather than an
 -   * alignment
 +   * @param size
 +   * @see jalview.api.ViewStyleI#setFontSize(int)
     */
 -  protected boolean isDataset = false;
 +  public void setFontSize(int size)
 +  {
 +    viewStyle.setFontSize(size);
 +  }
  
 -  private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getFontStyle()
 +   */
 +  public int getFontStyle()
 +  {
 +    return viewStyle.getFontStyle();
 +  }
  
 -  protected ColumnSelection colSel = new ColumnSelection();
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getFontName()
 +   */
 +  public String getFontName()
 +  {
 +    return viewStyle.getFontName();
 +  }
  
 -  public boolean autoCalculateConsensus = true;
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getFontSize()
 +   */
 +  public int getFontSize()
 +  {
 +    return viewStyle.getFontSize();
 +  }
  
 -  protected boolean autoCalculateStrucConsensus = true;
 +  /**
 +   * @param upperCasebold
 +   * @see jalview.api.ViewStyleI#setUpperCasebold(boolean)
 +   */
 +  public void setUpperCasebold(boolean upperCasebold)
 +  {
 +    viewStyle.setUpperCasebold(upperCasebold);
 +  }
  
 -  protected boolean ignoreGapsInConsensusCalculation = false;
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isUpperCasebold()
 +   */
 +  public boolean isUpperCasebold()
 +  {
 +    return viewStyle.isUpperCasebold();
 +  }
  
 -  protected ColourSchemeI globalColourScheme = null;
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isSeqNameItalics()
 +   */
 +  public boolean isSeqNameItalics()
 +  {
 +    return viewStyle.isSeqNameItalics();
 +  }
  
    /**
 -   * gui state - changes to colour scheme propagated to all groups
 +   * @param colourByReferenceSeq
 +   * @see jalview.api.ViewStyleI#setColourByReferenceSeq(boolean)
     */
 -  private boolean colourAppliesToAllGroups;
 +  public void setColourByReferenceSeq(boolean colourByReferenceSeq)
 +  {
 +    viewStyle.setColourByReferenceSeq(colourByReferenceSeq);
 +  }
  
    /**
 -   * @param value
 -   *          indicating if subsequent colourscheme changes will be propagated
 -   *          to all groups
 +   * @param b
 +   * @see jalview.api.ViewStyleI#setColourAppliesToAllGroups(boolean)
     */
    public void setColourAppliesToAllGroups(boolean b)
    {
    @Override
    public void setDisplayReferenceSeq(boolean displayReferenceSeq)
    {
 -    this.displayReferenceSeq = displayReferenceSeq;
 +    viewStyle.setDisplayReferenceSeq(displayReferenceSeq);
    }
  
+   @Override
    public boolean isColourByReferenceSeq()
    {
 -    return alignment.hasSeqrep() && colourByReferenceSeq;
 -  }
 -
 -  @Override
 -  public void setColourByReferenceSeq(boolean colourByReferenceSeq)
 -  {
 -    this.colourByReferenceSeq = colourByReferenceSeq;
 +    return alignment.hasSeqrep() && viewStyle.isColourByReferenceSeq();
    }
  
    @Override
    public Color getSequenceColour(SequenceI seq)
    {
    @Override
    public void setRightAlignIds(boolean rightAlignIds)
    {
 -    this.rightAlignIds = rightAlignIds;
 +    viewStyle.setRightAlignIds(rightAlignIds);
 +  }
 +
 +  @Override
 +  public boolean getConservationSelected()
 +  {
 +    return viewStyle.getConservationSelected();
 +  }
 +
 +  @Override
 +  public void setShowBoxes(boolean state)
 +  {
 +    viewStyle.setShowBoxes(state);
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getTextColour()
 +   */
 +  public Color getTextColour()
 +  {
 +    return viewStyle.getTextColour();
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getTextColour2()
 +   */
 +  public Color getTextColour2()
 +  {
 +    return viewStyle.getTextColour2();
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getThresholdTextColour()
 +   */
 +  public int getThresholdTextColour()
 +  {
 +    return viewStyle.getThresholdTextColour();
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isConservationColourSelected()
 +   */
 +  public boolean isConservationColourSelected()
 +  {
 +    return viewStyle.isConservationColourSelected();
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isRenderGaps()
 +   */
 +  public boolean isRenderGaps()
 +  {
 +    return viewStyle.isRenderGaps();
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isShowColourText()
 +   */
 +  public boolean isShowColourText()
 +  {
 +    return viewStyle.isShowColourText();
 +  }
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isShowSeqFeaturesHeight()
 +   */
 +  public boolean isShowSeqFeaturesHeight()
 +  {
 +    return viewStyle.isShowSeqFeaturesHeight();
 +  }
 +
 +  /**
 +   * @param conservationColourSelected
 +   * @see jalview.api.ViewStyleI#setConservationColourSelected(boolean)
 +   */
 +  public void setConservationColourSelected(
 +          boolean conservationColourSelected)
 +  {
 +    viewStyle.setConservationColourSelected(conservationColourSelected);
 +  }
 +
 +  /**
 +   * @param showColourText
 +   * @see jalview.api.ViewStyleI#setShowColourText(boolean)
 +   */
 +  public void setShowColourText(boolean showColourText)
 +  {
 +    viewStyle.setShowColourText(showColourText);
 +  }
 +
 +  /**
 +   * @param textColour
 +   * @see jalview.api.ViewStyleI#setTextColour(java.awt.Color)
 +   */
 +  public void setTextColour(Color textColour)
 +  {
 +    viewStyle.setTextColour(textColour);
 +  }
 +
 +  /**
 +   * @param thresholdTextColour
 +   * @see jalview.api.ViewStyleI#setThresholdTextColour(int)
 +   */
 +  public void setThresholdTextColour(int thresholdTextColour)
 +  {
 +    viewStyle.setThresholdTextColour(thresholdTextColour);
 +  }
 +
 +  /**
 +   * @param textColour2
 +   * @see jalview.api.ViewStyleI#setTextColour2(java.awt.Color)
 +   */
 +  public void setTextColour2(Color textColour2)
 +  {
 +    viewStyle.setTextColour2(textColour2);
 +  }
 +
 +  @Override
 +  public ViewStyleI getViewStyle()
 +  {
 +    return new ViewStyle(viewStyle);
 +  }
 +
 +  @Override
 +  public void setViewStyle(ViewStyleI settingsForView)
 +  {
 +    viewStyle = new ViewStyle(settingsForView);
 +  }
 +
 +  @Override
 +  public boolean sameStyle(ViewStyleI them)
 +  {
 +    return viewStyle.sameStyle(them);
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#getIdWidth()
 +   */
 +  public int getIdWidth()
 +  {
 +    return viewStyle.getIdWidth();
 +  }
 +
 +  /**
 +   * @param i
 +   * @see jalview.api.ViewStyleI#setIdWidth(int)
 +   */
 +  public void setIdWidth(int i)
 +  {
 +    viewStyle.setIdWidth(i);
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isCentreColumnLabels()
 +   */
 +  public boolean isCentreColumnLabels()
 +  {
 +    return viewStyle.isCentreColumnLabels();
 +  }
 +
 +  /**
 +   * @param centreColumnLabels
 +   * @see jalview.api.ViewStyleI#setCentreColumnLabels(boolean)
 +   */
 +  public void setCentreColumnLabels(boolean centreColumnLabels)
 +  {
 +    viewStyle.setCentreColumnLabels(centreColumnLabels);
 +  }
 +
 +  /**
 +   * @param showdbrefs
 +   * @see jalview.api.ViewStyleI#setShowDBRefs(boolean)
 +   */
 +  public void setShowDBRefs(boolean showdbrefs)
 +  {
 +    viewStyle.setShowDBRefs(showdbrefs);
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isShowDBRefs()
 +   */
 +  public boolean isShowDBRefs()
 +  {
 +    return viewStyle.isShowDBRefs();
 +  }
 +
 +  /**
 +   * @return
 +   * @see jalview.api.ViewStyleI#isShowNPFeats()
 +   */
 +  public boolean isShowNPFeats()
 +  {
 +    return viewStyle.isShowNPFeats();
 +  }
 +
 +  /**
 +   * @param shownpfeats
 +   * @see jalview.api.ViewStyleI#setShowNPFeats(boolean)
 +   */
 +  public void setShowNPFeats(boolean shownpfeats)
 +  {
 +    viewStyle.setShowNPFeats(shownpfeats);
    }
  }
Simple merge