[izpack-user] Izpack - Dynamic controls in userinputspec.xml file doesn't work

540 views
Skip to first unread message

Latha Elangovan

unread,
Jan 27, 2010, 7:19:59 PM1/27/10
to us...@izpack.codehaus.org
Hi All,
 
I am new to Izpack and I am trying to use the UserInputPanel to get certain information from the user, like whether tomcat is installed already. I am using Izpack 4.3.3

If tomcat was installed already I am trying to dynamically update a text and trying to get the installation location.

But the text to be displayed doesn’t get updated irrespective of user’s selection. I am using revalidate="yes" flag for the radio button choices and a conditionid for the controls to be dynamically displayed.

Please find below the contents of a very basic install.xml and UserInputSpec.xml.

UserInputSpec.xml:
<userInput>

<panel order="0" topBuffer="0">

<field type="staticText" align="left"
txt="staticText.text" id="Please select from one of the following options:"/>

<field type="radio" variable="tomcat" >
<description align="left" txt="This is a description for radio buttons"
id="tomcat.text"/>
<spec>
<choice txt="Tomcat-6 installed already"
id="tomcat.installed" value="installed" revalidate="yes" />
<choice txt="Tomcat not installed"
id="tomcat.not_installed" value="not_installed" set="true" revalidate="yes" />
</spec>

</field>

<field type="divider" align="center"/>

<!--<conditions>
<condition type="variable" id="condn_inst">
<name>installed</name>
<value>inst</value>
</condition>
<condition type="variable" id="condn_not_inst">
<name>not_installed</name>
<value>ninst</value>
</condition>
</conditions>-->

<conditions>
<condition type="variable" id="not_installed">
<name>tomcat.not_installed</name>
<value>not_installed</value>
</condition>

<condition type="variable" id="installed">
<name>tomcat.installed</name>
<value>installed</value>
</condition>
</conditions>

<field type="staticText" align="left" conditionid="not_installed"
txt="staticText.text" id="Please select the install folder for tomcat-6 installation:"/>

<field type="staticText" conditionid="installed" align="left"
txt="staticText.text" id="Please select the existing tomcat-6 install folder:"/>

<field type="dir" align="left" variable="tomcat.home" >
<spec txt="" size="25" set="" />
<!--<validator class="com.izforge.izpack.util.NotEmptyValidator" txt="You must select the directory for tomcat!"/>-->

</field>

</panel>

</userInput>

Now the install.xml:


<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

<installation version="1.0">

<info>
<appname>AML Demo Installation</appname>
<appversion>1.0</appversion>
<authors>
<author name="Joe Bloggs" email="joe.b...@test.com"/>
</authors>
<url>http://www.anotherworld-inspace-website.net/</url>
</info>

<guiprefs width="640" height="480" resizable="yes"/>
<locale>
<langpack iso3="eng"/>
<langpack iso3="fra"/>
</locale>

<resources>
<res id="LicencePanel.licence" src="Licence.txt"/>
<res id="InfoPanel.info" src="Readme.txt"/>
<res id="userInputSpec.xml" src="UserInputSpec.xml"/>
</resources>


<panels>
<panel classname="HelloPanel"/>
<panel classname="InfoPanel"/>
<panel classname="LicencePanel"/>
<panel classname="UserInputPanel"/>
<panel classname="TargetPanel"/>
<panel classname="PacksPanel"/>
<panel classname="InstallPanel"/>
<panel classname="FinishPanel"/>
</panels>

<packs>
<pack name="Tomcat Server" required="yes">
<description>Tomcat files</description>
<file src="Readme.txt" targetdir="$INSTALL_PATH"/>
</pack>

</packs>

</installation>




2. Also I would like to pass the user selected input whether the tomcat has been installed or not to the next panel - InstallPanel, which I am not sure as well.


Please help me to identify the issues. I have spent nearly 2 days now, but didn't get any where. I am so desperate, please help me.

Any help would be highly appreciated.


Thanks in advance,

Latha
 




Start searching NOW! Search for properties that match your lifestyle!

Soula, William

