Monthly Archives: December 2008

jsp tomahawk HtmlInputCalendar

I had an ongoing issue recently with pop-up javascript calendars in the tomahawk jsp library.  Hopefully this will save some trouble for someone.  The problems I was having were:

  1. sometimes the calendar pop-up was not selectable, and
  2. when it was selectable, the pop-up would show up at a distorted location on the page and the tables would be messed up.

Being new to debugging this, my first assumption was that there would be protections built into this packaged code so that my CSS and whatever else would not affect it.  So, to keep this post short and to the point, here is how I fixed it:

  1. An eventual look at the W3C HTML 4.1 Reference showed that this element was difficult to put directly inside a label, inside a fieldset.  The problem is that the label element only supports one input inside, so the additional calendar pop-up button is unusable and simply ignores any click on it and instead puts focus on the input element.  I ended up fixing this one by simulating a label element using a DIV and CSS.  (Note: at B6 Systems, we have developed an in-house jsp framework that we call PureFaces that allows writing JSP pages completely in Java code.  So I wrote my own components for the fieldsets and labels.  It is intended to be open source eventually and will be on the B6 website)
  2. The second problem took a little longer, and eventually I fixed it without really knowing why what I did worked.  I used a lot of the same techniques for debugging CSS that are shown in many places.  Eventually I found that I had a position: relative; style on my content wrapper that was totally throwing off the built-in CSS for the pop-up.  The reason I don’t know why that fixed it was that I could not find anything in the built-in CSS that seemed to care about position.  But, results speak loudly.  I was able remove and work around that style.  The second part of this one (the bad formatting of the pop-up) was related to having the table element way too globally defined in the CSS.  Adding more specific selectors quickly solved that one.
Advertisements

javascript testing

I have been messing around with javascript testing lately and i’ve had some issues.  I have been attempting to incorporate jsunit into JUnit (per the minimal instructions on the website) and have been unsuccessful.  emails to the site owner go unanswered.

The usage seems to be directed towards building via ANT/XML in something like CruiseControl, but I am trying to put it directly into a JUnit testcase that can be part of all of the other tests I run.

Here’s a summary of what i’m doing right now, and the problems i’m having:

  1. Create an instance of StandaloneTest, and supplying it with an implementation of ConfigurationSource
  2. Set up the test to be one that comes with the jsunit package… so that i KNOW it is formatting correctly.  (This is the html file with the javascript tests and asserts in it)
  3. run the unit test.

Step 3, of course, is what fails.  The browser I selected launches, and the java console says the everything is running and that it is waiting for a response.

Then it times out… I’m not sure what is going on here, but it seems that either the browsers are not sending a response, or JUnit is not able to catch it.

Any ideas?


new blog

This is the first post on geekin!  It may take me a while to get things rolling, but i plan on covering topics that relate to my work.  I’m a java developer at B6 Systems in Pittsburgh, and I also handle a lot of web development.  So this blog will cover a wide range of topics like java, web scripting, web design, jsp, whatever else I can think of.

disclaimer: I’m new to web development.  If my ideas seem strange or misguided, make a comment.  i’d love to find out how to do whatever it is better.