Interaction wizard

The Interaction Wizard allows you to quickly generate code for connecting interactions between components.

Once you are familiar with writing Java code to get and set component properties, or to create complex behaviors when an event occurs, you will probably usually use the Event page of the Component Inspector to specify a component event to handle, and then write the event handling code by hand.

Although that approach gives you the greatest flexibility in writing complex event handling code, in many cases a simple wizard approach is faster. This Interaction Wizard allows you to specify, by selecting from lists, simple actions that can be performed on components when an event occurs.

Another advantage of the Interaction Wizard is that it uses simple language to describe the interactions, whereas in the Inspector you must know the exact names for the events and properties, which are sometimes less than obvious until you get used to them.

An example of an event controlling the interactions between components interactions might be:

The way this example would work in this wizard is as follows:

  1. On page 1, you will indicate the container class where the interaction will take place.
  2. On page 2, you will indicate that button1 generates the event you are interested in.
  3. On page 3, you will indicate that when button1 is pressed, you want to set the text of textField1.
  4. On page 4, you will indicate what you want to set it to, namely "HelloWorld".


Step 1 of 4

Containing Class

This page of the wizard shows you a list of the UI container classes that are found in the file that was selected in the AppBrowser when the Wizard was invoked.

This page of the wizard will be skipped (i.e. you will start on Step 2 of 4) if there is only one container class defined in the selected file.

The class selected on this page is the one into which code will be inserted by this wizard for creating the interactions between components.

To select the class, when there is more than one, simply click on it in the list box, then click the Next button.


Step 2 of 4

Event-sourcing component

This page displays a list of the components, in the containing class, which can generate events.

Select which component will be generating the event to which you want to respond.

  1. Select the component in the list.
  2. Click the Next button.

This page performs essentially the same role as selecting an event on the Events page of the Component Inspector. Going on to the next page is roughly equivalent to double clicking on the event in the Inspector to drill down into the event handling method where you can define what should happen when the event occurs. When using the Inspector, you would then have to type code by hand in the event handling method. Using this wizard, you can use the next two pages to define the action you want taken when this event occurs.

For our example above, in which pressing button1 should set the text of textField1 to "HelloWorld", you would select button1 here.

To edit the events displayed in this wizard, press the Edit Interactions button. This opens the Interaction Wizard Editor.


Step 3 of 4

This step controls which component will be affected when the event occurs, and what type of affect it will be.
To component:
Select the target component (the one you want to do something to when the event occurs) from the pull down list.
On event:
Select the event that you want to trigger this interaction.
Do the following:
Select what you want done to the target component.

For our example above, in which pressing button1 should set the text of textField1 to "HelloWorld", you would select:


Step 4 of 4

Specify the value to use

This page of the Interaction Wizard is used to specify what value to use as a parameter for what you are doing to the target component.

You might enter a literal string here if you are setting text. For our example above, in which pressing button1 should set the text of textField1 to "HelloWorld", you would enter "HelloWorld" here (without the quotes).

  1. Enter the value you want used.
  2. Click the Finish button to complete the operation.

The required Java code will be inserted into the class selected in Step1.