5646 Form Snapshot issues

I tried out the New->Form Snapshot on an existing Swing application, and ran into a few problems.

  • Issues #1*

On the main console frame of the application which has extensive JMenuBar with many JMenus, it only captured the JMenuBar. Maybe I was expecting too much from this. I though it could pull in the entire menu. I was even thinking it might find the callback code (since it is all available in my project), and record all the bindings for the menu items.

I tried it on a bunch of form dialogs, and it worked on most of them,
at least at first glance.
I did get a couple errors on a few dialogs: See attached.
Issues #2 Failed to create snapshot: java.lang.RuntimeException: java.io.NotSerializableException: com.jgoodies.forms.layout.RowSpec#UnmodifyableRowSpec
I got this error on about 50% of the dialogs in the application because
they use JGoodies to create the button panel. Here is the code:


Issue #3 Unknown layout manager classes found. javax.swing.plaf.basic.BasicOptionPaneUI$ButtonAreaLayout Components using these layout managers iwll not be included inthe snapshot. Continue?

On the last item, this dialog was created with JOptionDialog. Here is part of the code:


I don't know if it would be possible to detect when JOptionPane is being used, and record it as such. But you don't have JOptionPane on the palette.



Attachment(s):
5646_Unknown_layout_manager_BasicOptionPaneUI_ButtonAreaLayout.png
5646_failed_to_create_snapshot_NotSerializable_jgoodies_RowSpec_UnmodifyableRowSpec.png
4 comments

Hello Alex,

A> I tried out the New->Form Snapshot on an existing Swing application,
A> and ran into a few problems.
A>
A> * Issues #1*
A> On the main console frame of the application which has extensive
A> JMenuBar with many JMenus, it only captured the JMenuBar. Maybe I
A> was expecting too much from this. I though it could pull in the
A> entire menu. I was even thinking it might find the callback code
A> (since it is all available in my project), and record all the
A> bindings for the menu items.

As there is no menu designer in the UI Designer, the form snapshot feature
does not support working with menus either. It's possible that the menu designer
will be added in the next version of IDEA after 6.0.

A> I tried it on a bunch of form dialogs, and it worked on most of them,
A> at least at first glance.
A> I did get a couple errors on a few dialogs: See attached.
A> Issues #2 Failed to create snapshot:
A> java.lang.RuntimeException: java.io.NotSerializableException:
A> com.jgoodies.forms.layout.RowSpec#UnmodifyableRowSpec
A> I got this error on about 50% of the dialogs in the application because
A> they use JGoodies to create the button panel.

What version of JGoodies Forms are you using? I don't quite understand how
such an exception could happen with a standard version of JGoodies Forms.

A> Issue #3 Unknown layout manager classes found.
A> javax.swing.plaf.basic.BasicOptionPaneUI$ButtonAreaLayout Components
A> using these layout managers iwll not be included inthe snapshot.
A> Continue?
A>
A> I don't know if it would be possible to detect when JOptionPane is
A> being used, and record it as such. But you don't have JOptionPane on
A> the palette.

Why do you need to create UI Designer forms for JOptionPane dialogs? As far
as I understand, you can keep calling methods in JOptionPane class to show
the dialogs.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0

What version of JGoodies Forms are you using? I don't quite understand how
such an exception could happen with a standard version of JGoodies Forms.


I believe we are using version 1.0.4. I downloaded the latest forms 1.0.7,
and I got further, but still got an error. I get a Serialization error. It looks like
JGoodies isn't explicityl setting the serialization ID in each class, so each time
the code is compiled, different IDs can result. That is a notorious problem with
Serialization. Looks like this may only work if I include the version of jgoodies
that comes bundled with IDEA. Will try that next.



Attachment(s):
5650_forms_serialization_uid_mismatch.png
0

Ok,

I took one of the Dialog I captured from the Form Snapshot and then tried to bind a class to it and so forth.

Some further comments:

  • Issue #1*


After you take a form snapshot, it shows up as Form1.form, Form2, form in the package you did New->Form Snapshot in.

By default, the form is not bound to a class. If I type the name of a new class in the binding field of the Form properties, I see an Intention to Create the Class. This is
nice except that by default it creates the new class with no package. I think this should be changed so that if you don't specify a package, then it should default to the package where the form resides (unless the form isn't in a source directory...).

Furthermore, I don't see why you don't just go ahead and generate this class automatically, so someone doesn't even have to do this step.

It took me about 10 minutes actually to find out that I had to click the toplevel form,
and then edit the binding field. If there was an action 'bind class' in the context menu
that would have helped.

  • Issue #2 *

So, I have a form Form1.form bound to class com.abc.apps.util.Form1.
After I bound the dialog to a class, and then named all the fields. Then I tried the Data Binding Wizard.
It is now asking me for a bean class to bind the fields to. Should this default to the
form's class? That would be the simplest thing to do.

  • Issue #3*


After associating Form1 as the bean class, it then showed me the fields I could bind.
However, it only showed two fields startDate and endDate. All my other fields, which includes several radio buttons and many comboboxes, and a JList, were not listed here
even though I had given them names.

Is there something I am doing wrong here?

  • Issue #4 *


Also on that field pane of the Data Binding Wizard, it forced me to give the
name of the corresponding bean property. Since I wanted the bean name to
be the same as the field name, this seem kind of pointless. I realize that you
might be hooking it to a bean that had different names, but you should make
this easier the case when you are creating this from scratch.

Couldn't you just fill in th bean name to be the same as the field name?

  • Issue #5 *


I wanted to get IDEA to generate the source code for the UI creation code
but I couldn't figure out how to do this? If I build the project, will this
happen? I am using ant to build my project, though; I never use IDEA's
build. Is there a way to just have UI Designer generate the code?



Attachment(s):
5650_ui_designer_intention_create_class.png
5650_data_binding_wizard.png
5650_scheduled_downtime_form_data_binding_wizard.png
0

Okay, maybe I'm an idiot, but that Data Binding Wizard didn't do what I though it was going to do.

I thought it was going to produce a setStartDate() which called startDate.setText() and
a getStartDate() which returned startDate.getText(). (startDate is a JTextField).
Similar for JTextField endDate.

It put all the other JComboBoxes and JRadioButtons in the Form1 that I had named,
but didn't give me an option to associate them with a bean and generate getter and
setter methods.

0

Please sign in to leave a comment.