[izpack-users] Variables in custom panel are not passed as IzPack variables

Klaus Bartz bartzkau at gmx.net
Tue Jan 3 11:05:25 CET 2006


Hi Yossi,
seems so you have overcomes the bigest obstaclethe starting developing
IzPack panels; the API of panels and to create the WarPathPanel.jar
and put it into $IZ_HOME/bin/panels.
Seems so that the AntInstallerListener will be also start.

I hope your first custom panel will be shown at installation!

I have not tested your panel code, but it seems OK. Only one question
context related...
myAntActionSpec is a little bit wrong (see context related).
UploadFile.xml can be discussed...

I do not know whether you know following or not:
There is one point which will be a little bit "magic" if you do not
know the source code: How can I use own messages.
Simple declare them in the locale files with the right key, no more
references are neede.
For messages we have two xml files for each language; the needed
(and existent) one will be placed in
$IZ_HOME/bin/langpacks/installer/<ISO3>.xml
If you declare e.g.
<str id="WarPathPanel.intro" txt="common user blah blah" />
This messages will be placed on the top of the panel. There are the
messages:
<myPanel>.intro
<myPanel>.info
<myPanel>.required
<myPanel>.notValid
<myPanel>.notwritable
<myPanel>.empty_target
<myPanel>.warn
Not all are used in all sub classes of PathInputPanel.
And for the summary
<str id="WarPathPanel.summaryCaption" txt="Path of JBoss war file"/>



Am 03.01.2006, 10:10 Uhr, schrieb Yossi Baram <yossiba at eldat.com>:

> Hi,
> I need the user to specify the location of a certain file and later on
> to copy it into a specific location.
> The custom panel:
> public class WarPathPanel extends PathInputPanel
> {
>  public WarPathPanel(InstallerFrame parent, InstallData idata)
>   {
>     super(parent, idata);

//Has Advantag.war to be exist before installation?? If so, add
	setMustExist(true);
	setExistFiles("Advantag.war");

>   }
>  public boolean isValidated()
>   {
>     boolean retval = super.isValidated();
>     String chosenPath = pathSelectionPanel.getPath();
>     if(chosenPath == null || chosenPath.length() < 1 )
>       return( false );
>     idata.setVariable("Jboss.WarFile",chosenPath);
>    return( true );
>   }
>  public void panelActivate()
>   {
>     super.panelActivate();
>     String chosenPath;
>     if( idata.getVariable("Jboss.WarFile") != null )
>       chosenPath = idata.getVariable("Jboss.WarFile");
>     else
>       chosenPath = idata.getInstallPath();
>     pathSelectionPanel.setPath(chosenPath);
>   }
>   public String getSummaryBody()
>   {
>     return(String) ( idata.getVariable("Jboss.WarFile"));
>   }
> }
> myAntActionSpec:
> <antactions>
> <pack name="Upload files">
>  <antcall quiet="yes"
>    buildfile="$INSTALL_PATH/compile/UploadFiles.xml"
>    order="afterpacks">
>    <property name="WAR" value="Jboss.WarFile"/>

At this point you have to write that it is a variable.
Do not forget the brackets because we use a special char
(the dot).

      <property name="WAR" value="${Jboss.WarFile}"/>

>     <target name="compile" />
>   </antcall>
>  </pack>
> .......
> .......
> </antactions>
> UploadFile.xml:
> <?xml version="1.0"?>
> <project name="AdvanTAG Installer" default="compile" basedir=".">
>  <target name="prepare">
>         <record name="${UPLOAD_LOG_FILE}" action="start"/>
>         <copyfile src="${WAR}\Advantag.war" dest="c:\Eldat Common
> Path\Advantag.war"/>

Uups, a fixed path as dest?? Not really...

>          <record name="${UPLOAD_LOG_FILE}" action="stop"/>
>   </target>
>   <target name="compile" depends="prepare"
>         description="Compiles all source code.">
>   </target>
> </project>
> I  inserted the panel to install.xml and it compiles.
> Running the installation and setting the path of advantag.war in the
> custom panel(should set the "Jboss.WarFile" variable), after running the
> InstallPanel I get an InstallerExecption in the UploadFile.xml file -
> src d:\Installation\Jboss.WarFile\Advantag.war  does not exist.
> Why didnt the Jboss.WarFile variable was set according to the path that
> was set in the custom panel?
> Please advise
> Yossi
>
>
> __________ NOD32 1.1349 (20060102) Information __________
>
> Diese E-Mail wurde vom NOD32 Antivirus System geprüft
> http://www.nod32.com
>

Cheers

Klaus




More information about the izpack-users mailing list