<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>No Open Blockers &#187; CodeTurtle</title>
	<atom:link href="http://noopenblockers.com/category/codeturtle/feed/" rel="self" type="application/rss+xml" />
	<link>http://noopenblockers.com</link>
	<description></description>
	<lastBuildDate>Thu, 01 Jul 2010 14:43:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CodeTurtle 0.4 Released</title>
		<link>http://noopenblockers.com/2009/05/25/codeturtle-04-released/</link>
		<comments>http://noopenblockers.com/2009/05/25/codeturtle-04-released/#comments</comments>
		<pubDate>Mon, 25 May 2009 18:46:57 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>

		<guid isPermaLink="false">http://noopenblockers.com/?p=588</guid>
		<description><![CDATA[I made a lot of changes to the code base to support the last few projects of the semester. I figured now that school is out for the summer it&#8217;d be a good idea to post a build with what CodeTurtle ended up being after a semester of usage (seven projects in total).
Before I go [...]]]></description>
			<content:encoded><![CDATA[<p>I made a lot of changes to the code base to support the last few projects of the semester. I figured now that school is out for the summer it&#8217;d be a good idea to post a build with what CodeTurtle ended up being after a semester of usage (seven projects in total).</p>
<p>Before I go on, I want to welcome Scott and Emily to the project. Scott was a contributor on this release, fixing some critical issues when running on Windows and providing the very cool printing support (a feature that coincided with me running out of paper at home and thus failing to print out the last project of the semester anyway). Emily is just starting out and we&#8217;re deciding on where she is going to focus her efforts. I&#8217;m psyched to be able to work with them and appreciate the support.</p>
<p>A big improvement with this release is that I finally had the discipline to sit down and begin to write some documentation. I ripped out the hardcoded HTML file from CodeTurtle and began work on a wiki specifically for the project:</p>
<p><a href="http://codeturtle.noopenblockers.com" target="new">http://codeturtle.noopenblockers.com</a></p>
<p>It&#8217;s a work in progress. What a loaded statement, it&#8217;s always going to be a work in progress. That&#8217;s one of the appeals of using a wiki, you get to use the excuse that &#8220;I&#8217;ll add that to the wiki soon&#8221; since all of the information is stored online.</p>
<p>The wiki has a mixed audience. I&#8217;m trying to jump to the quick parts of how to download and run since that&#8217;s what most people will be interested in. But I&#8217;m also catering to my students who want to contribute (as well as some, um, academics that haven&#8217;t actually worked on a real software project and sadly don&#8217;t know how to use these things). So I took some extra steps to explain concepts such as source control systems and build systems. This will pay off anyway, since I do a lecture on these things in class but never had a central reference location I could point them to. It&#8217;s also got my first feeble attempts at a logo (I&#8217;m thinking of blogging on its creation process in the future). My lack of creative skills is astounding.</p>
<p>Along the same lines, since there has been a growing interest lately, I took a number of steps taken to help introduce new users. I flushed out the sample project a bit more to make for a better demo. On the first run, there is a guided setup that will help the user set up the compiler used in the grading process and automatically configuring the sample project. I don&#8217;t know why, but I find writing that sort of thing to be a lot of fun.</p>
<p>As usual, the latest release can be found at the SourceForge site: <a href="https://sourceforge.net/projects/codeturtle/" target="new">https://sourceforge.net/projects/codeturtle/</a>.</p>
<p>I&#8217;m actually including the release notes in this post since there was some pretty cool shit done since 0.3.</p>
<p><strong>New and Cool Stuff</strong></p>
<ul>
<li>Added current project printing support (courtesy of Scott).</li>
<li>Added progress bar to indicate the work done towards creating a gradebook (compiling submissions, grading, etc.).</li>
<li>Added toolbar to UI to support quick access to common functions.</li>
<li>Added user preferences support.</li>
<li>Changed handling of command line options. If any of the gradebook options are specified, the create gradebook dialog will automatically be displayed and prepopulated with the command line values.
<ul>
<li>The &#8220;-c&#8221; option has been renamed to &#8220;-g&#8221; to reflect the change in terminology from &#8220;project checker&#8221; to &#8220;project grader&#8221;.</li>
<li>The &#8220;-c&#8221; option now clears the Java preferences node for CodeTurtle.</li>
<li>The command line options can be displayed by passing the &#8220;-?&#8221; flag.</li>
<li>The &#8220;&#8211;sample&#8221; option will populate the gradebook creation dialog with the included sample project</li>
</ul>
</li>
<li>Better flushed out sample project, including cleaning up their representation in the source control system and adding build scripts to set up their state.</li>
<li>Added &#8220;first run&#8221; feature that will perform installation and sample steps to ease new users into configuration and using CodeTurtle.</li>
<li>Bug fixes (hopefully more fixed than new ones introduced).
</ul>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/05/25/codeturtle-04-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Preferences</title>
		<link>http://noopenblockers.com/2009/05/02/java-preferences/</link>
		<comments>http://noopenblockers.com/2009/05/02/java-preferences/#comments</comments>
		<pubDate>Sun, 03 May 2009 02:20:34 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=524</guid>
		<description><![CDATA[I&#8217;m totally addicted to the Java preferences framework.
For a while, I&#8217;ve wanted to add user preferences to CodeTurtle. My motivation was less letting the user explicitly set certain values and more about adding in polish to the UI. For instance, I wanted to remember the last position and size of the UI if the user [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m totally addicted to the Java preferences framework.</p>
<p>For a while, I&#8217;ve wanted to add user preferences to CodeTurtle. My motivation was less letting the user explicitly set certain values and more about adding in polish to the UI. For instance, I wanted to remember the last position and size of the UI if the user moved it (rather than always starting maximized or something like that). Little things like that are somewhat taken for granted until you use a UI that doesn&#8217;t have them, at which time phrases like &#8220;This sucks&#8221; tends to come out. Besides, it seemed like a fun challenge.</p>
<p>I thought I was going to have to choose between using a simple key/value pair serialized to disk or actually adding in an XML framework for more flexibility and dealing with that headache (or some other unholy third option). What I found out was how little I actually knew. The Java preferences framework gives you both for pretty much free.</p>
<p>Java will keep track of storing the preferences in wherever it makes sense based on the native operating system (for instance, they are stored in a directory named <code>.java</code> in the user&#8217;s home directory on Linux). The format is XML, but it&#8217;s actually not necessary to know that since I don&#8217;t have to do squat to actually interact with it.</p>
<p>To load the preferences, it&#8217;s a one line call:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Preferences preferences <span style="color: #339933;">=</span> Preferences.<span style="color: #006633;">userNodeForPackage</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>After that, it&#8217;s simple getters to get your values. The <code>Preferences</code> object even has some really nice polish on the API letting you use type specific getters (getString, getBoolean, etc) and specify a default value. Setting values uses a put notation that functions like the <code>Map</code> interface.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">int</span> windowWidth <span style="color: #339933;">=</span> preferences.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;window.width&quot;</span>, <span style="color: #cc66cc;">800</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
...
<span style="color: #006633;">preferences</span>.<span style="color: #006633;">putInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;window.width&quot;</span>, frame.<span style="color: #006633;">getWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That&#8217;s it. That&#8217;s all you need to cover reading/writing the file, determining the proper home directory location, and serializing/deserializing the XML store of the data. My daughter could write code to use this if she could stop drooling long enough to not short circuit the keyboard.</p>
<p>You technically don&#8217;t even have to worry about saving, it will periodically do that for you. However, if you want to explicitly trigger a save, simply call the <code>flush()</code> method on the preferences object.</p>
<p>I even built in a command line option to CodeTurtle to clear the user preferences, which is in itself a simple call:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">preferences.<span style="color: #006633;">removeNode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I was happy to see that my design of having a central data manager passed throughout the GUI came in handy here as I was able to stuff the preferences object into it and access it from virtually anywhere else in the UI. At that point, it was just a matter of figuring out what I wanted to store. In the beginning it was things like the window placement, window size, and tab placement. Tonight I decided to add a flag indicating if it&#8217;s the first time the user is running CodeTurtle. If it is, I enter a bit of a &#8220;demo mode&#8221; where the sample project included with the CodeTurtle distribution is automatically loaded to more easily show off its complete awesomeness.</p>
<p>I still have other (reasonable) ideas on things I want to stuff into user preferences. Rather than requiring an environment variable to indicate the compiler path (i.e. TURTLE_JDK_HOME, JAVA_HOME), I&#8217;d like to move that to the user preferences to make it easier to see where the value came from. The real challenge at this point is trying to <em>not</em> abuse this new found power and stuff every imaginable value into it. <img src='http://noopenblockers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>My annoyingly over-engineered (and pretty much completely unnecessary) wrapper on top of the Java preferences framework can be found <a href="http://codeturtle.svn.sourceforge.net/viewvc/codeturtle/src/com/novasurv/turtle/frontend/swing/prefs/JavaPreferences.java?view=markup" target="new">in CodeTurtle&#8217;s SourceForge repository.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/05/02/java-preferences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeTurtle 0.3 Released</title>
		<link>http://noopenblockers.com/2009/03/31/codeturtle-03-released/</link>
		<comments>http://noopenblockers.com/2009/03/31/codeturtle-03-released/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 01:51:07 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=394</guid>
		<description><![CDATA[After four graded projects for the semester, I figured it was about time to get the changes I&#8217;ve made in that time out into a new release. There are a few new things coming (hopefully) soon and am getting some outside help, so making a clean break now felt like the right time. Ok, and [...]]]></description>
			<content:encoded><![CDATA[<p>After four graded projects for the semester, I figured it was about time to get the changes I&#8217;ve made in that time out into a new release. There are a few new things coming (hopefully) soon and am getting some outside help, so making a clean break now felt like the right time. Ok, and to be honest, I was starting to lose track of what I had added to the release notes and what I had just committed on the fly in an effort to get done grading projects, so I wanted a fresh start.</p>
<p>Like I said, I&#8217;ve now graded four projects this semester using CodeTurtle, so a number of the changes were made directly as a result of something that was actively annoying me. For instance, while writing the project grader, I found myself restarting and reloading the project a number of times. To facilitate that, I added some minimal command line support to automatically create the grade book with the proper grader and submissions values (I&#8217;d also like to add a &#8220;Reload grader&#8221; option in the near future).</p>
<p>The biggest change was gutting and rewriting the project grader APIs. I&#8217;ve <a href="/2009/03/09/back-to-the-drawing-board/">written about some of the changes before</a> and I want to write up a much better tutorial on writing a project grader in the near future (I know, I know, everything I want to do is in the &#8220;near future&#8221;), so I won&#8217;t talk about too many details right now. I will say that the new APIs feel a lot cleaner and have added quite a bit of flexibility in the way I do the testing of the student submissions.</p>
<p>The sample project is a bit lame and doesn&#8217;t really showcase all of what CodeTurtle can do, I realize that. I need to find me an intern or a monkey or a student in dire need of extra credit to flush that out for me.</p>
<p>Oddly, as I look back 0.2 was released right near Spacewalk 0.4, and now this one happens to line up with 0.5. I guess all that talk in work about releasing things inspires me.</p>
<p>CodeTurtle 0.3 can be downloaded at <a href="https://sourceforge.net/project/showfiles.php?group_id=248567" target="new">the project&#8217;s site on SourceForge.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/03/31/codeturtle-03-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeTurtle In Action</title>
		<link>http://noopenblockers.com/2009/01/25/codeturtle-in-action/</link>
		<comments>http://noopenblockers.com/2009/01/25/codeturtle-in-action/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 17:35:01 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=264</guid>
		<description><![CDATA[The first project of the semester was due last Thursday, which meant it was time to find out if CodeTurtle is actually, well, useful. I knew from the beginning that there was always a very real chance that it would be simpler to just grade by hand. I figured that chance revolved around two areas: [...]]]></description>
			<content:encoded><![CDATA[<p>The first project of the semester was due last Thursday, which meant it was time to find out if CodeTurtle is actually, well, useful. I knew from the beginning that there was always a very real chance that it would be simpler to just grade by hand. I figured that chance revolved around two areas: the difficulty or lack of flexibility in the project checker plugins themselves or a clunky, inflexible user interface.</p>
<p>I&#8217;m really happy to find that, at least for my purposes, CodeTurtle worked extremely well. In all honesty, it actually worked better than I would have expected. As I was writing it I was surprised how quickly I was able to get stuff done in Swing, and short of the insanely awful detailed report, I used all of the features (benefits of writing a program for yourself I suppose). Squeezing in the HTML summary report right before the semester turned out to be huge since I was able to simply print them out and be done.</p>
<p>The project was, not surprisingly this early in the semester, pretty simple. I gave out a class with a main method making calls to some methods I stubbed out. The students&#8217; job was to implement those methods, the idea being to make sure everyone has some basic knowledge of looping, conditions, reading/writing files, and so on.</p>
<p>My checker ended up using a lot of reflection (all through utilities provided by CodeTurtle, so the code was actually pretty short). In hindsight I could have made calls directly to the class I provided, compiling against my implementation, and letting CodeTurtle&#8217;s class loader creation automatically take care of using the student&#8217;s version of the class.That will be the approach for most of the interface based projects, so I&#8217;ll have my chance in the future.</p>
<p>In a way, I feel a bit of a sense of relief for the rest of the semester. Grading projects was a nightmare by the end of the last semester, so knowing CodeTurtle survived it&#8217;s first trial makes me optimistic about how things will go come April.</p>
<p>Some specific notes on things the good, the bad, and the ugly (*cough* detailed report *cough*) after the jump.</p>
<p><span id="more-264"></span></p>
<ul>
<li>I badly need to <b>implement saving/loading of grade books.</b> I added quite a few custom comments and grade item updates that I&#8217;m afraid to close CodeTurtle right now for fear I&#8217;ll need to make a change to one. I know how to get around the URLClassLoader not serializable issue, I just have to look up the syntax and take care of it. Hopefully I can squeeze that in before the next project.</li>
<li>I need to <b>loosen the checking when double-clicking files in the files view to load as source.</b> I require a README file in my project submissions, and being able to view that from within CodeTurtle will be nice, especially since I found myself doing all of the students&#8217; code reviews from within it.</li>
<li><b>The detailed report sucks.</b> Admittedly it was a first pass, but I don&#8217;t know what I was thinking when I figured I&#8217;d print that out. That said, the quick summary report I threw together for 0.2 works really well, so I&#8217;d like to spend some more time refining that.</li>
<li>I&#8217;d definitely like to <b>add a progress bar while loading.</b> It&#8217;s fine for me since I know to not click anything, but I&#8217;m afraid others will start banging around and get UI errors. That said, compiling 11 student projects didn&#8217;t take nearly as long as I feared, which is good.</li>
<li><b>Dealing with file reading and writing is a pain in the ass.</b> There&#8217;s no clean way to change the working directory in Java, so I had to give instructions on extra steps to take. That said, I should probably just suck it up and teach them how to load a file from the classpath (which really is the better way of doing it anyway) and at least for reading, this becomes a non-issue.</li>
<li><b>The GradeItem constructors need to be cleaned up.</b> It&#8217;s a clear sign that they suck when the author can&#8217;t even remember how to use them.</li>
<li>Along similar lines, I need to <b>change the distribution to include a source JAR.</b> That way I can add in the sources to my checker project and actually have access to the javadoc.</li>
<li>Ultimately, I should <b>provide a way to kill the classloaders and reload the project checker plugins.</b> During development of the checker I kept having to bounce CodeTurtle to test it, which was mildly annoying.</li>
<li>It&#8217;d be really cool if I <b>accepted the checker and submission directories as command line parameters</b> so when bouncing CodeTurtle it could automatically create the grade book, saving that step in the UI. Always nicer to do things at the command line than the UI.</li>
<li>The <b>dialog text areas need a quick revisit for line wrapping and scroll panes.</b> I thought I was pretty good about wrapping text areas in scroll panes, but the few times I didn&#8217;t it was very apparent.</li>
<li>The <b>edit a grade item dialog needs a little love.</b> Admittedly, it was part of a last minute decision that the in-table editing sucked, so it could use a quick revisit for auto-population (and a title on the dialog, how did I miss that one?)</li>
<li>Until I get printing implemented (man is that gonna be sweet), the project reports <b>should be saved to the checker directory</b> rather than (or at least in addition to) running around to every student directory loading and printing them.</li>
<li>I ran into a headache trying to cleanly convert an Object reference to a string when the reference contained an array of primitives. I have a bit of a hack in there now that only fell apart for an int[][], which really, I don&#8217;t imagine using all that much anyway. Still, this automatic string generation for result messages could probably use a little love.</li>
<li>I need a logo! I have one image I&#8217;m thinking of using, but it&#8217;s not completely what I want.</li>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/01/25/codeturtle-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeTurtle 0.2 Released</title>
		<link>http://noopenblockers.com/2009/01/17/codeturtle-02-released/</link>
		<comments>http://noopenblockers.com/2009/01/17/codeturtle-02-released/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 19:58:43 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=235</guid>
		<description><![CDATA[The first project for my class is due next week, so I had to finish flushing out the minimum functionality I&#8217;ll need to grade it. This is actually how I suspect the rest of the semester will go, releasing small versions with enhancements to the checker APIs based on what I need to grade the [...]]]></description>
			<content:encoded><![CDATA[<p>The first project for my class is due next week, so I had to finish flushing out the minimum functionality I&#8217;ll need to grade it. This is actually how I suspect the rest of the semester will go, releasing small versions with enhancements to the checker APIs based on what I need to grade the next project in the semester.</p>
<p>So, first the good news. Below are the release notes with the additions in this version:</p>
<ul>
<li>Ability to automatically compile student projects at grade book creation time. Compiled classes will be put in the respective student&#8217;s project directory.
<ul>
<li>Option to add a grade item for success/failure of compilation</li>
<li>Option to delete existing compiled classes</li>
</ul>
</li>
<li>The user.dir property is now set prior to grading a project, scoping the execution of the student&#8217;s code to the project directory in which it is found.*</li>
<li>Added ability to add custom notes on each grade item.</li>
<li>Added grade item editor dialog for changing the awarded points, result, or notes, launched by either double-clicking or from the right-click menu (editing the awarded points directly in the table is still supported).</li>
<li>Added HTML based &#8220;Summary Report&#8221; to display a high level overview of how points were accumulated, detail on any failed test cases, and all additional comments. The goal behind this initial implementation is a report to print and distribute to the student.**</li>
</ul>
<p>* The user.dir in particular is to support the reading/writing of files done in my first project of the semester.</p>
<p>** The existing plain-text report is still available, however only the HTML report will be saved to the student&#8217;s directory. In the future I hope to add more flexibility around selecting which reports to generate, print, and save.</p>
<p>Additionally, the project checker APIs were enhanced to support the following.</p>
<ul>
<li>Added: Utility (checkFileExists) to check that a file was included in the submission.</li>
<li>Added: Utility (findFile) to locate a file inside of the student&#8217;s project directory.</li>
<li>Added: Utility (checkManual) for adding a manually graded item.</li>
<li>Added: Utility (classExists) to return whether or not a class exists in the project.</li>
<li>Changed: signature of &#8220;findClass&#8221; to return the class object.</li>
</ul>
<p>It&#8217;s quite a bit more than I expected to get done by the start of the semester, which I&#8217;m pretty happy with. Alas, there are still many things I want to do. Printing remains my white whale as I just don&#8217;t feel like dealing with getting it set up. This version will save an HTML report to each student directory, so for now I&#8217;m content opening them individually and printing them. I also took some steps towards saving/loading grade books, but ran into an issue since URLClassLoader isn&#8217;t serializable. I know how to get around it &#8212; it should be as simple as implementing a custom serialization with Externalizable &#8212; I just didn&#8217;t feel like putting the time in and then adding the UI hooks for them and, again, I don&#8217;t see me needing it for the first project.</p>
<p>CodeTurtle 0.2 can be downloaded at <a href="https://sourceforge.net/projects/codeturtle/" target="new">the project&#8217;s site on SourceForge.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/01/17/codeturtle-02-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Right-Clicking Tables in Swing</title>
		<link>http://noopenblockers.com/2009/01/02/right-clicking-tables-in-swing/</link>
		<comments>http://noopenblockers.com/2009/01/02/right-clicking-tables-in-swing/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 18:07:48 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=198</guid>
		<description><![CDATA[A lot of the data in CodeTurtle is tabular. Inevitably, I ended up wanting to have a right-click menu for operations on a particular row. The problem is, the default behavior for a JTable doesn&#8217;t automatically select the row under the cursor on a right-click. After a bit of poking around, the solution was pretty [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of the data in <a href="/category/codeturtle/">CodeTurtle</a> is tabular. Inevitably, I ended up wanting to have a right-click menu for operations on a particular row. The problem is, the default behavior for a JTable doesn&#8217;t automatically select the row under the cursor on a right-click. After a bit of poking around, the solution was pretty simple. The following example is a mouse adapter assigned to the table itself. The purpose of this particular implementation is to display a popup menu under the cursor for operations on the selected row. This code allows the user to right-click any row to both select it and then display the menu of operations to execute against it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> <span style="color: #003399;">PopupMenuListener</span> <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">MouseAdapter</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> mousePressed<span style="color: #009900;">&#40;</span><span style="color: #003399;">MouseEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    showPopup<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> mouseReleased<span style="color: #009900;">&#40;</span><span style="color: #003399;">MouseEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    showPopup<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> showPopup<span style="color: #009900;">&#40;</span><span style="color: #003399;">MouseEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">isPopupTrigger</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// Select the row under the cursor so we know</span>
      <span style="color: #666666; font-style: italic;">// which to edit or delete</span>
      <span style="color: #003399;">Point</span> p <span style="color: #339933;">=</span> e.<span style="color: #006633;">getPoint</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">int</span> rowNumber <span style="color: #339933;">=</span> rowAtPoint<span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003399;">ListSelectionModel</span> model <span style="color: #339933;">=</span> getSelectionModel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      model.<span style="color: #006633;">setSelectionInterval</span><span style="color: #009900;">&#40;</span>rowNumber, rowNumber<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">// Display the popup </span>
      popupMenu.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getComponent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
          e.<span style="color: #006633;">getX</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, e.<span style="color: #006633;">getY</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This can be seen in action (at least as of the time of writing) in the <a href="http://codeturtle.svn.sourceforge.net/viewvc/codeturtle/src/com/novasurv/turtle/frontend/swing/comments/CommentsTable.java?view=markup" target="new">CommentsTable.java</a> file.</p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2009/01/02/right-clicking-tables-in-swing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeTurtle</title>
		<link>http://noopenblockers.com/2008/12/29/codeturtle/</link>
		<comments>http://noopenblockers.com/2008/12/29/codeturtle/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 18:22:08 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[CodeTurtle]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://notebook.novasurv.com/?p=189</guid>
		<description><![CDATA[Grading sucks.
Don&#8217;t get me wrong, I love teaching. And I love getting to see how students approach problems. I tend to leave my projects open-ended enough where they can express a bit of their own creativity into the solution. I like having small classes since I can spend a good amount of time offering suggestions [...]]]></description>
			<content:encoded><![CDATA[<p>Grading sucks.</p>
<p>Don&#8217;t get me wrong, I love teaching. And I love getting to see how students approach problems. I tend to leave my projects open-ended enough where they can express a bit of their own creativity into the solution. I like having small classes since I can spend a good amount of time offering suggestions on their implementation in addition to their results (my students can vouch for this, I usually provided 2-3 pages worth of comments that were unrelated to a particular grade item).</p>
<p>But coming up with an actual consistent, subjective, quantified number grade is a pain in the ass. I end up with a big checklist of things to look for and I am constantly having to go back and recheck projects to make sure I ran a particular test or to see how I scored a certain shortcoming.</p>
<p>I thought about writing my own test cases in one of the existing test frameworks (such as JUnit) to automate some of the process. The concept is sound, but in the end I was trying to shove the square peg into the circle hole; there would still be a lot of manual intervention to interpret the results and turn it into a grade.</p>
<p>I looked around for a solution. From what I saw, there really isn&#8217;t a solid application to facilitate what I wanted. So, I decided to write one.</p>
<p>The idea started out small: Point my application at a bunch of student projects and have it run tests and return me a grade. That would give me a very solid and consistent basis on which to derive the grade, allowing me to spend more time providing manual comments on the code or approach itself. I would just need a pretty flexible API to support the types of tests and introspection I wanted so it could be used to grade multiple projects easily.</p>
<p>Not surprisingly, once I started writing it more and more ideas started to take shape. I realized I could have my application, which I named CodeTurtle (more on that later), generate the report to return to the student as to which tests passed or failed. If I was going to have CodeTurtle generate the report, I needed a way to add my comments in, so comment functionality was written. Since most of my comments were based on a code review, I wanted to be able to view the students&#8217; source files as well and then tie that into the comments subsystem to skip the copy/paste need when commenting on particular code snippets. And so on&#8230;</p>
<p>Also not surprisingly, I open sourced it at <a href="http://sourceforge.net/projects/codeturtle/" target="new">SourceForge</a>. Ideally, I&#8217;d love to get other teachers, both at Villanova and eventually other schools, involved with both usage and development. But I also wanted to give some of my former students an opportunity to get some solid, real-world programming experience before they graduate.</p>
<p>I built the 0.1 version and made it <a href="http://sourceforge.net/project/showfiles.php?group_id=248567" target="new">available to download</a> from the SourceForge site for people to start playing around with. Being the first release there&#8217;s obviously a ton of more work to do, but I included a sample project to demonstrate the types of student submission validation I&#8217;m going after (<a href="http://sourceforge.net/project/screenshots.php?group_id=248567" target="new">screenshots available as well</a>). I also included some starting documentation, which will continue to get flushed out as I get the time. I&#8217;ve also got the interest of at least one friend of mine, so getting it off my laptop into a public area soon was important.</p>
<p>Feel free to contact me through SourceForge (mailing list or forums) or e-mail me directly if anyone is interested in either learning more about it or wanting to contribute.</p>
<p>Oh, and since I&#8217;ve been asked this a dozen times already and don&#8217;t have a FAQ up yet, I&#8217;ll just toss this out now. The name &#8220;CodeTurtle&#8221; came from the fact that I really didn&#8217;t have a good idea for a name. One night while working on it I looked up from my laptop and asked my 18 month daughter what I should call the project. The newest word at the time was &#8220;turtle&#8221; which sounded as good as any for a project name. And so, CodeTurtle was born. It&#8217;s not the most descriptive name out there, but it&#8217;s also not <a href="http://www.redhatmagazine.com/2008/10/31/interview-chris-morgan-on-jopr/" target="new">the worst named open source project</a> I&#8217;ve ever heard of.</p>
]]></content:encoded>
			<wfw:commentRss>http://noopenblockers.com/2008/12/29/codeturtle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
