1 / 17

Components

Components . Components are specialized self contained Software entities that can be replicated, Customized and inserted into applications. Components come in variety of different Implementation and support a wide range of Functions.

verne
Télécharger la présentation

Components

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Components • Components are specialized self contained Software entities that can be replicated, Customized and inserted into applications. • Components come in variety of different Implementation and support a wide range of Functions. • Numerous individual components can be created and tailored for different applications. • Components are contained within containers. • Interaction with components occurs through event handling and method invocation.

  2. Java Beans • Java Beans are software components that are designed for maximum reuse.They are often visible GUI components,but can also be invisible algorithmic components.

  3. Advantages of Java Beans • Java Beans is based on the policy of “write once and run anywhere” which means Bean component created once can be executed anywhere in any platform. • Java Beans has an builder tool called “Bean box” which is used to test bean component its properties,events and methods. • The configured settings of any bean component can be saved into persistence storage and reused when ever required. • A Bean may receive event from other objects and can generate events that are sent to other objects

  4. Bean development Kit • Bean development kit is used to create configure and connect a set of Beans. There is also a set of sample Beans with their source code. • In order to use BDK the tool should be installed and can be downloaded from the site java.sun.com • To start BDK execute run.bat(batch file) available in the directory c:\bdk1.1\beanbox which opens 4 windows 1. Toolbox : Its used to display Bean component

  5. 2. Bean Box : It’s the layout to create, design and configure a bean 3. Properties : Its used to display and configure properties associated with Bean. 4. Method Tracer : Any method invoked on Bean is Traced by the method tracer.

  6. Introspection • Introspection is the process of analyzing a bean to determine its capabilities. • Its essential feature of the Java Beans API because it allows to present the information about the component to the software designer. • In short it’s the exposure of methods, properties and events by an application builder.

  7. Jar Utilities • Jar refers to Java Archive files. • Java Archives are compressed form of all the class files and required resources for a component. • Jar technology makes the usage of resources much faster and easier.

  8. Steps to Create a Java Archieve • Create the class file which is to be converted into jar • Write a manifest file which describes which among the resources is going to be an java file • Issue jar command and convert the class file into jar.

  9. Jar options • c A new archive is to created. • C Change directories during command execution. • f The first element in the file list is the name of the archive file to be created. • m The second element in the file list is the name of the external manifest file. • M Manifest file not created • t The archive content should be tabulated • u Update existing JAR file • x The jar file is to be extracted.

  10. Types of Properties • Simple Properties Properties which is set by assigning a single value refers to simple property. eg: public type getN(); public void setN(); • Boolean Properties Properties which has true and false value refers to Boolean Property.’ eg: public void setN() public boolean getN()

  11. Indexed property An indexed property is one which has multiple values. For eg: public type getN(int index); public type[] getN(); public void setN(int index,type value); public void setN(type values[]); • Bound Property A bean that has bound property generates an event when the property is changed.The event is of type PropertyChangeEvent and sent to the objects that are previously registered an interest in receiving notifications.

  12. Constrained Properties • A Bean that has a constrained property generates an event when an attempt is made to change its value.The event is of PropertyChangeEvent and send to only those objects which are registered.

  13. Classes in Java Beans package • PropertyChangeEvent The PropertyChangeEvent class in the above package defines the event notification that are multicast by a bean when one of its properties is changed PropertyChangeEvent(Object src,String pname,Object Oldvalue,Object NewValue) src is the bean whose property is changed pname is the name of property which has changed OldValue is the initial value of the property NewValue is the updated value of the property

  14. Methods of PropertyChange Event class • Object getNewValue() • Object getOldValue() • String PropertyName() • PropertyChangeListener is interface which receives PropertyChangeEvent. • Method void propertyChange(PropertyChangeEvent pce)

  15. PropertyChangeSupport • PropertyChangeSupport is used to perform much of the work associated with bound properties. • synchronized void addPropertyChange(PropertyChangeListener pcl) • synchronized void removePropertyChange(PropertyChangeListener pcl) • Void firePropertyChange(String pname,Object oldValue,Object newValue)

  16. VetoableChangeListener interface void vetoableChange(PropertyChangeEvent pce)throws PropertyVetoException • PropertyVetoException class PropertyVetoException(String message, PropertyChangeEvent pce) • VetoableChangeSupport class VetoableChangeSupport(Object src) synchornized void addVetoableChangeListener( VetoableChangeListener pcl) synchornized void addVetoableChangeListener( VetoableChangeListener pcl) • Void fireVetoableChangeListener(String pname,Object oldValue,Object newValue)throws PropertyVetoException

More Related