Next: BeanBox Enhancements
Up: ContextBox: A BeanBox Environment Components
Previous: Assembly and Design Environments
In order to test beans implementing the BeanContext interface in a visual development environment, the beans need to have some kind of visual representation. Without such a representation, it would be impossible to manipulate them visually at assembly and design time.
Several difficulties arise. When a new ContextBean is added to the BeanBox there is the question of how to represent that bean visually. The visual representation can be provided either by the bean author or by the development environment. Moreover, the bean can be a BeanContextProxy and itself a visual container (extends java.awt.Container). In that case, there are two hierarchies to maintain and a possibility for inconsistency between the two.
The BeanBox distinguishes (when visual representation is concerned) only between visual beans (that are a kind of java.awt.Component) and non-visual ones. A non-visual bean is represented by a special label object (an instance of sun.beanbox.OurLabel), which displays the bean's name. When hide invisible beans mode is selected or design mode is disabled , the labels representing non-visual beans are hidden. When enhancing the BeanBox with support for runtime containment and services protocol, there is also the BeanContext or BeanContextProxy case to consider.
Every bean can have a Component or Container,
and/or a BeanContext, associated with it. A bean
can establish that relationships either through
inheritance by extending one of
BeanContext,
Component or Container classes, or by being a
BeanContextProxy or a
BeanContextContainerProxy or a
BeanContextChildComponentProxy for that
object.
There are 6 combinations to consider, for each we offer a different policy concerning the visual representation:
A possible work-around is to represent such beans at design time by a special container (e.g., OurContext, analogous to OurLabel) which will allow the user to add beans into that BeanContext, and at runtime by the Component associated with it. Beans placed inside this bean should be added to its special container and also to its BeanContext.
Even if it were possible to somehow manage this behavior, it is still too confusing to work with. Therefore, every bean that is a Container but not a BeanContext should be automatically associated (in the extended BeanBox version) with a BeanContext. Every bean contained in the container is should then also be added to that BeanContext, which would propagate the environment services according to the protocol.
Next: BeanBox Enhancements
Up: ContextBox: A BeanBox Environment Components
Previous: Assembly and Design Environments