| dedication xviii | ||
| preface xix | ||
| author online xxiii | ||
Part I Build your own beans 1 |
||
| 1 Introduction 3 | ||
| 1.1 | Visual assembly 4 | |
| Design time versus run time 5 | ||
| 1.2 | Scenarios 5 | |
| A simple scenario 5, A complex scenario 5 | ||
| 1.3 | Bean basics 7 | |
| 1.4 | Applets and beans 9 | |
| 1.5 | Bridging the gap 9 | |
| 1.6 | WWW browser support for JavaBeans 10 | |
| 1.7 | Relevant technologies 10 | |
| 1.8 | What's in store for JavaBeans? 10 | |
| Glasgow specifications 11, InfoBus 11, Enterprise JavaBeans 12 | ||
| 1.9 | Where to start? 12 | |
| 1.10 | Intended audience 13 | |
| 1.11 | Where to get some beans 14 | |
| 2 JavaBeans model 15 | ||
| 2.1 | Describing a Java bean 16 | |
| Introspection 17 | ||
| 2.2 | Design-time classes 18 | |
| 2.3 | Run-time classes 19 | |
| Properties 19, Events 22, Adapters 28, Exposing events 30, Timer: an example of a custom event 31, Methods 33, Bound and constrained properties 34 | ||
| 2.4 | Persistence 36 | |
| Serialization 36, Implementing serialization 37, Persistent versus transient fields 38 | ||
| 2.5 | Packaging beans 42 | |
| 2.6 | Summary 43 | |
| 3 Creating and assembling simple beans 45 | ||
| 3.1 | Overview of the BeanBox 46 | |
| Running the BeanBox 46, Loading beans 47 | ||
| 3.2 | Creating simple beans 47 | |
| Requirements and design 47, Implementation 48 | ||
| 3.3 | Visual assembly 56 | |
| Running the BeanBox 56, Running your application 60 | ||
| 3.4 | Manual assembly 62 | |
| Creating a bean instance 62 | ||
| 3.5 | Summary 64 | |
| 4 Building run-time bean classes 65 | ||
| 4.1 | Class libraries versus beans 66 | |
| 4.2 | Designing beans 66 | |
| Designing properties 67, Designing methods 67, Designing connection strategies 69, Class design 71, Package design 72 | ||
| 4.3 | Implementing run-time classes 73 | |
| Constructor with no arguments 73, Conformance to design patterns 74, Implementing multiple bean classes 74, Implementing serialization 75, Implementing property change events 77, Implementing a bound property 78, Listening to bound properties 79, Using bound properties for connecting beans 79, Implementing a constrained property 83, Listening to constrained properties 86 | ||
| 4.4 | Summary 87 | |
| 5 Building design-time classes 89 | ||
| 5.1 | Providing bean information 90 | |
| 5.2 | Building BeanInfo classes 91 | |
| Overview of the BeanInfo interface 92, Steps to build a BeanInfo class 93, Constructing feature descriptors 93, Multiple bean classes 104 | ||
| 5.3 | Building BeanInfo classes: a quick reference 111 | |
| 5.4 | Design-time utilities 112 | |
| Bean instantiation 112, Checking for an instance 114, Checking for design time 114, Checking for GUI availability 115 | ||
| 5.5 | Using the Introspector class 115 | |
| A BeanInfo tester 117 | ||
| 5.6 | Summary 122 | |
| 6 Building property editors and customizers 123 | ||
| 6.1 | Property editor 124 | |
| Overview of the PropertyEditor interface 124, How do property editors work? 126 | ||
| 6.2 | Building custom property editors 128 | |
| PropertyEditorSupport class 128, Editors for property presented as text 128, Indexed property editor 132, Editors for enumerated types 135, Editors with custom components 143 | ||
| 6.3 | Registering and locating and editors 148 | |
| Registering editors 148, Locating editors 150 | ||
| 6.4 | Customizers 150 | |
| Property sheet limitations 150, Building customizers 152, Registering and locating customizers 162, Customizer limitations 162 | ||
| 6.5 | Summary 163 | |
| 7 Packaging and delivery 165 | ||
| 7.1 | Java archive 165 | |
| Using the jar tool 166, Manifest file 167 | ||
| 7.2 | What goes in a beans jar file? 169 | |
| 7.3 | Data compression 170 | |
| The java.util.zip class library 170 | ||
| 7.4 | Accessing resources using the zip class library 174 | |
| 7.5 | Example: jar image browser bean 176 | |
| Location independent accessing of resources 179, Example: Jar Viewer bean 181 | ||
| 7.6 | Summary 185 | |
| 8 Applets and beans 187 | ||
| 8.1 | Applet basics 188 | |
| HTML tags 188, Applet class 189 | ||
| 8.2 | Making an applet a bean 189 | |
| Applet bean initialization 190, Configuring an applet 191, Rotator: example of an applet bean 191, Converting your applet into a bean 197 | ||
| 8.3 | Converting your bean into an applet 197 | |
| Using the BeanWrapper class 197, Using the MakeApplet utility 198 | ||
| 8.4 | Summary 200 | |
| 9 JavaBeans to ActiveX 201 | ||
| 9.1 | ActiveX overview 202 | |
| COM basics 203, Flavors of ActiveX 204, ActiveX and the web 206 | ||
| 9.2 | ActiveX bridge 207 | |
| How does it work? 207, OLE packager 207, Properties 212, Methods 212, Events 212, Implementing persistence 213 | ||
| 9.3 | Running beans in Visual Basic 213 | |
| 9.4 | Running beans in Internet Explorer 217 | |
| Steps 218, Embedding beans in Microsoft Office applications 222 | ||
| 9.5 | Tips with working with bean controls 223 | |
| 9.6 | Unregistering beans 223 | |
| 9.7 | Conclusion/summary 224 | |
| 10 ActiveX to JavaBeans 225 | ||
| 10.1 | Introduction to ActiveX controls 226 | |
| 10.2 | ActiveX controls on Visual C++ 227 | |
| ActiveX Template Library (ATL) 227, BaseCtrl framework 227, Microsoft Foundation Classes (MFC) 227 | ||
| 10.3 | The MFC way 227 | |
| 10.4 | The progress indicator ActiveX control 228 | |
| 10.5 | Creating our control 228 | |
| The OLE Test container 229 | ||
| 10.6 | The simplest MFC ActiveX control 230 | |
| 10.7 | Adding features to our control 230 | |
| Properties 231, Methods 237, Events 238, Drawing our control 238, Implementing property pages 240, Message handling 241, Error handling 241 | ||
| 10.8 | Caveat emptor! 241 | |
| 10.9 | Security issues 242 | |
| Registry manipulation 242, Implementing the IObjectSafety interface 242 | ||
| 10.10 | Running the control 243 | |
| 10.11 | The Migration Assistant 244 | |
| 10.12 | Benefits to using the migration assistant 245 | |
| 10.13 | Availability and installation 246 | |
| 10.14 | Converting our ActiveX control to a JavaBean 246 | |
| 10.15 | Problems with the generated code 249 | |
| 10.16 | Making it a complete bean 251 | |
| 10.17 | Running our bean in a BeanBox 254 | |
| 10.18 | Microsoft's JActiveX 254 | |
| 10.19 | Summary 260 | |
| 11 Building beans using tools 261 | ||
| 11.1 | Borland's JBuilder 262 | |
| Overview of JBuilder 262, AppBrowser 263, Build your beans using JBuilder 264, Adding beans to the component palette 267, Connecting beans 268 | ||
| 11.2 | PowerSoft's PowerJ 273 | |
| Overview of PowerJ 273, Building beans 275, Packaging beans 278, Adding beans to the component palette 278, Customizing beans 279, Connecting beans 281 | ||
| 11.3 | VisualAge WebRunner bean tools 283 | |
| BeanTester 283 | ||
| 11.4 | Summary 291 | |
| 12 Advanced JavaBeans 293 | ||
| 12.1 | Limitations of the basic model 294 | |
| 12.2 | Glasgow specifications 294 | |
| Run-time containment and services protocol 295, Overview of the bean context API 295 | ||
| 12.3 | JavaBeans activation framework (JAF) 302 | |
| JAF basics 303, Overview of the JAF API 304 | ||
| 12.4 | InfoBus 309 | |
| InfoBus basics 310, Creating a new instance of InfoBus 311, Becoming an InfoBus member 311, Joining and leaving an InfoBus 312, Becoming a data producer or data consumer 313, Exchanging data 314, Becoming a data controller 316, Describing data 319 | ||
| 12.5 | Summary 325 | |
Part II Bean collection 327 |
||
| List of beans 329 | ||
| 13 Visualization bean suite 331 | ||
| 13.1 | Visualization package organization 332 | |
| vis.util package 332, vis.beans package 332 | ||
| 14 File selector bean 337 | ||
| 14.1 | Exposed properties 338 | |
| 14.2 | Methods 339 | |
| 14.3 | Exposed events 339 | |
| Connection 340 | ||
| 14.4 | Run-time classes 341 | |
| List select event 342 | ||
| 14.5 | Design-time classes 342 | |
| 14.6 | Conclusions 345 | |
| 15 A simple numeric spreadsheet bean 347 | ||
| 15.1 | Exposed properties 349 | |
| Hidden properties 350 | ||
| 15.2 | Exposed methods 350 | |
| Exposed events 351, Observed events 351 | ||
| 15.3 | Connection 352 | |
| As a target 352, As a source 352 | ||
| 15.4 | Run-time classes 353 | |
| SpreadSheet class 354 | ||
| 15.5 | Design-time classes 356 | |
| 15.6 | Proposed improvements 356 | |
| 16 Plotter beans 357 | ||
| 16.1 | Scientific plotting 357 | |
| Business charts 359 | ||
| 16.2 | Exposed properties 359 | |
| Common properties 359 | ||
| 16.3 | Exposed methods 363 | |
| Common methods 363 | ||
| 16.4 | Events and connection 364 | |
| 16.5 | Run-time classes 364 | |
| Base classes 364, PieChart class 371 | ||
| 16.6 | Design-time classes 372 | |
| ChartBeanInfo class 376, BarChartBeanInfo class 377 | ||
| 16.7 | PieChartBeanInfo class 378 | |
| Customizers 381 | ||
| 16.8 | Business chart bean 381 | |
| Exposed properties 381, Exposed methods 381, Run-time classes 381, Design-time classes 384 | ||
| 17 ImageViewport bean 387 | ||
| 17.1 | Features 388 | |
| Image display modes 388, Image orientation 389, Scroll 389, Magnification 389, Cine' 389 | ||
| 17.2 | Exposed properties 390 | |
| Exposed methods 391, Exposed events 393 | ||
| 17.3 | Run-time classes 393 | |
| ImageCanvas class 393, ImageLoader class 396 | ||
| 17.4 | Design-time interfaces 397 | |
| ImageCanvasBeanInfo class 397, Customizer 401 | ||
| 18 Image loader bean 411 | ||
| 18.1 | Image loading basics 412 | |
| Asynchronous loading 412, Image loading stages 413, Image loading problems 414 | ||
| 18.2 | Exposed properties 420 | |
| 18.3 | Exposed methods 420 | |
| 18.4 | Exposed events 421 | |
| 18.5 | Observed events 421 | |
| 18.6 | Connection 421 | |
| 18.7 | Run-time classes 421 | |
| Loader class 422, Image loaded event 425 | ||
| 18.8 | Design-time classes 425 | |
| 18.9 | Proposed improvements 425 | |
| 19 Image manipulation beans 427 | ||
| 19.1 | Image display bean 427 | |
| Properties 428, Exposed events 429, Connection 429, As a source 429, As a target 430, Run-time classes 430, Design-time classes 432 | ||
| 19.2 | Cine' bean 434 | |
| Exposed properties 434, Exposed methods 435, Exposed events 436, Observed events 436, Connection 436, Run-time classes 436, Design-time classes 438 | ||
| 19.3 | Pan/Zoom bean 438 | |
| Exposed properties 438, Exposed methods 440, Events 440 | ||
| 19.4 | Run-time and design-time classes 440 | |
| 19.5 | An image viewer 440 | |
| 20 JDBC select bean 441 | ||
| 20.1 | Requirements 442 | |
| 20.2 | Exposed properties 442 | |
| 20.3 | Exposed methods 444 | |
| 20.4 | Exposed events 444 | |
| Connection 444 | ||
| 20.5 | Run-time classes 445 | |
| Loading drivers classes 445, Querying the database 446, JDBC Select GUI bean 447 | ||
| 20.6 | Design-time classes 448 | |
| 20.7 | Creating a sample application using JDBC select 449 | |
| Data Source creation 449, Creating sample application 449 | ||
| 21 File printer bean 451 | ||
| 21.1 | Requirements and design 451 | |
| 21.2 | Exposed properties 453 | |
| 21.3 | Exposed methods 454 | |
| 21.4 | Exposed events 454 | |
| 21.5 | Design-time classes 455 | |
| Customizer 455, Property editor for line spacing property 455 | ||
| 21.6 | Conclusion 455 | |
| 22 The Bean Collaborator 457 | ||
| 22.1 | Motivation 457 | |
| 22.2 | Using the Bean Collaborator 458 | |
| 22.3 | Potential uses and limitations 461 | |
| 22.4 | Exposed properties, methods, and events 461 | |
| 22.5 | Bean class design and implementation 461 | |
| 22.6 | Important issues addressed 463 | |
| 22.7 | IDL code snippets 463 | |
| Joining/leaving session 463, Event replication 464 | ||
| 22.8 | Design-time interfaces 465 | |
| BeanCollaboratorBeanInfo class 465, BeanCollaboratorCustomizer class 465 | ||
| 22.9 | References 468 | |
| 23 Jzoom 469 | ||
| 23.1 | Properties 469 | |
| 23.2 | Future improvements 470 | |
Part III Appendix 471 |
||
| Appendix A: A recipe to write your own beans 473 | ||
| Appendix B: Using the reflection API 477 | ||
| Class class 478 | ||
| Fetching class objects 478, Fetching method objects 481, Fetching constructor objects 482, Other methods in Class 482 | ||
| java.lang.reflect package 483 | ||
| Member interface 483, Method class 483, Constructor class 487, Field class 488, Modifier class 488 | ||
| JDK 1.2 enhancements 488 | ||
| AccessibleObject class 488 | ||
| Appendix C: The beans API 489 | ||
| Introspection classes/interfaces 490 | ||
| BeanInfo interface 490, SimpleBeanInfo class 491, Introspector class 491, Feature descriptor classes 492, IntrospectionException class 498 | ||
| Customization 499 | ||
| PropertyEditor interface 499, PropertyEditorSupport class 499, PropertyEditorManager class 500, Customizer interface 500 | ||
| Property change event notification classes 500 | ||
| PropertyEvent class 501, PropertyChangeListener interface 501, VetoableChangeListener interface 501, PropertyChangeSupport class 502, VetoableChangeSupport class 502, PropertyVetoException class 503, Designtime utility classes 503, Beans class 503, Bean instance methods 503, Visibility interface 504 | ||
| JDK 1.2 enhancements 504 | ||
| Support for bean contexts 504, Support for applets 505, Aggregation and delegation 506 | ||
| Appendix D: Miscellaneous 509 | ||
| Inner classes 509 | ||
| Top-level classes 510 | ||
| Inner classes 510 | ||
| Member inner classes 511, Local classes 513, Anonymous classes 513 | ||
| Collections and maps 521 | ||
| Collection interface 521, List interface 522, Set interface 523, Map interface 524, java.lang.Comparator interface 525, Comparator interface 525, Iterator interface 525, ListIterator interface 525, Map.Entry interface 526 | ||
| References and resources 527 | ||
| Java and JavaBeans 527 | ||
| Active X 529 | ||
| Resources 529 | ||
| Magazines 529, Java related web sites 530, News groups 530 | ||
| index 531 | ||