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

Compare with Current View Page History

« Previous Version 10 Next »

There following questions and steps are to help you plan and develop a plugin to fulfill a custom requirement.

คำถามและขั้นตอนต่อไปนี้เพื่อช่วยคุณวางแผนและพัฒนาปลั๊กอินเพื่อตอบสนองความต้องการที่กำหนดเอง

1. What is the problem?

อะไรคือปัญหา?

You have a custom requirement and you found that none of the built-in plugins provided by Joget Workflow nor plugins available in Marketplace are able to fulfill your requirement. 

คุณมีข้อกำหนดที่กำหนดเองและคุณพบว่าไม่มีปลั๊กอินในตัวที่หาให้โดย Joget Workflow หรือปลั๊กอินที่มีอยู่ใน Marketplace สามารถตอบสนองความต้องการของคุณได้

Example 1: Download a PDF version of a form when click on a button in a list.

ตัวอย่างที่ 1: ดาวน์โหลดแบบฟอร์ม PDF เวอร์ชันเมื่อคลิกที่ปุ่มในรายการ


Example 2: Provide a Gantt Chart view of your collected form data. 

ตัวอย่างที่ 2: ระบุมุมมองแผนภูมิ Gantt ของข้อมูลฟอร์มที่คุณรวบรวม


Example 3: Hash variable is convenient in use, but it does not provide the ability to do condition checking.

ตัวอย่างที่ 3: ตัวแปรแฮชใช้งานได้สะดวก แต่ไม่สามารถตรวจสอบสภาพได้

2. How to solve the problem?

วิธีแก้ปัญหา

Refer to the Plugin Types that are supported by Joget Workflow, find the most appropriate plugin type that can help you to fulfill the custom requirement.

อ้างอิงถึง Plugin Types ที่ Joget Workflow สนับสนุนค้นหาประเภทของปลั๊กอินที่เหมาะสมที่สุดที่สามารถช่วยให้คุณปฏิบัติตามข้อกำหนดที่กำหนดเองได้

Example 1: Develop a Datalist Action plugin to display a button for generate form PDF.

ตัวอย่างที่ 1: พัฒนาปลั๊กอินการกระทำ Datalist เพื่อแสดงปุ่มสำหรับสร้างฟอร์ม PDF


Example 2: Develop a Userview Menu plugin that can be used to display form data as Gantt Chart.

ตัวอย่างที่ 2: พัฒนาปลั๊กอินเมนู Userview ที่สามารถใช้เพื่อแสดงข้อมูลฟอร์มเป็นแผนภูมิ Gantt


Example 3: Develop a Hash Variable plugin that can do Bean Shell scripting.

ตัวอย่างที่ 3: พัฒนาปลั๊กอิน Hash Variable ที่สามารถเขียนสคริปต์ Bean Shell ได้

3. What is the input needed for your plugin?

สิ่งที่จำเป็นในการป้อนข้อมูลสำหรับปลั๊กอินของคุณ?

Find out what information are needed by your plugin to function/work. Look at it from the user's perspective; how are you going to use the plugin. Then, look at it from a developer's perspective; to make the plugin reusable in more use cases.

ค้นหาว่าปลั๊กอินของคุณจำเป็นต้องใช้ข้อมูลใดในฟังก์ชัน/ ทำงาน ดูจากมุมมองของผู้ใช้ คุณจะใช้ปลั๊กอินอย่างไร จากนั้นดูจากมุมมองของนักพัฒนา เพื่อทำให้ปลั๊กอินสามารถใช้ซ้ำได้ในกรณีใช้งานมากขึ้น

You can refer to Plugin Properties Options on what type of input field you can provide to your plugin user.

คุณสามารถอ้างถึง Plugin Properties Options ในฟิลด์ป้อนข้อมูลประเภทใดที่คุณสามารถให้กับผู้ใช้ปลั๊กอินของคุณ

Example 1: To develop a PDF Download Datalist Action plugin, we can consider providing the following as input.

