98-09-281 JavaBeans introduction Klaus-Peter Heidrich for the University of Karlstad Inst. for Information Technology Dept. of Computer Science.

Slides:



Advertisements
Similar presentations
3 Copyright © 2005, Oracle. All rights reserved. Basic Java Syntax and Coding Conventions.
Advertisements

Copyright © 2001 Qusay H. Mahmoud JavaBeans An introduction to component-based development in general Introduction to JavaBeans – Java components – client-side.
CSE 1302 Lecture 8 Inheritance Richard Gesick Figures from Deitel, “Visual C#”, Pearson.
Mari Göransson - KaU - Datavetenskap - DAVD11 1 Java Beans - Events and Properties -
Java Beans & Serialization CS-328 Dick Steflik. Java Beans Java based component technology –originally developed to provide java with a component technology.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Object-Oriented Enterprise Application Development Lecture 8 Advanced JavaBeans.
By Dr. Jiang B. Liu 12. The Java Beans. Java Beans n JavaBeans is a portable, platform-independent software component model written in Java. It enables.
JavaBeans A component architecture. What is JavaBeans? NC World (New Computing) Dictionary: JavaBeans n. 1. JavaSoft technology. 2. Component object model.
JAVA BEANS By Madhuri Kakumanu. What is a Java Bean? “ A Java Bean is a reusable software component that can be visually manipulated in builder tools.”
Software Engineering Module 1 -Components Teaching unit 3 – Advanced development Ernesto Damiani Free University of Bozen - Bolzano Lesson 2 – Components.
Lecture 9 Concepts of Programming Languages
ASP.NET Programming with C# and SQL Server First Edition
Abstract Data Types and Encapsulation Concepts
M.Sc. Course, Dept. of Informatics and Telecommunications, University of Athens S.Hadjiefthymiades “Web Application Servers” Basics on WAS WAS are necessary.
ACM/JETT Workshop - August 4-5, 2005 UML Modeling using MagicDraw UML for Java Programmers.
Introducing JavaBeans Lesson 2A / Slide 1 of 30 JDBC and JavaBeans Pre-assessment Questions 1.Which of the given symbols is used as a placeholder for PreparedStatement.
Introducing JavaBeans Identify the features of a JavaBean Create and add a bean to an application Manipulate bean properties using accessor and mutator.
Java Beans Component Technology Integrated, Visual Development Environments Reusable Platform-Independent Modular.
Component-Based Software Engineering Introduction to Java Beans Paul Krause and Sotiris Moschoyiannis.
Inheritance using Java
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
Java Beans.
Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Lecture 8 Inheritance Richard Gesick. 2 OBJECTIVES How inheritance promotes software reusability. The concepts of base classes and derived classes. To.
Java Class Syntax CSIS 3701: Advanced Object Oriented Programming.
Introduction to Java Beans by Anders Børjesson. Introduction to JavaBeans2 JavaBeans components JavaBeans are the components in the Java environment Many.
JavaBeans Components. To understand JavaBeans…  Proficient experience with the Java language required  Knowledge of classes and interfaces  Object-Oriented.
TM Introduction to JavaBeans™ Dimitrios Psarros Questra Consulting (716) x225.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
CG0165: Advanced Applications Development in Java Michael Brockway Sajjad Shami Week 5: JavaBeans Northumbria University School of Computing, Engineering.
Java Programming: Advanced Topics 1 JavaBeans Chapter 8.
Introduction to Component-Based Engineering Howard Abrams
SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.
Components Components are specialized self contained Software entities that can be replicated, Customized and inserted into applications. Components come.
Java Bean Definition “A Java Bean is a reusable software component that can be manipulated visually in a builder tool.”
Introduction to Java Beans CIS 421 Web-based Java Programming.
Introduction to Java 120 February 2004Sifei HE © 2004 Introduction to Java for CS381, EE4.Web By Sifei HE Department of Computing.
First Bean Compose SimpleBean Demo Simple Bean Discuss Manifest and Jar Add Properties to SimpleBean.
First Bean Compose SimpleBean Demo Simple Bean Discuss Manifest and Jar Add Properties to SimpleBean.
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Advanced Java Session 4 New York University School of Continuing and Professional Studies.
Introduction to Java Beans by Anders Børjesson. Introduction to JavaBeans2 JavaBeans components JavaBeans are the components in the Java environment –COM.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
JavaBean Component Java bean is a reusable software component that can be manipulated visually in a builder tool Graphic bean and Non-graphic bean Javabean.
Introduction to Java Beans From Anders Børjesson.
Introduction to Software Components: the JavaBeans specs Babak Esfandiari.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 32 JavaBeans and Bean.
Lorenz: Visitor Beans: An Aspect-Oriented Pattern Aspect-oriented pattern: describes a solution to a tangling problem in a particular context.
Java Beans THETOPPERSWAY.COM. Contents What is a Java Bean? Advantages Properties Bean Developers Kit (BDK) What makes Bean possible? Support for Java.
Java Beans - Basics CIS 421 Web-based Java Programming.
Javabeans for dummies.
Abstract Data Types and Encapsulation Concepts
Objects as a programming concept
JavaBeans* ICS 123 Richard N. Taylor & Eric M. Dashofy UC Irvine
Java Beans Sagun Dhakhwa.
JavaBeans and JSP CS-422.
Lecture 9 Concepts of Programming Languages
Persistence & Bean Properties
Lecture 22 Inheritance Richard Gesick.
Reusability 11/29/2018© 2006 ITT Educational Services Inc.
Pre-assessment Questions
Component-Based Software Engineering
Java Programming: Advanced Topics
Lecture 9 Concepts of Programming Languages
Presentation transcript:

