import java.awt.Button;\r
import java.awt.Color;\r
import java.awt.Component;\r
+import java.awt.EventQueue;\r
import java.awt.Font;\r
import java.awt.Frame;\r
import java.awt.Graphics;\r
* @author $author$\r
* @version $Revision: 1.92 $\r
*/\r
-public class JalviewLite extends Applet implements StructureSelectionManagerProvider, JalviewLiteJsApi\r
+public class JalviewLite extends Applet implements\r
+ StructureSelectionManagerProvider, JalviewLiteJsApi\r
{\r
\r
public StructureSelectionManager getStructureSelectionManager()\r
{\r
return StructureSelectionManager.getStructureSelectionManager(this);\r
}\r
+\r
// /////////////////////////////////////////\r
// The following public methods maybe called\r
// externally, eg via javascript in HTML page\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getSelectedSequences()\r
*/\r
public String getSelectedSequences()\r
return getSelectedSequencesFrom(getDefaultTargetFrame());\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String)\r
*/\r
public String getSelectedSequences(String sep)\r
return getSelectedSequencesFrom(getDefaultTargetFrame(), sep);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui.AlignFrame)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui\r
+ * .AlignFrame)\r
*/\r
public String getSelectedSequencesFrom(AlignFrame alf)\r
{\r
return getSelectedSequencesFrom(alf, separator); // ""+0x00AC);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui\r
+ * .AlignFrame, java.lang.String)\r
*/\r
public String getSelectedSequencesFrom(AlignFrame alf, String sep)\r
{\r
return result.toString();\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String,\r
+ * java.lang.String, java.lang.String)\r
*/\r
public void highlight(String sequenceId, String position,\r
String alignedPosition)\r
alignedPosition);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String, java.lang.String)\r
*/\r
- public void highlightIn(AlignFrame alf, String sequenceId,\r
- String position, String alignedPosition)\r
+ public void highlightIn(final AlignFrame alf, final String sequenceId,\r
+ final String position, final String alignedPosition)\r
{\r
// TODO: could try to highlight in all alignments if alf==null\r
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(\r
alf.viewport.getAlignment().getSequencesArray());\r
- SequenceI sq = matcher.findIdMatch(sequenceId);\r
+ final SequenceI sq = matcher.findIdMatch(sequenceId);\r
if (sq != null)\r
{\r
- int pos, apos = -1;\r
+ int apos = -1;\r
try\r
{\r
apos = new Integer(position).intValue();\r
{\r
return;\r
}\r
+ final StructureSelectionManagerProvider me = this;\r
+ final int pos = apos;\r
// use vamsas listener to broadcast to all listeners in scope\r
if (alignedPosition != null\r
&& (alignedPosition.trim().length() == 0 || alignedPosition\r
.toLowerCase().indexOf("false") > -1))\r
{\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .mouseOverVamsasSequence(sq, sq.findIndex(apos), null);\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
+ {\r
+ @Override\r
+ public void run()\r
+ {\r
+ StructureSelectionManager.getStructureSelectionManager(me)\r
+ .mouseOverVamsasSequence(sq, sq.findIndex(pos), null);\r
+ }\r
+ });\r
}\r
else\r
{\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .mouseOverVamsasSequence(sq, apos, null);\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
+ {\r
+ @Override\r
+ public void run()\r
+ {\r
+ StructureSelectionManager.getStructureSelectionManager(me)\r
+ .mouseOverVamsasSequence(sq, pos, null);\r
+ }\r
+ });\r
}\r
-\r
}\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,\r
+ * java.lang.String)\r
*/\r
public void select(String sequenceIds, String columns)\r
{\r
selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String,\r
+ * java.lang.String, java.lang.String)\r
*/\r
public void select(String sequenceIds, String columns, String sep)\r
{\r
selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String)\r
*/\r
public void selectIn(AlignFrame alf, String sequenceIds, String columns)\r
{\r
selectIn(alf, sequenceIds, columns, separator);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String, java.lang.String)\r
*/\r
- public void selectIn(AlignFrame alf, String sequenceIds, String columns,\r
- String sep)\r
+ public void selectIn(final AlignFrame alf, String sequenceIds,\r
+ String columns, String sep)\r
{\r
if (sep == null || sep.length() == 0)\r
{\r
// deparse fields\r
String[] ids = separatorListToArray(sequenceIds, sep);\r
String[] cols = separatorListToArray(columns, sep);\r
- SequenceGroup sel = new SequenceGroup();\r
- ColumnSelection csel = new ColumnSelection();\r
+ final SequenceGroup sel = new SequenceGroup();\r
+ final ColumnSelection csel = new ColumnSelection();\r
AlignmentI al = alf.viewport.getAlignment();\r
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher(\r
alf.viewport.getAlignment().getSequencesArray());\r
}\r
sel.setStartRes(start);\r
sel.setEndRes(end);\r
- alf.select(sel, csel);\r
+ EventQueue.invokeLater(new Runnable()\r
+ {\r
+ @Override\r
+ public void run()\r
+ {\r
+ alf.select(sel, csel);\r
+ }\r
+ });\r
}\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang.\r
+ * String, java.lang.String)\r
*/\r
public String getSelectedSequencesAsAlignment(String format, String suffix)\r
{\r
format, suffix);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview\r
+ * .appletgui.AlignFrame, java.lang.String, java.lang.String)\r
*/\r
public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf,\r
String format, String suffix)\r
return "";\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder()\r
*/\r
public String getAlignmentOrder()\r
return getAlignmentOrderFrom(getDefaultTargetFrame());\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame\r
+ * )\r
*/\r
public String getAlignmentOrderFrom(AlignFrame alf)\r
{\r
return getAlignmentOrderFrom(alf, separator);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame\r
+ * , java.lang.String)\r
*/\r
public String getAlignmentOrderFrom(AlignFrame alf, String sep)\r
{\r
return arrayToSeparatorList(order);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,\r
+ * java.lang.String)\r
*/\r
public String orderBy(String order, String undoName)\r
{\r
return orderBy(order, undoName, separator);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String,\r
+ * java.lang.String, java.lang.String)\r
*/\r
public String orderBy(String order, String undoName, String sep)\r
{\r
return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String, java.lang.String)\r
*/\r
public String orderAlignmentBy(AlignFrame alf, String order,\r
String undoName, String sep)\r
return "";\r
}\r
;\r
- AlignmentOrder aorder = new AlignmentOrder(sqs);\r
+ final AlignmentOrder aorder = new AlignmentOrder(sqs);\r
\r
if (undoName != null && undoName.trim().length() == 0)\r
{\r
undoName = null;\r
}\r
-\r
- return alf.sortBy(aorder, undoName) ? "true" : "";\r
+ final String _undoName = undoName;\r
+ // TODO: deal with synchronization here: cannot raise any events until after\r
+ // this has returned.\r
+ return alf.sortBy(aorder, _undoName) ? "true" : "";\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String)\r
*/\r
public String getAlignment(String format)\r
return getAlignmentFrom(getDefaultTargetFrame(), format, "true");\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,\r
+ * java.lang.String)\r
*/\r
public String getAlignmentFrom(AlignFrame alf, String format)\r
{\r
return getAlignmentFrom(alf, format, "true");\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String,\r
+ * java.lang.String)\r
*/\r
public String getAlignment(String format, String suffix)\r
{\r
return getAlignmentFrom(getDefaultTargetFrame(), format, suffix);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String)\r
*/\r
public String getAlignmentFrom(AlignFrame alf, String format,\r
String suffix)\r
}\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String)\r
*/\r
public void loadAnnotation(String annotation)\r
loadAnnotationFrom(getDefaultTargetFrame(), annotation);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame\r
+ * , java.lang.String)\r
*/\r
public void loadAnnotationFrom(AlignFrame alf, String annotation)\r
{\r
}\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String)\r
*/\r
public String getFeatures(String format)\r
return getFeaturesFrom(getDefaultTargetFrame(), format);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame,\r
+ * java.lang.String)\r
*/\r
public String getFeaturesFrom(AlignFrame alf, String format)\r
{\r
return alf.outputFeatures(false, format);\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getAnnotation()\r
*/\r
public String getAnnotation()\r
return getAnnotationFrom(getDefaultTargetFrame());\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame\r
+ * )\r
*/\r
public String getAnnotationFrom(AlignFrame alf)\r
{\r
return alf.outputAnnotations(false);\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#newView()\r
*/\r
public AlignFrame newView()\r
return newViewFrom(getDefaultTargetFrame());\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String)\r
*/\r
public AlignFrame newView(String name)\r
return newViewFrom(getDefaultTargetFrame(), name);\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame)\r
*/\r
public AlignFrame newViewFrom(AlignFrame alf)\r
return alf.newView(null);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame,\r
+ * java.lang.String)\r
*/\r
public AlignFrame newViewFrom(AlignFrame alf, String name)\r
{\r
return alf.newView(name);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String,\r
+ * java.lang.String)\r
*/\r
public AlignFrame loadAlignment(String text, String title)\r
{\r
return null;\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String)\r
*/\r
public void setMouseoverListener(String listener)\r
\r
private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<jalview.javascript.JSFunctionExec>();\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame\r
+ * , java.lang.String)\r
*/\r
public void setMouseoverListener(AlignFrame af, String listener)\r
{\r
}\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String)\r
*/\r
public void setSelectionListener(String listener)\r
setSelectionListener(null, listener);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame\r
+ * , java.lang.String)\r
*/\r
public void setSelectionListener(AlignFrame af, String listener)\r
{\r
}\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String,\r
+ * java.lang.String)\r
*/\r
public void setStructureListener(String listener, String modelSet)\r
{\r
}\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui\r
+ * .AlignFrame, java.lang.String)\r
*/\r
public void removeJavascriptListener(AlignFrame af, String listener)\r
{\r
\r
public void stop()\r
{\r
- System.err.println("Applet "+getName()+" stop().");\r
+ System.err.println("Applet " + getName() + " stop().");\r
tidyUp();\r
}\r
+\r
public void destroy()\r
{\r
- System.err.println("Applet "+getName()+" destroy().");\r
+ System.err.println("Applet " + getName() + " destroy().");\r
tidyUp();\r
}\r
+\r
private void tidyUp()\r
{\r
removeAll();\r
- if (currentAlignFrame!=null && currentAlignFrame.viewport!=null\r
- && currentAlignFrame.viewport.applet!=null)\r
+ if (currentAlignFrame != null && currentAlignFrame.viewport != null\r
+ && currentAlignFrame.viewport.applet != null)\r
{\r
AlignViewport av = currentAlignFrame.viewport;\r
currentAlignFrame.closeMenuItem_actionPerformed();\r
- av.applet=null;\r
- currentAlignFrame=null;\r
+ av.applet = null;\r
+ currentAlignFrame = null;\r
}\r
if (javascriptListeners != null)\r
{\r
while (javascriptListeners.size() > 0)\r
{\r
- jalview.javascript.JSFunctionExec mol = javascriptListeners.elementAt(0);\r
+ jalview.javascript.JSFunctionExec mol = javascriptListeners\r
+ .elementAt(0);\r
javascriptListeners.removeElement(mol);\r
if (mol instanceof SelectionListener)\r
{\r
StructureSelectionManager.getStructureSelectionManager(this)\r
.removeStructureViewerListener(mol, null);\r
}\r
- mol.jvlite=null;\r
+ mol.jvlite = null;\r
}\r
}\r
- if (jsFunctionExec!=null) {\r
+ if (jsFunctionExec != null)\r
+ {\r
jsFunctionExec.stopQueue();\r
- jsFunctionExec.jvlite=null;\r
+ jsFunctionExec.jvlite = null;\r
}\r
- initialAlignFrame=null;\r
+ initialAlignFrame = null;\r
jsFunctionExec = null;\r
- javascriptListeners=null;\r
+ javascriptListeners = null;\r
StructureSelectionManager.release(this);\r
}\r
+\r
private jalview.javascript.JSFunctionExec jsFunctionExec;\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String, java.lang.String, java.lang.String)\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String,\r
+ * java.lang.String, java.lang.String)\r
*/\r
- public void mouseOverStructure(String pdbResNum, String chain,\r
- String pdbfile)\r
+ public void mouseOverStructure(final String pdbResNum,\r
+ final String chain, final String pdbfile)\r
{\r
- try\r
+ final StructureSelectionManagerProvider me = this;\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
{\r
- StructureSelectionManager.getStructureSelectionManager(this)\r
- .mouseOverStructure(new Integer(pdbResNum).intValue(), chain,\r
- pdbfile);\r
- if (debug)\r
+ @Override\r
+ public void run()\r
{\r
- System.err.println("mouseOver for '" + pdbResNum + "' in chain '"\r
- + chain + "' in structure '" + pdbfile + "'");\r
+ try\r
+ {\r
+ StructureSelectionManager.getStructureSelectionManager(me)\r
+ .mouseOverStructure(new Integer(pdbResNum).intValue(),\r
+ chain, pdbfile);\r
+ if (debug)\r
+ {\r
+ System.err.println("mouseOver for '" + pdbResNum\r
+ + "' in chain '" + chain + "' in structure '" + pdbfile\r
+ + "'");\r
+ }\r
+ } catch (NumberFormatException e)\r
+ {\r
+ System.err.println("Ignoring invalid residue number string '"\r
+ + pdbResNum + "'");\r
+ }\r
+\r
}\r
- } catch (NumberFormatException e)\r
- {\r
- System.err.println("Ignoring invalid residue number string '"\r
- + pdbResNum + "'");\r
- }\r
+ });\r
}\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String)\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String)\r
*/\r
- public void scrollViewToIn(AlignFrame alf, String topRow, String leftHandColumn)\r
+ public void scrollViewToIn(final AlignFrame alf, final String topRow,\r
+ final String leftHandColumn)\r
{\r
- try {\r
- alf.scrollTo(new Integer(topRow).intValue(), new Integer(leftHandColumn).intValue());\r
- \r
- } catch (Exception ex)\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
{\r
- System.err.println("Couldn't parse integer arguments (topRow='"+topRow+"' and leftHandColumn='"+leftHandColumn+"')");\r
- ex.printStackTrace();\r
- }\r
+ @Override\r
+ public void run()\r
+ {\r
+ try\r
+ {\r
+ alf.scrollTo(new Integer(topRow).intValue(), new Integer(\r
+ leftHandColumn).intValue());\r
+\r
+ } catch (Exception ex)\r
+ {\r
+ System.err.println("Couldn't parse integer arguments (topRow='"\r
+ + topRow + "' and leftHandColumn='" + leftHandColumn\r
+ + "')");\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ });\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui\r
+ * .AlignFrame, java.lang.String)\r
*/\r
@Override\r
- public void scrollViewToRowIn(AlignFrame alf, String topRow)\r
+ public void scrollViewToRowIn(final AlignFrame alf, final String topRow)\r
{\r
- try {\r
- alf.scrollToRow(new Integer(topRow).intValue());\r
- \r
- } catch (Exception ex)\r
+\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
{\r
- System.err.println("Couldn't parse integer arguments (topRow='"+topRow+"')");\r
- ex.printStackTrace();\r
- }\r
+ @Override\r
+ public void run()\r
+ {\r
+ try\r
+ {\r
+ alf.scrollToRow(new Integer(topRow).intValue());\r
+\r
+ } catch (Exception ex)\r
+ {\r
+ System.err.println("Couldn't parse integer arguments (topRow='"\r
+ + topRow + "')");\r
+ ex.printStackTrace();\r
+ }\r
+\r
+ }\r
+ });\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui.AlignFrame, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui\r
+ * .AlignFrame, java.lang.String)\r
*/\r
@Override\r
- public void scrollViewToColumnIn(AlignFrame alf, String leftHandColumn)\r
+ public void scrollViewToColumnIn(final AlignFrame alf,\r
+ final String leftHandColumn)\r
{\r
-\r
- try {\r
- alf.scrollToColumn(new Integer(leftHandColumn).intValue());\r
- \r
- } catch (Exception ex)\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
{\r
- System.err.println("Couldn't parse integer arguments (leftHandColumn='"+leftHandColumn+"')");\r
- ex.printStackTrace();\r
- } \r
+\r
+ @Override\r
+ public void run()\r
+ {\r
+ try\r
+ {\r
+ alf.scrollToColumn(new Integer(leftHandColumn).intValue());\r
+\r
+ } catch (Exception ex)\r
+ {\r
+ System.err\r
+ .println("Couldn't parse integer arguments (leftHandColumn='"\r
+ + leftHandColumn + "')");\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+ });\r
+\r
}\r
\r
// //////////////////////////////////////////////\r
{\r
vp.applet.currentAlignFrame = null;\r
}\r
- vp.applet=null;\r
- vp=null;\r
- \r
+ vp.applet = null;\r
+ vp = null;\r
+\r
}\r
lastFrameX -= 40;\r
lastFrameY -= 40;\r
{\r
if (file.indexOf("://") == -1)\r
{\r
- String fl = applet.resolveUrlForLocalOrAbsolute(file, getDocumentBase());\r
+ String fl = applet.resolveUrlForLocalOrAbsolute(file,\r
+ getDocumentBase());\r
try\r
{\r
if (new java.net.URL(fl).openStream() != null)\r
// IDS include pipes.\r
\r
/**\r
- * set to enable the URL based javascript execution mechanism \r
+ * set to enable the URL based javascript execution mechanism\r
*/\r
- public boolean jsfallbackEnabled=false;\r
+ public boolean jsfallbackEnabled = false;\r
\r
/**\r
* parse the string into a list\r
return "" + separator;\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getFeatureGroups()\r
*/\r
public String getFeatureGroups()\r
return lst;\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame\r
+ * )\r
*/\r
public String getFeatureGroupsOn(AlignFrame alf)\r
{\r
return lst;\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean)\r
*/\r
public String getFeatureGroupsOfState(boolean visible)\r
.getFeatureGroupsOfState(visible));\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui.AlignFrame, boolean)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see\r
+ * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui\r
+ * .AlignFrame, boolean)\r
*/\r
public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible)\r
{\r
return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible));\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.AlignFrame, java.lang.String, boolean)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui.\r
+ * AlignFrame, java.lang.String, boolean)\r
*/\r
- public void setFeatureGroupStateOn(AlignFrame alf, String groups,\r
- boolean state)\r
+ public void setFeatureGroupStateOn(final AlignFrame alf,\r
+ final String groups, boolean state)\r
{\r
- boolean st = state;// !(state==null || state.equals("") ||\r
+ final boolean st = state;// !(state==null || state.equals("") ||\r
// state.toLowerCase().equals("false"));\r
- alf.setFeatureGroupState(separatorListToArray(groups), st);\r
+ java.awt.EventQueue.invokeLater(new Runnable()\r
+ {\r
+ @Override\r
+ public void run()\r
+ {\r
+ alf.setFeatureGroupState(separatorListToArray(groups), st);\r
+ }\r
+ });\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String, boolean)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String,\r
+ * boolean)\r
*/\r
public void setFeatureGroupState(String groups, boolean state)\r
{\r
setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state);\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#getSeparator()\r
*/\r
public String getSeparator()\r
return separator;\r
}\r
\r
- /* (non-Javadoc)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
* @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String)\r
*/\r
public void setSeparator(String separator)\r
return false;\r
}\r
\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame, java.lang.String, java.lang.String, java.lang.String)\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame,\r
+ * java.lang.String, java.lang.String, java.lang.String)\r
*/\r
public boolean addPdbFile(AlignFrame alFrame, String sequenceId,\r
String pdbEntryString, String pdbFile)\r
\r
public void start()\r
{\r
-// callInitCallback();\r
+ // callInitCallback();\r
}\r
- private Hashtable<String,long[]> jshashes=new Hashtable<String,long[]>();\r
- private Hashtable<String,Hashtable<String,String[]>> jsmessages=new Hashtable<String,Hashtable<String,String[]>>();\r
+\r
+ private Hashtable<String, long[]> jshashes = new Hashtable<String, long[]>();\r
+\r
+ private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<String, Hashtable<String, String[]>>();\r
+\r
public void setJsMessageSet(String messageclass, String viewId,\r
String[] colcommands)\r
{\r
- Hashtable<String,String[]> msgset = jsmessages.get(messageclass);\r
- if (msgset==null)\r
+ Hashtable<String, String[]> msgset = jsmessages.get(messageclass);\r
+ if (msgset == null)\r
{\r
- msgset=new Hashtable<String,String[]>();\r
+ msgset = new Hashtable<String, String[]>();\r
jsmessages.put(messageclass, msgset);\r
}\r
msgset.put(viewId, colcommands);\r
long[] l = new long[colcommands.length];\r
- for (int i=0;i<colcommands.length;i++) { l[i] = colcommands[i].hashCode();}\r
- jshashes.put(messageclass+"|"+viewId,l);\r
+ for (int i = 0; i < colcommands.length; i++)\r
+ {\r
+ l[i] = colcommands[i].hashCode();\r
+ }\r
+ jshashes.put(messageclass + "|" + viewId, l);\r
}\r
- /* (non-Javadoc)\r
- * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String, java.lang.String)\r
+\r
+ /*\r
+ * (non-Javadoc)\r
+ * \r
+ * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String,\r
+ * java.lang.String)\r
*/\r
public String getJsMessage(String messageclass, String viewId)\r
{\r
- Hashtable<String,String[]> msgset = jsmessages.get(messageclass);\r
- if (msgset!=null)\r
+ Hashtable<String, String[]> msgset = jsmessages.get(messageclass);\r
+ if (msgset != null)\r
{\r
String[] msgs = msgset.get(viewId);\r
- if (msgs!=null)\r
+ if (msgs != null)\r
{\r
- for (int i=0;i<msgs.length;i++) {\r
- if (msgs[i]!=null) {\r
+ for (int i = 0; i < msgs.length; i++)\r
+ {\r
+ if (msgs[i] != null)\r
+ {\r
String m = msgs[i];\r
- msgs[i]=null;\r
+ msgs[i] = null;\r
return m;\r
}\r
}\r
public boolean isJsMessageSetChanged(String string, String string2,\r
String[] colcommands)\r
{\r
- long[] l=jshashes.get(string+"|"+string2);\r
- if (l==null && colcommands!=null)\r
+ long[] l = jshashes.get(string + "|" + string2);\r
+ if (l == null && colcommands != null)\r
{\r
return true;\r
}\r
- for (int i=0;i<colcommands.length;i++) { if (l[i] != colcommands[i].hashCode()) { return true; }}\r
+ for (int i = 0; i < colcommands.length; i++)\r
+ {\r
+ if (l[i] != colcommands[i].hashCode())\r
+ {\r
+ return true;\r
+ }\r
+ }\r
return false;\r
}\r
\r
- private Vector jsExecQueue=new Vector();\r
+ private Vector jsExecQueue = new Vector();\r
+\r
public Vector getJsExecQueue()\r
{\r
return jsExecQueue;\r
\r
public void setExecutor(JSFunctionExec jsFunctionExec2)\r
{\r
- jsFunctionExec=jsFunctionExec2;\r
+ jsFunctionExec = jsFunctionExec2;\r
}\r
\r
/**\r
- * return the given colour value parameter or the given default if parameter not given\r
+ * return the given colour value parameter or the given default if parameter\r
+ * not given\r
+ * \r
* @param colparam\r
* @param defcolour\r
* @return\r
public Color getDefaultColourParameter(String colparam, Color defcolour)\r
{\r
String colprop = getParameter(colparam);\r
- if (colprop==null || colprop.trim().length()==0)\r
+ if (colprop == null || colprop.trim().length() == 0)\r
{\r
return defcolour;\r
}\r
- Color col = jalview.schemes.ColourSchemeProperty.getAWTColorFromName(colprop);\r
- if (col==null)\r
+ Color col = jalview.schemes.ColourSchemeProperty\r
+ .getAWTColorFromName(colprop);\r
+ if (col == null)\r
{\r
- try {\r
+ try\r
+ {\r
col = new jalview.schemes.UserColourScheme(colprop).findColour('A');\r
} catch (Exception ex)\r
{\r
- System.err.println("Couldn't parse '"+colprop+"' as a colour for "+colparam);\r
- col=null;\r
+ System.err.println("Couldn't parse '" + colprop\r
+ + "' as a colour for " + colparam);\r
+ col = null;\r
}\r
}\r
- return (col==null) ? defcolour: col;\r
+ return (col == null) ? defcolour : col;\r
\r
}\r
\r
public void openJalviewHelpUrl()\r
{\r
- String helpUrl=getParameter("jalviewhelpurl");\r
- if (helpUrl==null || helpUrl.trim().length()<5)\r
+ String helpUrl = getParameter("jalviewhelpurl");\r
+ if (helpUrl == null || helpUrl.trim().length() < 5)\r
{\r
- helpUrl="http://www.jalview.org/help.html";\r
+ helpUrl = "http://www.jalview.org/help.html";\r
}\r
- showURL(helpUrl, "HELP"); \r
+ showURL(helpUrl, "HELP");\r
}\r
- \r
+\r
/**\r
- * form a complete URL given a path to a resource and a reference location on the same server\r
- * @param url - an absolute path on the same server as localref or a document located relative to localref\r
- * @param localref - a URL on the same server as url\r
+ * form a complete URL given a path to a resource and a reference location on\r
+ * the same server\r
+ * \r
+ * @param url\r
+ * - an absolute path on the same server as localref or a document\r
+ * located relative to localref\r
+ * @param localref\r
+ * - a URL on the same server as url\r
* @return a complete URL for the resource located by url\r
*/\r
private String resolveUrlForLocalOrAbsolute(String url, URL localref)\r
}\r
\r
/**\r
- * open a URL in the browser - resolving it according to relative refs and coping with javascript: protocol if necessary.\r
+ * open a URL in the browser - resolving it according to relative refs and\r
+ * coping with javascript: protocol if necessary.\r
+ * \r
* @param url\r
* @param target\r
*/\r
// form valid URL\r
// Should really use docbase, not codebase.\r
URL prepend;\r
- url = resolveUrlForLocalOrAbsolute(url, prepend=getDefaultParameter("resolvetocodebase", false) ? getDocumentBase() : getCodeBase());\r
- if (debug) {\r
- System.err.println("Show url (prepended "+prepend+" - toggle resolvetocodebase if code/docbase resolution is wrong): " + url);\r
+ url = resolveUrlForLocalOrAbsolute(\r
+ url,\r
+ prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase()\r
+ : getCodeBase());\r
+ if (debug)\r
+ {\r
+ System.err\r
+ .println("Show url (prepended "\r
+ + prepend\r
+ + " - toggle resolvetocodebase if code/docbase resolution is wrong): "\r
+ + url);\r
}\r
}\r
else\r
{\r
- if (debug) {\r
+ if (debug)\r
+ {\r
System.err.println("Show url: " + url);\r
}\r
}\r
if (url.indexOf("javascript:") == 0)\r
{\r
// no target for the javascript context\r
- getAppletContext().showDocument(\r
- new java.net.URL(url));\r
+ getAppletContext().showDocument(new java.net.URL(url));\r
}\r
else\r
{\r
- getAppletContext().showDocument(\r
- new java.net.URL(url), target);\r
+ getAppletContext().showDocument(new java.net.URL(url), target);\r
}\r
} catch (Exception ex)\r
{\r