Rob Gordon is a seasoned Java developer and a big fan of open source. Oddjob is his own open source project to make job scheduling and task automation in Java much much easier. Rob is based in London. Rob is a DZone MVB and is not an employee of DZone and has posted 17 posts at DZone. You can read more from them at their website. View Full User Profile

Oddjob 1.2 New Features – Part 2

07.28.2012
| 2065 views |
  • submit to reddit

One new feature in Oddjob 1.2, took me ages – and it’s just two little buttons!

Here they are:

Properties DesignerAll they do is move a row up or down. Here we need to move our row up, so that favourite.fruit is defined before it is needed to define favourite.snack.

Why did I do all this work for two little buttons? Because before these two buttons the only way to change the configuration order was to toggle into XML mode for the design of the enclosing job and edit the text – and this is not the slick user interaction experience that Oddjobbers have come to expect!

Why did it take ages? Because the widget has three different incarnations, and following that developer best practice of removing duplication I resisted the temptation to develop a square peg and a round peg but instead developed a multi-hole-type peg with a square hole and round hole adapters.

The three different incarnations for the widget are:

  • Indexed property ( public void setFoo(int index, Object thing) ) configuration.
  • Mapped property ( public void setFoo(String key, Object thing) ) configuration.
  • And configuration of variables job which is a BeanUtils DynaBean and so can have any properties.

Here’s variables job.

Variables DesignerThe user friendliness of navigation within the table has been improved a bit too. Here’s some helpful hints on how to find your way around.

New Rows
The last row in the table, or the first row in an otherwise empty table is to allow a new row to be entered. Once the value of the first column has been entered the row is created and is part of the configuration. Other value can then be entered for the row.
Focus
As with all swing tables, TAB, SHIFT-TAB and the LEFT, RIGHT, UP and DOWN keys move the focus between cells, and CTRL-TAB and SHIFT-CTRL-TAB move focus out of the Table
Editing
On the cell that has focus, any key will given the component in that cell focus to start editing. For text fields F2 will give focus without the keystroke going through to the field data. For other component types, such as the file field, the keystroke just provides focus but isn’t passed through to the component. I don’t know why, it’s slightly irritating but not enough to make me want to fix it.
Buttons and Drop Downs
For buttons that have focus, the SPACE-BAR will open the dialogue for the next level of configuration. For the type drop down, the DOWN key provides the list.
File Selection
The little widget with the text field and the file selection button deserves a special mention. Once the component has focus CTRL-TAB, SHIFT-CTRL-TAB and will tab between the text field and the button.

These two diminutive buttons turned out to be quite a satisfying and useful little feature – well worth the work.

Published at DZone with permission of Rob Gordon, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)