8.3. Organizer

8.3.1. Introduction

Using the API, the EDAB Organizer can also be called with custom choices instead of the default options provided. It can be customized in terms of look, feel, and function. Report and Chart Designer, called from the Organizer, can also be customized via the API.

Both EDABOrganizer.jar and EDABServer.jar (in the <EDAB-installation-directory>/lib directory) needs to be added to the CLASSPATH for any code using EDAB Organizer. The following snippet shows how to connect to EDAB Organizer:

QbOrganizer.setServletRunner("http://localhost:8080");
QbOrganizer.setServletContext("EDAB/servlet");
QbOrganizer organizer = new QbOrganizer(null, "admin", "admin");
        

The above code sets the connection information to connect to EDAB Server and provides the username and password (in the above example, admin and admin) for EDAB Organizer.

EDAB Organizer can then be shown by getting a handle to the Organizer user interface and setting it visible.

JFrame frame = organizer.getOrganizerUI();
frame.setVisible(true);
        

Please note that you need to copy the contents of the images, orgimages, reportimages, and backgroundImages directories to the working directory of the .class file.

All examples and code given in the manual assume that EDAB server is running locally (i.e. on your local machine) and on port 8080. You can change this by going to the source code (you can download the source code by clicking on the Full Source Code link in the corresponding chapter), editing the code to enter the new connection information and recompiling it.

Also note that if you have applets that use EDAB Report API, the browser must have at least 1.5 JVM plugin.

8.3.2. Look and Feel

You can specify a look and feel to EDAB Organizer before getting a handle to the user interface. By default, the EDAB Organizer uses the system's look and feel. The look and feel can be set using the following method in QbOrganizer:

public static void setLookAndFeel(javax.swing.LookAndFeel newLookAndFeel);
        

8.3.3. Inserting and Removing Items

You do not have to show EDAB Organizer in order to insert and remove items. You can add and delete items from Organizer via the API.

The following method shows how to add an item to the Organizer:

public void insertNewItem(String name, String description, String location, String url, String folderName);
        

For example:

organizer.insertNewItem("Orders_Breakdown", "This is an example report added to Organizer", "OrdersBreakdown.qrp", "http://localhost:8080/EDAB/OrdersBreakdown.qrp", "/New Project");
        

Full Source Code

Result Screenshot

The above code inserts a new item called Account_Report in the Organizer under the /ReportFiles project folder. The URL and physical location of the file is also passed along with a short description. Please note that to run the above code successfully, you will need to create a project called ReportFiles in Organizer. The recommended way to run the above code is to compile the source code, then go to the root EDAB directory and enter the following command:

java -classpath "../../src/er/bin;./lib/EDABOrganizer.jar;./lib/EDABServer.jar;./lib/qblicense.jar;./lib/hsqldb.jar;.&gt;PATH_TO_COMPILED_CLASS_FILE&lt;" InsertingItem
        

You can also remove items from the Organizer using the following method:

public void removeItem(String name, String folderName);
        

For example:

organizer.removeItem("Orders_Breakdown", "/New Project");
        

Full Source Code

Result Screenshot

The above code deletes Account_Report from the /ReportFiles project folder in EDAB Organizer. The recommended way to run the above code is to compile the source code, then go to the root EDAB directory and enter the following command:

java -classpath "../../src/er/bin;./lib/EDABOrganizer.jar;./lib/EDABServer.jar;./lib/qblicense.jar;./lib/hsqldb.jar;&gt;PATH_TO_COMPILED_CLASS_FILE&lt;" RemovingItem
        

8.3.4. Javadoc

Javadoc for the entire API is provided along with EDAB. It is located here (server functions).

8.3.5. Summary

EDAB API provides an easy-to-use and powerful API to customize and show Organizer interface as well as customize Report Designer and Chart Designer interfaces. You can also write code to insert and delete items in Organizer.

Please note that the API requires JDK 1.8 or higher. The EDAB API has been tested on Windows, Solaris, Linux, AIX, HP, and Mac platforms.