A representation of an Echo component. This is an abstract base class from which all Echo components are derived.
A hierarchy of Component objects is used to represent the state of an application's user interface. A Component may have a single parent Component and may contain zero or more child Components. Certain Components may limit the number or type(s) of children which may be added to them, and may even establish requirements for what type(s) of parent Components they may be added to. In the event that an application attempts to add a child Component to a parent Component in spite of these requirements, an IllegalChildException is thrown.
Properties and Styles
The state of a single Component is represented by its properties. Properties can be categorized into two types: "style" and "non-style". Style properties are generally used to represent the "look-and-feel" of a Component--information such as colors, fonts, location, and borders. "Non-style" properties are generally used to represent non-stylistic information such as data models, selection models, and locale.
"Style Properties" have a special definition because they may be stored in Style or StyleSheet objects instead of as properties of a specific Component instance. Property values contained in a relevant Style or StyleSheet will be used for rendering when the property values are not specified by a Component itself. Style properties are identified by the presence of a public static constant name in a Component implementation with the prefix PROPERTY_. In the base Component class itself there are several examples of style properties, such as PROPERTY_BACKGROUND,PROPERTY_FONT and PROPERTY_LAYOUT_DATA. The rendering application container will use the Component.getRenderProperty() and Component.getRenderIndexedProperty() to retrieve the values of stylistic properties, in order that their values might be obtained from the Component's shared Style or the ApplicationInstance's StyleSheet in the event they are not directly set in the Component.
A Component implementation should not store the values of style properties as instance variables. Rather, the values of style properties should be stored in the local Style instance, by way of the setProperty() method. The getProperty() method may be used to obtain the value of such properties. Only style properties should be stored using these methods; properties such as models should never be stored using the getProperty()/setProperty() interface.
Events
Many Components will provide the capability to register EventListeners to notify interested parties when various state changes occur. The base Component class provides an EventListenerList as a convenient and memory efficient means of storing such listeners. The internal EventListenerList may be obtained using the getEventListenerList() method. The EventListenerList is lazy-created and will only be instantiated on the first invocation of the getEventListenerList() method. If the intent is only to inquire about the state of event listeners without necessarily forcing instantiation of an EventListenerList, the hasEventListenerList() should be queried prior to invoking getEventListenerList().