ตัวอย่างที่ 1: ในการพัฒนาปลั๊กอินการดาวน์โหลดดาต้าลิสต์แอ็คชัน PDF เราสามารถพิจารณาให้สิ่งต่อไปนี้เป็นอินพุต

    1. Form ID : The form that will be used to generate the PDF file.

      แบบฟอร์ม: แบบฟอร์มที่จะใช้ในการสร้างไฟล์ PDF

    2. Record ID : Use the id of the datalist row or a column value to load the record.

      ID เรคคอร์ด: ใช้ id ของแถวดาต้าลิสต์หรือค่าคอลัมน์เพื่อโหลดเรคคอร์ด

    3. File Name : File name of the the generated PDF file.

      ชื่อไฟล์: ชื่อไฟล์ของไฟล์ PDF ที่สร้างขึ้น

    4. Formatting options : Options to format and customise the PDF output. 

      ตัวเลือกการจัดรูปแบบ: ตัวเลือกในการจัดรูปแบบและปรับแต่งเอาต์พุต PDF

Example 2: To develop an Gantt Chat Userview Menu plugin, we can consider providing the following as input.

ตัวอย่างที่ 2: ในการพัฒนาปลั๊กอินเมนู Gantt Chat Userview เราสามารถพิจารณาให้สิ่งต่อไปนี้เป็นอินพุต

    1. Datalist Binder : We can reuse datalist binder in our plugin to retrieve the data needed by the Gantt Chart.

      ดาต้าลิสต์ Binder: เราสามารถใช้ดาต้าลิสต์ Binder ในปลั๊กอินของเราเพื่อดึงข้อมูลที่ต้องการโดยแผนภูมิแกนต์

    2. Mapping : A field to map the columns that will be returned from the datalist binder to the data needed by the Gantt Chart.

      การแมป: ฟิลด์เพื่อแมปคอลัมน์ที่จะส่งคืนจากตัวยึดข้อมูลไปยังข้อมูลที่ต้องการโดยแผนภูมิแกนต์

    3. Styling : Options to style the Gantt Chart.

      จัดแต่ง: ตัวเลือกเพื่อจัดสไตล์แผนภูมิแกนต์

Example 3: Hash Variable plugin does not provide interface for user to configure, but to develop a Bean Shell Hash Variable plugin, we need somewhere to put our Bean Shell script. We can reuse the Environment Variable to store our scripts. So the Hash Variable syntax will be a prefix with environment variable key.

ตัวอย่างที่ 3: ปลั๊กอิน Hash Variable ไม่มีส่วนต่อประสานสำหรับผู้ใช้ในการกำหนดค่า แต่เพื่อพัฒนาปลั๊กอิน Bean Shell Hash Variable ที่เราต้องการใส่สคริปต์ Bean Shell ของเรา เราสามารถนำ Environment Variable มาใช้ใหม่เพื่อจัดเก็บสคริปต์ของเรา ดังนั้นไวยากรณ์ Hash Variable จะเป็นคำนำหน้าด้วยคีย์ตัวแปรสภาพแวดล้อม

E.g. #beanshell.EnvironmentVariableKey#

But, this may not be enough. We may need some other way to pass in some variable too. We can consider using a URL query parameters syntax to pass in our variables because it is easier to parse later on.

E.g. #beanshell.EnvironmentVariableKey[name=Joget&email=info@joget.org&message={form.sample.message?url}]#

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

ผลลัพธ์และผลลัพธ์ที่คาดหวังของปลั๊กอินของคุณคืออะไร?

How and what a normal user (Not the admin user who use the plugin to provide functionality) will use and see your plugin result.

ผู้ใช้ปกติและไม่ใช่ผู้ใช้ที่ไม่ใช่ผู้ดูแลระบบที่ใช้ปลั๊กอินเพื่อจัดเตรียมการทำงานจะใช้งานและดูผลลัพธ์ปลั๊กอินของคุณ

Example 1: When PDF Download Datalist Action is used as a 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 prompted to be downloaded.

When the plugin is used as a whole datalist action, a zip file containing all the generated PDF of every selected rows will be prompted to be downloaded.


