<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -32,12 +32,14 @@ import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
+import com.izforge.izpack.Pack;
 import com.izforge.izpack.Panel;
 import com.izforge.izpack.adaptator.IXMLElement;
 import com.izforge.izpack.installer.AutomatedInstallData;
 import com.izforge.izpack.installer.PanelConsole;
 import com.izforge.izpack.installer.PanelConsoleHelper;
 import com.izforge.izpack.util.Debug;
+import com.izforge.izpack.util.OsVersion;
 import com.izforge.izpack.util.SpecHelper;
 import com.izforge.izpack.util.VariableSubstitutor;
 
@@ -116,8 +118,16 @@ public class UserInputPanelConsoleHelper extends PanelConsoleHelper implements P
     private static final String DESCRIPTION = &quot;description&quot;;
 
     private static final String TRUE = &quot;true&quot;;   
-    
-    
+        
+    private static final String NAME = &quot;name&quot;;
+
+    private static final String FAMILY = &quot;family&quot;;
+
+    private static final String OS = &quot;os&quot;;
+
+    private static final String SELECTEDPACKS = &quot;createForPack&quot;;
+
+   
     private static Input SPACE_INTPUT_FIELD = new Input(SPACE, null, null, SPACE, &quot;\r&quot;, 0);
     private static Input DIVIDER_INPUT_FIELD = new Input(DIVIDER, null, null, DIVIDER, &quot;------------------------------------------&quot;, 0);
     
@@ -162,9 +172,11 @@ public class UserInputPanelConsoleHelper extends PanelConsoleHelper implements P
 
     public boolean runConsole(AutomatedInstallData idata)
     {
-                
-        collectInputs(idata);
-        VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
+
+        boolean processpanel = collectInputs(idata);
+        if (!processpanel) {
+            return true;
+        }
         boolean status = true;
         Iterator&lt;Input&gt; inputsIterator = listInputs.iterator();
         while (inputsIterator.hasNext())
@@ -236,6 +248,7 @@ public class UserInputPanelConsoleHelper extends PanelConsoleHelper implements P
         {
 
             e1.printStackTrace();
+            return false;
         }
 
         specElements = specHelper.getSpec().getChildrenNamed(NODE_ID);
@@ -247,25 +260,43 @@ public class UserInputPanelConsoleHelper extends PanelConsoleHelper implements P
             if (((attribute != null) &amp;&amp; instance.equals(attribute))
                     || ((dataID != null) &amp;&amp; (panelid != null) &amp;&amp; (panelid.equals(dataID))))
             {
-                spec = data;
+
+                Vector&lt;IXMLElement&gt; forPacks = data.getChildrenNamed(SELECTEDPACKS);
+                Vector&lt;IXMLElement&gt; forOs = data.getChildrenNamed(OS);
+
+                if (itemRequiredFor(forPacks, idata) &amp;&amp; itemRequiredForOs(forOs)) {
+                    spec = data;
+                    break;
+                }
             }
         }
+        
+        if (spec == null) {
+            return false;
+        }
         Vector&lt;IXMLElement&gt; fields = spec.getChildrenNamed(FIELD_NODE_ID);
         for (int i = 0; i &lt; fields.size(); i++)
         {
             IXMLElement field = fields.elementAt(i);
-            String conditionid = field.getAttribute(ATTRIBUTE_CONDITIONID_NAME);
-            if (conditionid != null)
-            {
-                // check if condition is fulfilled
-                if (!idata.getRules().isConditionTrue(conditionid, idata.getVariables()))
+
+            Vector&lt;IXMLElement&gt; forPacks = field.getChildrenNamed(SELECTEDPACKS);
+            Vector&lt;IXMLElement&gt; forOs = field.getChildrenNamed(OS);
+
+            if (itemRequiredFor(forPacks, idata) &amp;&amp; itemRequiredForOs(forOs)) {
+        
+                String conditionid = field.getAttribute(ATTRIBUTE_CONDITIONID_NAME);
+                if (conditionid != null)
                 {
-                    continue;
+                    // check if condition is fulfilled
+                    if (!idata.getRules().isConditionTrue(conditionid, idata.getVariables()))
+                    {
+                        continue;
+                    }
+                }
+                Input in = getInputFromField(field, idata);
+                if (in != null) {
+                	listInputs.add(in);
                 }
-            }
-            Input in = getInputFromField(field, idata);
-            if (in != null) {
-            	listInputs.add(in);
             }
          }
         return true;
@@ -312,16 +343,13 @@ public class UserInputPanelConsoleHelper extends PanelConsoleHelper implements P
             if (set == null)
             {
                 set = &quot;&quot;;
-            }
+            } 
         }
-        else
-        {
-            if (set != null &amp;&amp; !&quot;&quot;.equals(set))
-            {
 
-                VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
-                set = vs.substitute(set, null);
-            }
+        if (set != null &amp;&amp; !&quot;&quot;.equals(set))
+        {
+            VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
+            set = vs.substitute(set, null);
         }
 
         fieldText = input.listChoices.get(0).strText;
@@ -825,6 +853,103 @@ public class UserInputPanelConsoleHelper extends PanelConsoleHelper implements P
         return null;
     }
     
+    /*--------------------------------------------------------------------------*/
+    /**
+     * Verifies if an item is required for any of the packs listed. An item is required for a pack
+     * in the list if that pack is actually selected for installation. &lt;br&gt;
+     * &lt;br&gt;
+     * &lt;b&gt;Note:&lt;/b&gt;&lt;br&gt;
+     * If the list of selected packs is empty then &lt;code&gt;true&lt;/code&gt; is always returnd. The same is
+     * true if the &lt;code&gt;packs&lt;/code&gt; list is empty.
+     *
+     * @param packs a &lt;code&gt;Vector&lt;/code&gt; of &lt;code&gt;String&lt;/code&gt;s. Each of the strings denotes a
+     * pack for which an item should be created if the pack is actually installed.
+     * @return &lt;code&gt;true&lt;/code&gt; if the item is required for at least one pack in the list,
+     * otherwise returns &lt;code&gt;false&lt;/code&gt;.
+     */
+    /*--------------------------------------------------------------------------*/
+    /*
+     * $ @design
+     *
+     * The information about the installed packs comes from InstallData.selectedPacks. This assumes
+     * that this panel is presented to the user AFTER the PacksPanel.
+     * --------------------------------------------------------------------------
+     */
+    private boolean itemRequiredFor(Vector&lt;IXMLElement&gt; packs, AutomatedInstallData idata)
+    {
+
+        String selected;
+        String required;
+
+        if (packs.size() == 0) { return (true); }
+
+        // ----------------------------------------------------
+        // We are getting to this point if any packs have been
+        // specified. This means that there is a possibility
+        // that some UI elements will not get added. This
+        // means that we can not allow to go back to the
+        // PacksPanel, because the process of building the
+        // UI is not reversable.
+        // ----------------------------------------------------
+        // packsDefined = true;
+
+        // ----------------------------------------------------
+        // analyze if the any of the packs for which the item
+        // is required have been selected for installation.
+        // ----------------------------------------------------
+        for (int i = 0; i &lt; idata.selectedPacks.size(); i++)
+        {
+            selected = ((Pack) idata.selectedPacks.get(i)).name;
+
+            for (int k = 0; k &lt; packs.size(); k++)
+            {
+                required = (packs.elementAt(k)).getAttribute(NAME, &quot;&quot;);
+                if (selected.equals(required)) { return (true); }
+            }
+        }
+
+        return (false);
+    }
+    
+    /**
+     * Verifies if an item is required for the operating system the installer executed. The
+     * configuration for this feature is: &lt;br/&gt;
+     * &amp;lt;os family=&quot;unix&quot;/&amp;gt; &lt;br&gt;
+     * &lt;br&gt;
+     * &lt;b&gt;Note:&lt;/b&gt;&lt;br&gt;
+     * If the list of the os is empty then &lt;code&gt;true&lt;/code&gt; is always returnd.
+     *
+     * @param os The &lt;code&gt;Vector&lt;/code&gt; of &lt;code&gt;String&lt;/code&gt;s. containing the os names
+     * @return &lt;code&gt;true&lt;/code&gt; if the item is required for the os, otherwise returns
+     * &lt;code&gt;false&lt;/code&gt;.
+     */
+    public boolean itemRequiredForOs(Vector&lt;IXMLElement&gt; os)
+    {
+        if (os.size() == 0) { return true; }
+
+        for (int i = 0; i &lt; os.size(); i++)
+        {
+            String family = (os.elementAt(i)).getAttribute(FAMILY);
+            boolean match = false;
+
+            if (&quot;windows&quot;.equals(family))
+            {
+                match = OsVersion.IS_WINDOWS;
+            }
+            else if (&quot;mac&quot;.equals(family))
+            {
+                match = OsVersion.IS_OSX;
+            }
+            else if (&quot;unix&quot;.equals(family))
+            {
+                match = OsVersion.IS_UNIX;
+            }
+            if (match) { return true; }
+        }
+        return false;
+    }
+
+    
 
     public static class Input
     {</diff>
      <filename>src/lib/com/izforge/izpack/panels/UserInputPanelConsoleHelper.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>75022dd04a48593aecb9403da0d657cfe3c8b521</id>
    </parent>
  </parents>
  <author>
    <name>jponge</name>
    <email>jponge@7d736ef5-cfd4-0310-9c9a-b52d5c14b761</email>
  </author>
  <url>http://github.com/jponge/izpack/commit/ab320378abc97b86f81fe869bb4a783b024e90d6</url>
  <id>ab320378abc97b86f81fe869bb4a783b024e90d6</id>
  <committed-date>2009-06-11T01:49:47-07:00</committed-date>
  <authored-date>2009-06-11T01:49:47-07:00</authored-date>
  <message>Part of IZPACK-368

git-svn-id: https://svn.codehaus.org/izpack/izpack-src/trunk@2794 7d736ef5-cfd4-0310-9c9a-b52d5c14b761</message>
  <tree>1045a3f56f19585f6747a1336856b38c6151892d</tree>
  <committer>
    <name>jponge</name>
    <email>jponge@7d736ef5-cfd4-0310-9c9a-b52d5c14b761</email>
  </committer>
</commit>