unread,
Jan 28, 2010, 8:00:44 AM1/28/10
to us...@izpack.codehaus.org
Hi Latha,
I am new to IzPack as well, but I have a few suggestions.  I don't think IzPack will redraw a screen you are on.  I think you will have to put the text you want to display on another panel, then when you click next after selecting if tomcat is installed it will evaluate the conditions and draw the correct text.  To use the user selected input on the next panel you just call the variable name.  I don't know exactly what you want to do but I use the previous input as the set for the current panel (I have several panels that are essentially the same) like <spec ... set="${tomcat}"/> (to use your variable below).  You could also keep using the conditionid if you want to display something or not.  Hope this helps :)

Will


Latha Elangovan

unread,
Jan 28, 2010, 4:26:43 PM1/28/10
to user izpack
Hi Will,
Thanks for your feedback. Basically I wanted to check whether the user has installed tomcat already. If installed , I wanted to get the current installation location. If not I wanted him to input the location where he would like to install it.
 
Now depending upon the radio button he has selected, for instance if user has clicked the radio button tomcat.not_installed, then I would like to install
1. tomcat
2. the web service,
3. demo application etc., under the folder the user provides
 
If user has selected the radio button tomcat.installed, then I would like to get the user's tomcat install folder and simply install
1. the web service and
2. demo app under this folder
 
I am not sure how I can get the selected radio button value in the following panel. Can you provide a simple example?
I am not sure what you meant by:

 
I use the previous input as the set for the current panel 
 
Thanks,
Latha

 

From: wso...@pointserve.com
To: us...@izpack.codehaus.org
Date: Thu, 28 Jan 2010 07:00:44 -0600
Subject: Re: [izpack-user] Izpack - Dynamic controls in userinputspec.xml file doesn't work

If It Exists, You'll Find it on SEEK Shopping Trolley Mechanic

Soula, William

unread,
Jan 28, 2010, 4:54:36 PM1/28/10
to user izpack
I don't think your conditions are correct, I've been doing it the way I corrected below.  Can you use the radio id as the <name> element in a <condition>?

<conditions>
<condition type="variable" id="not_installed">
<name>tomcat</name>
<value>not_installed</value>
</condition>

<condition type="variable" id="installed">
<name>tomcat</name>

<value>installed</value>
</condition>
</conditions>

To get the selected radio button value in the following panel you just use the variable name.  ${tomcat} and it will have the value (in your example) of installed or not_installed.  Although it seems more like you want to use the conditions on the following panel and in your pack instead of the actual value of the radio.  Then when you go to install it will only install tomcat if tomcat is not installed.

What I meant by my comment is that in my installer I am installing several instances of a server, so the previous panel might have something like:
<field type="text" variable="testVar">
       <spec txt="Test:" set="default"/>
</field>

Then in the next panel I'll have:
<field type="text" variable="testVar2">
       <spec txt="Test:" set="${testVar}"/>
</field>


Latha Elangovan

unread,
Jan 28, 2010, 7:18:12 PM1/28/10
to user izpack
Hi William,
 
Thanks very much for your updates. Yes you are correct, the conditions definitions should be as explained by you.
But I had my conditions defined in the userInputSpec.xml file, so even after fixing them as per your suggestion it didn't work. Later while checking the Izpack documentation, I noticed that the conditions need to be defined in a separate xml file. So I removed my conditions from userinputspec.xml to conditions.xml file. Then it started working.
 
Thanks very much William. Your prompt reply is really appreciated.
 
Thank you,
Date: Thu, 28 Jan 2010 15:54:36 -0600

Abhijith Venkatesh

unread,
Nov 28, 2013, 6:15:39 AM11/28/13
to izpac...@googlegroups.com, user izpack, wso...@pointserve.com
Can anybody please post the complete flow? I mean from install.xml we call userInputSpec.xml. There I'm using 2 radio buttons viz. 'express installation' and 'enterprise installation'. Based on the selection of radio button, I've to decide the which packs to display in install.xml.
If this is possible, please some one post the complete flow (screenshots would be of great use).
Reply all
Reply to author
Forward
0 new messages