Merge branch 'features/JAL-2360colourSchemeApplicability' into features/JAL-2371colle...
[jalview.git] / src / jalview / gui / AlignViewport.java
index f755b25..35a87d4 100644 (file)
  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
-/*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
- */
 package jalview.gui;
 
 import jalview.analysis.AlignmentUtils;
@@ -55,9 +37,12 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
+import jalview.schemes.CollectionColourScheme;
+import jalview.schemes.ColourSchemeI;
 import jalview.schemes.ColourSchemeProperty;
 import jalview.schemes.UserColourScheme;
 import jalview.structure.CommandListener;
@@ -78,7 +63,6 @@ import java.util.List;
 import java.util.Vector;
 
 import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
 
 /**
  * DOCUMENT ME!
@@ -309,14 +293,15 @@ public class AlignViewport extends AlignmentViewport implements
     }
     if (propertyValue != null)
     {
-      globalColourScheme = ColourSchemeProperty.getColour(alignment,
-              propertyValue);
+      ColourSchemeI colourScheme = ColourSchemeProperty.getColourScheme(
+              alignment, propertyValue);
+      globalColourScheme = new CollectionColourScheme(colourScheme);
 
-      if (globalColourScheme instanceof UserColourScheme)
+      if (colourScheme instanceof UserColourScheme)
       {
-        globalColourScheme = UserDefinedColours.loadDefaultColours();
-        ((UserColourScheme) globalColourScheme).setThreshold(0,
-                isIgnoreGapsConsensus());
+        globalColourScheme = new CollectionColourScheme(
+                UserDefinedColours.loadDefaultColours());
+        globalColourScheme.setThreshold(0, isIgnoreGapsConsensus());
       }
 
       if (globalColourScheme != null)
@@ -676,7 +661,8 @@ public class AlignViewport extends AlignmentViewport implements
       List<SequenceI> choosenSeqs = new ArrayList<SequenceI>();
       for (SequenceI sq : alignment.getSequences())
       {
-        Vector<PDBEntry> pdbRefEntries = sq.getDatasetSequence().getAllPDBEntries();
+        Vector<PDBEntry> pdbRefEntries = sq.getDatasetSequence()
+                .getAllPDBEntries();
         if (pdbRefEntries == null)
         {
           continue;
@@ -708,7 +694,8 @@ public class AlignViewport extends AlignmentViewport implements
           }
         }
       }
-      seqvectors.add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()]));
+      seqvectors
+              .add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()]));
     }
     return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
   }
@@ -891,9 +878,9 @@ public class AlignViewport extends AlignmentViewport implements
         MessageManager.getString("label.new_window"), };
     final String question = JvSwingUtils.wrapTooltip(true,
             MessageManager.getString("label.open_split_window?"));
-    int response = JOptionPane.showOptionDialog(Desktop.desktop, question,
+    int response = JvOptionPane.showOptionDialog(Desktop.desktop, question,
             MessageManager.getString("label.open_split_window"),
-            JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null,
+            JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
             options, options[0]);
 
     if (response != 1 && response != 2)
@@ -933,7 +920,7 @@ public class AlignViewport extends AlignmentViewport implements
 
     // TODO if we want this (e.g. to enable reload of the alignment from file),
     // we will need to add parameters to the stack.
-    // if (!protocol.equals(AppletFormatAdapter.PASTE))
+    // if (!protocol.equals(DataSourceType.PASTE))
     // {
     // alignFrame.setFileName(file, format);
     // }
@@ -1058,7 +1045,7 @@ public class AlignViewport extends AlignmentViewport implements
      * there is no complement, or it is not following highlights, or no mapping
      * is found, the result will be empty.
      */
-    SearchResults sr = new SearchResults();
+    SearchResultsI sr = new SearchResults();
     int verticalOffset = findComplementScrollTarget(sr);
     if (!sr.isEmpty())
     {