ตัวอย่างที่ 1: เมื่อ PDF Download Datalist Action ถูกใช้เป็นแอ็คชั่นแถวของดาต้าลิสต์หรือการกระทำคอลัมน์ผู้ใช้ปกติจะเห็นลิงค์เพื่อดาวน์โหลดไฟล์ PDF ในทุก ๆ แถวของดาต้าลิสต์ เมื่อคลิกที่ลิงค์ไฟล์ PDF จะถูกถามให้ดาวน์โหลด

เมื่อมีการใช้ปลั๊กอินเป็นการกระทำของดาต้าลิสต์ทั้งหมดไฟล์ซิปที่มี PDF ทั้งหมดที่สร้างขึ้นของทุกแถวที่เลือกจะได้รับแจ้งให้ดาวน์โหลด

Example 2: A normal user can see a Gantt Chart when a menu using the Gantt Chart Userview Menu plugin is clicked. User may navigate or interact with the Gantt Chart. 


ตัวอย่างที่ 2: ผู้ใช้ทั่วไปสามารถเห็นแผนภูมิ Gantt เมื่อมีการคลิกเมนูโดยใช้ปลั๊กอินของเมนู Gartt Chart Userview ผู้ใช้สามารถนำทางหรือโต้ตอบกับแผนภูมิแกนต์

Example 3: The Bean Shell Hash Variable plugin is for the admin user. Once it is used, the Hash Variable will be replaced by the output return from the Bean Shell interpreter.


ตัวอย่างที่ 3: ปลั๊กอิน Bean Shell Hash สำหรับผู้ดูแลระบบ เมื่อมีการใช้งานตัวแปรแฮชจะถูกแทนที่ด้วยการส่งคืนผลลัพธ์จาก Bean Shell

5. Are there any resources/API that can be reused?

มีทรัพยากร / API ที่สามารถนำกลับมาใช้ใหม่ได้หรือไม่?

Always refer to existing plugins and tutorials to look for a similar plugin/plugin type that you can refer to whenever possible.  The Joget team will try their best to enrich the contents in the tutorials section.

You may need to check out the document of Utility & Service MethodsJSON APIJavascript API and Bean Shell Programming Guide as well. These documents may contains some methods/examples that may help you in the development.

โปรดอ้างอิง existing plugins และ tutorials ที่มีอยู่เสมอเพื่อค้นหาประเภทปลั๊กอิน / ปลั๊กอินที่คล้ายกันที่คุณสามารถอ้างถึงได้เมื่อใดก็ตามที่เป็นไปได้ ทีม Joget จะพยายามอย่างดีที่สุดเพื่อเพิ่มเนื้อหาในส่วนบทช่วยสอน คุณอาจต้องตรวจสอบเอกสาร Utility & Service MethodsJSON APIJavascript API และ Bean Shell Programming Guide เช่นกัน เอกสารเหล่านี้อาจมีวิธีการ / ตัวอย่างที่อาจช่วยคุณในการพัฒนา

Example 1: 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.


ตัวอย่างที่ 1: เพื่อพัฒนาปลั๊กอินการดาวน์โหลดดาต้าลิสต์แอ็คชัน PDF เราสามารถนำวิธีการใน FormPdfUtil มาใช้ใหม่เพื่อสร้างฟอร์มเป็น PDF นอกจากนี้เรายังสามารถอ้างถึงซอร์สโค้ดของปลั๊กอินการกระทำการลบแบบฟอร์มข้อมูลดาต้าลิสต์ได้เช่นกัน นอกเหนือจากนั้นเราสามารถอ้างถึง Export Form Email Tool เกี่ยวกับตัวเลือกคุณสมบัติปลั๊กอินที่เราสามารถให้ในปลั๊กอินได้เนื่องจากเครื่องมือส่งออกฟอร์มอีเมลใช้วิธีการใน FormPdfUtil เช่นกัน

Example 2: To develop a Gantt Chart Userview Menu plugin, we can refer to the source code of all the Userview Menu plugin. From there, we can have a better understanding on how to make a template for a plugin using FreeMaker syntax. 


