You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

 

In this tutorial, we will following the guideline of developing a plugin to develop our Download PDF Datalist Action plugin.

1. What is the problem?

We need to provide a PDF download feature when user click on a link/button on a datalist. The downloaded PDF file should be a form with data populated.

2. What is your idea to solve the problem?

We can develop a Datalist Action Plugin to display a button for generate a form PDF file. 

3. What is the input needed for your plugin?

To develop a PDF Download Datalist Action plugin, we can consider to provide the following as input.

  1. Form ID : The form that will be used to generate the PDF file.
  2. Record ID : Use the id of the datalist row or a column value to load the record.
  3. File Name : File name of the the generated PDF file.
  4. Formatting options : Options to format and customise the PDF output. 

4. What is the output and expected outcome of your plugin?

When PDF Download Datalist Action is used as datalist row action or column action, a normal user will see a link to download the PDF file in every rows of a datalist. Once the link is clicked, a PDF will be prompt to download.

When the plugin is used as whole datalist action, a zip file containing all the generated PDF of every selected rows will be prompt to download when the button is clicked.

5. Is there any resources/API that can be reuse?

To develop the PDF Download Datalist Action plugin, we can reuse the methods in FormPdfUtil to generate a form as PDF. We can also refer to the source code of the Datalist Form Data Delete Action plugin as well. Other than that, we can refer to the Export Form Email Tool on what kind of plugin properties options we can provide in the plugin as the Export Form Email Tool are using the methods in FormPdfUtil as well.

6. Prepare your development environment

We need to always have our Joget Workflow Source Code ready and builded by following this guideline

The following of this tutorial is prepared with a Macbook Pro and Joget Source Code version 5.0.0. Please refer to Guideline of developing a plugin for other platform command.

Let said our folder directory as following. 

- Home
  - joget
    - plugins
    - jw-community
      -5.0.0

The "plugins" directory is the folder we will create and store all our plugins and the "jw-community" directory is where the Joget Workflow Source code stored.

Run the following command to create a maven project in "plugins" directory.

cd joget/plugins/
~/joget/jw-community/5.0.0/wflow-plugin-archetype/create-plugin.sh org.joget.tutorial download_pdf_datalist_action 5.0.0

Then, the shell script will ask us to key in a version for your plugin and ask us for confirmation before generate the maven project.

Define value for property 'version':  1.0-SNAPSHOT: : 5.0.0
[INFO] Using property: package = org.joget.tutorial
Confirm properties configuration:
groupId: org.joget.tutorial
artifactId: download_pdf_datalist_action
version: 5.0.0
package: org.joget.tutorial
Y: : y

We should get "BUILD SUCCESS" message shown in our terminal and a "download_pdf_datalist_action" folder created in "plugins" folder.

Open the maven project with your favour IDE. I will be using NetBeans.  

7. Just code it!

a. Extending the abstract class of a plugin type

Create a "DownloadPdfDatalistAction" class under "org.joget.tutorial" package.

  • No labels