|
NextApp Echo2 v2.1.0.rc2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnextapp.echo2.app.Component
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.
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.
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().
| Field Summary | |
static java.lang.String |
CHILDREN_CHANGED_PROPERTY
|
static java.lang.String |
ENABLED_CHANGED_PROPERTY
|
static java.lang.String |
FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY
|
static java.lang.String |
FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY
|
static java.lang.String |
LAYOUT_DIRECTION_CHANGED_PROPERTY
|
static java.lang.String |
LOCALE_CHANGED_PROPERTY
|
static java.lang.String |
PROPERTY_BACKGROUND
|
static java.lang.String |
PROPERTY_FONT
|
static java.lang.String |
PROPERTY_FOREGROUND
|
static java.lang.String |
PROPERTY_LAYOUT_DATA
|
static java.lang.String |
STYLE_CHANGED_PROPERTY
|
static java.lang.String |
STYLE_NAME_CHANGED_PROPERTY
|
static java.lang.String |
VISIBLE_CHANGED_PROPERTY
|
| Constructor Summary | |
Component()
Creates a new Component. |
|
| Method Summary | |
void |
add(Component c)
Adds the specified Component as a child of this
Component. |
void |
add(Component c,
int n)
Adds the specified Component as the nth
child of this component. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener to this component. |
void |
dispose()
Life-cycle method invoked when the Component is removed
from a registered hierarchy. |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Reports a bound property change to PropertyChangeListeners
and to the ApplicationInstance's update management system. |
ApplicationInstance |
getApplicationInstance()
Returns the ApplicationInstance to which this
Component is registered, or null if it is not currently
registered. |
Color |
getBackground()
Returns the default/base background color of the Component. |
Component |
getComponent(int n)
Returns the nth immediate child component. |
Component |
getComponent(java.lang.String id)
Recursively searches for the component with the specified id by querying this component and its descendants. |
int |
getComponentCount()
Returns the number of immediate child Components. |
Component[] |
getComponents()
Returns an array of all immediate child Components. |
protected EventListenerList |
getEventListenerList()
Returns the local EventListenerList. |
int |
getFocusTraversalIndex()
Returns the focus traversal (tab) index of the component. |
Font |
getFont()
Returns the default/base font of the component. |
Color |
getForeground()
Returns the default/base foreground color of the Component. |
java.lang.String |
getId()
Returns the user-defined identifier of the Component. |
java.lang.Object |
getIndexedProperty(java.lang.String propertyName,
int propertyIndex)
Returns the value of the specified indexed property. |
LayoutData |
getLayoutData()
Returns the LayoutData object used to describe how this
Component should be laid out within its parent container. |
LayoutDirection |
getLayoutDirection()
Returns the specific layout direction setting of this component, if any. |
java.util.Locale |
getLocale()
Returns the specific locale setting of this component, if any. |
Component |
getParent()
Returns the parent component. |
java.lang.Object |
getProperty(java.lang.String propertyName)
Returns the value of the specified property. |
java.lang.String |
getRenderId()
Returns the render id of this component. |
java.lang.Object |
getRenderIndexedProperty(java.lang.String propertyName,
int propertyIndex)
Determines the "rendered state" of an indexed property. |
java.lang.Object |
getRenderIndexedProperty(java.lang.String propertyName,
int propertyIndex,
java.lang.Object defaultValue)
Determines the "rendered state" of an indexed property. |
LayoutDirection |
getRenderLayoutDirection()
Returns the rendered LayoutDirection of the
Component. |
java.util.Locale |
getRenderLocale()
Returns the rendered Locale of the Component. |
java.lang.Object |
getRenderProperty(java.lang.String propertyName)
Determines the "rendered state" of a property. |
java.lang.Object |
getRenderProperty(java.lang.String propertyName,
java.lang.Object defaultValue)
Determines the "rendered state" of a property. |
Style |
getStyle()
Returns the shared Style object assigned to this
Component. |
java.lang.String |
getStyleName()
Returns the name of the Style in the
ApplicationInstance'sStyleSheet from
which the renderer will retrieve properties. |
Component |
getVisibleComponent(int n)
Returns the nth immediate visible
child Component. |
int |
getVisibleComponentCount()
Returns the number of visible immediate child Components. |
Component[] |
getVisibleComponents()
Returns an array of all visible immediate child Components. |
protected boolean |
hasEventListenerList()
Determines if a local EventListenerList exists. |
int |
indexOf(Component c)
Determines the index of the given Component within the
children of this Component. |
void |
init()
Life-cycle method invoked when the Component is added
to a registered hierarchy. |
boolean |
isAncestorOf(Component c)
Determines if this Component is or is an ancestor of
the specified Component. |
boolean |
isEnabled()
Determines the enabled state of this Component. |
boolean |
isFocusTraversalParticipant()
Determines if the Component participates in (tab) focus
traversal. |
boolean |
isRegistered()
Determines if the Component is registered to an
ApplicationInstance. |
boolean |
isRenderEnabled()
Determines whether this Component should be rendered with
an enabled state. |
boolean |
isRenderVisible()
Determines if the Component and all of its parents are
visible. |
boolean |
isValidChild(Component child)
Determines if a given Component is valid to be added as a
child to this Component. |
boolean |
isValidParent(Component parent)
Determines if this Component is valid to be added as a
child of the given parent Component. |
boolean |
isVisible()
Returns the visibility state of this Component. |
void |
processInput(java.lang.String inputName,
java.lang.Object inputValue)
Processes client input specific to the Component
received from the UpdateManager. |
void |
remove(Component c)
Removes the specified child Component from this
Component. |
void |
remove(int n)
Removes the Component at the nth index. |
void |
removeAll()
Removes all child Components. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener from this Component. |
void |
setBackground(Color newValue)
Sets the default background color of the Component. |
void |
setEnabled(boolean newValue)
Sets the enabled state of the Component. |
void |
setFocusTraversalIndex(int newValue)
Sets the focus traversal (tab) index of the component. |
void |
setFocusTraversalParticipant(boolean newValue)
Sets whether the component participates in the focus traversal order (tab order). |
void |
setFont(Font newValue)
Sets the default text font of the Component. |
void |
setForeground(Color newValue)
Sets the default foreground color of the Component. |
void |
setId(java.lang.String id)
Sets a user-defined identifier for this Component. |
void |
setIndexedProperty(java.lang.String propertyName,
int propertyIndex,
java.lang.Object newValue)
Sets a generic indexed property of the Component. |
void |
setLayoutData(LayoutData newValue)
Sets the LayoutData of this Component. |
void |
setLayoutDirection(LayoutDirection newValue)
Sets the LayoutDirection of this Component,
describing whether content is rendered left-to-right or right-to-left. |
void |
setLocale(java.util.Locale newValue)
Sets the locale of the Component. |
void |
setProperty(java.lang.String propertyName,
java.lang.Object newValue)
Sets a generic property of the Component. |
void |
setRenderId(java.lang.String renderId)
Sets a custom render identifier for this Component. |
void |
setStyle(Style newValue)
Sets the shared style of the Component. |
void |
setStyleName(java.lang.String newValue)
Sets the name of the style to use from the ApplicationInstance-defined StyleSheet. |
void |
setVisible(boolean newValue)
Sets the visibility state of this Component. |
void |
validate()
A life-cycle method invoked before the component is rendered to ensure it is in a valid state. |
boolean |
verifyInput(java.lang.String inputName,
java.lang.Object inputValue)
Invoked by the ClientUpdateManager on each component in the
hierarchy whose processInput() method will layer be invoked
in the current transaction. |
int |
visibleIndexOf(Component c)
Determines the index of the given Component within the
visible children of this Component. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String CHILDREN_CHANGED_PROPERTY
public static final java.lang.String ENABLED_CHANGED_PROPERTY
public static final java.lang.String FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY
public static final java.lang.String FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY
public static final java.lang.String LAYOUT_DIRECTION_CHANGED_PROPERTY
public static final java.lang.String LOCALE_CHANGED_PROPERTY
public static final java.lang.String PROPERTY_BACKGROUND
public static final java.lang.String PROPERTY_FONT
public static final java.lang.String PROPERTY_FOREGROUND
public static final java.lang.String PROPERTY_LAYOUT_DATA
public static final java.lang.String STYLE_CHANGED_PROPERTY
public static final java.lang.String STYLE_NAME_CHANGED_PROPERTY
public static final java.lang.String VISIBLE_CHANGED_PROPERTY
| Constructor Detail |
public Component()
Component.
| Method Detail |
public void add(Component c)
Component as a child of this
Component. The child will be added at the greatest
index.
c - the child Component to add
public void add(Component c,
int n)
throws IllegalChildException
Component as the nth
child of this component.
All component-add operations use this method to add components.
Components that require notification of all child additions
should override this method (making sure to call the superclass'
implementation).
c - the child component to addn - the index at which to add the child component, or -1 to add the
component at the end
IllegalChildException - if the child is not allowed to be added
to this component, because it is either not valid for the
component's state or is of an invalid typepublic void addPropertyChangeListener(java.beans.PropertyChangeListener l)
l - the listener to addpublic void dispose()
Component is removed
from a registered hierarchy. Implementations should always invoke
super.dispose().
Modifications to the component hierarchy are not allowed within this
method.
protected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
PropertyChangeListeners
and to the ApplicationInstance's update management system.
propertyName - the name of the changed propertyoldValue - the previous value of the propertynewValue - the present value of the propertypublic ApplicationInstance getApplicationInstance()
ApplicationInstance to which this
Component is registered, or null if it is not currently
registered.
public Color getBackground()
Component.
This property may not be relevant to certain components, though
even in such cases may be useful for setting a default for
children.
public final Component getComponent(int n)
nth immediate child component.
n - the index of the Component to retrieve
Component at index n
java.lang.IndexOutOfBoundsException - when the index is invalidpublic final Component getComponent(java.lang.String id)
getId()
and setId() methods. This method is in no way
related to renderIds.
id - the user-defined id of the component to be retrieved
public final int getComponentCount()
Components.
Componentspublic final Component[] getComponents()
Components.
Componentsprotected EventListenerList getEventListenerList()
EventListenerList.
The listener list is lazily created; invoking this method will
create the EventListenerList if required.
public final int getFocusTraversalIndex()
public Font getFont()
public Color getForeground()
Component.
This property may not be relevant to certain components, though
even in such cases may be useful for setting a default for
children.
public java.lang.String getId()
Component.
Note that the user defined identifier has no relation to the
renderId.
public final java.lang.Object getIndexedProperty(java.lang.String propertyName,
int propertyIndex)
Component, however there are exceptions.
The more specific getXXX() methods to retrieve
property values from a Component whenever
possible.
See the class-level documentation for a more detailed
explanation of the use of this method.
propertyName - the property namepropertyIndex - the property index
public LayoutData getLayoutData()
LayoutData object used to describe how this
Component should be laid out within its parent container.
LayoutDatapublic LayoutDirection getLayoutDirection()
LayoutDirection is
specifically set on this Component.
ComponentgetRenderLayoutDirection()public java.util.Locale getLocale()
Locale is
specifically set on this Component.
ComponentgetRenderLocale()public final Component getParent()
public final java.lang.Object getProperty(java.lang.String propertyName)
Component, however there are exceptions.
The more specific getXXX() methods to retrieve
property values from a Component whenever
possible.
See the class-level documentation for a more detailed
explanation of the use of this method.
propertyName - the property name
public java.lang.String getRenderId()
ApplicationInstance to which this component is
registered. This method returns null in the event that the
component is not registered to an ApplicationInstance.
getRenderId in interface RenderIdSupportApplicationInstance-wide unique id of this
componentRenderIdSupport.getRenderId()
public final java.lang.Object getRenderIndexedProperty(java.lang.String propertyName,
int propertyIndex)
Component, and returning
it in that case. If the property state is not set locally, the
shared Style assigned to this component will be queried
for the property value. If the property state is not set in the
shared Style, the StyleSheet of the
ApplicationInstance to which this Component
is registered will be queried for the property value.
In the event the property is not set in any of these resources,
null is returned.
The application container will invoke this method rather than individual property getter methods to determine the state of properties when rendering.
propertyName - the name of the property
public final java.lang.Object getRenderIndexedProperty(java.lang.String propertyName,
int propertyIndex,
java.lang.Object defaultValue)
Component, and returning
it in that case. If the property state is not set locally, the
shared Style assigned to this component will be queried
for the property value. If the property state is not set in the
shared Style, the StyleSheet of the
ApplicationInstance to which this Component
is registered will be queried for the property value.
In the event the property is not set in any of these resources,
defaultValue is returned.
propertyName - the name of the propertydefaultValue - the value to be returned if the property is not set
public final LayoutDirection getRenderLayoutDirection()
LayoutDirection of the
Component.
public final java.util.Locale getRenderLocale()
Locale of the Component.
If this Component does not itself specify a locale, its
ancestors will be queried recursively until a Component
providing a Locale is found. If no ancestors have
Locales set, the ApplicationInstance's
locale will be returned. In the event that no locale information is
available from the ancestral hierarchy of Components and
no ApplicationInstance is registered, null is returned.
public final java.lang.Object getRenderProperty(java.lang.String propertyName)
Component, and returning
it in that case. If the property state is not set locally, the
shared Style assigned to this component will be queried
for the property value. If the property state is not set in the
shared Style, the StyleSheet of the
ApplicationInstance to which this Component
is registered will be queried for the property value.
In the event the property is not set in any of these resources,
null is returned.
The application container will invoke this method rather than individual property getter methods to determine the state of properties when rendering.
propertyName - the name of the property
public final java.lang.Object getRenderProperty(java.lang.String propertyName,
java.lang.Object defaultValue)
Component, and returning
it in that case. If the property state is not set locally, the
shared Style assigned to this component will be queried
for the property value. If the property state is not set in the
shared Style, the StyleSheet of the
ApplicationInstance to which this Component
is registered will be queried for the property value.
In the event the property is not set in any of these resources,
defaultValue is returned.
propertyName - the name of the propertydefaultValue - the value to be returned if the property is not set
public final Style getStyle()
Style object assigned to this
Component.
As its name implies, the shared Style
may be shared amongst multiple Components.
Style properties will be rendered from the specified Style
when they are not specified locally in the Component
itself.
Stylepublic final java.lang.String getStyleName()
Style in the
ApplicationInstance'sStyleSheet from
which the renderer will retrieve properties. The renderer will only query
the StyleSheet when properties are not specified directly
by the Component or by the Component's
shared Style.
public final Component getVisibleComponent(int n)
nth immediate visible
child Component.
n - the index of the Component to retrieve
Component at index n
java.lang.IndexOutOfBoundsException - when the index is invalidpublic final int getVisibleComponentCount()
Components.
Componentspublic final Component[] getVisibleComponents()
Components.
Componentsprotected boolean hasEventListenerList()
EventListenerList exists.
If no listener list exists, it can be assured that there are thus no
listeners registered to it. This method should be invoked by event
firing code prior to invoking getListenerList() to avoid
unnecessary creation of an EventListenerList in response
to their query.
EventListenerList existspublic final int indexOf(Component c)
Component within the
children of this Component. If the given
Component is not a child, -1 is returned.
c - the Component to analyze
Component amongst the
children of this Componentpublic void init()
Component is added
to a registered hierarchy. Implementations should always invoke
super.init().
Modifications to the component hierarchy are not allowed within this
method.
public final boolean isAncestorOf(Component c)
Component is or is an ancestor of
the specified Component.
c - the Component to test for ancestry
Component is an ancestor of the
specified Componentpublic final boolean isEnabled()
Component.
DisabledComponents are not eligible to receive user input.
The application container may render disabled components with an altered
appearance.
verifyInput(java.lang.String, java.lang.Object)public boolean isFocusTraversalParticipant()
Component participates in (tab) focus
traversal.
Component participates in focus
traversalpublic final boolean isRegistered()
Component is registered to an
ApplicationInstance.
Component is registered to an
ApplicationInstancepublic final boolean isRenderEnabled()
Component should be rendered with
an enabled state.
DisabledComponents are not eligible to receive user input.
The application container may render disabled components with an altered
appearance.
public final boolean isRenderVisible()
Component and all of its parents are
visible.
Component is recursively visiblepublic boolean isValidChild(Component child)
Component is valid to be added as a
child to this Component. Default implementation always
returns true, may be overridden to provide specific behavior.
child - the Component to evaluate as a child
Component is a valid childpublic boolean isValidParent(Component parent)
Component is valid to be added as a
child of the given parent Component. Default
implementation always returns true, may be overridden to provide specific
behavior.
parent - the Component to evaluate as a parent
Component is a valid parentpublic final boolean isVisible()
Component.
Non-visible components will not be seen by the rendering application
container, and will not be rendered in any fashion on the user
interface. Rendering Application Containers should ensure that no
information about the state of an invisible component is provided to
the user interface for security purposes.
Component
public void processInput(java.lang.String inputName,
java.lang.Object inputValue)
Component
received from the UpdateManager.
Derivative implementations should take care to invoke
super.processInput().
inputName - the name of the inputinputValue - the value of the inputUpdateManagerpublic void remove(Component c)
Component from this
Component.
All Component remove operations use this method to
remove Components. Components that require
notification of all child removals should
override this method (while ensuring to call the superclass'
implementation).
c - the child Component to removepublic void remove(int n)
Component at the nth index.
n - the index of the child Component to remove
java.lang.IndexOutOfBoundsException - if the index is not validpublic void removeAll()
Components.
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Component.
l - the listener to be removedpublic void setBackground(Color newValue)
Component.
newValue - the new background Colorpublic void setEnabled(boolean newValue)
Component.
newValue - the new stateisEnabled()public void setFocusTraversalIndex(int newValue)
newValue - the new focus traversal indexgetFocusTraversalIndex()public void setFocusTraversalParticipant(boolean newValue)
newValue - true if the component participates in the focus
traversal orderpublic void setFont(Font newValue)
Component.
newValue - the new Fontpublic void setForeground(Color newValue)
Component.
newValue - the new foreground Colorpublic void setId(java.lang.String id)
Component.
id - the new identifier
public void setIndexedProperty(java.lang.String propertyName,
int propertyIndex,
java.lang.Object newValue)
Component.
The value will be stored in this Component's local style.
propertyName - the name of the propertypropertyIndex - the index of the propertynewValue - the value of the propertygetIndexedProperty(java.lang.String, int)public void setLayoutData(LayoutData newValue)
LayoutData of this Component.
A LayoutData implementation describes how this
Component is laid out within/interacts with its
containing parent Component.
newValue - the new LayoutDataLayoutDatapublic void setLayoutDirection(LayoutDirection newValue)
LayoutDirection of this Component,
describing whether content is rendered left-to-right or right-to-left.
newValue - the new LayoutDirection.public void setLocale(java.util.Locale newValue)
Component.
newValue - the new localegetLocale()
public void setProperty(java.lang.String propertyName,
java.lang.Object newValue)
Component.
The value will be stored in this Component's local style.
propertyName - the name of the propertynewValue - the value of the propertygetProperty(java.lang.String)public void setRenderId(java.lang.String renderId)
Component.
The identifier may be changed without notification if another
component is already using it.
Identifiers are limited to ASCII alphanumeric values.
The first character must be an upper- or lower-case ASCII letter.
Underscores and other punctuation characters are not permitted.
Use of "TitleCase" or "camelCase" is recommended.
renderId - the new identifierpublic void setStyle(Style newValue)
Component.
Setting the shared style will have no impact on the local stylistic
properties of the Component.
newValue - the new shared stylegetStyle()public void setStyleName(java.lang.String newValue)
ApplicationInstance-defined StyleSheet.
Setting the style name will have no impact on the local stylistic
properties of the Component.
newValue - the new style namegetStyleName()public void setVisible(boolean newValue)
Component.
newValue - the new visibility stateisVisible()public void validate()
super.validate()
out of convention.
public boolean verifyInput(java.lang.String inputName,
java.lang.Object inputValue)
ClientUpdateManager on each component in the
hierarchy whose processInput() method will layer be invoked
in the current transaction. This method should return true if the
component will be capable of processing the given input in its current
state or false otherwise. This method should not do any of the actual
processing work if overridden (any actual processing should be done in
the processInput() implementation).
The default implementation verifies that the component is visible,
enabled, and not "obscured" by the presence of any modal component.
If overriding this method, your implementation should invoke
super.verifyInput().
inputName - the name of the inputinputValue - the value of the input
public final int visibleIndexOf(Component c)
Component within the
visible children of this Component. If the
given Component is not a child, -1 is
returned.
c - the Component to analyze
Component amongst the
visible children of this Component
|
NextApp Echo2 v2.1.0.rc2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||