The application is being ported to Java and, since it's a large application that needs to be flexible (not all users need all features, etc), to the NetBeans Platform. Robert sent me the current state of his application, which is created on top of JSR-296, the Swing Application Framework:
Less than a day later, it is now mostly ported to the NetBeans Platform:
The benefits? A much cleaner architecture, with all the sources neatly organized into modules:
Currently there's still a dependency on the Swing Application Framework, because one of the modules is still using the ResourceMap from that framework, which can easily be exchanged with the NetBeans NbBundle class.
It's pretty cool that Robert's original JDialogs continue to work as before. I.e., I simply copied them into a module, tweaked a bit to remove the ResourceMaps, and then I was able to call them from my Action classes.
Two special hidden features of the current state of the application are that (1) @ConvertAsJavaBean is used to serialize each newly created instance of the "BusinessAccount" object (with the upper ChildFactory listening to a folder for new entries and repopulating its node hierarchy displayed in the OutlineView) and (2) the Actions defined in the lower window (which, of course, is defined in a different module to where the upper window is found) come from the layer, so that anyone can easily extend the list of menu items from an external plugin:
class OrderBasketBeanNode extends BeanNode {
public OrderBasketBeanNode(OrderBasket orderBasket) throws IntrospectionException {
super(orderBasket, Children.LEAF, Lookups.singleton(orderBasket));
setDisplayName(orderBasket.getOrdNumb());
}
@Override
public Action[] getActions(boolean context) {
List extends Action> registeredOrderActions = Utilities.actionsForPath("OrderActions/");
Action[] actions = new Action[registeredOrderActions.size()];
for (int i = 0; i < registeredOrderActions.size(); i++) {
Action oneRegisteredOrderAction = registeredOrderActions.get(i);
actions[i] = oneRegisteredOrderAction;
}
return actions;
}
}
There are many other cool things about how all this is implemented. Maybe this example will be used as the porting example during the NetBeans Platform Certified Training in South Africa. It really illustrates many things about the NetBeans Platform.
Dear Geertjan,
Very interesting example, but i have one question about search functionality in your example, how to make it with OutlineView or BeanTreeView ? You don't implement it here.
Thanks
In fact, what you see above are two OutlineViews.
And, yes, search functionality is going to be added. Will blog about that when it's done!
The link for 'AMSOIL dealers' points to the link belw:
http://blogs.sun.com/geertjan/entry/more_on_convertasjavabean
Was that intentional?
I had clicked that to find more info on what an AMSOIL dealer was. ( Though google helped out here :)