ตัวอย่างที่ 2: ในการพัฒนาปลั๊กอินเมนู Userview เมนู Gantt เราสามารถอ้างถึง source code ของปลั๊กอินเมนู Userview ทั้งหมด จากตรงนั้นเราสามารถทำความเข้าใจเกี่ยวกับวิธีสร้างเทมเพลตสำหรับปลั๊กอินโดยใช้ไวยากรณ์ FreeMaker ได้ดีขึ้น

Example 3: To develop Bean Shell Hash Variable plugin, we can refer to the source code of all the Hash Variable plugin and Bean Shell plugin. Especially, we can refer to Environment Variable Hash Variable plugin on how to retrieve environment variable using a variable key. We can also refer to Bean Shell Tool or Bean Shell Form Binder plugin on what to execute the script with Bean Shell interpreter.


Example 3: การพัฒนาปลั๊กอิน Bean Shell Hash Variable เราสามารถอ้างอิง source code ของปลั๊กอิน Hash Variable และปลั๊กอิน Bean Shell ทั้งหมด โดยเฉพาะอย่างยิ่งเราสามารถอ้างถึงปลั๊กอินตัวแปรสภาพแวดล้อมของแฮชตัวแปรในการเรียกข้อมูลตัวแปรสภาพแวดล้อมโดยใช้คีย์ตัวแปร นอกจากนี้เรายังสามารถอ้างอิงถึง Bean Shell Tool หรือปลั๊กอิน Bean Binder ของ Form Shell เกี่ยวกับสิ่งที่เรียกใช้งานสคริปต์ด้วยล่าม Bean Shell

6. Prepare your development environment

เตรียมสภาพแวดล้อมการพัฒนาของคุณ

a. You will need to have the Joget Open Source ready and built. We will use the "wflow-plugin-archetype" module to generate a maven project for our plugin.

คุณจะต้องมี Joget Open Source ให้พร้อมและสร้าง เราจะใช้โมดูล "wflow-plugin-archetype" เพื่อสร้างโครงการ maven สำหรับปลั๊กอินของเรา


b. Generate a maven project.

The project file generated will be placed at the directory specified in the command prompt, eg: running the command in "C:\" will place the project file in the root of C drive.

To get the correct jogetDependencyVersion in order to build a proper project file with correct dependencies, check the file name specified in the ".m2" folder under directory of, eg:

C:\Users\(your computer name)\.m2\repository\org\joget\wflow-core\"5.0.11"

Run the following for Window 

สร้างโครงการ maven

ไฟล์โครงการที่สร้างจะถูกวางไว้ที่ไดเรกทอรีที่ระบุในพรอมต์คำสั่งเช่น: การเรียกใช้คำสั่งใน "C: \" จะวางไฟล์โครงการไว้ในรากของไดรฟ์ C ในการรับ jogetDependencyVersion ที่ถูกต้องเพื่อสร้างไฟล์โปรเจ็กต์ที่เหมาะสมกับการพึ่งพาที่ถูกต้องให้ตรวจสอบชื่อไฟล์ที่ระบุในโฟลเดอร์ ".m2" ภายใต้ไดเรกทอรีของเช่น: C: \ Users \ (ชื่อคอมพิวเตอร์ของคุณ) \. m2 \ repository \ org \ joget \ wflow-core \ "5.0.11"

- เรียกใช้สิ่งต่อไปนี้สำหรับหน้าต่าง

                 - Sample Screenshot in Window:


"C:\Joget Source Code\wflow-plugin-archetype\create-plugin.bat" packageName pluginFolderName jogetDependencyVersion

Run the following for Linux or Mac

/joget_src/wflow-plugin-archetype/create-plugin.sh packageName pluginFolderName jogetDependencyVersion

- Sample Screenshot in Mac:                                                                                                                                        
 

c. Open/Import the maven project with your favorite IDE. Joget team recommends NetBeans IDE.  

7. Just code it!

เพียงแค่รหัส!

a. Extending the abstract class of a plugin type

การขยายคลาสนามธรรมของประเภทปลั๊กอิน

Refer to the document of the plugin type listed in Plugin Types. Find the abstract class and interface that need to be extended and implemented by your plugin.

Example: To develop a Userview Menu plugin, the plugin class need to extends the org.joget.apps.userview.model.UserviewMenu abstract class.

