Refactoring of Jalview, JalviewAppLoader, JalviewApp, various
[jalview.git] / src / jalview / bin / JalviewLite.java
index 6504290..6a8db59 100644 (file)
@@ -31,7 +31,6 @@ import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentOrder;
 import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceGroup;
@@ -46,10 +45,12 @@ import jalview.io.IdentifyFile;
 import jalview.io.JPredFile;
 import jalview.io.JnetAnnotationMaker;
 import jalview.io.NewickFile;
-import jalview.javascript.JSFunctionExec;
-import jalview.javascript.JalviewLiteJsApi;
-import jalview.javascript.JsCallBack;
-import jalview.javascript.MouseOverStructureListener;
+import jalview.appletgui.js.JSFunctionExec;
+import jalview.appletgui.js.JalviewLiteJsApi;
+import jalview.appletgui.js.JsCallBack;
+import jalview.appletgui.js.JsSelectionSender;
+import jalview.appletgui.js.MouseOverListener;
+import jalview.appletgui.js.MouseOverStructureListener;
 import jalview.structure.SelectionListener;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.ColorUtils;
@@ -199,7 +200,7 @@ public class JalviewLite extends Applet
       int apos = -1;
       try
       {
-        apos = new Integer(position).intValue();
+        apos = Integer.valueOf(position).intValue();
         apos--;
       } catch (NumberFormatException ex)
       {
@@ -338,7 +339,7 @@ public class JalviewLite extends Applet
           int from = -1, to = -1;
           try
           {
-            from = new Integer(cl.substring(0, p)).intValue();
+            from = Integer.valueOf(cl.substring(0, p)).intValue();
             from--;
           } catch (NumberFormatException ex)
           {
@@ -349,7 +350,7 @@ public class JalviewLite extends Applet
           }
           try
           {
-            to = new Integer(cl.substring(p + 1)).intValue();
+            to = Integer.valueOf(cl.substring(p + 1)).intValue();
             to--;
           } catch (NumberFormatException ex)
           {
@@ -409,7 +410,7 @@ public class JalviewLite extends Applet
           int r = -1;
           try
           {
-            r = new Integer(cl).intValue();
+            r = Integer.valueOf(cl).intValue();
             r--;
           } catch (NumberFormatException ex)
           {
@@ -471,7 +472,7 @@ public class JalviewLite extends Applet
         SequenceI rs = sel.getSequenceAt(0);
         start = rs.findIndex(start);
         end = rs.findIndex(end);
-        List<Integer> cs = new ArrayList<Integer>(csel.getSelected());
+        List<Integer> cs = new ArrayList<>(csel.getSelected());
         csel.clear();
         for (Integer selectedCol : cs)
         {
@@ -921,7 +922,7 @@ public class JalviewLite extends Applet
     setMouseoverListener(currentAlignFrame, listener);
   }
 
-  private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();
+  private Vector<JSFunctionExec> javascriptListeners = new Vector<>();
 
   /*
    * (non-Javadoc)
@@ -943,7 +944,7 @@ public class JalviewLite extends Applet
         return;
       }
     }
-    jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener(
+    MouseOverListener mol = new MouseOverListener(
             this, af, listener);
     javascriptListeners.addElement(mol);
     StructureSelectionManager.getStructureSelectionManager(this)
@@ -990,7 +991,7 @@ public class JalviewLite extends Applet
         return;
       }
     }
-    jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender(
+    JsSelectionSender mol = new JsSelectionSender(
             this, af, listener);
     javascriptListeners.addElement(mol);
     StructureSelectionManager.getStructureSelectionManager(this)
@@ -1129,7 +1130,7 @@ public class JalviewLite extends Applet
     {
       while (javascriptListeners.size() > 0)
       {
-        jalview.javascript.JSFunctionExec mol = javascriptListeners
+        JSFunctionExec mol = javascriptListeners
                 .elementAt(0);
         javascriptListeners.removeElement(mol);
         if (mol instanceof SelectionListener)
@@ -1156,7 +1157,7 @@ public class JalviewLite extends Applet
     StructureSelectionManager.release(this);
   }
 
-  private jalview.javascript.JSFunctionExec jsFunctionExec;
+  private JSFunctionExec jsFunctionExec;
 
   /*
    * (non-Javadoc)
@@ -1177,7 +1178,7 @@ public class JalviewLite extends Applet
         try
         {
           StructureSelectionManager.getStructureSelectionManager(me)
-                  .mouseOverStructure(new Integer(pdbResNum).intValue(),
+                  .mouseOverStructure(Integer.valueOf(pdbResNum).intValue(),
                           chain, pdbfile);
           if (debug)
           {
@@ -1213,8 +1214,8 @@ public class JalviewLite extends Applet
       {
         try
         {
-          alf.scrollTo(new Integer(topRow).intValue(),
-                  new Integer(leftHandColumn).intValue());
+          alf.scrollTo(Integer.valueOf(topRow).intValue(),
+                  Integer.valueOf(leftHandColumn).intValue());
 
         } catch (Exception ex)
         {
@@ -1231,7 +1232,7 @@ public class JalviewLite extends Applet
    * (non-Javadoc)
    * 
    * @see
-   * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui
+   * JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui
    * .AlignFrame, java.lang.String)
    */
   @Override
@@ -1245,7 +1246,7 @@ public class JalviewLite extends Applet
       {
         try
         {
-          alf.scrollToRow(new Integer(topRow).intValue());
+          alf.scrollToRow(Integer.valueOf(topRow).intValue());
 
         } catch (Exception ex)
         {
@@ -1262,7 +1263,7 @@ public class JalviewLite extends Applet
    * (non-Javadoc)
    * 
    * @see
-   * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui
+   * JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui
    * .AlignFrame, java.lang.String)
    */
   @Override
@@ -1277,7 +1278,7 @@ public class JalviewLite extends Applet
       {
         try
         {
-          alf.scrollToColumn(new Integer(leftHandColumn).intValue());
+          alf.scrollToColumn(Integer.valueOf(leftHandColumn).intValue());
 
         } catch (Exception ex)
         {
@@ -1334,7 +1335,7 @@ public class JalviewLite extends Applet
   private boolean alignPdbStructures = false;
 
   /**
-   * use an external structure viewer exclusively (no jmols or MCViews will be
+   * use an external structure viewer exclusively (no jmols or mc_views will be
    * opened by JalviewLite itself)
    */
   public boolean useXtrnalSviewer = false;
@@ -1799,7 +1800,7 @@ public class JalviewLite extends Applet
           if (!jmolAvailable)
           {
             System.out.println(
-                    "Jmol not available - Using MCview for structures");
+                    "Jmol not available - Using mc_view for structures");
           }
         } catch (java.lang.ClassNotFoundException ex)
         {
@@ -1811,7 +1812,7 @@ public class JalviewLite extends Applet
         if (debug)
         {
           System.err.println(
-                  "Skipping Jmol check. Will use MCView (probably)");
+                  "Skipping Jmol check. Will use mc_view (probably)");
         }
       }
       checkedForJmol = true;
@@ -2165,8 +2166,8 @@ public class JalviewLite extends Applet
           else
           {
             param = st.nextToken();
-            List<SequenceI> tmp = new ArrayList<SequenceI>();
-            List<String> tmp2 = new ArrayList<String>();
+            List<SequenceI> tmp = new ArrayList<>();
+            List<String> tmp2 = new ArrayList<>();
 
             while (st.hasMoreTokens())
             {
@@ -2279,12 +2280,9 @@ public class JalviewLite extends Applet
           JnetAnnotationMaker.add_annotation(predictions,
                   alignFrame.viewport.getAlignment(), 0, false);
           // false == do not add sequence profile from concise output
-          SequenceI repseq = alignFrame.viewport.getAlignment()
-                  .getSequenceAt(0);
-          alignFrame.viewport.getAlignment().setSeqrep(repseq);
-          HiddenColumns cs = new HiddenColumns();
-          cs.hideInsertionsFor(repseq);
-          alignFrame.viewport.getAlignment().setHiddenColumns(cs);
+
+          alignFrame.viewport.getAlignment().setupJPredAlignment();
+
           alignFrame.alignPanel.fontChanged();
           alignFrame.alignPanel.setScrollValues(0, 0);
           result = true;
@@ -2802,9 +2800,9 @@ public class JalviewLite extends Applet
     // callInitCallback();
   }
 
-  private Hashtable<String, long[]> jshashes = new Hashtable<String, long[]>();
+  private Hashtable<String, long[]> jshashes = new Hashtable<>();
 
-  private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<String, Hashtable<String, String[]>>();
+  private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<>();
 
   public void setJsMessageSet(String messageclass, String viewId,
           String[] colcommands)
@@ -2812,7 +2810,7 @@ public class JalviewLite extends Applet
     Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
     if (msgset == null)
     {
-      msgset = new Hashtable<String, String[]>();
+      msgset = new Hashtable<>();
       jsmessages.put(messageclass, msgset);
     }
     msgset.put(viewId, colcommands);