Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Izpack: Creating custom panels

I am trying to create a custom panel for an IzPack installer. This means that I have to extend IzPanel. However, it appears that if I do this, the extended panel needs to be in the com.izforge.izpack.panels package.

Then I found this post, which stipulates that:

  1. As such, you must include installer.jar from the lib folder of IzPack in the build path of your custom panel project.
  2. Your custom panel /must/ extend com.izforge.izpack.installer.IzPanel.
  3. Furthermore, it /must/ reside in the com.izforge.izpack.panels package.
  4. On top of it all, your build jar's name /must/ be the same as the unqualified name of your custom panel class.

I take issue with the 1st and 4th points. They imply that I have to create an additional JAR file for each custom IzPanel that I create. Also, I would have to modify the IzPack installation by adding these JARs to one of its subdirectories.

Is this article outdated (2008) and can it be safely ignored, or is this still true?
If not how can I avoid this and simply have the extended IzPanel on the classpath instead?

Thank you!

like image 413
bguiz Avatar asked Mar 26 '10 00:03

bguiz


1 Answers

Okay, I take it you want to have your panels in a single jar within your own package.

This is how you do it:

  1. Create your jar with all of your custom panels
  2. Copy that jar to the IzPackStagingFolder\bin\panels
  3. Edit the installer descriptor and under the panels sections reference your CustomPanels.jar

Then inside your install.xml you define your panels sections similar to:

...
<panels>
    <panel classname="HTMLInfoPanel"          id="infopanel" encoding="ISO-8859-1" />
    <panel classname="TargetPanel"            id="targetpanel" />
    <panel classname="com.myCompany.installer.panels.MyCustomPanelOne"     id="customPanelOne" jar="bin/panels/CustomPanels.jar" />
    <panel classname="UserInputPanel"         id="userInputPanel" />
    <panel classname="InstallPanel"           id="installPanel" />
    <panel classname="ProcessPanel"           id="processPanel" />
    <panel classname="com.myCompany.installer.panels.MyCustomPanelTwo"   id="customPanelTwo" jar="bin/panels/CustomPanels.jar" />
    <panel classname="FinishPanel"            id="finishPanel" />
</panels>
...

Where CustomPanels.jar can be a single maven project with your own panels in your own package with two classes CustomPanelOne and CustomPanelTwo both extending IzPanel.

For more info see IzPack's older 4.x documentation at https://izpack.atlassian.net/wiki/spaces/IZPACK/pages/491534/Creating+Panels. As of right now the newer IzPack 5.x doc wiki is missing this section.

Also reffer to the XML DTD at https://github.com/izpack/izpack/blob/4.3/src/dtd/installation.dtd

like image 154
Paul Bors Avatar answered Sep 20 '22 22:09

Paul Bors