*/\r
public class JalviewLite extends Applet\r
{\r
+\r
+ ///////////////////////////////////////////\r
+ //The following public methods maybe called\r
+ //externally, eg via javascript in HTML page\r
+ public String getSelectedSequences()\r
+ {\r
+ StringBuffer result = new StringBuffer("");\r
+\r
+ if(initialAlignFrame.viewport.getSelectionGroup()!=null)\r
+ {\r
+ SequenceI[] seqs = initialAlignFrame.viewport.getSelectionGroup().\r
+ getSequencesInOrder(\r
+ initialAlignFrame.viewport.getAlignment());\r
+\r
+ for (int i = 0; i < seqs.length; i++)\r
+ result.append(seqs[i].getName() + "¬");\r
+ }\r
+\r
+ return result.toString();\r
+ }\r
+\r
+ public String getAlignment(String format)\r
+ {\r
+ return getAlignment(format, "true");\r
+ }\r
+\r
+ public String getAlignment(String format, String suffix)\r
+ {\r
+ try\r
+ {\r
+ boolean seqlimits = suffix.equalsIgnoreCase("true");\r
+\r
+ String reply = new AppletFormatAdapter().formatSequences(format,\r
+ currentAlignFrame.viewport.getAlignment(), seqlimits);\r
+ return reply;\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ return "Error retrieving alignment in " + format + " format. ";\r
+ }\r
+ }\r
+\r
+ public String getFeatures(String format)\r
+ {\r
+ return currentAlignFrame.outputFeatures(false, format);\r
+ }\r
+\r
+ public void loadAlignment(String text, String title)\r
+ {\r
+ Alignment al = null;\r
+ String format = new IdentifyFile().Identify(text, AppletFormatAdapter.PASTE);\r
+ try{\r
+ al = new AppletFormatAdapter().readFile(text,\r
+ AppletFormatAdapter.PASTE,\r
+ format);\r
+ if (al.getHeight() > 0)\r
+ new AlignFrame(al, this, title, false);\r
+ }catch(java.io.IOException ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
+ }\r
+\r
+\r
+ ////////////////////////////////////////////////\r
+ ////////////////////////////////////////////////\r
+\r
+\r
static int lastFrameX = 200;\r
static int lastFrameY = 200;\r
boolean fileFound = true;\r
frame.setVisible(true);\r
}\r
\r
- public String getSelectedSequences()\r
- {\r
- StringBuffer result = new StringBuffer("");\r
-\r
- if(initialAlignFrame.viewport.getSelectionGroup()!=null)\r
- {\r
- SequenceI[] seqs = initialAlignFrame.viewport.getSelectionGroup().\r
- getSequencesInOrder(\r
- initialAlignFrame.viewport.getAlignment());\r
-\r
- for (int i = 0; i < seqs.length; i++)\r
- result.append(seqs[i].getName() + "¬");\r
- }\r
-\r
- return result.toString();\r
- }\r
\r
- public String getAlignment(String format)\r
- {\r
- return getAlignment(format, "true");\r
- }\r
-\r
- public String getAlignment(String format, String suffix)\r
- {\r
- try\r
- {\r
- boolean seqlimits = suffix.equalsIgnoreCase("true");\r
-\r
- String reply = new AppletFormatAdapter().formatSequences(format,\r
- currentAlignFrame.viewport.getAlignment().getSequences(), seqlimits);\r
- return reply;\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- return "Error retrieving alignment in " + format + " format. ";\r
- }\r
- }\r
\r
/**\r
* This paints the background surrounding the "Launch Jalview button"\r