GraphHeight might be zero
[jalview.git] / src / jalview / gui / AlignFrame.java
index 2d39108..807b6e3 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Copyright (C) 2006 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
@@ -604,7 +604,7 @@ public class AlignFrame
   {
     HistoryItem nh,hi = (HistoryItem) redoList.pop();
     historyList.push(nh=new HistoryItem(hi.getDescription(), viewport.alignment,
-        HistoryItem.HIDE)); 
+        HistoryItem.HIDE));
     if (hi.alColumnChanges!=null)
       nh.alColumnChanges=hi.alColumnChanges.getInverse();
     restoreHistoryItem(hi);
@@ -1192,7 +1192,7 @@ public class AlignFrame
     ShiftList shifts;
     viewport.getAlignment().removeGaps(shifts=new ShiftList());
     edit.alColumnChanges=shifts.getInverse();
-    if (viewport.hasHiddenColumns) 
+    if (viewport.hasHiddenColumns)
       viewport.getColumnSelection().compensateForEdits(shifts);
     viewport.setStartRes(seq.findIndex(startRes)-1);
    viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
@@ -1247,13 +1247,13 @@ public class AlignFrame
        current = (SequenceI) seqs.elementAt(i);
        //dr[i]=
        current.removeGaps(start, end);
-       /*if (d<diff) // can only shift 
+       /*if (d<diff) // can only shift
          diff=d;
        if (diffmax<d)
          diffmax=d;
          */
      }
-     /* // after the end of each chunk - 
+     /* // after the end of each chunk -
       * if (diff>0) {
       // record shift for history.
        editgaps.addShift(start, diff);
@@ -1266,10 +1266,10 @@ public class AlignFrame
         current = (SequenceI) seqs.elementAt(i);
         if (dr[i]-diff>0) {
         String sq = current.getSequence();
-        current.setSequence(sq.substring(0, hcend-dr[i])+gaps.substring(0, dr[i]-diff)+sq.substring()); 
+        current.setSequence(sq.substring(0, hcend-dr[i])+gaps.substring(0, dr[i]-diff)+sq.substring());
         }
         }
-       } 
+       }
        }*/
 
     viewport.setStartRes(seq.findIndex(startRes)-1);
@@ -2818,17 +2818,35 @@ public void drop(DropTargetDropEvent evt)
    public void loadJalviewDataFile(String file)
   {
     try{
+      String protocol = "File";
+
+      if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1)
+      {
+        protocol = "URL";
+      }
+
       boolean isAnnotation = new AnnotationFile().readAnnotationFile(viewport.
           alignment, file);
 
       if (!isAnnotation)
       {
-        boolean isGroupsFile = parseFeaturesFile(file,
-                                                AppletFormatAdapter.FILE);
+        boolean isGroupsFile = parseFeaturesFile(file,protocol);
         if (!isGroupsFile)
         {
-          String format = new IdentifyFile().Identify(file, FormatAdapter.FILE);
-          new FileLoader().LoadFile(viewport, file, FormatAdapter.FILE, format);
+          String format = new IdentifyFile().Identify(file, protocol);
+
+          if(format.equalsIgnoreCase("JnetFile"))
+          {
+            jalview.io.JPredFile predictions = new jalview.io.JPredFile(
+                file, protocol);
+            new JnetAnnotationMaker().add_annotation(predictions,
+                viewport.getAlignment(),
+                0, false);
+            alignPanel.adjustAnnotationHeight();
+            alignPanel.repaint();
+          }
+          else
+            new FileLoader().LoadFile(viewport, file, protocol, format);
         }
       }
       else