Before you can use the Design API to perform certain tasks, you need to first make the following preparations:
The license information is set via a method called setUserInfo(String uid, String key), where UID is the user ID, and key is the license key. This method should be called before you can call any other Design API methods. The UID is the license user ID you received with the purchase of Logi JReport Server and Logi JReport Designer. The license key will be either Server Designer License Key or Designer License Key depending on your class path setting to
DesignerUserInfo userInfo=new DesignerUserInfo(Uid, key);
Designer desg = new Designer(catalogPath, catalogName, userInfo); // For creating page report
MultipliedDesigner md = new MultipliedDesigner(path, catName, Designer.CAT, userInfo); // For creating web report
Before working with reports and library components using the Design API, you need to specify the catalog in which they are saved. The method public CatalogAPI getCatalogAPI() is used for getting a Catalog API instance.
All the objects in a report are organized into and browsed from a tree structure. For each report, the Report Inspector consists of a report objects tree at the top of the view panel and its corresponding reporting features or properties at the bottom. Selecting any object node on the tree also selects the same element in the report design area. The following diagrams cover all objects that can be used in a report with their relationships.
Every node and object in the above trees is identified by a HANDLE in Logi JReport Design API. Therefore, before you can create or edit a report with the Design API, you will first have to get the handle information. Super class API provides the following methods to get handles of different nodes and different types.
Gets all the handles of a report and returns a handle array.
- getHandles(String handle)
Gets handles of the sub node in the current node and returns a handle array. If it fails, it will return null.
- getHandles(String handle, int type)
Gets sub node handles of the same types for the given node and returns a handle array. If it fails, it will return null.
- getHandles(String handle, int type, int depth)
Gets sub node handles of the same types for the given node and returns a handle array. The depth is described below. If it fails, it will return null.
- getParent(String handle)
Gets the parent handle of an object and returns the parent handle. If it fails, it will return null.
- handle - Parent node handle when getting sub node handles. Object handle when getting parent handle.
- type - Class type value defined in the API class.
- depth - This is related to the current level in the report tree. When the depth is -1, all handles in the report will be returned. When the depth is 0, the handles of the current level will be returned. When the depth is number n, the handles of n levels and the current level will be returned.