Sonntag Oktober 15, 2006
First steps on automatically testing a NetBeans wizard
At first I didn't see how these
J-tools fit together, but after trying to use them, the picture became clearer.
The next steps for my project would be:
- How do I get the name of a control.
- Try to automate clicking through the project wizard
'StarOffice/OpenOffice.org Calc Add-In'
- How do I organize the files for the test.
- How to present the result of the test.
Now to my experiences with: How do I get the name of a control.
For screen shots see
'StarOffice/OpenOffice.org Calc Add-In'
The Calc Add-In wizard is compareable with the 'Java Application' wizard - it is extended.
Therefore some controls are accessible by the Jelly operators for
NewProjectWizardOperator and
NewProjectNameLocationStepOperator.
In these classes you can see how the controls are accessed - and I just
need to do the same for the additional controls from the Calc Add-In
wizard.
For example in the second step of the wizard the edit field with the label: 'Calc Add-In Name'.
It is comparable with the edit field 'Project Name', which comes from
NetBeans. Both consist of 2 separated controls: a label and the edit
field.
But with the current implementation there is something wrong:
- How does the connection work between the label and the edit field?
- How does the short cut from the label know to which edit field the cursor has to jump?
- If I identify the edit field by it's label how can I access the text in the edit field?
To get the label is quite easy:
Start in NetBeans: Tools -> Resource Bundle Lookup
and search for the label text: 'Calc Add-In Name'
That's how it should work, but unfortunately it doesn't;
So I had to look into the source code of the wizard, to get the handle for the resource string.
Got the string of the label; From the label operator I should get the text from the edit field;
This works for the 'Project Name', but not for the 'Calc Add-In Name'.
But I did it the same way as in Jelly! Argh...
After taking a closer look:
1. The short cut was missing for the 'Calc Add-In Name' - the short cuts were missing for all new generated labels in the wizard
So I assigned a short cut to the label, compiled it myself
- since it is a NetBeans project that was quite simple

But using the short cut didn't work...
Taking a
very
close look onto the label properties for 'Project Name' and 'Calc
Add-In Name' showed one property, that was not set for the second:
'labelFor' - After setting this property to the edit field, the short cut worked;
Now I would also expect that my function worked, to get the text from the edit field...
2. But it wasn't ...
So I tried to get the text directly, assigning the property 'name' to the edit field.
I got the text on using
- The number of the control
- The name of the field
- BUT NOT derived from the label !?!
(I shorten this .... I returned an unsigned
value from my function ... don't tell anybody ... I was realy blind on
this....)
Ok, now it works as expected, and the same way as in Jelly tools for 'Project Name'
To answer now the questions about the connection: It's just a small property on the label: 'labelFor'.
Now Let's go on to the third page of the wizard: Ups, Panes, Trees, Panels ..... ?
Aehhhh... I take the Finish button for now

Leaving the experience to control this page in detail for another blog entry
If you want to try out the
StarOffice/OpenOffice.org NetBeans integration you have to
build it on your own to get the latest fixes.
btw: Happy birthday
NetBeans and
OpenOffice.org

Gesendet von tbo
( Okt 15 2006, 06:44:57 PM CEST )
Permalink