อ้างถึงเอกสารประเภทปลั๊กอินที่ระบุไว้ใน Plugin Types ค้นหาคลาสนามธรรมและอินเทอร์เฟซที่ต้องขยายและนำไปใช้โดยปลั๊กอิน

ตัวอย่าง: ในการพัฒนา Userview Menu plugin คลาสปลั๊กอินจำเป็นต้องขยายคลาสนามธรรม org.joget.apps.userview.model.UserviewMenu

b. Implement all the abstract methods

ใช้วิธีนามธรรมทั้งหมด

A plugin will have to implements the abstract method of Plugin Base Abstract Class and Interface and also the abstract method of the individual abstract class and interface for the plugin type. 

Example: To develop a Userview Menu plugin, the following methods have to be implemented by the plugin. Please refer to the plugin documents for the details of each methods.

ปลั๊กอินจะต้องใช้วิธีการแบบนามธรรมของ Plugin Base Abstract Class and Interface และวิธีการแบบนามธรรมของคลาสนามธรรมส่วนบุคคลและส่วนต่อประสานสำหรับประเภทปลั๊กอิน

ตัวอย่าง: ในการพัฒนา Userview Menu plugin ต้องใช้วิธีการต่อไปนี้โดยปลั๊กอิน โปรดดูเอกสารปลั๊กอินสำหรับรายละเอียดของแต่ละวิธี

  • getCategory
  • getClassName
  • getDecoratedMenu
  • getDescription
  • getIcon
  • getLabel
  • getName
  • getPropertyOptions
  • getRenderPage
  • getVersion
  • isHomePageSupported

c. Manage the dependency libraries of your plugin

จัดการไลบรารีการพึ่งพาของปลั๊กอินของคุณ

The generated plugin folder by "wflow-plugin-archetype" module is a maven project. So, we will using the Dependency Mechanism provided by Maven.

โฟลเดอร์ปลั๊กอินที่สร้างขึ้นโดยโมดูล "wflow-plugin-archetype" เป็นโครงการ maven ดังนั้นเราจะใช้ Dependency Mechanism ที่ Maven จัดหาให้

d. Make your plugin internationalization (i18n) ready

เตรียมปลั๊กอินสากลให้พร้อม (i18n)

