aButton
by itself will cause MyApp
and everything it refers to to be serialized as well. The problem is that the listener is serializable by coincidence, not by design. To separate the decisions about MyApp
and the ActionListener
being serializable one can use a nested class, as in the following example: import ae.java.awt.*; import ae.java.awt.event.*; import java.io.Serializable; class MyApp java.io.Serializable { BigObjectThatShouldNotBeSerializedWithAButton bigOne; Button aButton = new Button(); static class MyActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Hello There"); } } MyApp() { aButton.addActionListener(new MyActionListener()); } }
Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
For details on the focus subsystem, see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information. @author Arthur van Hoff @author Sami Shaio
Base class for all Ext components. All subclasses of Component can automatically participate in the standard Ext component lifecycle of creation, rendering and destruction. They also have automatic support for basic hide/show and enable/disable behavior. All visual widgets that require rendering into a layout should subclass Component (or BoxComponent if managed box model handling is required).
Every component has a specific xtype. This is the list of all valid xtypes:
xtype Class ------------- ------------------ box BoxComponent button Button colorpalette ColorPalette component Component container Container cycle CycleButton dataview DataView datepicker DatePicker editor Editor editorgrid EditorGridPanel grid GridPanel paging PagingToolbar panel Panel progress ProgressBar splitbutton SplitButton tabpanel TabPanel treepanel TreePanel viewport ViewPort window Window Toolbar components --------------------------------------- toolbar Toolbar Form components --------------------------------------- checkbox Checkbox combo ComboBox datefield DateField field Field fieldset FieldSet form FormPanel hidden Hidden htmleditor HtmlEditor numberfield NumberField radio Radio textarea TextArea textfield TextField timefield TimeField@author Sanjiv Jivan
Components are laid out in the user interface hierarchically. The layout is managed by layout components, or more generally by components that implement the {@link ComponentContainer} interface. Such a container is theparent of the contained components.
The {@link #getParent()} method allows retrieving the parent component of acomponent. While there is a {@link #setParent(Component) setParent()}, you rarely need it as you normally add components with the {@link ComponentContainer#addComponent(Component) addComponent()} method ofthe layout or other {@code ComponentContainer}, which automatically sets the parent.
A component becomes attached to an application (and the {@link #attach()} is called) when it or one of its parents is attached to themain window of the application through its containment hierarchy.
@author IT Mill Ltd. @version 6.7.1 @since 3.0Component
representa la clase base para cualquier componente, real o virtual, permitido en una simulaci�n. Un componente es una entidad lo suficientemente abstracta, como para que a partir de ella puedan construirse diferentes objetos (robots reales o virtuales, sensores, redes neuronales, etc).Observable
, lo que permite que cualquier componente pueda ser "observado" y actuar ante cambios en el mismo (por ejemplo, la interfaz gr�fica de usuario puede redibujarse ante un cambio en la posici�n de un robot).ComponentInterface
, que es la forma en que el mundo exterior puede acceder a las caracter�sticas de un componente.aButton
by itself will cause MyApp
and everything it refers to to be serialized as well. The problem is that the listener is serializable by coincidence, not by design. To separate the decisions about MyApp
and the ActionListener
being serializable one can use a nested class, as in the following example: import java.awt.*; import java.awt.event.*; import java.io.Serializable; class MyApp java.io.Serializable { BigObjectThatShouldNotBeSerializedWithAButton bigOne; Button aButton = new Button(); static class MyActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Hello There"); } } MyApp() { aButton.addActionListener(new MyActionListener()); } }
Note: For more information on the paint mechanisms utilitized by AWT and Swing, including information on how to write the most efficient painting code, see Painting in AWT and Swing.
For details on the focus subsystem, see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information. @version 1.451, 07/29/09 @author Arthur van Hoff @author Sami Shaio
Component is immutable. All update functions such as the ones started with "with" are functional-update, which means a new Component object is created to reflect the change, while the state of the old object remains the same.
Component is the core of Yan in the sense that most customizations of instance creation strategy can be done by combining existing Component objects.
This is called a "combinator" approach where complex components can be constructed by combining simpler components who may be combinations of yet simpler components.
Common combinators are included in this class to make the syntax simpler for combining components. For example:
comp1.withArguments(args) rather than Components.withArguments(comp1, args)
Implementing classes should consider implementing {@link JRCloneable} as wellin order to have component clones created when components elements are cloned. @author Lucian Chirita (lucianc@users.sourceforge.net) @version $Id: Component.java 3033 2009-08-27 11:46:22Z teodord $ @see JRComponentElement
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 Component
s. Certain Component
s 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 Component
s 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 Component
s will provide the capability to register EventListener
s 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()
.
Components
by a Composable
. The contract surrounding the Component
is that it is used, but not a user. When a class implements this interface, it is stating that other entities may use that class.
A Component
is the basic building block of the Avalon Framework. When a class implements this interface, it allows itself to be managed by a ComponentManager
and used by an outside element called a Composable
. The Composable
must know what type of Component
it is accessing, so it will re-cast the Component
into the type it needs.
In order for a Component
to be useful you must either extend this interface, or implement this interface in conjunction with one that actually has methods. The new interface is the contract with the Composable
that this is a particular type of component, and as such it can perform those functions on that type of component.
For example, we want a component that performs a logging function so we extend the Component
to be a LoggingComponent
.
interface LoggingComponent extends Component { log(String message); }
Now all Composable
s that want to use this type of component, will re-cast the Component
into a LoggingComponent
and the Composable
will be able to use the log
method.
Deprecated: Deprecated without replacement. Should only be used while migrating away from a system based on Composable/ComponentManager. A generic java.lang.Object
can be used as a replacement.
Component
interface represents a single component managed by the Service Component Runtime. Management agents may access the Component instances through the {@link ScrService}.
Use at your own risk as everything in this API is subject to change without notice from release to release.
String[] onProvideCompletionsFromMyField(String input) { return . . .; }
The path from the Page at the root of the component hierarchy to a given Component is simply the concatenation with colon separators of each id along the way. For example, the path "a:b:c" would refer to the component named "c" inside the MarkupContainer named "b" inside the container named "a". The path to a component can be retrieved by calling {@link #getPath()}. To get a Component path relative to the page that contains it, you can call {@link #getPageRelativePath()}.
{@link #onInitialize()} is called on the component as soon as the component is part of a page'scomponent tree. At this state the component is able to access its markup.
init
, destroy
) and an Environment. _getComponent()
which returns the implementation.
@author "Toomas Römer" Component
component processes a {@link MuleEvent} by invoking thecomponent instance that has been configured, optionally returning a result. Implementations of Component
can use different types of component implementation, implement component instance pooling or implement bindings which allow for service composition.
<?xml version="1.0"?> <component xmlns="http://www.restlet.org/schemas/2.0/Component"> <client protocol="CLAP" /> <client protocol="FILE" /> <client protocols="HTTP HTTPS" /> <server protocols="HTTP HTTPS" /> <defaultHost> <attach uriPattern="/abcd/{xyz}" targetClass="org.restlet.test.MyApplication" /> <attach uriPattern="/efgh/{xyz}" targetDescriptor="clap://class/org/restlet/test/MyApplication.wadl" /> </defaultHost> </component>
There are two kind of life-cycles: one is page creations and the other is asynchronous updates.
The page creation occurs when a page is about to render at the first time. The detailed phases can be found in the devloper's guide.
The asynchronous update occurs when users does something on the browser, such as changing the content of input, clicking buttons and so on. Such behaviors are packed as requests, queue in the browser, and then send to the server at the proper time. The detailed phases can be found in the developer's guide.
To simplify the development of components and applications, invocations of methods of components and event listener are all serialized. In other words, application and component developers need not worry synchronization and other thread issues (unless you are developing background thread to handle long operations).
It also implies a limitation that you cannot access components belonging to other desktops when processing an event. @author tomyeh
TODO Add a contains() method or some equivalent that will support mouse interaction with non-rectangular components.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|