[izpack-users] How can I create a panel and not display it?

Klaus Bartz bartzkau at gmx.net
Mon Feb 20 13:06:29 CET 2006


Hi Yossi,
you can perform your actions in a custom action or a custom panel.
The right place for such actions are "custom actions", but may
be it will be more easy for you to use a custom panel for it, if you
have already written some.
Additional custom actions current are only possible during installation
(before or after Pack(s)).

In IzPanels you have access to all InstallData via the class variable
"idata" e.g. for the install path
idata.getInstallPath();
If you would do something in an IzPanel but nothing see, do your work in
the method
   public void panelActivate()
   {
     // Do your work
     parent.skipPanel();
     return;
   }

and skip the panel after the work. You know, some one will say this is
a hack...
Be aware that the time your work need the panel will block. May be
use an other thread in your work.
If you use skipPanel in method panelActivate, never forget the
following return also you do not need in this special case.

As an example for a simple custom action one of my "private" with which
I generate path variables for Unix and Windows script files.
Most work will be to understand how to add a custom action to the  
installation
(see the docu).
------------------------------------------------------------
package com.coi.tools.install.listener;

import com.izforge.izpack.event.SimpleInstallerListener;
import com.izforge.izpack.installer.AutomatedInstallData;
import com.izforge.izpack.util.AbstractUIProgressHandler;
import com.izforge.izpack.util.IoHelper;

/**
  * Installer custom action for modifying IzPack variables
  * before packs will be installed at client installations.
  * This is used to create some IzPack variables which are
  * used at installation.
  * This custom action needs no resource file.
  * @author  Klaus Bartz
  * @version @(#) $Revision: 1.3 $ $Date: 2005/03/10 10:52:17 $
  *
  */
public class ClVariableModifierInstallerListener
   extends SimpleInstallerListener
{

   /**
    * Default constructor.
    */
   public ClVariableModifierInstallerListener()
   {
     super(false);
   }
   /* (non-Javadoc)
    * @see  
com.izforge.izpack.event.InstallerListener#beforePacks(com.izforge.izpack.installer.AutomatedInstallData,  
java.lang.Integer, com.izforge.izpack.util.AbstractUIProgressHandler)
    */
   public void beforePacks(AutomatedInstallData idata, Integer npacks,
           AbstractUIProgressHandler handler) throws Exception
   {
     super.beforePacks(idata, npacks, handler);
     // Create path vars with a fixed notation.
     String tmp = idata.getInstallPath();
     tmp  = IoHelper.replaceString(tmp,"\\", "/");
     idata.setVariable("InstallPathUNIX",tmp);
     tmp  = IoHelper.replaceString(tmp,"/", "\\");
     idata.setVariable("InstallPathDOS",tmp);

   }



}
------------------------------------------------------------


Cheers

Klaus


Am 20.02.2006, 09:05 Uhr, schrieb Yossi Baram <yossiba at eldat.com>:

> Hi,
> I need to perform some actions after TargetPanel is activated.
> My code (creating a file) is currently added to TargetPanel class (I
> need InstallData object to retrieve Install_Path value) but I dont want
> it to be that way.
> I can create a new panel but for that I need to retrieve InstallData
> object and not to display it.
> Can I do it?
> Is it better to create a custom panel? but then again, I need to have
> the InstallData with Install_Path value and not display it.
> Please advise
> Thanks
> Yossi
>



More information about the izpack-users mailing list