X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalviewLite.java;h=7fa514710dbf1cfbfeca9faed7d1c98beffe759b;hb=bdff041b485dae497cfa699bb536e3e79105527b;hp=0f3feb261947df17fbc1011f194f0da2e04b04fc;hpb=230fac58c5afe1843bf7177834fe1bd1d7e6f9d5;p=jalview.git diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 0f3feb2..7fa5147 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -39,6 +39,7 @@ import jalview.io.AnnotationFile; import jalview.io.AppletFormatAdapter; import jalview.io.DataSourceType; import jalview.io.FileFormatI; +import jalview.io.FileFormats; import jalview.io.FileParse; import jalview.io.IdentifyFile; import jalview.io.JPredFile; @@ -50,6 +51,7 @@ import jalview.javascript.JsCallBack; import jalview.javascript.MouseOverStructureListener; import jalview.structure.SelectionListener; import jalview.structure.StructureSelectionManager; +import jalview.util.ColorUtils; import jalview.util.HttpUtils; import jalview.util.MessageManager; @@ -469,17 +471,11 @@ public class JalviewLite extends Applet implements SequenceI rs = sel.getSequenceAt(0); start = rs.findIndex(start); end = rs.findIndex(end); - if (csel != null) - { - List cs = csel.getSelected(); - // note - the following actually clears cs as well, since - // csel.getSelected returns a reference. Need to check if we need to - // have a concurrentModification exception thrown here - csel.clear(); - for (Integer selectedCol : cs) - { - csel.addElement(rs.findIndex(selectedCol)); - } + List cs = new ArrayList(csel.getSelected()); + csel.clear(); + for (Integer selectedCol : cs) + { + csel.addElement(rs.findIndex(selectedCol)); } } sel.setStartRes(start); @@ -518,25 +514,27 @@ public class JalviewLite extends Applet implements */ @Override public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, - FileFormatI format, String suffix) + String format, String suffix) { try { + FileFormatI theFormat = FileFormats.getInstance().forName(format); boolean seqlimits = suffix.equalsIgnoreCase(TRUE); if (alf.viewport.getSelectionGroup() != null) { // JBPNote: getSelectionAsNewSequence behaviour has changed - this // method now returns a full copy of sequence data // TODO consider using getSequenceSelection instead here - String reply = new AppletFormatAdapter().formatSequences(format, + String reply = new AppletFormatAdapter().formatSequences(theFormat, new Alignment(alf.viewport.getSelectionAsNewSequence()), seqlimits); return reply; } - } catch (Exception ex) + } catch (IllegalArgumentException ex) { ex.printStackTrace(); - return "Error retrieving alignment in " + format + " format. "; + return "Error retrieving alignment, possibly invalid format specifier: " + + format; } return ""; } @@ -718,13 +716,15 @@ public class JalviewLite extends Applet implements { boolean seqlimits = suffix.equalsIgnoreCase(TRUE); - String reply = new AppletFormatAdapter().formatSequences(format, + FileFormatI theFormat = FileFormats.getInstance().forName(format); + String reply = new AppletFormatAdapter().formatSequences(theFormat, alf.viewport.getAlignment(), seqlimits); return reply; - } catch (Exception ex) + } catch (IllegalArgumentException ex) { ex.printStackTrace(); - return "Error retrieving alignment in " + format + " format. "; + return "Error retrieving alignment, possibly invalid format specifier: " + + format; } } @@ -2256,6 +2256,11 @@ public class JalviewLite extends Applet implements { boolean result = false; String param = applet.getParameter("jnetfile"); + if (param == null) + { + // jnet became jpred around 2016 + param = applet.getParameter("jpredfile"); + } if (param != null) { try @@ -2884,22 +2889,13 @@ public class JalviewLite extends Applet implements { return defcolour; } - Color col = jalview.schemes.ColourSchemeProperty - .getAWTColorFromName(colprop); + Color col = ColorUtils.parseColourString(colprop); if (col == null) { - try - { - col = new jalview.schemes.UserColourScheme(colprop).findColour('A'); - } catch (Exception ex) - { - System.err.println("Couldn't parse '" + colprop - + "' as a colour for " + colparam); - col = null; - } + System.err.println("Couldn't parse '" + colprop + + "' as a colour for " + colparam); } return (col == null) ? defcolour : col; - } public void openJalviewHelpUrl()