<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Depth-First: Hacking JSpecView: Enhancing the User Interface</title>
    <link>http://depth-first.com/articles/2008/02/01/hacking-jspecview-enhancing-the-user-interface</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Hacking JSpecView: Enhancing the User Interface</title>
      <description>&lt;p&gt;&lt;center&gt;&lt;applet code="jspecview/applet/JSVApplet.class" name= "jsv" mayscript="true" archive="http://depth-first.com/demo/20080201/jspecview.jar" width="490" height="350"&gt;&lt;param name="script" value="load http://depth-first.com/demo/20080128/demo/demo1/netanilineH.jdx; reverseplot true; gridon false; plotcolor 150,100,200;" /&gt;&lt;/applet&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://depth-first.com/articles/2008/01/28/hacking-jspecview-creating-an-html-test-harness"&gt;last installment&lt;/a&gt; of this series showed how to set up an HTML testing harness for JSpecView. With the preliminaries taken care of, this installment will show how to enhance the user interface.&lt;/p&gt;

&lt;h4&gt;The Goal&lt;/h4&gt;

&lt;p&gt;The live applet shown above illustrates the changes that were made. As you move your mouse cursor into the spectrum area, you'll see a vertical red line appear and track the movements of the mouse. As you presss the mouse key to begin a selection, a grey rectangle will show you exactly where the selection area will be.&lt;/p&gt;

&lt;p&gt;If you can't view the applet, be sure you system has &lt;a href="http://www.java.com/en/download/index.jsp"&gt;JDK 1.5 or higher&lt;/a&gt; installed, and that you've enabled applets for your browser.&lt;/p&gt;

&lt;p&gt;Clearly, these modifications need more work. For example, you can extend the selection box outside the boundary of the spectrum area. And green might be a better color for the cursor. Then again, maybe the cursor should use an alpha channel. But I digress.&lt;/p&gt;

&lt;h4&gt;One More Thing&lt;/h4&gt;

&lt;p&gt;Being a &lt;a href="http://depth-first.com/articles/2008/01/11/my-favorite-eclipse-shortcut-quick-fix"&gt;longtime Eclipse user&lt;/a&gt;, I prefer this tool for my Java development. So far, only the use of Ant has been described. Fortunately, Eclipse offers an elegant way to import an existing Ant project. File-&gt;New gives a dialog like the one shown below:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20080201/new_project.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;Selecting "Java Project from Existing Ant Buildfile" gives this dialog:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20080201/create_project.png"&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;Filling in the fields as shown should give a fully-functional Eclipse project.&lt;/p&gt;

&lt;h4&gt;Still One More Thing&lt;/h4&gt;

&lt;p&gt;If you check the HTML source for this page, you'll notice that the &lt;tt&gt;applet&lt;/tt&gt; tag is used to display the applet. Yet on Internet Explorer, there is no "click to activate" message. The reason is that Depth-First is using the excellent JavaScript library &lt;a href="http://depth-first.com/articles/2007/11/02/eolas-and-jactivating-working-around-a-workaround"&gt;JActivating&lt;/a&gt;, which re-writes the &lt;tt&gt;applet&lt;/tt&gt; tag so that it isn't detected by the Eolas workaround. This lets us stick with plain HTML, rather than using &lt;tt&gt;document.write&lt;/tt&gt; to specify the applet.&lt;/p&gt;

&lt;h4&gt;Changing the Source Code&lt;/h4&gt;

&lt;p&gt;Too many changes were made to detail individually. In general, they related to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Removing non-applet classes such as those involved with the desktop application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Removing code flagged by Eclipse as unused.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Editing the &lt;tt&gt;jspecview.common.JSVPanel&lt;/tt&gt; source to add the UI modifications. The &lt;tt&gt;drawGraph&lt;/tt&gt;, &lt;tt&gt;drawCursor&lt;/tt&gt;, and &lt;tt&gt;drawZoomBox&lt;/tt&gt; methods contained most of the changes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The complete Eclipse project should be &lt;a href="http://sourceforge.net/project/showfiles.php?group_id=161398&amp;amp;package_id=260592"&gt;available from SourceForge&lt;/a&gt; shortly.&lt;/p&gt;

&lt;h4&gt;Conclusions&lt;/h4&gt;

&lt;p&gt;Given the right tools, modifying JSpecView is not that difficult. We've gone from raw souce code to a complete Eclipse project, and even added some functionality in the process.&lt;/p&gt;

&lt;p&gt;Where would you like to take JSpecView?&lt;/p&gt;</description>
      <pubDate>Fri, 01 Feb 2008 11:25:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:29a83e80-30b1-4da8-b4a1-be5958312bca</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/02/01/hacking-jspecview-enhancing-the-user-interface</link>
      <category>Tools</category>
      <category>jspecview</category>
      <category>applet</category>
      <category>eclipse</category>
      <category>ant</category>
      <category>xydata</category>
    </item>
  </channel>
</rss>