To make the plugin i18n ready, we need to create a message resource bundle property file for the plugin.

  • Create a property file with the plugin class name in "[Plugin project directory]/src/main/resources/message" directory. 

    Example: For a plugin named "GanttChartMenu", we need to create a "GanttChartMenu.properties" file under "[Plugin project directory]/src/main/resources/message" directory. 

    Sample content for GanttChartMenu.properties file

    ในการทำให้ปลั๊กอิน i18n พร้อมใช้งานเราจำเป็นต้องสร้างไฟล์คุณสมบัติบันเดิลทรัพยากรข้อความสำหรับปลั๊กอิน

    • สร้างไฟล์คุณสมบัติที่มีชื่อคลาสปลั๊กอินในไดเรกทอรี "[ไดเรกทอรีโครงการปลั๊กอิน] / src / main / resources / message"

              ตัวอย่าง: สำหรับปลั๊กอินชื่อ "GanttChartMenu" เราต้องสร้างไฟล์ "GanttChartMenu.properties" ภายใต้ไดเรกทอรี "[ไดเรกทอรีโครงการปลั๊กอิน] / src / main / resources / ข้อความ"

              เนื้อหาตัวอย่าง สำหรับไฟล์ GanttChartMenu.properties

    org.joget.sample.GanttChartMenu.pluginLabel=Gantt Chart
    org.joget.sample.GanttChartMenu.pluginDesc=To display form data in Gantt Chart layout
    userview.ganttChart.label.title=Title
    userview.ganttChart.label.week=Week
  • Use getMessage(String key, String pluginName, String translationPath) of PluginManager or AppPluginUtil to retrieve i18n label.

    Example: Use the getMessage method in getLabel and getDescription methods to return i18n label and description.

    ใช้ getMessage (คีย์ String, String pluginName, String translationPath) ของ PluginManager หรือ AppPluginUtil เพื่อดึงข้อมูลฉลาก i18n

        ตัวอย่าง: ใช้เมธอด getMessage ใน getLabel และเมธอด getDescription เพื่อส่งคืนเลเบล i18n และคำอธิบาย

    public String getLabel() {
        return AppPluginUtil.getMessage("org.joget.sample.GanttChartMenu.pluginLabel", getClassName(), "message/GanttChartMenu");
    }
    public String getDescription() {
        return AppPluginUtil.getMessage("org.joget.sample.GanttChartMenu.pluginDesc", getClassName(), "message/GanttChartMenu");
    }
  • Pass a translation file path to readPluginResource(String pluginName, String resourceUrl, Object[] arguments, boolean removeNewLines, String translationFileName) method of AppUtil to provide the plugin properties option with i18n label.  We can use "@@message.key@@" in the JSON of Plugin Properties Options.

    Example: For property options of a GanttChartMenu plugin, the following shows the sample code implementation of getPropertyOptions method and the GanttChartMenu.json file

    ผ่านไฟล์การแปลไปยัง readPluginResource (String pluginName, String resourceUrl, อาร์กิวเมนต์ [] บูลีน removeNewLines, String translationFileName) ของ AppUtil เพื่อจัดเตรียมตัวเลือกคุณสมบัติปลั๊กอินที่มีฉลาก i18n เราสามารถใช้ "@@ message.key @@" ในตัวเลือก Plugin Properties Options ของ JSON

        ตัวอย่าง: สำหรับตัวเลือกคุณสมบัติของปลั๊กอิน GanttChartMenu ข้อมูลต่อไปนี้แสดงการใช้งานโค้ดตัวอย่างของวิธีการ getPropertyOptions และไฟล์ GanttChartMenu.json

    public String getPropertyOptions() {
        return AppUtil.readPluginResource(getClassName(), "/properties/GanttChartMenu.json", null, true, "message/GanttChartMenu");
    }
    [{
        title : '@@userview.ganttChart.edit@@',
        properties : [{
            name : 'id',
            label : 'Id',
            type : 'hidden'
        },
        {
            name : 'customId',
            label : '@@userview.ganttChart.customId@@',
            type : 'textfield',
            regex_validation : '^[a-zA-Z0-9_]+$',
            validation_message : '@@userview.ganttChart.invalidId@@'
        },
        {
            name : 'label',
            label : '@@userview.ganttChart.label@@',
            type : 'textfield',
            required : 'True',
            value : '@@userview.ganttChart.label.value@@'
        }]
    }]
  • Pass a translation file path to getPluginFreeMarkerTemplate(Map data, final String pluginName, final String templatePath, String translationPath) method of PluginManager whenever retrieving a HTML template. Once we passed a translation file path, we can use "@@message.key@@" in the freemarker template to retrieve i18n label.

    Example: For getRenderPage method of a GanttChartMenu plugin, the following show the sample code implementation of getRenderPage method and the "GanttChartMenu.ftl" FreeMarker template. 

    ไฟล์การแปลไปที่ getPluginFreeMarkerTemplate (ข้อมูลแผนที่ปลั๊กอิน String สุดท้ายชื่อแม่แบบ String สุดท้ายPath, String translationPath) วิธีการของ PluginManager เมื่อใดก็ตามที่เรียกแม่แบบ HTML เมื่อเราผ่านเส้นทางไฟล์แปลแล้วเราสามารถใช้ "@@ message.key @@" ในเทมเพลต freemarker เพื่อดึงฉลาก i18n

        ตัวอย่าง: สำหรับเมธอด getRenderPage ของปลั๊กอิน GanttChartMenu ต่อไปนี้จะแสดงการใช้งานโค้ดตัวอย่างของเมธอด getRenderPage และเท็มเพลต "GanttChartMenu.ftl" FreeMarker

        public String getRenderPage() {
            Map model = new HashMap();
            model.put("request", getRequestParameters());
            model.put("element", this);
            
            PluginManager pluginManager = (PluginManager)AppUtil.getApplicationContext().getBean("pluginManager");
            String content = pluginManager.getPluginFreeMarkerTemplate(model, getClasstName(), "/templates/GanttChartMenu.ftl", "message/GanttChartMenu");
            return content;
        }
    <div>
        <h1>@@userview.ganttChart.label.title@@ : ${element.properties.title!}</h1>
    </div>
  • Postfix the plugin class name with an underscore and language code to create a message resource bundle property file for other language. 

