next up previous NU-CCS-99-04.ps [ Readme | Copyright | Tutorial | Download | Feedback ]


Next: How Are the Existing Up: Uncovering the BeanBox Design Previous: The BeanBox Class

The Wrapper Class

Wrapper is the other very important class in the BDK, and holds several responsibilities. Every bean added to the BeanBox is first placed inside an instance of the Wrapper class, and that wrapper instance is the actual object placed inside the BeanBox. The top BeanBox is also put inside a wrapper before it is put into the BeanBoxFrame at startup.

The first responsibility of the wrapper is visual representation of the wrapped bean in the assembly window in case the bean is not an instance of java.awt.Component. The Wrapper class is a subclass of java.awt.Panel. It has two important properties: bean and child. The bean property holds the bean that the wrapper wraps, and the child property is one of the following: If the wrapped bean is an instance of java.awt.Component, then the child is a wrapped bean; otherwise, the child is a label with the short bean's class name. In any case, the child is put into the wrapper, and plays a part in the presentation hierarchy. The wrapper class, among other things, draws the black-and-white hashed border around the currently active bean. If you look carefully in a newly activated BDK, you can also see a hashed border around the entire BeanBox. It belongs to the top wrapper, which wraps the top BeanBox (Figure 1).

The second wrapper's responsibility is keeping track of various BeanBox related states for each bean in the assembly window. It keeps track of all the event listeners attached to the bean, and the targets for bounded properties. This information is used to detach listeners before the beans are serialized, and reattach them afterwards. It also offers introspection information in the easy-to-use form, like keeping a hash table of bean's event names and event descriptors.


next up previous NU-CCS-99-04.ps [ Readme | Copyright | Tutorial | Download | Feedback ]


Next: How Are the Existing Up: Uncovering the BeanBox Design Previous: The BeanBox Class

David H. Lorenz
3/17/2000