example applet and desktop application files that should be published
[jalview.git] / examples / formComplete.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
3 <head>
4 <!-- InstanceBeginEditable name="doctitle" -->
5 <TITLE>JalviewLite Applet API and Form Complete Example</TITLE>
6 <!-- InstanceEndEditable --> 
7 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
8 <!-- InstanceBeginEditable name="head" -->
9 <!-- InstanceEndEditable --> 
10 <style type="text/css">
11 <!--
12 td {
13         font-family: Geneva, Arial, Helvetica, sans-serif;
14         font-size: 12px;
15 }
16 .plain {
17         font-family: Verdana, Arial, Helvetica, sans-serif;
18         font-size: 14px;
19         text-decoration: none;
20 }
21 .plain:hover{
22         background-color:#000000; color: #F2F2FF;
23 }
24  
25 -->
26 </style>
27 <script language="JavaScript">
28 function genHref()
29 {
30 var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
31 for(i=0; i<8; i++)
32 {href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i);      }
33 window.location=href;
34 }
35 function getEventTarget(e)
36 {
37 if(!e)
38 e = window.event;
39 if(e.target)
40 return e.target;
41 return e.srcElement;
42 }
43 </script>
44 </head>
45 <body alink="#000000" vlink="#000000" link="#000000">
46 <script type="text/javascript">
47 var gaJsHost = (("https:" == document.location.protocol) ? 
48 "https://ssl." : "http://www.");
49 document.write(unescape("%3Cscript src='" + gaJsHost + 
50 "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
51 </script>
52 <script type="text/javascript">
53 try{
54 var pageTracker = _gat._getTracker("UA-9060947-1");
55 pageTracker._trackPageview();
56 } catch(err) {}
57 </script>
58 <div align="left"> 
59   <table width="805" height="100" cellpadding="5">
60     <tr>
61       <td background="../jalview.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
62     </tr>
63   </table>
64   <table width="805" border="0" cellpadding="5" cellspacing="5">
65     <tr> 
66       <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> 
67           
68           <div align="center">
69           <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
70             <tr> 
71               <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
72             </tr>
73             <tr> 
74               <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
75             </tr>
76             <tr> 
77               <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
78             </tr>
79             <tr> 
80               <td align="left" valign="middle"><a href="applets.html" class="plain">Applet 
81                 Version</a></td>
82             </tr>
83             <tr> 
84               <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
85             </tr>
86             <tr> 
87               <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
88             </tr>
89             <tr> 
90               <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
91             </tr>
92             <tr>
93               <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release 
94                 history</a></td>
95             </tr>
96             <tr> 
97               <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source 
98                 Code</a></td>
99             </tr>
100                         <tr> 
101               <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
102             </tr>
103                         <tr> 
104               <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
105             </tr>
106             <tr> 
107               <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News 
108                 Mailing List</a></td>
109             </tr>
110             <tr>
111               <td align="left" valign="middle"><a
112             href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
113             class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
114             bug reports to the discussion list.</em></td>
115             </tr>
116             <tr></tr>
117             <tr>
118               <!--<td align="left" valign="middle"><br>
119                 Please send problems<br>and
120             bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
121             </tr>
122           </table>
123         </div>
124         <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
125           <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> 
126         </div>
127         </td>
128       <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
129                 <p>&nbsp;</p>
130                 Click the Javascript buttons below to interact with the Applet
131                 instance on the page.<br>
132                 View the source in your browser to see how it has been done.<br>
133                 The applet's public API methods are <a href="#api">listed below</a>
134                 the following example.<br>
135                 <applet code="jalview.bin.JalviewLite" width="140" height="35"
136                         archive="jalviewApplet.jar" name="Jalview">
137                         <param name="file" value="plantfdx.fa">
138                         <param name="features" value="plantfdx.features">
139                         <param name="wrap" value="true">
140                         <param name="showAnnotation" value="false">
141                         <param name="windowHeight" value="500">
142                         <param name="windowWidth" value="650">
143                         <param name="showFullId" value="false">
144                         <param name="RGB" value="F2F2FF">
145                         <param name="linkLabel_1" value="SRS">
146                         <param name="linkUrl_1"
147                                 value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
148                         <param name="linkLabel_2" value="Uniprot">
149                         <param name="linkUrl_2"
150                                 value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
151                         <param name="hidefeaturegroups" value="uniprot" />
152                         <param name="showbutton" value="false" />
153                 </applet>
154                 <form name="exampleForm"><br>
155                 <br>
156                 <center><strong>Using the Jalview Applet for Input
157                 to an HTML Form</strong></center>
158                 <div align="center"><input type="button"
159                         onClick="document.forms.exampleForm.exampleTextarea.value=document.applets.Jalview.getAlignment('fasta', 'false')"
160                         value="Fill Form from Jalview" /> <br>
161                 <br>
162                 <textarea name="exampleTextarea" cols="55" rows="9"></textarea></div>
163                 </form>
164                 <center><strong>Make a new View and Get and Set
165                 Group Display List</strong></center>
166                 <form name="groupForm">
167                 <div align="center"><input type="button"
168                         onClick="document.forms.groupForm.groups.value=document.applets.Jalview.getFeatureGroups()"
169                         value="Get groups" /> <input type="button"
170                         onClick="document.applets.Jalview.newView()" value="new View" /> <br>
171                 <textarea name="groups" cols="55" rows="9"></textarea> <br>
172                 <input type="button"
173                         onClick="document.applets.Jalview.setFeatureGroupState(document.forms.groupForm.groups.value, true)"
174                         value="Display groups" /> <input type="button"
175                         onClick="document.applets.Jalview.setFeatureGroupState(document.forms.groupForm.groups.value, false)"
176                         value="Hide groups" /></div>
177                 </form>
178                 <p><a name="api" /> Since Jalview 2.5, the public methods listed
179                 below are available to be called via Javascript.</p>
180                 <p>Unfortunately Javascript - Java communication is not possible
181                 using Internet Explorer or Opera on Macs. Please use Safari or
182                 Firefox.</p>
183                 <p>If more than one Jalview window is open, Jalview returns the
184                 alignment in the active window, unless you provide an AlignFrame
185                 object reference.</p>
186                 <p>The alignment output format can be either Fasta, PFAM, Clustal,
187                 MSF, PIR, or BLC.</p>
188                 <p>When referring to the Jalview applet in javascript, you must
189                 either give Jalview a name in the applet tag or use the applets index.</p>
190
191                 <pre>//get list of IDs of selected sequences
192 public String getSelectedSequences()
193
194 // list of IDs of selected sequences terminated by sep or, if sep is null, '&#172;' (&amp;#172;)
195 public String getSelectedSequences(sep)
196
197 // get selected sequences as alignment as format with or without start-end suffix
198 public String getSelectedSequencesAsAlignment(String format, boolean suffix)
199
200 // get selected sequences as alignment from given view as format with or without start-end suffix
201 public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, String format, boolean suffix)
202
203 // get alignment as format
204 public String getAlignment(String format)
205
206 // get alignment as format with jalview 
207 // start-end sequence suffix appended
208 public String getAlignment(String format, String suffix)
209
210 // get alignment displayed in alf as format
211 public String getAlignmentFrom(AlignFrame alf, String format)
212
213 // get alignment displayed in alf as format 
214 // with jalview start-end sequence suffix appended
215 public String getAlignmentFrom(AlignFrame alf, String format, String suffix)
216
217 // add the given features or annotation to the current alignment
218 public void loadAnnotation(String annotation)
219
220 // add the given features or annotation to the given alignment view
221 public void loadAnnotationFrom(AlignFrame alf, String annotation)
222
223 // get the sequence features in the given format (Jalview or GFF)
224 public String getFeatures(String format)
225
226 // get the sequence features in alf in the given format (Jalview or GFF)
227 public String getFeaturesFrom(AlignFrame alf, String format)
228
229 // get current alignment's annotation as an annotation file
230 public String getAnnotation()
231
232 // get alignment view alf's annotation as an annotation file
233 public String getAnnotationFrom(AlignFrame alf)
234
235 // create a new view and return the alignFrame instance
236 public AlignFrame newView()
237
238 // create a new view named name and return the alignFrame instance
239 public AlignFrame newView(String name)
240
241 // create a new view on alf and return the alignFrame instance
242 public AlignFrame newViewFrom(AlignFrame alf)
243
244 // create a new view named name on alf 
245 // and return the alignFrame instance
246 public AlignFrame newViewFrom(AlignFrame alf, String name)
247
248 // load a new alignment 
249 public AlignFrame loadAlignment(String text, String title)
250
251 // return separator separated list of feature groups 
252 // on the current alignment
253 public String getFeatureGroups()
254
255 // return separator separated list of feature groups on alf
256 public String getFeatureGroupsOn(AlignFrame alf)
257
258 // return separator separated list of feature groups 
259 // either visible or hidden
260 public String getFeatureGroupsOfState(boolean state)
261
262 // return separator separated list of feature groups 
263 // either visible or hidden on alf
264 public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean state)
265
266 // set the separator separated list of feature groups as 
267 // visible or hidden on the current alignment
268 public void setFeatureGroupState(String groupList, boolean state)
269
270 // set the separator separated list of feature groups 
271 // as visible or hidden on alf
272 public void setFeatureGroupStateOn(AlignFrame alf, String groupList, boolean state)
273
274 // helper functions
275
276 // convert list to a separator separated array
277 public String arrayToSeparatorList(String[] list) 
278
279 // get a string array from a list
280 public String[] separatorListToArray(String list)
281
282 // get the current separator
283 public String getSeparator()
284
285 // set the current separator
286 public void setSeparator(String)
287
288 //// JalviewLite global state methods and fields
289
290 // return the build date as a string
291 public static String getBuildDate() 
292
293 // return the JalviewLite version as a string
294 public static String getVersion()
295
296 // debug flag - controls output to standard out
297 public static boolean debug
298
299 </pre> <!-- InstanceEndEditable --></td>
300     </tr>
301   </table>
302 </div>
303 </body>
304 <!-- InstanceEnd --></html>