From: BobHanson Date: Tue, 2 Jun 2020 01:17:03 +0000 (-0500) Subject: JAL-3253-applet removes references to JalviewLite interface X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8bdcb5fb1d1fc9fccd8c6c97a17eb3ee4ceaa4d0;p=jalview.git JAL-3253-applet removes references to JalviewLite interface no longer any need to implement the Jalview methods as an interface that is common to JalviewLite --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 9418913..ab9b1d9 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -21,7 +21,6 @@ package jalview.bin; import jalview.api.AlignCalcWorkerI; -import jalview.api.AlignFrameI; import jalview.api.AlignViewportI; import jalview.api.JalviewApp; import jalview.api.StructureSelectionManagerProvider; @@ -287,9 +286,13 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi * @param args * open filename */ + @SuppressWarnings("unused") public static void main(String[] args) { - // Platform.startJavaLogging(); + if (false) + { + Platform.startJavaLogging(); + } getInstance().doMain(args); } @@ -1672,7 +1675,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi * .AlignFrame) */ @Override - public String getSelectedSequencesFrom(AlignFrameI alf) + public String getSelectedSequencesFrom(AlignFrame alf) { if (alf == null) { @@ -1687,7 +1690,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi * .AlignFrame, java.lang.String) */ @Override - public String getSelectedSequencesFrom(AlignFrameI alf, String sep) + public String getSelectedSequencesFrom(AlignFrame alf, String sep) { if (alf == null) { @@ -1710,7 +1713,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void highlightIn(AlignFrameI alf, String sequenceId, + public void highlightIn(AlignFrame alf, String sequenceId, String position, String alignedPosition) { if (alf == null) @@ -1733,13 +1736,13 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void selectIn(AlignFrameI alf, String sequenceIds, String columns) + public void selectIn(AlignFrame alf, String sequenceIds, String columns) { selectIn(alf, sequenceIds, columns, null); } @Override - public void selectIn(AlignFrameI alf, String sequenceIds, String columns, + public void selectIn(AlignFrame alf, String sequenceIds, String columns, String sep) { if (alf == null) @@ -1758,7 +1761,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getSelectedSequencesAsAlignmentFrom(AlignFrameI alf, + public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, String sep) { if (alf == null) @@ -1775,13 +1778,13 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getAlignmentOrderFrom(AlignFrameI alf) + public String getAlignmentOrderFrom(AlignFrame alf) { return getAlignmentFrom(alf, null); } @Override - public String getAlignmentOrderFrom(AlignFrameI alf, String sep) + public String getAlignmentOrderFrom(AlignFrame alf, String sep) { if (alf == null) { @@ -1803,7 +1806,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String orderAlignmentBy(AlignFrameI alf, String order, + public String orderAlignmentBy(AlignFrame alf, String order, String undoName, String sep) { if (alf == null) @@ -1820,7 +1823,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getAlignmentFrom(AlignFrameI alf, String format) + public String getAlignmentFrom(AlignFrame alf, String format) { return getAlignmentFrom(alf, format, null); } @@ -1832,7 +1835,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getAlignmentFrom(AlignFrameI alf, String format, + public String getAlignmentFrom(AlignFrame alf, String format, String suffix) { return appLoader.getAlignmentFrom(alf, format, suffix); @@ -1845,7 +1848,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void loadAnnotationFrom(AlignFrameI alf, String annotation) + public void loadAnnotationFrom(AlignFrame alf, String annotation) { if (alf == null) { @@ -1861,7 +1864,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public boolean loadFeaturesFrom(AlignFrameI alf, String features, + public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay) { if (alf == null) @@ -1878,7 +1881,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getFeaturesFrom(AlignFrameI alf, String format) + public String getFeaturesFrom(AlignFrame alf, String format) { if (alf == null) { @@ -1894,7 +1897,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getAnnotationFrom(AlignFrameI alf) + public String getAnnotationFrom(AlignFrame alf) { if (alf == null) { @@ -1903,43 +1906,43 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi return appLoader.getAnnotationFrom(alf); } - @Override - public AlignFrameI newView() - { - return newViewFrom(null, null); - } - - @Override - public AlignFrameI newView(String name) - { - return newViewFrom(null, name); - } - - @Override - public AlignFrameI newViewFrom(AlignFrameI alf) - { - return newViewFrom(alf, null); - } + // @Override + // public AlignFrame newView() + // { + // return newViewFrom(null, null); + // } + // + // @Override + // public AlignFrame newView(String name) + // { + // return newViewFrom(null, name); + // } + // + // @Override + // public AlignFrame newViewFrom(AlignFrame alf) + // { + // return newViewFrom(alf, null); + // } - @Override - public AlignFrameI newViewFrom(AlignFrameI alf, String name) - { - if (alf == null) - { - alf = getCurrentAlignFrame(); - } - return appLoader.newViewFrom(alf, name); - } + // @Override + // public AlignFrame newViewFrom(AlignFrame alf, String name) + // { + // if (alf == null) + // { + // alf = getCurrentAlignFrame(); + // } + // return appLoader.newViewFrom(alf, name); + // } @Override - public AlignFrameI loadAlignment(String text, String title) + public AlignFrame loadAlignment(String text, String title) { return appLoader.loadAlignment(text, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT, title); } @Override - public boolean addPdbFile(AlignFrameI alFrame, String sequenceId, + public boolean addPdbFile(AlignFrame alFrame, String sequenceId, String pdbEntryString, String pdbFile) { if (alFrame == null) @@ -1951,7 +1954,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void scrollViewToIn(AlignFrameI alf, String topRow, + public void scrollViewToIn(AlignFrame alf, String topRow, String leftHandColumn) { if (alf == null) @@ -1962,7 +1965,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void scrollViewToRowIn(AlignFrameI alf, String topRow) + public void scrollViewToRowIn(AlignFrame alf, String topRow) { if (alf == null) { @@ -1972,7 +1975,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void scrollViewToColumnIn(AlignFrameI alf, String leftHandColumn) + public void scrollViewToColumnIn(AlignFrame alf, String leftHandColumn) { if (alf == null) { @@ -1988,7 +1991,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getFeatureGroupsOn(AlignFrameI alf) + public String getFeatureGroupsOn(AlignFrame alf) { if (alf == null) { @@ -2004,7 +2007,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getFeatureGroupsOfStateOn(AlignFrameI alf, boolean visible) + public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible) { if (alf == null) { @@ -2020,7 +2023,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void setFeatureGroupStateOn(AlignFrameI alf, String groups, + public void setFeatureGroupStateOn(AlignFrame alf, String groups, boolean state) { if (alf == null) @@ -2098,7 +2101,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public String getSelectedSequencesAsAlignmentFrom(AlignFrameI alf, + public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, boolean suffix) { if (alf == null) @@ -2132,7 +2135,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void setMouseoverListener(AlignFrameI af, String listener) + public void setMouseoverListener(AlignFrame af, String listener) { // TODO Auto-generated method stub @@ -2146,7 +2149,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void setSelectionListener(AlignFrameI af, String listener) + public void setSelectionListener(AlignFrame af, String listener) { // TODO Auto-generated method stub @@ -2160,7 +2163,7 @@ public class Jalview implements ApplicationSingletonI, JalviewJSApi } @Override - public void removeJavascriptListener(AlignFrameI af, String listener) + public void removeJavascriptListener(AlignFrame af, String listener) { // TODO Auto-generated method stub diff --git a/src/jalview/bin/JalviewAppLoader.java b/src/jalview/bin/JalviewAppLoader.java index 51a0330..a7c5042 100644 --- a/src/jalview/bin/JalviewAppLoader.java +++ b/src/jalview/bin/JalviewAppLoader.java @@ -1,6 +1,5 @@ package jalview.bin; -import jalview.api.AlignFrameI; import jalview.api.JalviewApp; import jalview.api.StructureSelectionManagerProvider; import jalview.datamodel.Alignment; @@ -761,14 +760,14 @@ public class JalviewAppLoader return arrayToSeparatorList(array, separator); } - public String getSelectedSequencesFrom(AlignFrameI alf, String sep) + public String getSelectedSequencesFrom(AlignFrame alf, String sep) { StringBuffer result = new StringBuffer(""); if (sep == null || sep.length() == 0) { sep = separator; // "+0x00AC; } - AlignViewport v = ((AlignFrame) alf).getViewport(); + AlignViewport v = alf.getViewport(); if (v.getSelectionGroup() != null) { SequenceI[] seqs = v.getSelectionGroup() @@ -784,7 +783,7 @@ public class JalviewAppLoader return result.toString(); } - public void setFeatureGroupStateOn(final AlignFrameI alf, + public void setFeatureGroupStateOn(final AlignFrame alf, final String groups, boolean state) { java.awt.EventQueue.invokeLater(new Runnable() @@ -792,19 +791,19 @@ public class JalviewAppLoader @Override public void run() { - ((AlignFrame) alf).setFeatureGroupState( + alf.setFeatureGroupState( separatorListToArray(groups, separator), state); } }); } - public String getFeatureGroupsOfStateOn(AlignFrameI alf, boolean visible) + public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible) { return arrayToSeparatorList( - ((AlignFrame) alf).getFeatureGroupsOfState(visible)); + alf.getFeatureGroupsOfState(visible)); } - public void scrollViewToIn(final AlignFrameI alf, final String topRow, + public void scrollViewToIn(final AlignFrame alf, final String topRow, final String leftHandColumn) { java.awt.EventQueue.invokeLater(new Runnable() @@ -814,8 +813,8 @@ public class JalviewAppLoader { try { - ((AlignFrame) alf).scrollTo(new Integer(topRow).intValue(), - new Integer(leftHandColumn).intValue()); + alf.scrollTo(Integer.valueOf(topRow).intValue(), + Integer.valueOf(leftHandColumn).intValue()); } catch (Exception ex) { @@ -828,7 +827,7 @@ public class JalviewAppLoader }); } - public void scrollViewToRowIn(final AlignFrameI alf, final String topRow) + public void scrollViewToRowIn(final AlignFrame alf, final String topRow) { java.awt.EventQueue.invokeLater(new Runnable() @@ -838,7 +837,7 @@ public class JalviewAppLoader { try { - ((AlignFrame) alf).scrollToRow(new Integer(topRow).intValue()); + alf.scrollToRow(Integer.valueOf(topRow).intValue()); } catch (Exception ex) { @@ -851,7 +850,7 @@ public class JalviewAppLoader }); } - public void scrollViewToColumnIn(final AlignFrameI alf, + public void scrollViewToColumnIn(final AlignFrame alf, final String leftHandColumn) { java.awt.EventQueue.invokeLater(new Runnable() @@ -862,8 +861,9 @@ public class JalviewAppLoader { try { - ((AlignFrame) alf) - .scrollToColumn(new Integer(leftHandColumn).intValue()); + alf + .scrollToColumn( + Integer.valueOf(leftHandColumn).intValue()); } catch (Exception ex) { @@ -877,10 +877,10 @@ public class JalviewAppLoader } - public boolean addPdbFile(AlignFrameI alf, String sequenceId, + public boolean addPdbFile(AlignFrame alf, String sequenceId, String pdbEntryString, String pdbFile) { - AlignFrame alFrame = (AlignFrame) alf; + AlignFrame alFrame = alf; SequenceI toaddpdb = alFrame.getViewport().getAlignment() .findName(sequenceId); boolean needtoadd = false; @@ -930,7 +930,7 @@ public class JalviewAppLoader return true; } - public AlignFrameI loadAlignment(String text, int width, int height, + public AlignFrame loadAlignment(String text, int width, int height, String title) { AlignmentI al = null; @@ -952,18 +952,18 @@ public class JalviewAppLoader return null; } - public String getFeatureGroupsOn(AlignFrameI alf) + public String getFeatureGroupsOn(AlignFrame alf) { return arrayToSeparatorList( - ((AlignFrame) alf).getFeatureGroups()); + alf.getFeatureGroups()); } - public void highlightIn(final AlignFrameI alf, final String sequenceId, + public void highlightIn(final AlignFrame alf, final String sequenceId, final String position, final String alignedPosition) { // TODO: could try to highlight in all alignments if alf==null jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( - ((AlignFrame) alf).getViewport().getAlignment() + alf.getViewport().getAlignment() .getSequencesArray()); final SequenceI sq = matcher.findIdMatch(sequenceId); if (sq != null) @@ -971,7 +971,7 @@ public class JalviewAppLoader int apos = -1; try { - apos = new Integer(position).intValue(); + apos = Integer.valueOf(position).intValue(); apos--; } catch (NumberFormatException ex) { @@ -1009,7 +1009,7 @@ public class JalviewAppLoader } } - public void selectIn(final AlignFrameI alf, String sequenceIds, + public void selectIn(final AlignFrame alf, String sequenceIds, String columns, String sep) { if (sep == null || sep.length() == 0) @@ -1029,9 +1029,9 @@ public class JalviewAppLoader String[] cols = JalviewAppLoader.separatorListToArray(columns, sep); final SequenceGroup sel = new SequenceGroup(); final ColumnSelection csel = new ColumnSelection(); - AlignmentI al = ((AlignFrame) alf).getViewport().getAlignment(); + AlignmentI al = alf.getViewport().getAlignment(); jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( - ((AlignFrame) alf).getViewport().getAlignment() + alf.getViewport().getAlignment() .getSequencesArray()); int start = 0, end = al.getWidth(), alw = al.getWidth(); boolean seqsfound = true; @@ -1069,7 +1069,7 @@ public class JalviewAppLoader 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) { @@ -1080,7 +1080,7 @@ public class JalviewAppLoader } try { - to = new Integer(cl.substring(p + 1)).intValue(); + to = Integer.valueOf(cl.substring(p + 1)).intValue(); to--; } catch (NumberFormatException ex) { @@ -1140,7 +1140,7 @@ public class JalviewAppLoader int r = -1; try { - r = new Integer(cl).intValue(); + r = Integer.valueOf(cl).intValue(); r--; } catch (NumberFormatException ex) { @@ -1216,16 +1216,16 @@ public class JalviewAppLoader @Override public void run() { - ((AlignFrame) alf).select(sel, csel, ((AlignFrame) alf) + alf.select(sel, csel, alf .getCurrentView().getAlignment().getHiddenColumns()); } }); } } - public String getAlignmentOrderFrom(AlignFrameI alf, String sep) + public String getAlignmentOrderFrom(AlignFrame alf, String sep) { - AlignmentI alorder = ((AlignFrame) alf).getViewport().getAlignment(); + AlignmentI alorder = alf.getViewport().getAlignment(); String[] order = new String[alorder.getHeight()]; for (int i = 0; i < order.length; i++) { @@ -1234,12 +1234,12 @@ public class JalviewAppLoader return arrayToSeparatorList(order, sep); } - public String getSelectedSequencesAsAlignmentFrom(AlignFrameI alf, + public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, String suffix) { try { - AlignViewport vp = ((AlignFrame) alf).getViewport(); + AlignViewport vp = alf.getViewport(); FileFormatI theFormat = FileFormats.getInstance().forName(format); boolean seqlimits = (suffix == null || suffix.equalsIgnoreCase("true")); @@ -1262,7 +1262,7 @@ public class JalviewAppLoader return ""; } - public String orderAlignmentBy(AlignFrameI alf, String order, + public String orderAlignmentBy(AlignFrame alf, String order, String undoName, String sep) { if (sep == null || sep.length() == 0) @@ -1274,7 +1274,7 @@ public class JalviewAppLoader if (ids != null && ids.length > 0) { jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( - ((AlignFrame) alf).getViewport().getAlignment() + alf.getViewport().getAlignment() .getSequencesArray()); int s = 0; sqs = new SequenceI[ids.length]; @@ -1315,10 +1315,10 @@ public class JalviewAppLoader final String _undoName = undoName; // TODO: deal with synchronization here: cannot raise any events until after // this has returned. - return ((AlignFrame) alf).sortBy(aorder, _undoName) ? "true" : ""; + return alf.sortBy(aorder, _undoName) ? "true" : ""; } - public String getAlignmentFrom(AlignFrameI alf, String format, + public String getAlignmentFrom(AlignFrame alf, String format, String suffix) { try @@ -1328,7 +1328,7 @@ public class JalviewAppLoader FileFormatI theFormat = FileFormats.getInstance().forName(format); String reply = new AppletFormatAdapter().formatSequences(theFormat, - ((AlignFrame) alf).getViewport().getAlignment(), seqlimits); + alf.getViewport().getAlignment(), seqlimits); return reply; } catch (IllegalArgumentException ex) { @@ -1338,26 +1338,26 @@ public class JalviewAppLoader } } - public void loadAnnotationFrom(AlignFrameI alf, String annotation) + public void loadAnnotationFrom(AlignFrame alf, String annotation) { if (new AnnotationFile().annotateAlignmentView( - ((AlignFrame) alf).getViewport(), annotation, + alf.getViewport(), annotation, DataSourceType.PASTE)) { - ((AlignFrame) alf).alignPanel.fontChanged(); - ((AlignFrame) alf).alignPanel.setScrollValues(0, 0); + alf.alignPanel.fontChanged(); + alf.alignPanel.setScrollValues(0, 0); } else { - ((AlignFrame) alf).parseFeaturesFile(annotation, + alf.parseFeaturesFile(annotation, DataSourceType.PASTE); } } - public boolean loadFeaturesFrom(AlignFrameI alf, String features, + public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay) { - boolean ret = ((AlignFrame) alf).parseFeaturesFile(features, + boolean ret = alf.parseFeaturesFile(features, DataSourceType.PASTE); if (!ret) { @@ -1365,16 +1365,16 @@ public class JalviewAppLoader } if (autoenabledisplay) { - ((AlignFrame) alf).getViewport().setShowSequenceFeatures(true); + alf.getViewport().setShowSequenceFeatures(true); // this next was for a checkbox in JalviewLite // ((AlignFrame) alf).getViewport().sequenceFeatures.setState(true); } return true; } - public String getFeaturesFrom(AlignFrameI alf, String format) + public String getFeaturesFrom(AlignFrame alf, String format) { - AlignFrame f = ((AlignFrame) alf); + AlignFrame f = (alf); String features; FeaturesFile formatter = new FeaturesFile(); @@ -1399,25 +1399,25 @@ public class JalviewAppLoader } - public String getAnnotationFrom(AlignFrameI alf) + public String getAnnotationFrom(AlignFrame alf) { - AlignFrame f = (AlignFrame) alf; + AlignFrame f = alf; String annotation = new AnnotationFile() .printAnnotationsForView(f.getViewport()); return annotation; } - public AlignFrameI newViewFrom(AlignFrameI alf, String name) - { - return (AlignFrameI) ((AlignFrame) alf).newView(name, true); - } - + // public AlignFrame newViewFrom(AlignFrame alf, String name) + // { + // return (AlignFrame) alf.newView(name, true); + // } + // public String[] separatorListToArray(String list) { return separatorListToArray(list, separator); } - public Object[] getSelectionForListener(AlignFrameI currentFrame, + public Object[] getSelectionForListener(AlignFrame currentFrame, SequenceGroup seqsel, ColumnSelection colsel, HiddenColumns hidden, SelectionSource source, Object alignFrame) { @@ -1428,10 +1428,10 @@ public class JalviewAppLoader if (source != null) { if (source instanceof AlignViewport - && ((AlignFrame) currentFrame).getViewport() == source) + && currentFrame.getViewport() == source) { // should be valid if it just generated an event! - src = (AlignFrame) currentFrame; + src = currentFrame; } } diff --git a/src/jalview/bin/JalviewJSApi.java b/src/jalview/bin/JalviewJSApi.java index b1fed25..a21bebe 100644 --- a/src/jalview/bin/JalviewJSApi.java +++ b/src/jalview/bin/JalviewJSApi.java @@ -1,7 +1,6 @@ package jalview.bin; import jalview.gui.AlignFrame; -import jalview.javascript.JalviewLiteJsApi; /** * JAL-3369 JalviewJS API BH 2019.07.17 @@ -9,7 +8,7 @@ import jalview.javascript.JalviewLiteJsApi; * @author hansonr * */ -public interface JalviewJSApi extends JalviewLiteJsApi +public interface JalviewJSApi { void showOverview(); @@ -49,4 +48,646 @@ public interface JalviewJSApi extends JalviewLiteJsApi */ public Object openPcaPanel(AlignFrame af, String modelName); + /** + * The following public methods may be called externally, eg via javascript in + * an HTML page. + * + *
+ * TODO: introduce abstract interface for + * jalview.appletgui.AlignFrame
+ * + * Most function arguments are strings, which contain serialised versions of + * lists. Lists of things are separated by a separator character - either the + * default or a user supplied one. Ranges and positions on an alignment or + * sequence can be specified as a list, where an item containing a single + * number is a single position, and an item like 1-2 specifies columns 1 and 2 + * as a range. + */ + + // /** + // * @author jimp + // * + // */ + // public interface JalviewLiteJsApi + // { + + /** + * @return String list of selected sequence IDs, each terminated by the + * 'boolean not' character (""+0x00AC); or (¬); + */ + + public abstract String getSelectedSequences(); + + /** + * @param sep + * separator string or null for default + * @return String list of selected sequence IDs, each terminated by given + * separator string + */ + + public abstract String getSelectedSequences(String sep); + + /** + * @param alf + * AlignFrame containing selection + * @return String list of selected sequence IDs, each terminated by current + * default separator sequence + * + */ + public abstract String getSelectedSequencesFrom(AlignFrame alf); + + /** + * get list of selected sequence IDs separated by given separator + * + * @param alf + * window containing selection + * @param sep + * separator string to use - default is 'boolean not' + * @return String list of selected sequence IDs, each terminated by the given + * separator + */ + public abstract String getSelectedSequencesFrom(AlignFrame alf, + String sep); + + /** + * + * @param sequenceId + * id of sequence to highlight + * @param position + * integer position [ tobe implemented or range ] on sequence + * @param alignedPosition + * true/false/empty string - indicate if position is an alignment + * column or unaligned sequence position + */ + + public abstract void highlight(String sequenceId, String position, + String alignedPosition); + + /** + * + * @param sequenceId + * id of sequence to highlight + * @param position + * integer position [ tobe implemented or range ] on sequence + * @param alignedPosition + * false, blank or something else - indicate if position is an + * alignment column or unaligned sequence position + */ + public abstract void highlightIn(AlignFrame alf, String sequenceId, + String position, String alignedPosition); + + /** + * select regions of the currrent alignment frame + * + * @param sequenceIds + * String separated list of sequence ids or empty string + * @param columns + * String separated list { column range or column, ..} or empty + * string + */ + + public abstract void select(String sequenceIds, String columns); + + /** + * select regions of the currrent alignment frame + * + * @param toselect + * String separated list { column range, seq1...seqn sequence ids } + * @param sep + * separator between toselect fields + */ + + public abstract void select(String sequenceIds, String columns, + String sep); + + /** + * select regions of the given alignment frame + * + * @param alf + * @param toselect + * String separated list { column range, seq1...seqn sequence ids } + * @param sep + * separator between toselect fields + */ + public abstract void selectIn(AlignFrame alf, String sequenceIds, + String columns); + + /** + * select regions of the given alignment frame + * + * @param alf + * @param toselect + * String separated list { column range, seq1...seqn sequence ids } + * @param sep + * separator between toselect fields + */ + public abstract void selectIn(AlignFrame alf, String sequenceIds, + String columns, String sep); + + /** + * get sequences selected in current AlignFrame and return their alignment in + * format 'format' either with or without suffix + * + * @param alf + * - where selection is + * @param format + * - format of alignment file + * @param suffix + * - "true" to append /start-end string to each sequence ID + * @return selected sequences as flat file or empty string if there was no + * current selection + */ + + public abstract String getSelectedSequencesAsAlignment(String format, + String suffix); + + /** + * get sequences selected in alf and return their alignment in format 'format' + * either with or without suffix + * + * @param alf + * - where selection is + * @param format + * - format of alignment file + * @param suffix + * - "true" to append /start-end string to each sequence ID + * @return selected sequences as flat file or empty string if there was no + * current selection + */ + public abstract String getSelectedSequencesAsAlignmentFrom( + AlignFrame alf, + String format, String suffix); + + /** + * get a separator separated list of sequence IDs reflecting the order of the + * current alignment + * + * @return + */ + + public abstract String getAlignmentOrder(); + + /** + * get a separator separated list of sequence IDs reflecting the order of the + * alignment in alf + * + * @param alf + * @return + */ + public abstract 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 abstract String getAlignmentOrderFrom(AlignFrame alf, + String sep); + + /** + * re-order the current alignment using the given list of sequence IDs + * + * @param order + * - sep separated list + * @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 abstract String orderBy(String order, String undoName); + + /** + * re-order the current alignment using the given list of sequence IDs + * separated by sep + * + * @param order + * - sep separated list + * @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 abstract String orderBy(String order, String undoName, + String sep); + + /** + * re-order the given alignment using the given list of sequence IDs separated + * by sep + * + * @param alf + * @param order + * - sep separated list + * @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 abstract String orderAlignmentBy(AlignFrame alf, String order, + String undoName, String sep); + + /** + * get alignment as format (format names FASTA, BLC, CLUSTAL, MSF, PILEUP, + * PFAM - see jalview.io.AppletFormatAdapter for full list); + * + * @param format + * @return + */ + + public abstract String getAlignment(String format); + + /** + * get alignment displayed in alf as format + * + * @param alf + * @param format + * @return + */ + public abstract String getAlignmentFrom(AlignFrame alf, String format); + + /** + * get alignment as format with jalview start-end sequence suffix appended + * + * @param format + * @param suffix + * @return + */ + + public abstract String getAlignment(String format, String suffix); + + /** + * get alignment displayed in alf as format with or without the jalview + * start-end sequence suffix appended + * + * @param alf + * @param format + * @param suffix + * @return + */ + public abstract String getAlignmentFrom(AlignFrame alf, String format, + String suffix); + + /** + * add the given features or annotation to the current alignment + * + * @param annotation + */ + + public abstract void loadAnnotation(String annotation); + + /** + * add the given features or annotation to the given alignment view + * + * @param alf + * @param annotation + */ + public abstract void loadAnnotationFrom(AlignFrame alf, + String annotation); + + /** + * parse the given string as a jalview feature or GFF annotation file and + * optionally enable feature display on the current AlignFrame + * + * @param features + * - gff or features file + * @param autoenabledisplay + * - when true, feature display will be enabled if any features can + * be parsed from the string. + */ + + public abstract void loadFeatures(String features, + boolean autoenabledisplay); + + /** + * parse the given string as a jalview feature or GFF annotation file and + * optionally enable feature display on the given AlignFrame. + * + * @param alf + * @param features + * - gff or features file + * @param autoenabledisplay + * - when true, feature display will be enabled if any features can + * be parsed from the string. + * @return true if data parsed as features + */ + public abstract boolean loadFeaturesFrom(AlignFrame alf, String features, + boolean autoenabledisplay); + + /** + * get the sequence features in the given format (Jalview or GFF); + * + * @param format + * @return + */ + + public abstract String getFeatures(String format); + + /** + * get the sequence features in alf in the given format (Jalview or GFF); + * + * @param alf + * @param format + * @return + */ + public abstract String getFeaturesFrom(AlignFrame alf, String format); + + /** + * get current alignment's annotation as an annotation file + * + * @return + */ + + public abstract String getAnnotation(); + + /** + * get alignment view alf's annotation as an annotation file + * + * @param alf + * @return + */ + public abstract String getAnnotationFrom(AlignFrame alf); + + // BH incompatibility here -- JalviewLite created an AlignFrame; Jalview + // creates an AlignmentPanel + // /** + // * create a new view and return the AlignFrame instance + // * + // * @return + // */ + // + // public abstract AlignFrame newView(); + // + // /** + // * create a new view named name and return the AlignFrame instance + // * + // * @param name + // * @return + // */ + // + // public abstract AlignFrame newView(String name); + // + // /** + // * create a new view on alf and return the AlignFrame instance + // * + // * @param alf + // * @return + // */ + // public abstract AlignFrame newViewFrom(AlignFrame alf); + // + // /** + // * create a new view named name on alf + // * + // * @param alf + // * @param name + // * @return + // */ + // public abstract AlignFrame newViewFrom(AlignFrame alf, String name); + + /** + * + * @param text + * alignment file as a string + * @param title + * window title + * @return null or new alignment frame + */ + + public abstract AlignFrame loadAlignment(String text, String title); + + /** + * register a javascript function to handle any alignment mouseover events + * + * @param listener + * name of javascript function (called with arguments + * [jalview.appletgui.AlignFrame,String(sequence id);,String(column + * in alignment);, String(position in sequence);] + */ + + public abstract void setMouseoverListener(String listener); + + /** + * register a javascript function to handle mouseover events + * + * @param af + * (null or specific AlignFrame for which events are to be listened + * for); + * @param listener + * name of javascript function + */ + public abstract void setMouseoverListener(AlignFrame af, + String listener); + + /** + * register a javascript function to handle any alignment selection events. + * Events are generated when the user completes a selection event, or when the + * user deselects all selected regions. + * + * @param listener + * name of javascript function (called with arguments + * [jalview.appletgui.AlignFrame, String(sequence set id);, + * String(separator separated list of sequences which were + * selected);, String(separator separated list of column ranges (i.e. + * single number or hyphenated range); that were selected);] + */ + + public abstract void setSelectionListener(String listener); + + public abstract void setSelectionListener(AlignFrame af, + String listener); + + /** + * register a javascript function to handle events normally routed to a Jmol + * structure viewer. + * + * @param listener + * - javascript function (arguments are variable, see + * jalview.javascript.MouseOverStructureListener for full details); + * @param modelSet + * - separator separated list of PDB file URIs that this viewer is + * handling. These files must be in the same order they appear in + * Jmol (e.g. first one is frame 1, second is frame 2, etc);. + * @see jalview.javascript.MouseOverStructureListener + */ + + public abstract void setStructureListener(String listener, + String modelSet); + + /** + * remove any callback using the given listener function and associated with + * the given AlignFrame (or null for all callbacks); + * + * @param af + * (may be null); + * @param listener + * (may be null); + */ + public abstract void removeJavascriptListener(AlignFrame af, + String listener); + + /** + * send a mouseover message to all the alignment windows associated with the + * given residue in the pdbfile + * + * @param pdbResNum + * @param chain + * @param pdbfile + */ + + public abstract void mouseOverStructure(String pdbResNum, String chain, + String pdbfile); + + /** + * bind a pdb file to a sequence in the given AlignFrame. + * + * @param alFrame + * - 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 + * @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. + */ + public abstract boolean addPdbFile(AlignFrame alFrame, String sequenceId, + String pdbEntryString, String pdbFile); + + /** + * adjust horizontal/vertical scroll to make the given location the top left + * hand corner for the given view + * + * @param alf + * @param topRow + * @param leftHandColumn + */ + public abstract void scrollViewToIn(AlignFrame alf, String topRow, + String leftHandColumn); + + /** + * adjust vertical scroll to make the given row the top one for given view + * + * @param alf + * @param topRow + */ + public abstract void scrollViewToRowIn(AlignFrame alf, String topRow); + + /** + * adjust horizontal scroll to make the given column the left one in the given + * view + * + * @param alf + * @param leftHandColumn + */ + public abstract void scrollViewToColumnIn(AlignFrame alf, + String leftHandColumn); + + /** + * + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroups(); + */ + + public abstract String getFeatureGroups(); + + /** + * @param alf + * AlignFrame to get feature groups on + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroups(); + */ + public abstract String getFeatureGroupsOn(AlignFrame alf); + + /** + * @param visible + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean); + */ + + public abstract String getFeatureGroupsOfState(boolean visible); + + /** + * @param alf + * align frame to get groups of state visible + * @param visible + * @return + * @see jalview.appletgui.AlignFrame#getFeatureGroupsOfState(boolean); + */ + public abstract String getFeatureGroupsOfStateOn(AlignFrame alf, + boolean visible); + + /** + * @param groups + * tab separated list of group names + * @param state + * true or false + * @see jalview.appletgui.AlignFrame#setFeatureGroupState(java.lang.String[], + * boolean); + */ + public abstract void setFeatureGroupStateOn(AlignFrame alf, + String groups, + boolean state); + + + public abstract void setFeatureGroupState(String groups, boolean state); + + /** + * List separator string + * + * @return the separator + */ + + public abstract String getSeparator(); + + /** + * List separator string + * + * @param separator + * the separator to set. empty string will reset separator to default + */ + + public abstract void setSeparator(String separator); + + /** + * Retrieve fragments of a large packet of data made available by JalviewLite. + * + * @param messageclass + * @param viewId + * @return next chunk of message + */ + + public abstract String getJsMessage(String messageclass, String viewId); + + /// in http://www.jalview.org/examples/jalviewLiteJs.html but missing here + + // get selected sequences as alignment as format with or without start-end + // suffix + + public String getSelectedSequencesAsAlignment(String format, + boolean suffix); + + // get selected sequences as alignment from given view as format with or + // without start-end suffix + public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, + String format, boolean suffix); + + + public String arrayToSeparatorList(String[] array); + + // get a string array from a list + + public String[] separatorListToArray(String list); + + // debug flag - controls output to standard out + public static boolean debug = false; + } diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 207fcb8..1f77f75 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -100,6 +100,8 @@ public class Preferences extends GPreferences public static final String AUTOASSOCIATE_PDBANDSEQS = "AUTOASSOCIATE_PDBANDSEQS"; + public static final String BLOSUM62_PCA_FOR_NUCLEOTIDE = "BLOSUM62_PCA_FOR_NUCLEOTIDE"; + public static final String CENTRE_COLUMN_LABELS = "CENTRE_COLUMN_LABELS"; public static final String CHIMERA_PATH = "CHIMERA_PATH"; @@ -237,8 +239,6 @@ public class Preferences extends GPreferences public static final List groupURLLinks; // not implemented - public static final String BLOSUM62_PCA_FOR_NUCLEOTIDE = "BLOSUM62_PCA_FOR_NUCLEOTIDE"; - public static final String SHOW_IDENTITY = "SHOW_IDENTITY"; public static final String SHOW_FULLSCREEN = "SHOW_FULLSCREEN";