X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalviewLite.java;h=b49081594c9412a7deb5a4673ab7878d29fa0da0;hb=25aaaa87042b3f507ad4348120df7dd073182759;hp=68a85f3ceb8c5467cca11a4f8b7ccf14cfbff3f1;hpb=2f4f1d8fb6878271b64f327bc58c895f458137af;p=jalview.git
diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java
index 68a85f3..b490815 100644
--- a/src/jalview/bin/JalviewLite.java
+++ b/src/jalview/bin/JalviewLite.java
@@ -1,19 +1,21 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
* Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.bin;
@@ -61,6 +63,7 @@ import java.util.Hashtable;
import java.util.StringTokenizer;
import java.util.Vector;
+import netscape.javascript.JSException;
import netscape.javascript.JSObject;
/**
@@ -706,8 +709,8 @@ public class JalviewLite extends Applet implements
*/
public void loadAnnotationFrom(AlignFrame alf, String annotation)
{
- if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport()
- .getAlignment(), annotation, AppletFormatAdapter.PASTE))
+ if (new AnnotationFile().annotateAlignmentView(alf.getAlignViewport(),
+ annotation, AppletFormatAdapter.PASTE))
{
alf.alignPanel.fontChanged();
alf.alignPanel.setScrollValues(0, 0);
@@ -1266,7 +1269,7 @@ public class JalviewLite extends Applet implements
public static boolean debug = false;
- static String builddate = null, version = null;
+ static String builddate = null, version = null, installation = null;
private static void initBuildDetails()
{
@@ -1274,6 +1277,7 @@ public class JalviewLite extends Applet implements
{
builddate = "unknown";
version = "test";
+ installation = "Webstart";
java.net.URL url = JalviewLite.class
.getResource("/.build_properties");
if (url != null)
@@ -1293,6 +1297,10 @@ public class JalviewLite extends Applet implements
{
builddate = line.substring(line.indexOf("=") + 1);
}
+ if (line.indexOf("INSTALLATION") > -1)
+ {
+ installation = line.substring(line.indexOf("=") + 1);
+ }
}
} catch (Exception ex)
{
@@ -1308,6 +1316,12 @@ public class JalviewLite extends Applet implements
return builddate;
}
+ public static String getInstallation()
+ {
+ initBuildDetails();
+ return installation;
+ }
+
public static String getVersion()
{
initBuildDetails();
@@ -1357,6 +1371,7 @@ public class JalviewLite extends Applet implements
System.err.println("JalviewLite Version " + getVersion());
System.err.println("Build Date : " + getBuildDate());
+ System.err.println("Installation : " + getInstallation());
}
String externalsviewer = getParameter("externalstructureviewer");
@@ -1389,8 +1404,7 @@ public class JalviewLite extends Applet implements
}
else
{
- throw new Error(
- "Invalid separator parameter - must be non-zero length");
+ throw new Error(MessageManager.getString("error.invalid_separator_parameter"));
}
}
int r = 255;
@@ -1480,6 +1494,43 @@ public class JalviewLite extends Applet implements
}
}
+ private void initLiveConnect()
+ {
+ // try really hard to get the liveConnect thing working
+ boolean notFailed = false;
+ int tries = 0;
+ while (!notFailed && tries < 10)
+ {
+ if (tries > 0)
+ {
+ System.err.println("LiveConnect request thread going to sleep.");
+ }
+ try
+ {
+ Thread.sleep(700 * (1 + tries));
+ } catch (InterruptedException q)
+ {
+ }
+ ;
+ if (tries++ > 0)
+ {
+ System.err.println("LiveConnect request thread woken up.");
+ }
+ try
+ {
+ JSObject scriptObject = JSObject.getWindow(this);
+ if (scriptObject.eval("navigator") != null)
+ {
+ notFailed = true;
+ }
+ } catch (JSException jsex)
+ {
+ System.err.println("Attempt " + tries
+ + " to access LiveConnect javascript failed.");
+ }
+ }
+ }
+
private void callInitCallback()
{
String initjscallback = getParameter("oninit");
@@ -1498,6 +1549,9 @@ public class JalviewLite extends Applet implements
{
}
;
+ // try really hard to let the browser plugin know we want liveconnect
+ initLiveConnect();
+
if (scriptObject != null)
{
try
@@ -1612,15 +1666,19 @@ public class JalviewLite extends Applet implements
g.setColor(Color.cyan);
g.fillRect(0, 0, getSize().width, getSize().height);
g.setColor(Color.red);
- g.drawString(MessageManager.getString("label.jalview_cannot_open_file"), 5, 15);
+ g.drawString(
+ MessageManager.getString("label.jalview_cannot_open_file"),
+ 5, 15);
g.drawString("\"" + file + "\"", 5, 30);
}
else if (embedded)
{
g.setColor(Color.black);
g.setFont(new Font("Arial", Font.BOLD, 24));
- g.drawString(MessageManager.getString("label.jalview_applet"), 50, getSize().height / 2 - 30);
- g.drawString(MessageManager.getString("label.loading_data") + "...", 50, getSize().height / 2);
+ g.drawString(MessageManager.getString("label.jalview_applet"), 50,
+ getSize().height / 2 - 30);
+ g.drawString(MessageManager.getString("label.loading_data") + "...",
+ 50, getSize().height / 2);
}
}
@@ -1827,10 +1885,14 @@ public class JalviewLite extends Applet implements
if (protocol == jalview.io.AppletFormatAdapter.PASTE)
{
- newAlignFrame.setTitle(MessageManager.formatMessage("label.sequences_from", new String[]{applet.getDocumentBase().toString()}));
+ newAlignFrame.setTitle(MessageManager.formatMessage(
+ "label.sequences_from", new String[]
+ { applet.getDocumentBase().toString() }));
}
- newAlignFrame.statusBar.setText(MessageManager.formatMessage("label.successfully_loaded_file", new String []{file}));
+ newAlignFrame.statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_loaded_file", new String[]
+ { file }));
String treeFile = applet.getParameter("tree");
if (treeFile == null)
@@ -1928,7 +1990,7 @@ public class JalviewLite extends Applet implements
param = applet.getParameter("showFeatureSettings");
if (param != null && param.equalsIgnoreCase("true"))
{
- newAlignFrame.viewport.showSequenceFeatures(true);
+ newAlignFrame.viewport.setShowSequenceFeatures(true);
new FeatureSettings(newAlignFrame.alignPanel);
}
@@ -1937,8 +1999,8 @@ public class JalviewLite extends Applet implements
{
param = setProtocolState(param);
- if (new AnnotationFile().readAnnotationFile(
- newAlignFrame.viewport.getAlignment(), param, protocol))
+ if (new AnnotationFile().annotateAlignmentView(
+ newAlignFrame.viewport, param, protocol))
{
newAlignFrame.alignPanel.fontChanged();
newAlignFrame.alignPanel.setScrollValues(0, 0);
@@ -1962,6 +2024,12 @@ public class JalviewLite extends Applet implements
param, protocol);
JnetAnnotationMaker.add_annotation(predictions,
newAlignFrame.viewport.getAlignment(), 0, false); // false==do
+ SequenceI repseq = newAlignFrame.viewport.getAlignment()
+ .getSequenceAt(0);
+ newAlignFrame.viewport.getAlignment().setSeqrep(repseq);
+ ColumnSelection cs = new ColumnSelection();
+ cs.hideInsertionsFor(repseq);
+ newAlignFrame.viewport.setColumnSelection(cs);
// not
// add
// sequence
@@ -2026,10 +2094,12 @@ public class JalviewLite extends Applet implements
{
String sequence = applet.getParameter("PDBSEQ");
if (sequence != null)
+ {
seqs = new SequenceI[]
{ matcher == null ? (Sequence) newAlignFrame
.getAlignViewport().getAlignment()
.findName(sequence) : matcher.findIdMatch(sequence) };
+ }
}
else
@@ -2089,6 +2159,8 @@ public class JalviewLite extends Applet implements
if (seqs[i] != null)
{
((Sequence) seqs[i]).addPDBId(pdb);
+ StructureSelectionManager.getStructureSelectionManager(
+ applet).registerPDBEntry(pdb);
}
else
{
@@ -2273,7 +2345,9 @@ public class JalviewLite extends Applet implements
// note separator local variable intentionally masks object field
int seplen = separator.length();
if (list == null || list.equals("") || list.equals(separator))
+ {
return null;
+ }
java.util.Vector jv = new Vector();
int cp = 0, pos;
while ((pos = list.indexOf(separator, cp)) > cp)