Composite Element

Overview

The composite elements are a new kind of user created element introduced in Jaspersof Studio with the version 6.1.1. They allow to create a new element in the palette starting from one or more basic elements, and reuse them whenever you want in any report. For example it is possible to create a composite element using a static text and a text field with some attributes already predefined (like the fonts or the colors). You will have this new element in the palette and when you drag it in the report it will create the same StaticTtext and Text Field with the same set of properties of the originals.

This composite elements are stored inside a special folder of your workspace, so when you switch your version of Jaspersoft Studio you will found always your previously created elements as soon as you use the same Workspace.

Create a Composite Element

Create a Composite Element it is really simple. In any report create the elements you want to add to the Composite Element and customize their properties as you want, when you have finished select this elements, right click on them and form the contextual menu select "Save as Composite Element..". NOTE: A composite element can be created only from a set of Basic Elements, basic means elements that are not depending from a dataset.

When you click this option a Dialog will appear, in this dialog you will be able to specify:

  1. The name of your Composite Element, this information is mandatory since it will be used inside the palette and must be an unique name
  2. An optional description for the element
  3. An optional icon used in the palette for the Composite Element, if this field is leave blank then a default image is used.
  4. The palette section where this element will be placed

After you have set all the informations press Finish.  The element will now be created in the selected palette, NOTE: if you create the element inside a palette that in the next run is missing. This can happen maybe because you have created it with a Jaspersoft Studio Pro, placing them inside the Pro Compontents section of the palette, but you are reusing them into a Community version. The Community version has not the Pro Compontents section, in this case and in every case where the palette of a Composite Element is missing, it will be displayed in the Composite Elements section of the palette.

Use a Composite Element

To use your element you have simply to drag and drop it inside a report, it will and all its contents will be created in the same way it was defined originally.

Modify a Composite Element

When you right click on a Composite Element you have 3 options:

  1. Edit: This option reopen the dialog used to Create the element and every informations (name, description, icon and palette location) can be changed. 
  2. Open in Designer: This option can be used to modify the content of the composite element, in other words you can modify the single elements inside it. When this option is selected a special editor will be opened where where you can see all the contents of the element and you can modify it as you wish. This editor will look really similar to the report editor but with some simplifications: there will be only a band where the content is placed, there will be no dataset a no possibility to create one and the palette will allow to use only a set of basic elements. In this editor you can add new elements, remove the existing ones or change their properties. When you have finished simply save your work and the associated Composite Element will be reloaded automatically
  3. Delete: After a coinform requeste this action will simply delete the Composite Element and all its resources

Import/Export of the Composite Elements

The composite elements can be exported and imported in any instance of Jaspersoft Studio.

To Export a Composite Element:

  1. In the Palette Right-Click on the the element you want to export and select "Export Composite Elemenets"
  2. A dialog will popup and here you can select any number of composite elements to export. The element that was selected in the palette wil be already marked for the export. Every element selected in this page will be exported.
  3. Press "Finish" and select the destination, every element selected and their resources, like images, will be exported into a single Zip container. This container can be then used in the import procedure to get this elements back.

To Import a Composite Element:

  1. Right-Click on any position in the Palette and select "Import Composite Elements".
  2. Select a Zip container obtained during the Export procedure.
  3. A wizard will popup where you can review every element that will be imported, you can define the name, the icon, the descritpion and the palette position of every imported element. However all this fields will be precompiled with the information of the original exported elements, but you can redifine them during the import procedure. If one of the imported elements has the same name of one of the Composite Elements in your workspace you will need to provide a new name for it, since the name must be unique.
  4. When you have reviewed all the elements press Finish to complete the import procedure.
Feedback
randomness