JAL-3446 differences.txt now delivered with SwingJS-site.zip
[jalview.git] / src / jalview / bin / JalviewJSApi.java
index 3f5dba0..0512841 100644 (file)
@@ -2,7 +2,6 @@ package jalview.bin;
 
 import java.io.IOException;
 import java.net.URL;
-import java.util.Hashtable;
 
 import jalview.api.AlignViewportI;
 import jalview.datamodel.ColumnSelection;
@@ -34,26 +33,22 @@ public interface JalviewJSApi
    *          - null or specific AlignFrame. This specifies the dataset that
    *          will be searched for a seuqence called sequenceId
    * @param sequenceId
-   *          - sequenceId within the dataset.
-   * @param pdbEntryString
-   *          - the short name for the PDB file
+   *          - sequenceId within the dataset or null
+   * @param pdbId
+   *          - the four-character PDB ID
    * @param pdbFile
-   *          - pdb file - either a URL or a valid PDB file.
-   * @return true if binding was as success TODO: consider making an exception
-   *         structure for indicating when PDB parsing or sequenceId location
-   *         fails.
+   *          - pdb file - either a URL or a valid PDB file or null.
+   * @return true if binding was success
    */
-  public boolean addPdbFile(AlignFrame alFrame, String sequenceId, String pdbEntryString, String pdbFile);
-
-  public String arrayToSeparatorList(String[] array);
+  public boolean addPdbFile(AlignFrame alFrame, String sequenceId,
+          String pdbId, String pdbFile);
 
   /**
    * The following public methods may be called externally, eg via javascript in
    * an HTML page.
    * 
    * <br>
-   * <em>TODO: introduce interface for
-   * jalview.appletgui.AlignFrame</em><br>
+   * <em>TODO: introduce interface for jalview.appletgui.AlignFrame</em><br>
    * 
    * Most function arguments are strings, which contain serialised versions of
    * lists. Lists of things are separated by a separator character - either the
@@ -108,7 +103,8 @@ public interface JalviewJSApi
    * @param suffix
    * @return
    */
-  public String getAlignmentFrom(AlignFrame alf, String format, String suffix);
+  public String getAlignmentFrom(AlignFrame alf, String format,
+          String suffix);
 
   /**
    * get a separator separated list of sequence IDs reflecting the order of the
@@ -126,18 +122,7 @@ public interface JalviewJSApi
    * @param alf
    * @return
    */
-  public String getAlignmentOrderFrom(AlignFrame alf);
-
-  /**
-   * get a sep separated list of sequence IDs reflecting the order of the
-   * alignment in alf
-   * 
-   * @param alf
-   * @param sep
-   *          - separator to use
-   * @return
-   */
-  public String getAlignmentOrderFrom(AlignFrame alf, String sep);
+  public String[] getAlignmentOrderFrom(AlignFrame alf);
 
   /**
    * get current alignment's annotation as an annotation file
@@ -167,7 +152,7 @@ public interface JalviewJSApi
    * @see jalview.appletgui.AlignFrame#getFeatureGroups();
    */
 
-  public String getFeatureGroups();
+  public String[] getFeatureGroups();
 
   /**
    * @param visible
@@ -175,7 +160,7 @@ public interface JalviewJSApi
    * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean);
    */
 
-  public String getFeatureGroupsOfState(boolean visible);
+  public String[] getFeatureGroupsOfState(boolean visible);
 
   /**
    * @param alf
@@ -184,7 +169,8 @@ public interface JalviewJSApi
    * @return
    * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean);
    */
-  public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible);
+  public String[] getFeatureGroupsOfStateOn(AlignFrame alf,
+          boolean visible);
 
   /**
    * @param alf
@@ -192,7 +178,7 @@ public interface JalviewJSApi
    * @return
    * @see jalview.appletgui.AlignFrame#getFeatureGroups();
    */
-  public String getFeatureGroupsOn(AlignFrame alf);
+  public String[] getFeatureGroupsOn(AlignFrame alf);
 
   /**
    * get the sequence features in the given format (Jalview or GFF);
@@ -214,8 +200,6 @@ public interface JalviewJSApi
 
   public Object getFrameForSource(VamsasSource source);
 
-  public jalview.renderer.seqfeatures.FeatureRenderer getNewFeatureRenderer(AlignViewportI vp);
-
   public String getParameter(String name);
 
   /**
@@ -248,7 +232,8 @@ public interface JalviewJSApi
    *         current selection
    */
 
