What is a Java Bean.What is a Java Bean.
Components and classes with respect to Java Bean.Components and classes with respect to Java Bean.
Java.Beans(Package).Java.Beans(Package).
The Component and its type in Java Beans.The Component and its type in Java Beans.
Useful Terms while Using Java Beans.Useful Terms while Using Java Beans.
Software ComponentsSoftware Components
Visually Manipulated, Builder ToolsVisually Manipulated, Builder Tools
SupportSupport
“It’s a Component Architecture of Java which allow
you to define the Component ”
Java Bean is nothing but the Java Class.
Example:-
Swing are all the Java Bean component
Component (Button,TextField,Label)
Java Bean classes follow certain Rule or Condition.
All java Bean classes must Implement the
Serializable Interface.
Component may be used by some apllication
builder.
A bean has a no argument constructor.
Serializing
CLASS
Class Object
Component
Object
Java Bean API makes it possible to write the
component s/w in a java programming language.
This package will be used depending upon the need
of the Application (based on funcion of bean classes).
Now when its only the use of the property or the
Getter & Setter Method at that time you might not
even make a use of this package.
The component is nothing but the group of classes.
Example:- Jbutton(it’s a component not a class).
In order to a swing Button there are whole lot of
class are involved to build this Jbutton.
Component is a single Functionality provided by
many different classes
Component is a group of classses that interact with
eachother to fulfill the single purpose.
Application developer uses different beans in his
application using the Java Beans.
You can build two types of Components.
Component
GUI based
Non GUI based
Extends
Component
Properties
Event
Persistence
Introspection
Customization
Discrete,Discrete, named attributesnamed attributes thatthat determinedetermine thethe
appearanceappearance ,,behaviorbehavior andand statestate of aof a component.component.
Accessible programmatically throughAccessible programmatically through accessoraccessor
methods.methods.
Accessible visually throughAccessible visually through property sheets.property sheets.
Simple PropertiesSimple Properties
Boolean PropertiesBoolean Properties
Indexed PropertiesProperties
1 Simple Properties:-1 Simple Properties:-
Represent a single value.Represent a single value.
The accessor methods should follow standard namingThe accessor methods should follow standard naming
conventions.conventions.
public <PropertyType> get<PropertyName>();
public void set<PropertyName>(<PropertyType> value);
Example:
public String getHostName();
public void setHostName( String hostName );
22 BooleanPropertiesBooleanProperties:-:-
They are simple propertiesThey are simple properties
The getter methods follow an optional design patternThe getter methods follow an optional design pattern
public boolean is<PropertyName>();
Example:
public boolean isConnected();
33 Indexed PropertiesProperties:-:-
Represent an array of valuesRepresent an array of values
public <PropertyElement> get<PropertyName>(int index);
public void set<PropertyName>(int index,<PropertyElement> value);
public <PropertyElement>[] get<PropertyName>();
public void set<PropertyName>(<PropertyElement>[] values);
Example:
public Color setPalette(int index);
public void setPalette(int index,Color value);
public Color[] getPalette();
public void setPalette(Color[] values);
Bound:-
a bound property notifies other objects when its value
changes
generates a PropertyChange event with property name,
old value and new value
Constrained:-
an object with constrained properties allows other
objects to veto a constrained property value change
Constrained property listeners can veto a change by
throwing a PropertyVetoException
Two types of objects are involved:Two types of objects are involved:
““Source” objects.Source” objects.
““Listener” objects.Listener” objects.
Message sent from one object to another.Message sent from one object to another.
SenderSender firesfires event, recipient (listener)event, recipient (listener) handleshandles thethe
eventevent
There may be many listeners.There may be many listeners.
Event
source
Event
listener
Fire event
Event
Object
Register listener
Sender fires event, recipient (listener) handles
the event
Persistance
Your Bean should be able to store its state, which
means there should be the serializable interface.
Upon the Bean a builder tool should be able to make a
reflaction and be able to create an object of your
component.
[Ex. Drag and drop a component in to a design area and
the builder tool should be able to create the instance of
that component and be able to display the property of
that bean via reflaction.]
Customization
Using the Bean customization, you can specify what
methods or the properties that you want to expose at
rhe run time environment, so such property will be
displayed in the propertysheet.
Introspection
Is nothing but a reflection using which the builder tool
can display all the events and the properties of the
component.
Reflection API
It helps us to find out what are the contents of the class,
so you can findout what are the methods, constructors
and variables in the class and you can find out the
details in return.
Due to the process of the reflection builder tool can be
able to display what are the property of the Component
in the property sheet and also provides the details
regarding the Events and methods.
Buttons
Text Fields
List Boxes
Scroll Bars
Dialogs
BeanBoxToolBoxToolBox BeanBox
Property Sheet
BDK - SunBDK - Sun
NetBeans – www.netbeans.orgNetBeans – www.netbeans.org
Jbuilder - InpriseJbuilder - Inprise
Super Mojo - Penumbra SoftwareSuper Mojo - Penumbra Software
Visual Age for Java - IBMVisual Age for Java - IBM
Visual Cafe - Symantec CorporationVisual Cafe - Symantec Corporation
JDeveloper Suite - OracleJDeveloper Suite - Oracle
Java beans

