install4j

Can I reset File Association checkboxes to their original values without leaving that screen? (e.g. "Reset to defaults" button)


I'd like to implement a "Reset to defaults" button on the File associations selection screen, but the File associations selector component seems a little different from other more basic components.

For a start, the list of checkboxes must be created from the number of Create a file association actions found later on in the installer. Also the getConfigurationObjectClass() and getConfigurationObject() methods on the component both return null (presumably because this isn't a single JComponent).

The reason for wanting a "Reset to defaults" is that our default selection is a selection of the file associations that are presented to the user, so the Select All button is not sufficient.

I've got an ID naming scheme on the Create file association actions so that I can get all of these and even set/change the selected value to true or false as appropriate, but the formEnvironment.reinitializeFormComponents() call does not update the appearance of the File association selector component. I've tried various combinations of formComponent.initialize(), formEnvironment.resetFormComponents().

The best I've been able to do is use a context.gotoScreen(this_screen) which updates the checkboxes to the most recently accepted values (which is not exactly what I'm after, I'd like to reset them all to the original values), but also adds an extra File association screen into the "Back" history.

Is there anything else I should try?


Solution

  • For 10.0.9, we will add a resetSelections() method to the form component class com.install4j.runtime.beans.formcomponentsFileAssociationsComponent that you can call in a script after casting the form component object to the above class.

    Please contact support@ej-technologies.com to get a build where this is already implemented.