-  public String getSelectedSequencesAsAlignment(String format, String suffix);
+  public String getSelectedSequencesAsAlignment(String format,
+          String suffix);
 
   /**
    * get sequences selected in alf and return their alignment in format 'format'
@@ -263,7 +248,8 @@ public interface JalviewJSApi
    * @return selected sequences as flat file or empty string if there was no
    *         current selection
    */
-  public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, String suffix);
+  public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,
+          String format, String suffix);
 
   /**
    * @param alf
@@ -322,15 +308,9 @@ public interface JalviewJSApi
    */
   public SequenceI[] getSelectedSequencesFrom(AlignFrame alf, String sep);
 
-  public Object[] getSelectionForListener(SequenceGroup seqsel, ColumnSelection colsel, HiddenColumns hidden, SelectionSource source, Object alignFrame);
-
-  /**
-   * List separator string
-   * 
-   * @return the separator
-   */
-
-  public String getSeparator();
+  public Object[] getSelectionForListener(SequenceGroup seqsel,
+          ColumnSelection colsel, HiddenColumns hidden,
+          SelectionSource source, Object alignFrame);
 
   public AlignViewportI getViewport();
 
@@ -345,7 +325,8 @@ public interface JalviewJSApi
    *          column or unaligned sequence position
    */
 
-  public void highlight(String sequenceId, String position, String alignedPosition);
+  public void highlight(String sequenceId, String position,
+          String alignedPosition);
 
   /**
    * 
@@ -357,7 +338,8 @@ public interface JalviewJSApi
    *          false, blank or something else - indicate if position is an
    *          alignment column or unaligned sequence position
    */
-  public void highlightIn(AlignFrame alf, String sequenceId, String position, String alignedPosition);
+  public void highlightIn(AlignFrame alf, String sequenceId,
+          String position, String alignedPosition);
 
   /**
    * 
@@ -411,38 +393,15 @@ public interface JalviewJSApi
    *          be parsed from the string.
    * @return true if data parsed as features
    */
-  public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay);
+  public boolean loadFeaturesFrom(AlignFrame alf, String features,
+          boolean autoenabledisplay);
 
   public boolean loadScoreFile(String sScoreFile) throws IOException;
 
   public void newFeatureSettings();
 
-  public void newStructureView(PDBEntry pdb, SequenceI[] seqs, String[] chains, DataSourceType protocol);
-
-  /**
-   * public static method for JalviewJS API to open a PCAPanel without
-   * necessarily using a dialog.
-   * 
-   * @param af
-   *          may be null
-   * @param modelName
-   * @return the PCAPanel, or the string "label.you_need_at_least_n_sequences"
-   *         if number of sequences selected is inappropriate
-   */
-  public Object openPcaPanel(AlignFrame af, String modelName);
-
-  /**
-   * Open a new Tree panel on the desktop statically. Params are standard (not
-   * set by Groovy). No dialog is opened.
-   * 
-   * @param af
-   *          may be null
-   * @param treeType
-   * @param modelName
-   * @return null, or the string "label.you_need_at_least_n_sequences" if number
-   *         of sequences selected is inappropriate
-   */
-  public Object openTreePanel(AlignFrame af, String treeType, String modelName);
+  public void newStructureView(PDBEntry pdb, SequenceI[] seqs,
+          String[] chains, DataSourceType protocol);
 
   /// in http://www.jalview.org/examples/jalviewLiteJs.html but missing here
 
@@ -450,41 +409,38 @@ public interface JalviewJSApi
   // suffix
 
   /**
-   * re-order the given alignment using the given list of sequence IDs separated
-   * by sep
+   * re-order the given alignment using the given array of sequence IDs
    * 
    * @param alf
-   * @param order
-   *          - sep separated list
+   * @param ids
+   *          array of sequence IDs
    * @param undoName
    *          - string to use when referring to ordering action in undo buffer
-   * @param sep
    * @return 'true' if alignment was actually reordered. empty string if
    *         alignment did not contain sequences.
    */
