Home Examples Downloads Installation Registration Applet FAQ Help Contact Us
Navigation Menu
Friend Home
Examples
Downloads
Installation
Registration
Friend Applet
FAQ
Extended capabilites
Data formats
Defining custom menus
Using ClustalW
Using MODELLER
Help
Contact us
The following examples demonstrate the usage of Friend Applet
(To avoid possible browser crash please view one example at a time)



Adding Friend Applet to a web page
The Friend Applet file can be downloaded here. To embed the Friend Applet into the web page you have to include the following text into your html page
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
 WIDTH = "85" HEIGHT = "40" NAME = "friend"
 codebase="http://www.java.com/en/download">
<PARAM NAME = CODE VALUE = "friendMain/FriendApplet" >
<PARAM NAME = ARCHIVE VALUE = "friend_app.jar" >
<PARAM NAME = NAME VALUE = "friend" >
<PARAM NAME = "type" VALUE="application/x-java-applet;version=1.4">
<PARAM NAME = "scriptable" VALUE="false">
<PARAM NAME = "file_to_load" VALUE ="pdb1d2r.ent">
<PARAM NAME = "script_to_execute" VALUE ="center">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.4"
 CODE="friendMain/FriendApplet" WIDTH="85" HEIGHT="40"
 ARCHIVE="friend_app.jar"
 NAME="friend"
 file_to_load="pdb1d2r.ent"
 script_to_execute="center"
 scriptable=false
 pluginspage="http://www.java.com/en/download/">
<NOEMBED>
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>
This code will produce such a button ==>
Pressing the button (might have to press twice) will open a main applet window with structure and sequence views.

This is a universal syntax which will work with both Mozilla based browsers (FireFox, Safari, Netscape, Mozilla, etc.) and Internet Explorer.

  • The parameter CODE describes the applet class in Friend. The parameter should be left unchanged.
  • The parameter ARCHIVE describes filename with applet. Change it only if you rename the applet file.
  • The parameter NAME names the object. You can name object as you like but be sure to reference to it by its name (see examples below).
  • The parameters file_to_load is Friend specific and describes semi-colon delimited set of files to be loaded after main applet window is opened. The type of file is determined by its extension. In cases when file is not located in the directory of the web page, its filename must include the full path to it.
  • The parameter script_to_execute is Friend specific and describes semi-colon delimited set of friend commands to be executed after main applet window is opened and structures are loaded.
Note, all parameters appear in two places, and in both places you have to provide them with exactly the same values to allow different browsers to display the web page in the same way.

Since access to embedded objects is also browser specific we recommend the use of a JavaScript function, implementing browser dependent access to the applet. While this can be done in a number of ways, a very simple example is shown below.
<script language="javascript" type="text/javascript">
 function play_script(script)
 {
  try { document.embeds.friend.runScript(null,script); }
  catch (e) {}
  try { document.friend.runScript(null,script); }
  catch (e) {}
 }
</script>
First, the function tries to locate the applet object, named friend, in the list of embedded objects. This is Mozilla specific way of object access. Then, the function tries to locate the applet object directly in the document, i.e., in the current web page. This is Internet Explorer specific way. Statement try{...}catch(){...} ensures that the function does not abort and proceeds to the next line if the applet object is null, i.e., the object is not found. Function runScript is implemented in Friend Applet and executes the commands provided as an argument. This peace of the code has to be inserted into the header of web page, between tags <head> and </head>.

Manipulation buttons can be created using standard html tags <form> and <input>
<form>
 <input type="button" value="Color red" onClick="play_script('color red')">
 <input type="button" value="Color green" onClick="play_script('color green')">
</form>

The mechanism of structure view manipulation in Friend Applet from html page is summarized in the following picture Structure view manipulation mechanism
 

Abyzov A, Errami M, Leslin CM, Ilyin VA. Friend, an integrated analytical front-end application for bioinformatics. Bioinformatics. 2005 Sep 15(18):3677-8. PubMed
neu-logo         neu-logo

Wednesday 14th of May 2008 02:03:25 AM