The Instance Manager


Just as you would if you imported an object into an IDE and had to create an instance of it by hand coding, an instance needs to be created for imported objects in JDesignerPro. One of the strengths of JDesignerPro is that we have provided and advanced, visual system for creating such instances, the Instance Manager.

In order to create an instance of an imported class or JavaBean in JDesignerPro, you must first choose a its constructor. The Instance manager is where you setup the constructors for imported objects and the included Java objects. The Instance Manager uses the same button as the Data Wizard to startup. This button will bring up either the Data Wizard or the Instance Manager as needed, depending on what you drop on your application screen.

Any object that has been imported or that is in the Java group will bring up the Interaction Manager automatically when you add that object to your application. Objects that come with JDesignerPro in the Data, Standard, Extended and Non Visual folders, as well as .class files that were created with JDesignerPro do not require the use of the Instance Manager. Although you can try to import non-beans compliant objects, they may not work. Even some Beans may not work because of their construction.

The use of the Instance Manager is similar to the Interaction Manager. When it first appears you will see three columns that have headers. The first column will display the constructors that JDesignerPro has found for the object. There are three steps to creating an instance of it:

  1. Choose one of the constructors in the list at the left.
  2. Select each parameter in the middle column.
  3. For each selection in the middle column, choose an entry from the third column. This will be used in place of that parameter when JDP creates an instance of this object. The third column will automatically show the objects that match the selected parameter. This tree is populated with objects of other components that are currently available in this application.

The Instance Manager:

To find out about the constructors for an object, look at the API from the vendor of the component. For the Java objects, look at the JDK API. Once you have chosen the constructors and an instance has been created, you can use the object in the Interaction Manager to build action events like you would with any other JDesignerPro object.

Common constructors are (), (string) and "Create from other object". To instantiate an object without passing any outside parameters, choose the () option in the first column. The (string) option is for passing the initial string parameter to the object. To pass a hard-coded string, select the String("String") parameter in the third column. When you do, a field will appear under the middle column where you can enter the value of the string.

The "Create from other object" constructor gives you the option to have the object draw methods from another existing object that is currently available. If there are no methods that match the return type for the object chosen, a message will display in the status bar. A simple example is to use Java/Lang String object. Place on the screen, choose Create from other object, then choose that again from the middle column, then select the string from which it will always draw its value in the third column.

See the tutorial titled The Instance Manager and Java Beans.