-  public String orderAlignmentBy(AlignFrame alf, String order, String undoName, String sep);
+  String orderAlignmentBy(AlignFrame alf, String[] ids, String undoName);
 
   // get a string array from a list
 
   /**
    * re-order the current alignment using the given list of sequence IDs
    * 
-   * @param order
-   *          - sep separated list
+   * @param ids
+   *          array of sequence IDs
    * @param undoName
    *          - string to use when referring to ordering action in undo buffer
    * @return 'true' if alignment was actually reordered. empty string if
    *         alignment did not contain sequences.
    */
 
-  public String orderBy(String order, String undoName);
+  public String orderBy(String[] ids, String undoName);
 
   /**
    * re-order the current alignment using the given list of sequence IDs
-   * separated by sep
    * 
-   * @param order
-   *          - sep separated list
+   * @param ids
+   *          array of sequence IDs
    * @param undoName
    *          - string to use when referring to ordering action in undo buffer
    * @param sep
@@ -492,15 +448,8 @@ public interface JalviewJSApi
    *         alignment did not contain sequences.
    */
 
-  public String orderBy(String order, String undoName, String sep);
-
-  /**
-   * process commandline arguments after the JavaScript application has started
-   * 
-   * @param args
-   * @return
-   */
-  public Object parseArguments(String[] args);
+  // public String orderBy(String[] ids, String undoName, String sep);
+  //
 
   // public boolean getDefaultParameter(String name, boolean def);
 
@@ -536,7 +485,8 @@ public interface JalviewJSApi
    * @param topRow
    * @param leftHandColumn
    */
-  public void scrollViewToIn(AlignFrame alf, String topRow, String leftHandColumn);
+  public void scrollViewToIn(AlignFrame alf, String topRow,
+          String leftHandColumn);
 
   /**
    * adjust vertical scroll to make the given row the top one for given view
@@ -589,9 +539,8 @@ public interface JalviewJSApi
    * @param sep
    *          separator between toselect fields
    */
-  public void selectIn(AlignFrame alf, String sequenceIds, String columns, String sep);
-
-  public String[] separatorListToArray(String list);
+  public void selectIn(AlignFrame alf, String sequenceIds, String columns,
+          String sep);
 
   public void setFeatureGroupState(String groups, boolean state);
 
@@ -608,7 +557,8 @@ public interface JalviewJSApi
    * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[],
    *      boolean);
    */
-  public void setFeatureGroupStateOn(AlignFrame alf, String groups, boolean state);
+  public void setFeatureGroupStateOn(AlignFrame alf, String groups,
+          boolean state);
 
   public void setSelectionListener(AlignFrame af, String listener);
 
@@ -627,17 +577,46 @@ public interface JalviewJSApi
 
   public void setSelectionListener(String listener);
 
+  public void updateForAnnotations();
+
+  // Bob's additions:
+
   /**
-   * List separator string
+   * public static method for JalviewJS API to open a PCAPanel without
+   * necessarily using a dialog.
    * 
-   * @param separator
-   *          the separator to set. empty string will reset separator to default
+   * @param af
+   *          may be null
+   * @param modelName
+   * @return the PCAPanel, or the string "label.you_need_at_least_n_sequences"
+   *         if number of sequences selected is inappropriate
    */
+  public Object openPcaPanel(AlignFrame af, String modelName);
 
-  public void setSeparator(String separator);
+  /**
+   * Open a new Tree panel on the desktop statically. Params are standard (not
+   * set by Groovy). No dialog is opened.
+   * 
+   * @param af
+   *          may be null
+   * @param treeType
+   * @param modelName
+   * @return null, or the string "label.you_need_at_least_n_sequences" if number
+   *         of sequences selected is inappropriate
+   */
+  public Object openTreePanel(AlignFrame af, String treeType,
+          String modelName);
 
-  public void showOverview();
+  /**
+   * process commandline arguments after the JavaScript application has started
+   *
+   * @param args
+   * @return
+   */
+  public Object parseArguments(String[] args);
 
-  public void updateForAnnotations();
+  public void showStructure(AlignFrame af, String pdbID, String fileType);
+
+  public void showOverview();
 
 }