MiG InfoCom Calendar JavaBeans User Manual

MiG InfoCom AB
MiG Calendar™ JavaBeans Guide
______________________________________________________________
Release 6
MiG Calendar JavaBeans Guide Page 1 / 45
MiG InfoCom AB
MiG InfoCom AB S:t Olofsgatan 28a 753 32 Uppsala Sweden
www.miginfocom.com www.migcomponents.com
COPYRIGHT © MiG InfoCom AB. All rights reserved.
Java is a trademark registered ® to Sun Microsystems.
http://java.sun.com
MiG Calendar JavaBeans Guide Page 2 / 45
MiG InfoCom AB
Table of Contents
MiG Calendar Tutorial.................................6
Preface....................................................................... 6
Resources and Developer Support..............................6
Contacting Support via Email............................................6
Contacting support via online forums.................................6
MiG Calendar Product Site................................................6
Bug Reports................................................................... 7
Introduction............................................................... 8
Examples.................................................................... 8
Visual JavaBean Support in Different IDEs..................8
JFormDesigner (Stand alone & Eclipse/IDEA plugin)............9
NetBeans....................................................................... 9
JBuilder X.....................................................................10
JBuilder 2005................................................................11
Swing-Designer (Eclipse plug-in)..................................... 11
Visual Editor (Eclipse default GUI plugin)..........................11
Bean Builder 0.6 alpha & Bean Box 1.1............................12
Other IDEs................................................................... 12
MiG Calendar Approaches.........................................12
Normal or “Core” Approach.............................................12
Themed Approach (deprecated in 6.0, but it works)...........12
JavaBean Approach (Preferred from v6.0)........................ 13
How the Java Bean Classes Relate to the Core
Component............................................................... 13
Installing the JavaBean Components................................14
The JavaBean Classes............................................... 14
DateAreaBean...............................................................14
MiG Calendar JavaBeans Guide Page 3 / 45
MiG InfoCom AB
DateHeaderBean........................................................... 15
CategoryHeaderBean..................................................... 15
DatePickerBean.............................................................15
DemoDataBean.............................................................15
GridDimensionLayoutBean..............................................16
ActivityAShapeBean.......................................................16
CategoryTreeBean......................................................... 16
PrintPreviewBean.......................................................... 16
PrintSpecificationBean...................................................16
DateSpinnerBean.......................................................... 17
DateComboBean........................................................... 17
DateGroupConnectorBean..............................................17
PaintPanelBean............................................................. 17
How Things Are Connected.......................................17
DateAreaBean...............................................................17
DateGrid Structure........................................................ 18
Connecting a GridDimensionLayoutBean...........................19
Sub Rows..................................................................... 20
Adding Date Headers..................................................... 21
Adding a Category Header..............................................24
SubRowLevels and HeaderRows......................................26
Some examples:........................................................... 28
Grid Lines.....................................................................30
The CategoryTreeBean..............................................30
Date Spinners/Combos and Date Groups..................32
Creating Demo Activities and Categories..................32
The ActivityCategories property......................................33
The Categories property.................................................33
Customizing how the Activities Look......................... 34
Sub Shapes.................................................................. 35
MiG Calendar JavaBeans Guide Page 4 / 45
MiG InfoCom AB
Adding a Date Picker Component.............................. 35
Advanced Topics....................................................... 37
Adding Activities to your Application................................39
Tracking Changes to Activities......................................... 39
Setting Activity Look Dynamically.................................... 40
Adding Custom Visuals to a DateArea or Header...............42
Tool Tips for Activities.................................................... 44
Even More Advanced Topics...................................... 44
Mixing low level core component code with JavaBeans.......44
MiG Calendar JavaBeans Guide Page 5 / 45
MiG InfoCom AB
MiG Calendar Tutorial
Preface
This document aims at providing enough information to get started using the MiG Calendar JavaBeans components in your application. The MiG Calendar Tutorial contains information on how the component is structured including a overview of the different parts.
The MiG Calendar Technical Specification (API JavaDoc) will provide details and should be used as a reference. It can be found at the web site indicated below and should also normally be installed adjacent to this document.
Many IDE:s (Integrated Development Environment) of today have good support for inline help using JavaDocs. The standard HTML JavaDocs for the MiG Calendar component is installed by default and can also be obtained from the site as described below. We highly recommend using this feature as it increases productively when creating applications with this component.
Although all developers independent of prior experience can benefit from reading this document, general knowledge of the standard Java API and OOP (Object Oriented Programming) will help understand some of the details and why they are implemented in a certain way.
Resources and Developer Support
MiG InfoCom AB provides support through email and the online forums. Information and updated tutorials will be made available on the MiG Calendar product site
Contacting Support directly via Email
support@miginfocom.com
Submit a support ticket
http://www.migcalendar.com/support.php
MiG Calendar Product Site
MiG Calendar JavaBeans Guide Page 6 / 45
MiG InfoCom AB
www.migcalendar.com
Bug Reports
Please submit a support ticket.
MiG Calendar JavaBeans Guide Page 7 / 45
MiG InfoCom AB
Introduction
MiG Calendar's Visual JavaBean(s) makes the component very easy to use and configure, especially in combination with a visual programming tool, sometimes called a RAD-tool (Rapid Application Development), such as IntelliJ IDEA, NetBeans, JBuilder, JFormDesigner, SwingDesigner (Eclipse) and Eclipse's Visual Editor .
The JavaBean classes are wrapper classes around the different parts of the framework rather than sub classes of the same. This is for increased decoupling, which means that one part can be enhanced without being constrained by the other, optionally more efficient packaging.
All JavaBean classes, including the support classes, reside in the com.miginfocom.beans.* package. The API
documentation for all properties of these classes is as usual in the provided JavaDoc HTML pages installed with the component.
This document will provide information on how to use the MiG Calendar component's JavaBean classes. For a more thorough explanation of every property please use the JavaDoc.
Examples
MiG Calendar comes with examples for the JavaBeans. They are created with netBeans 5.5. and can be imported directly and be used for testing, code copying or running.
They are in the installation folder under examples. E.g.
C:\Program Files\MiG InfoCom\MiGCalendar6\examples\
These examples are importable to Eclipse using the plugins Visual Editor or Swing Designer (Note! In Swing Designer there's a bug that makes all non-visual components non­parsable. This was confirmed in the daily build 2007-02-15).
Visual JavaBean Support in Different IDEs
MiG Calendar JavaBeans Guide Page 8 / 45
MiG InfoCom AB
The support for handling advanced beans visually in a designer is somewhat different for every IDE (Integrated Development Environments). We expect this to improve considerably in the short future as RAD (Rapid Application Development) is getting more popular with Java.
JFormDesigner (Stand alone & Eclipse/IDEA plugin)
Works flawlessly. JFormDesigner has excellent error reporting if anything goes wrong with the bean in any situation. It also supports all features of the MiG Calendar Beans.
NetBeans
Works flawlessly. netBeans has almost as good error reporting as JFormDesigner. Sometimes NB has to be restarted to for instance see new created Beans and connecting them to other beans.
The IDE doesn't have support for viewing how visual beans look if they aren't in the visual JComponent tree (i.e. if they
are in the "Other Components", where all non-visual beans are). This means that you may have to for instance configure your DateAreaBean on the visual side even if it is supposed to be non-visual (for a print preview or date picker) and then move it to the "Other Components" tree when done.
MiG Calendar JavaBeans Guide Page 9 / 45
Illustration 1: JFormDesigner 2.0 when configuring MiG Calendar
MiG InfoCom AB
JBuilder X
Works flawlessly. Error handling is not as good as for those above.
MiG Calendar JavaBeans Guide Page 10 / 45
Illustration 2: NetBeans 4.1 when configuring MiG Calendar
MiG InfoCom AB
JBuilder 2005
Due to a JBuilder 2005 bug (Report # 9476) that prevents custom components to work in many situations MiG Calendar component is not usable in the designer. The component can be handled in the code editor without problems. According to Borland the bug will not be fixed until the next release.
The bug can be viewed here:
http://qc.borland.com/wc/qcmain.aspx?d=9476
Swing-Designer (Eclipse plug-in)
Works in the latest 6.0 release but there are a few smaller bugs in the designer for the advanced property editors in the daily builds (January 2007). This might have been fixed when you read this. See their daily builds as they often contains unannounced bug fixes.
Currently (January 2007) you can not add visual beans to the non-visual workspace which means that DatePickerBean's and PrintPreviewBean's DateAreaBean must be configured
manually or in the visual component tree and then copy&pasted.
Visual Editor (Eclipse default GUI plugin)
MiG Calendar JavaBeans Guide Page 11 / 45
Illustration 3: JBuilder X when configuring MiG Calendar
MiG InfoCom AB
Visual Editor works with MiG Calendar. It should be noted though that VE doesn't have the possibility to have custom beans on its JavaBean palette. You will have to "Choose Bean.." for every bean you want to add, for every time. This makes Swing-Designer or JFormDesigner a better choice for Eclipse.
Bean Builder 0.6 alpha & Bean Box 1.1
These tools are reference tools provided by Sun. They are not being maintained anymore and are very unfinished and buggy. MiG Calendar does work to some degree in these tools but for instance Bean Box does not accept null property values and that we can't work around.
Other IDEs
If they support visual JavaBeans they will support the MiG Calendar beans as well, however they are untested.
MiG Calendar Approaches
There are three main approached to choose from when developing with the MiG Calendar component, this JavaBean approach is one of them. What approach to use depends on the expected complexity of the application to be created, developer experience level and demands on flexibility.
Normal or “Core” Approach
This involves creating for instance DefaultDateArea, DateAreaContainer and XxxHeader classes manually in code
and configuring these using the methods on them. This is the most flexible approach but also the most code-centric which means that the demands on the developer’s abilities are higher than any of the other approaches.
The core approach enables all of the build in flexibility of the MiG Calendar component. The other approaches can also access this core flexibility, there are noting preventing that, but parts of the core might be preconfigured.
Themed Approach (deprecated in 6.0, but it works)
This involves using the Theme Editor to visually, much like a normal GUI editor, build a single date area with surrounding headers. How the activities should look can not be set in the
MiG Calendar JavaBeans Guide Page 12 / 45
MiG InfoCom AB
theme though, this has to be set manually if the default look doesn’t fulfills the requirements. It is easy to tweak and build in functionality but at the expense of extensibility.
JavaBean Approach (Preferred from v6.0)
This approach is what this guide is about. It means using special wrapper JavaBeans that are delivered with the component and visually configure these using your favorite GUI tool, just like is commonly done in Visual Basic, Delphi or Visual C++. Examples of such tools are:
netBeans – www.netbeans.org
JFormDesigner – www.jformdesigner.com
JDeveloper –
www.oracle.com/technology/products/jdev/
JBuilder – www.borland.com/jbuilder
Eclipse with Swing-Designer – www.eclipse.org and
www.swing-designer.com
This is the leanest of the different approaches when it comes to the developer experience level. It is easy to get started and still as flexible. It is still possible to get to the core classes and configure and tweak those.
The wrapper layer introduced by the JavaBeans is extremely thin and does not affect runtime speed or memory requirements.
This approach is the preferred one from v6.0 and is the interface that will get most updates in future releases.
How the Java Bean Classes Relate to the Core Component
The JavaBean classes wrap the core classes and present a new surface that is optimized to act as visual JavaBean components that can reside in a GUI tool’s component palette. This makes it a lot like the Themed approach.
There is also a core level in the component that is accessible to the developer. It is more code-centric and more flexible since the JavaBean framework imposes some, but not many, limitations. This core level is still accessible if the JavaBean
MiG Calendar JavaBeans Guide Page 13 / 45
MiG InfoCom AB
approach is chosen. See more about this as the “Mixing core­level …” below.
Installing the JavaBean Components
To use the MiG Calendar component’s JavaBeans you must add these beans to the tool’s palette. How this is done is different for every tool and not explained here. Refer to the GUI tool’s manual on how to do this, it is usually a very simple task.
The JavaBeans that has full support to be visual JavaBeans in a tool are:
com.miginfocom.beans.GridDimensionLayoutBean com.miginfocom.beans.ActivityAShapeBean com.miginfocom.beans.WestCategoryHeaderBean com.miginfocom.beans.NorthCategoryHeaderBean com.miginfocom.beans.DateHeaderBean com.miginfocom.beans.DemoDataBean com.miginfocom.beans.DateAreaBean com.miginfocom.beans.DatePickerBean com.miginfocom.beans.CategoryTreeBean com.miginfocom.beans.PrintPreviewBean com.miginfocom.beans.PrintSpecificationBean com.miginfocom.beans.DateSpinnerBean com.miginfocom.beans.DateComboBean com.miginfocom.beans.DateGroupConnectorBean com.miginfocom.beans.PaintPanelBean
They all exist in the .jar file “migcalendarbean.jar” that is located in the “/lib” folder where the component was installed (e.g. “C:/Program
Files/MiGInfoCom/MiGCalendar/lib/migcalendarbean.jar” on
Windows). This jar file isn't needed for redistribution of your application, you still only need the migcalendar.jar.
All beans listed above have BeanInfo classes that specify what they are capable of in the GUI tool. They also have
entries in the so called Manifest in the .jar file. This should make adding them to the GUI tool a snap.
The JavaBean Classes
DateAreaBean
This class is the main class when using the MiG Calendar JavaBeans. The other classes described here make little
MiG Calendar JavaBeans Guide Page 14 / 45
Loading...
+ 31 hidden pages