Top
Interstage Studio J Business Kit GUI Library User's Guide
FUJITSU Software

4.3.1 Development Flow

The development flow using the Object Control Facility is as follows.

  1. Create each object from subclasses of Java Object.

  2. Define a subclass of JFCObjectLoaderManager, and register the objects.

    By calling the add method in JFCObjectLoaderManager, register each object. The object names specified for each object using the add method must be unique among the object names.

  3. After adding all objects created in step 2, manage and control the objects.

    First, by calling the getObject method, get a reference to the object. If the object creation timing is specified as DELAYED_CREATION, realizeObject method should be called beforehand.

  4. Second, appropriate operation can be performed on the object.

  5. And last, to remove the object from the memory, the releaseObject method is called. Whether the memory of the object is freed or not depends on the release timing of the object.

For example, the ObjectManager class is defined as subclass of JFCObjectLoaderManager class, and the SubButton class is defined as subclass of java.awt.Button class. The following code shows the usage of the object.

//The subclass of JFCObjectLoaderManager
public class SubObjectManager extends JFCObjectLoaderManager
{
    public SubObjectManager() {
        this.add("Button1", "SubButton", JFCObjectLoader.DELAYED_CREATION, JFCObjectLoader.TEMPORARY_INSTANCE);
        //add arguments are described below
        //1st argument specifies he object name.
        //2nd argument specifies the created object class name.
        //3rd argument specifies the object creation timing.
        //  For the above example, the object is created when the realizeObject method is called.
        //  Refer to "Creation Timing List" below for other creation timings.
        //4th argument specifies the object release timing.
        //  For the above example, the object is released when the releaseObject method is called.
        //  Refer to "Release Timing List" below for other release timings.
        //Other objects can be registered in the same way as above.
        this.add(......);
        ....
    }
}
Table 4.13 Creation Timing List

Timing

Class Variable to specify

Description

at Initialization

JFCObjectLoader.INIT_CREATION

Create the object immediately when add method is called.

when realizeObject is called

JFCObjectLoader.DELAYED_CREATION

Create the object when the realizeObject method is called.
This is the creation timing recommended for applications or applets with a large number of objects.

Asynchronously at Initialization

JFCObjectLoader.BACKGROUND_CREATION

Create the object when the add method is called, using a separate thread from the application or applet.
This creation timing is specified to increase the speed of getting reference to objects that are frequently used, when application or applet startup performance is also important.

Table 4.14 Release Timing List

Timing

Class Variable to specify

Description

when releaseObject is called

JFCObjectLoader.TEMPORARY_INSTANCE

The object is released from memory when the releaseObject method is called.
This timing is used for applications or applets designed to save on memory resource usage.

Buffered when releaseObject is called

JFCObjectLoader.BUFFERED_INSTANCE

The object is held in a memory buffer when the releaseObject method is called. When the number of objects held in the memory buffer exceeds the limit of buffered objects set in JFCObjectLoaderManager, the oldest object is released from memory.
The maximum number of objects held in the buffered memory can be set by calling the setReleaseBufferSize method of JFCObjectLoaderManager. The default value is 10.

at Application/Applet termination

JFCObjectLoader.PERMANENT_INSTANCE

The object is held in memory until the JFCObjectLoaderManager (or subclass of JFCObjectLoaderManager) managing the object is released from memory.
Normally, this is synonymous to termination time of the application or applet.

Note

The applications or applets using Object Control Facility may use the setURLs or addURL method of JFCObjectLoader to specify the location of the object class, so that the object class can be loaded via the network at the time of object creation as if the object class is loaded locally. Note that in the case of applet, due to the security restriction, only the host from which the applet has been downloaded is trusted. The same restriction is applied when using setURLs or addURL in a applet. For the case of application, you can use setURLs and addURL as you wish.