Behaviour of custom field and dynamic variables (izpack 5.1.2)

159 views
Skip to first unread message

Juan. Tecknolab

unread,
Mar 9, 2018, 4:59:14 AM3/9/18
to izpack-user

Hi,

 

I am trying to mimic (with some variations) the example of custom fields in the izpack documentation, specifically, this one:

 

<field id="activemq.connection.panel.title" type="title"/>

<field align="left" id="activemq.connection.description" type="staticText"/>

<field type="space"/>

<field maxRow="10" minRow="1" type="custom" variable="activemq.connection.count">

  <spec>

    <col>

      <field type="rule" variable="activemq.connection.address">

        <spec default="tcp://localhost:7000" id="activemq.connection.url.label" layout="O:5:U :// O:15:U : N:5:5" resultFormat="displayFormat"/>

      </field>

      <validator class="com.izforge.izpack.panels.userinput.validator.UniqueValidator" id="activemq.connection.host.unique"/>

    </col>

  </spec>

</field>

 

First thing I have noticed, activating the -debug -stacktrace option is that the layout pattern is generating exceptions due to the ":" that is separating the pieces of content. The exception is:

Failed to parse: :

com.izforge.izpack.api.exception.IzPackException: Invalid no. of tokens: 0 in rule: :

 

If I change the character separator in layout, it also fails (with invalid number of tokens, 1 instead of 0). In any case, the setup proceeds so it is a ‘minor’ issue.

The real problem in my case is that the panel is ignoring the new value in dynamic variable variables (e.g. activemq.connection.address.<n>). I am presetting in install.xml a dynamic variable <activemq.connection.address.1 as whatever ‘blank’ value  (eg. “-://-:0000”). Then, by a piece of java code in a previous panel validator, I am setting the activemq.connection.address.1 as e.g. “tcp://realhost:8080” and I see at log that the variable is set to the new value. But when I press next to go to the panel I see in the logs the message “refreshing dynamic variables…” and the values refreshed are the ones I had at the beginning. This behavior is not happening in other situations and panels (updated values are preserved), only in this one.

Any idea?

Juan. Tecknolab

unread,
Mar 9, 2018, 3:25:16 PM3/9/18
to izpack-user

After further investigation, the behaviour of dynamic variables is quite strange under my opinion (independent of the custom field).

- If I initialize a dynamic variable in the install.xml and then the variable is modified by java code (e.g. in a panel validator using the installData interface), the modification is ignored in the next dynamic variables refresh (e.g. when moving out from this panel). However, it the variable is not initialized in the install.xml, the value set in the java code is preserved, even if the variable does not appear on logs (the variable is not listed in the "refreshing dynamic variables" log message).

I don't believe this is an expected behaviour,, isn't it?

Juan. Tecknolab

unread,
Mar 12, 2018, 4:40:15 AM3/12/18
to izpack-user
And, finally, regarding the custom field behaviour there is something not expected under my logic... I know that the panels are created at the installer startup; OK, that's fine. But if I create a custom field with (e.g. 3 rows), the values of "<variable_row>.1" ... "<variable_row>.3" are read at the startup as well and not refreshed. If the value of any of this dynamic variables changes afterwards (but before the panel is shown), the value is not refreshed in the panel. This IMHO breaks the logic of dynamic variables; it seems the panel should read the value of the variables right before being activated and not only at startup.

Reply all
Reply to author
Forward
0 new messages