Antwort: [izpack-users] Disable/Enable or Select/Deselect packs based on a variable

Martina.Albrecht at curiavant.de Martina.Albrecht at curiavant.de
Tue Mar 7 10:26:42 CET 2006


To enable/disable packs, I used the installGroups attribute in the packs
configuration and added the following lines at the beginning of method
panelActivate() for my PacksPanel:

        List suitablePacks = new ArrayList();
            HashSet installGroups = new HashSet();
            installGroups = null;
            String installtype = idata.getVariable("installtype");
            Iterator packs = (idata.availablePacks).iterator();
            while (packs.hasNext()) {
                  Pack pack = (Pack) packs.next();
                  installGroups = (HashSet) pack.installGroups;
                  if (installGroups.isEmpty() ||
installGroups.contains(installtype))
                        suitablePacks.add(pack);
                  installGroups = null;
            }

            packsTable.setModel(new PacksModel(suitablePacks,
idata.selectedPacks, this));

It's similar to what Hal already suggested, but you shouldn't alter iData
directly - this was my first solution and it turned out to be a problem
when pressing the back button :).

Martina



|---------+----------------------------->
|         |           "Rich Stephens"   |
|         |           <rstephens at pathfir|
|         |           e.com>            |
|         |           Gesendet von:     |
|         |           izpack-users-admin|
|         |           @berlios.de       |
|         |                             |
|         |                             |
|         |           06.03.2006 23:21  |
|         |           Bitte antworten an|
|         |           izpack-users      |
|         |                             |
|---------+----------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                               |
  |       An:       <izpack-users at lists.berlios.de>                                                                               |
  |       Kopie:                                                                                                                  |
  |       Thema:    [izpack-users] Disable/Enable or Select/Deselect packs based on a variable                                    |
  >-------------------------------------------------------------------------------------------------------------------------------|




I have a need to set whether a pack is available to be installed based
on a variable set at install time.

I have a hidden custom panel that does some system checks and determines
things about the current installation and sets a variable, let's call it
"install_type".  In this case, I would like certain packs to be
preselected (and others to be completely disabled) if "install_type" is
set to "server", and a different set of panels to be preselected (and
again, others disabled) if "install_type" is set to "client".

I see and understand packs dependencies where one pack depends upon the
selection of another, but there doesn't appear to be a way to set a pack
to be dependent upon the value of a variable.

If that feature doesn't exist (and it appears that it doesn't) could
someone point me to the best place in the code to check for and
disable/enable and/or select/deselect a panel based on a variable value?
I know how to check a variable's value, but I'm unsure of the best place
in the code to go about trying disable/enable/select/deselect a panel on
the fly based on a variable.

Any suggestions would be greatly appreciated.

Thanks,
Rich Stephens
Pathfire, Inc.

_______________________________________________
izpack-users mailing list
izpack-users at lists.berlios.de
http://lists.berlios.de/mailman/listinfo/izpack-users








More information about the izpack-users mailing list