Dynamic form loading suggestions

First of all great work on the designer and, not need it to say, for the product in general.
I have a few issues trying to offer support dynamic form (IDEA forms) loading in my framework.

As a general idea, I'm a big supporter of forms as resources not as java code. Starting from this idea, I'm trying to load a form design at runtime using AsmCodeGenerator and I found a issue (maybe is too much issue, I'm sure you cannot create something that will fit everybody design) which can be solved with small changes.

The issues exist because I'm trying to follow a MVC model: forms will hold the visual components, a controller will provide the business logic and the model (created in controller) will be attached to the form. Having this design, the form actually doesn't hold any fields or code is just a container of visual components.

Having names for fields (which I need for later binding) doesn’t mean that the form class must have fields with that name and a binding must be made. There should be a flag that force AsmCodeGenerator not to try to bind any components to fields.

private void validateFieldBinding(LwComponent component, final Class componentClass) throws CodeGenerationException {

  • if (myIgnoreBinding) {

String binding = component.getBinding();
if (binding == null) return;

validateFieldClass(binding, componentClass, component.getId());

Also it will be good if you will shift the ASM library in your own namespace (com.intellij.asm ?) so class version conflicts can be avoid(your version of ASM libraries could be different that the application ASM library)

At this moment I will apply the change myself and rebuild forms_rt but I think it is a small change that can be applied in 6.x


1 comment
Comment actions Permalink

Actually the things are a little more complicated so I presume the code changes are bigger to make them part of the IDEA Form API.

I will change the generator based on my needs.

Anyway, there is something that I think it should be different : form file should be allowed to be placed in any folder, not only in the sources.


Please sign in to leave a comment.