JavaBeans introduction Klaus-Peter Heidrich for the University of Karlstad Inst. for Information Technology Dept. of Computer Science

Computer Science, University of Karlstad2 Introduction What is a Java Bean? l „A Java Bean is a reusable software component that can be visually manipulated in builder tools.“ l Java Beans are Java classes that conform to the Java Beans specification, can be visible (button, slider) or invisible (network component)

Computer Science, University of Karlstad3 Example for Builder

Computer Science, University of Karlstad4 Motivation l Build an application out of prebuild parts like in industrial production of for example cars or computers l Cross platform component model l Interoperability (ActiveX, OpenDoc...) l Constructing instead of coding l Visual building of applications

Computer Science, University of Karlstad5 Example Interoperability

Computer Science, University of Karlstad6 The Converter in Delphi

Computer Science, University of Karlstad7 How is it done? l A Bean is delivered in binary form l It exposes its attributes (methods, instance variables, properties, and interfaces) through a default mechanism included in the Java API or explicit Information Classes l Bridges translate the attributes to other Component Models

Computer Science, University of Karlstad8 Basic Concepts A Java Bean supports l Introspection l Customization l Properties l Events l Persistence

Computer Science, University of Karlstad9 Requirements for a Bean A Bean is represented by one ore more Java classes which follow the Java Beans specifications, it must not inherit from any special class A JavaBean must l Have a default Constructor without no arguments l be Customizable allowing access to its internal state l be Serializable, must be able to save its state in a stream It should l be Packaged in JAR-File all Classes, Pictures, Documentation... in one file l provide BeanInfo and Customizer Classes

Computer Science, University of Karlstad10 Design vs. Runtime A Java Bean has two lives: l In the design environment, where it should provide design information to the application builder to let the user customize its behaviour and appearance l In the application to do the task it was build for

Computer Science, University of Karlstad11 Features of a Java Bean A Java Bean has certain attributes l Properties To represent the internal state l Methods To be called from outside l Events To inform about changes

Computer Science, University of Karlstad12 The Bean Development Kit Available for free at l Reference implementation of a builder application to test own Java Beans l Allows customization of Beans and simple linking of Beans with adapters

Computer Science, University of Karlstad13 The Beanbox

Computer Science, University of Karlstad14 Example ProgressBean TimerBean ButtonBean The TimerBean calls the ProgressBar in an editable intervall after being started by the Button.

Computer Science, University of Karlstad15 Class Diagram

Computer Science, University of Karlstad16 Example Interaction Diagram

Computer Science, University of Karlstad17 Properties represent the internal state of a component control behaviour or visual representation can be read or written the process of setting up properties at design- or runtime is called Customization

Computer Science, University of Karlstad18 Properties Properties can be: l Simple (simple Java type or Class) l Indexed (an array of the above) l Bound an event is created when the property changes to inform the attached Listeners l Constrained like Bound, but the Listeners can revert the change

Computer Science, University of Karlstad19 Property Example A Property is defined by two accessor methods (setter and getter) allowing other classes or the Builder to manipulate their state public void setTimeout (int t) { timeout = t; } public int getTimeout () { return timeout; }

Computer Science, University of Karlstad20 Bound Properties Example protected PropertyChangeSupport listeners = new PropertyChangeSupport(this); public void addPropertyChangeListener (PropertyChangeListener l) { listeners.addPropertyChangeListener(l); } public void removePropertyChangeListener (PropertyChangeListener l) { listeners.removePropertyChangeListener(l); } public synchronized void setValue(int v) { Integer oldValue = new Integer(value); value = v; repaint(); listeners.firePropertyChange("value", oldValue, new Integer(value)); }

Computer Science, University of Karlstad21 Events l Mechanism to plug beans together l Event is a notification between source and one or more listeners l Listener registers itself in being interested in events l Beans may be plugged together by adapters generated by builder tool

Computer Science, University of Karlstad22 TimerEvent public class TimerEvent extends EventObject { long time; public TimerEvent(Object source, long time) { super(source); this.time = time; } public long getTime() { return time; } public interface TimerListener extends EventListener { public abstract void timedOut(TimerEvent te); }

Computer Science, University of Karlstad23 Handling Listeners protected Vector listeners = new Vector (); public void addTimerListener (TimerListener listener) { listeners.addElement (listener); } public void removeTimerListener (TimerListener listener) { listeners.removeElement (listener); } protected void fireTimeOut() { TimerEvent event = new TimerEvent (this, System.currentTimeMillis()); Vector listeners = (Vector) this.listeners.clone (); for (int i = 0; i < listeners.size (); ++ i) ((TimerListener) listeners.elementAt (i)).timedOut (event); }