IzPack

UserInputPanel checkbox does not set properly

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 3.11.0
  • Fix Version/s: 4.0.0
  • Component/s: Panels
  • Labels:
    None
  • Number of attachments :
    0

Description

When a checkbox is created in addCheckBox() the variable is read in case it has been previously set and is compared against boolean values instead of the spec values. This creates a situation where the checkbox does not represent the variable state.

For example, if I use 1 and 0 for true and false, and preset the variable to 1; the checkbox will render as unchecked because the spec "set" value is ignored and the variable value used. Since the variable value is not boolean, it will always evaluate to false.

install.xml

<variables>
<variable name="the.variable" value="1"/>
</variables>

userInputSpec.xml

<field type="check" align="left" variable="the.variable">
<spec txt=" Set Me" true="1" false="0" set="true"/>
</field>

Activity

Hide
Jeff Gordon added a comment -

Made the following change in UserInputPanel, will commit if there are no objections:

if (value != null)

{ set = value; }

Changed to:

if (value != null)
{
// Default is not checked so we only need to check for true
if (value.equals(trueValue)) { set = TRUE; }
}

Show
Jeff Gordon added a comment - Made the following change in UserInputPanel, will commit if there are no objections: if (value != null) { set = value; } Changed to: if (value != null) { // Default is not checked so we only need to check for true if (value.equals(trueValue)) { set = TRUE; } }
Hide
Julien Ponge added a comment -

You can go ahead for inclusion in 4.0.0.

Show
Julien Ponge added a comment - You can go ahead for inclusion in 4.0.0.
Hide
Jeff Gordon added a comment -

Committed as proposed.

Show
Jeff Gordon added a comment - Committed as proposed.
Hide
Julien Ponge added a comment -

The issue is confirmed to be closed.

Show
Julien Ponge added a comment - The issue is confirmed to be closed.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: