Component: a Visual Presentation and a Java Object

Besides being a Java object in the server, a component has a visual part[22] in the browser, if and only if it belongs to a page. When a component is attached to a page, its visual part is created[23]. When a component is detached from a page, its visual part is removed.

There are two ways to attach a component into a page. First, you could call the setPage method to make a component to become a root component of the specified page. Second, you could call the setParent, insertBefore or appendChild method to make it to become a child of another component. Then, the child component belongs to the same page as to which the parent belongs.

Similarly, you could detach a root component from a page by calling setPage with null. A child is detached if it is detached from a parent or its parent is detached from a page.



[22] If the client is a browser, the visual presentation is a DOM element or a set of DOM elements.

[23] The visual part is created, updated and removed automatically. Application developers rarely need to notice its existence. Rather, they manipulate the object part in the server.