Oddjob 1.2 New Features – Part 2
One new feature in Oddjob 1.2, took me ages – and it’s just two little buttons!
Here they are:
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.
- 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.
- 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
- 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.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)