Example: GanttChartMenu_zh_CN.properties

โพสต์ชื่อคลาสปลั๊กอินด้วยการขีดเส้นใต้และรหัสภาษาเพื่อสร้างไฟล์คุณสมบัติบันเดิลทรัพยากรข้อความสำหรับภาษาอื่น

   ตัวอย่าง: GanttChartMenu_zh_CN.properties

e. Register your plugin to the Felix Framework

ลงทะเบียนปลั๊กอินของคุณไปที่ Felix Framework

You will find that a class named "Activator.java" is auto generated in a package of your plugin maven project. The class is used to register your plugin class to the Felix Framework. You do not need to do this if your plugin is not an OSGI Plugin.

In the start method of the activator class, add your plugin class to the "registrationList" variable.

คุณจะพบว่าคลาสที่ชื่อว่า "Activator.java" นั้นสร้างขึ้นโดยอัตโนมัติในแพ็คเกจของโปรเจ็กต์ maven ของคุณ คลาสนี้ใช้เพื่อลงทะเบียนคลาสปลั๊กอินของคุณไปที่ Felix Framework คุณไม่จำเป็นต้องทำเช่นนี้หากปลั๊กอินของคุณไม่ใช่ OSGI Plugin

ในวิธีเริ่มต้นของคลาส activator ให้เพิ่มคลาสปลั๊กอินของคุณลงในตัวแปร "registrationList"

public void start(BundleContext context) {
    registrationList = new ArrayList<ServiceRegistration>();

    //Register plugin here
    registrationList.add(context.registerService(MyPlugin.class.getName(), new MyPlugin(), null));
}

f. Build it and testing

สร้างและทดสอบ

Once you are done with all the steps above, you can build your project with your IDE using Maven. You can also run "mvn clean install" command in your project directory to build it. After building your project, a jar file is created under "target" folder in your plugin project folder. Upload the plugin jar to Manage Plugins to test your plugin.

Example: In NetBeans, right-click on the project name, then select "Clean and Build".

เมื่อคุณทำตามขั้นตอนทั้งหมดข้างต้นเสร็จแล้วคุณสามารถสร้างโครงการของคุณด้วย IDE ของคุณโดยใช้ Maven คุณยังสามารถเรียกใช้คำสั่ง "mvn clean install" ในไดเรกทอรีโครงการของคุณเพื่อสร้าง หลังจากสร้างโครงการของคุณไฟล์ jar จะถูกสร้างขึ้นภายใต้โฟลเดอร์ "ปลายทาง" ในโฟลเดอร์โครงการปลั๊กอินของคุณ อัปโหลดโถปลั๊กอินไปที่ Manage Plugins เพื่อทดสอบปลั๊กอินของคุณ

ตัวอย่าง: ใน NetBeans คลิกขวาที่ชื่อโครงการจากนั้นเลือก "ล้างและสร้าง"


8. Take a step further, share it or sell it

ก้าวไปอีกขั้นแบ่งปันหรือขายมัน

You have completed a very useful plugin. Don't just keep it to yourself, share or sell your plugin in the Joget Marketplace or even better, you can write a tutorial in our Knowledge Base to share your effort with others. To share or sell your plugin, please send an email to info@joget.org.

คุณทำปลั๊กอินที่มีประโยชน์มากเสร็จสมบูรณ์แล้ว อย่าเพียงเก็บไว้เป็นของตัวเองแบ่งปันหรือขายปลั๊กอินของคุณใน Joget Marketplace หรือดีกว่าคุณสามารถเขียนบทแนะนำในฐานความรู้ของเราเพื่อแบ่งปันความพยายามของคุณกับผู้อื่น หากต้องการแบ่งปันหรือขายปลั๊กอินของคุณโปรดส่งอีเมลไปที่ info@joget.org





  • No labels