Java beans

  • 2.
    What is aJava Bean.What is a Java Bean. Components and classes with respect to Java Bean.Components and classes with respect to Java Bean. Java.Beans(Package).Java.Beans(Package). The Component and its type in Java Beans.The Component and its type in Java Beans. Useful Terms while Using Java Beans.Useful Terms while Using Java Beans. Software ComponentsSoftware Components Visually Manipulated, Builder ToolsVisually Manipulated, Builder Tools SupportSupport
  • 3.
    “It’s a ComponentArchitecture of Java which allow you to define the Component ” Java Bean is nothing but the Java Class. Example:- Swing are all the Java Bean component Component (Button,TextField,Label)
  • 4.
    Java Bean classesfollow certain Rule or Condition. All java Bean classes must Implement the Serializable Interface. Component may be used by some apllication builder. A bean has a no argument constructor. Serializing CLASS Class Object Component Object
  • 5.
    Java Bean APImakes it possible to write the component s/w in a java programming language. This package will be used depending upon the need of the Application (based on funcion of bean classes). Now when its only the use of the property or the Getter & Setter Method at that time you might not even make a use of this package.
  • 6.
    The component isnothing but the group of classes. Example:- Jbutton(it’s a component not a class). In order to a swing Button there are whole lot of class are involved to build this Jbutton. Component is a single Functionality provided by many different classes Component is a group of classses that interact with eachother to fulfill the single purpose.
  • 7.
    Application developer usesdifferent beans in his application using the Java Beans. You can build two types of Components. Component GUI based Non GUI based Extends Component
  • 8.
  • 9.
    Discrete,Discrete, named attributesnamedattributes thatthat determinedetermine thethe appearanceappearance ,,behaviorbehavior andand statestate of aof a component.component. Accessible programmatically throughAccessible programmatically through accessoraccessor methods.methods. Accessible visually throughAccessible visually through property sheets.property sheets.
  • 10.
    Simple PropertiesSimple Properties BooleanPropertiesBoolean Properties Indexed PropertiesProperties
  • 11.
    1 Simple Properties:-1Simple Properties:- Represent a single value.Represent a single value. The accessor methods should follow standard namingThe accessor methods should follow standard naming conventions.conventions. public <PropertyType> get<PropertyName>(); public void set<PropertyName>(<PropertyType> value); Example: public String getHostName(); public void setHostName( String hostName );
  • 12.
    22 BooleanPropertiesBooleanProperties:-:- They aresimple propertiesThey are simple properties The getter methods follow an optional design patternThe getter methods follow an optional design pattern public boolean is<PropertyName>(); Example: public boolean isConnected();
  • 13.
    33 Indexed PropertiesProperties:-:- Representan array of valuesRepresent an array of values public <PropertyElement> get<PropertyName>(int index); public void set<PropertyName>(int index,<PropertyElement> value); public <PropertyElement>[] get<PropertyName>(); public void set<PropertyName>(<PropertyElement>[] values); Example: public Color setPalette(int index); public void setPalette(int index,Color value); public Color[] getPalette(); public void setPalette(Color[] values);
  • 14.
    Bound:- a bound propertynotifies other objects when its value changes generates a PropertyChange event with property name, old value and new value Constrained:- an object with constrained properties allows other objects to veto a constrained property value change Constrained property listeners can veto a change by throwing a PropertyVetoException
  • 15.
    Two types ofobjects are involved:Two types of objects are involved: ““Source” objects.Source” objects. ““Listener” objects.Listener” objects. Message sent from one object to another.Message sent from one object to another. SenderSender firesfires event, recipient (listener)event, recipient (listener) handleshandles thethe eventevent There may be many listeners.There may be many listeners.
  • 16.
    Event source Event listener Fire event Event Object Register listener Senderfires event, recipient (listener) handles the event
  • 17.
    Persistance Your Bean shouldbe able to store its state, which means there should be the serializable interface. Upon the Bean a builder tool should be able to make a reflaction and be able to create an object of your component. [Ex. Drag and drop a component in to a design area and the builder tool should be able to create the instance of that component and be able to display the property of that bean via reflaction.]
  • 18.
    Customization Using the Beancustomization, you can specify what methods or the properties that you want to expose at rhe run time environment, so such property will be displayed in the propertysheet. Introspection Is nothing but a reflection using which the builder tool can display all the events and the properties of the component.
  • 19.
    Reflection API It helpsus to find out what are the contents of the class, so you can findout what are the methods, constructors and variables in the class and you can find out the details in return. Due to the process of the reflection builder tool can be able to display what are the property of the Component in the property sheet and also provides the details regarding the Events and methods.
  • 20.
  • 21.
  • 22.
    BDK - SunBDK- Sun NetBeans – www.netbeans.orgNetBeans – www.netbeans.org Jbuilder - InpriseJbuilder - Inprise Super Mojo - Penumbra SoftwareSuper Mojo - Penumbra Software Visual Age for Java - IBMVisual Age for Java - IBM Visual Cafe - Symantec CorporationVisual Cafe - Symantec Corporation JDeveloper Suite - OracleJDeveloper Suite - Oracle