[izpack-users] izpack variable issue

Mandeep Saini Mandeep.Saini at dante.org.uk
Wed Dec 20 19:48:59 CET 2006


Hi Carmel,

Try this :
else if (RULE_FIELD.equals(element[POS_TYPE]))
{
    RuleInputField rulef = (RuleInputField) element[POS_FIELD];
    String variable = (String) element[POS_VARIABLE];
    for (int l = 0; l < rulef.getNumFields(); l++) {
  	 value = idata.getVariable(variable + '.' + l);
          if (value != null && value.length() > 0)
          rulef.setFieldContents(value, l)
    }
}

How you are taking the value of port number at run time. if you are 
taking it from user then you must be storing it inside a variable say 
'port' declared in Install.xml.

If we assume that variable name is 'port' then you have to write:
  <field type="rule" variable="AppServerPort">
    <description align="left" txt="" id="description1.text"/>
    <spec txt="Enter web site port:" layout="N:15:5" set="0:${port}"/>
    validator class="com.izforge.izpack.util.NotEmptyValidator" 
txt="Please enter a valid port number"/>
</field>	

and in Install.xml you can define the default value of port variable as 
8888.

I think this will help bcoz its working for me.

Mandeep	

Carmel Morrissey wrote:
> Hi Mandeep
> 
> The update of the RULE_FIELD does not work within UserInputPanel
> updateUIElements method asI would have expected.  The value is not getting
> updated within the RuleInputField.  There is no setText() method or similar
> with the RuleInputField class.  I would have expected similar processing as
> the TEXT_FIELD functionality.
> 
> 		else if (TEXT_FIELD.equals(element[POS_TYPE]))
>             {
>                 // update TextField
>                 JTextField textf = (JTextField) element[POS_FIELD];
> 
>                 // System.out.println("Textfield: " + value);
>                 if (value == null)
>                 {
>                     value = textf.getText();
>                 }
>                 textf.setText(vs.substitute(value, null));
>                 element[POS_FIELD] = textf;
>             }
> 		else if (RULE_FIELD.equals(element[POS_TYPE]))
>             {
> 
>                 RuleInputField rulef = (RuleInputField) element[POS_FIELD];
>                 // System.out.println("RuleInputField: " + value);
>                 if (value == null)
>                 {
>                     value = rulef.getText();
>                 }               
>             }
> 
> Is there any easy way of updating the text within the RuleInputField?
> 
> In particular I want to update NODE 'set' within ELEMENT 'spec' (see sample
> excerpt from userInputSpec.xml.  I want to update the default port 8888 to a
> value set at runtime.
> 
> <field type="rule" variable="AppServerPort">
>   <description align="left" txt="" id="description1.text"/>
>   <spec txt="Enter web site port:" layout="N:15:5" set="0:8888"/>
>   validator class="com.izforge.izpack.util.NotEmptyValidator" txt="Please
> enter a valid port number"/>
> </field>			
> 
> Any ideas?
> 
> Thanks!
> Carmel
> 
> 
> 
> 
> -----Original Message-----
> From: Mandeep Saini [mailto:Mandeep.Saini at dante.org.uk] 
> Sent: 20 December 2006 15:54
> To: izpack-users at lists.berlios.de
> Subject: Re: [izpack-users] izpack variable issue
> 
> Hi Carmel,
> 
> Try to checkout the recent IzPack from SVN repository on 
> http://svn.berlios.de/svnroot/repos/izpack/izpack-src/trunk/. You will 
> get the latest code here.
> 
> Regards
> Mandeep
> 
> 
> Carmel Morrissey wrote:
>> Hi Mandeep
>>
>> I have downloaded the latest source code from IzPack and the
> UserInputPanel
>> class does not contain any updateUIElements method.  Would it be possible
> to
>> get a copy of the code?  I am trying to update default values on the
>> UserInputPanel at runtime.
>>
>> Regards
>> Carmel
>>
>> -----Original Message-----
>> From: Mandeep Saini [mailto:Mandeep.Saini at dante.org.uk] 
>> Sent: 20 December 2006 11:43
>> To: izpack-users at lists.berlios.de
>> Subject: Re: [izpack-users] izpack variable issue
>>
>> Hi Sonal,
>>
>> In IzPack graphical interface is build only once and it happens in the 
>> very beginning so if you are setting a field with the value of a 
>> variable which you are taking as input from user will not be displayed 
>> in the field because the graphical interface was already build at that 
>> time and will not be able to show the recent value.
>>
>> But if you checkout the recent IzPack from the trunk then its possible. 
>> Because a new method updateUIElements has been added in the 
>> UserInputPanel class which  updates the UI elements. Although it has not 
>> been implemented completely  . It updates the rule field, text field but 
>> doesn't do it for search field and other fields. But you can write your 
>> own code to update Search field inside this method.
>>
>> Hope this will help you.
>>
>> Regards
>> Mandeep
>> sonal.deshpande at tcs.com wrote:
>>> Hi,
>>> I want to use a variable for file tag in search field in
> userInputSpc.xml.
>>> e.g:
>>> <field filename=VAR type="search" variable="db2_home">
>>> where VAR is variable set in some radiobutton control.
>>> Is it possible and how?
>>>
>>>
>>> Regards
>>>
>>> Sonal B Deshpande
>>> Tata Consultancy Services
>>> Mailto: sonal.deshpande at tcs.com
>>> Website: http://www.tcs.com
>>> =====-----=====-----=====
>>> Notice: The information contained in this e-mail
>>> message and/or attachments to it may contain 
>>> confidential or privileged information. If you are 
>>> not the intended recipient, any dissemination, use, 
>>> review, distribution, printing or copying of the 
>>> information contained in this e-mail message 
>>> and/or attachments to it are strictly prohibited. If 
>>> you have received this communication in error, 
>>> please notify us by reply e-mail or telephone and 
>>> immediately and permanently delete the message 
>>> and any attachments. Thank you
>>>
>>>
>>> _______________________________________________
>>> izpack-users mailing list
>>> izpack-users at lists.berlios.de
>>> https://lists.berlios.de/mailman/listinfo/izpack-users
>> _______________________________________________
>> izpack-users mailing list
>> izpack-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/izpack-users
>> _______________________________________________
>> izpack-users mailing list
>> izpack-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/izpack-users
> 
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users




More information about the izpack-users mailing list