[izpack-changes] r1905 - in izpack-src/trunk/src: dtd lib/com/izforge/izpack lib/com/izforge/izpack/compiler lib/com/izforge/izpack/installer

noreply at berlios.de noreply at berlios.de
Fri Nov 16 13:58:56 CET 2007


Author: dreil
Date: 2007-11-16 13:58:42 +0100 (Fri, 16 Nov 2007)
New Revision: 1905

Modified:
   izpack-src/trunk/src/dtd/installation.dtd
   izpack-src/trunk/src/lib/com/izforge/izpack/Panel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java
   izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
Log:
added condition support in installation.xml

Modified: izpack-src/trunk/src/dtd/installation.dtd
===================================================================
--- izpack-src/trunk/src/dtd/installation.dtd	2007-11-16 12:40:11 UTC (rev 1904)
+++ izpack-src/trunk/src/dtd/installation.dtd	2007-11-16 12:58:42 UTC (rev 1905)
@@ -95,6 +95,7 @@
     <!ELEMENT panel (os*)>
         <!ATTLIST panel os (unix|windows|mac) #IMPLIED>
         <!ATTLIST panel classname CDATA #REQUIRED>
+        <!ATTLIST panel condition CDATA #IMPLIED>
 
 <!-- The listener section (indicates which listener where to use) -->
 <!ELEMENT listeners (listener*)>

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/Panel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/Panel.java	2007-11-16 12:40:11 UTC (rev 1904)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/Panel.java	2007-11-16 12:58:42 UTC (rev 1905)
@@ -40,6 +40,9 @@
 
     /** the unique id of this panel */
     protected String panelid;
+    
+    /** condition for this panel */
+    private String condition = null;
 
     public String getClassName() {
       return this.className;
@@ -68,4 +71,26 @@
     public void setPanelid(String panelid) {      
       this.panelid = panelid;
     }
+
+    
+    /**
+     * @return the condition
+     */
+    public String getCondition()
+    {
+        return this.condition;
+    }
+
+    
+    /**
+     * @param condition the condition to set
+     */
+    public void setCondition(String condition)
+    {
+        this.condition = condition;
+    }
+    
+    public boolean hasCondition() {
+        return this.condition != null;
+    }
 }

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java	2007-11-16 12:40:11 UTC (rev 1904)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java	2007-11-16 12:58:42 UTC (rev 1905)
@@ -1205,6 +1205,9 @@
             // add an id
             String panelid = xmlPanel.getAttribute("id");
             panel.setPanelid(panelid);                   
+            String condition = xmlPanel.getAttribute("condition");
+            panel.setCondition(condition);
+            
             // Panel files come in jars packaged w/ IzPack
             String jarPath = "bin/panels/" + className + ".jar";
             URL url = findIzPackResource(jarPath, "Panel jar file", xmlPanel);

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java	2007-11-16 12:40:11 UTC (rev 1904)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java	2007-11-16 12:58:42 UTC (rev 1905)
@@ -1414,19 +1414,26 @@
     public boolean canShow(int panelnumber)
     {
         IzPanel panel = (IzPanel) installdata.panels.get(panelnumber);
-        String panelid = panel.getMetadata().getPanelid();
-        Debug.trace("Current Panel: " + panelid);
-
-        if (!this.getRules().canShowPanel(panelid, this.installdata.variables))
-        {
-            // skip panel, if conditions for panel aren't met
-            Debug.log("Skip panel with panelid=" + panelid);
-            // panel should be skipped, so we have to decrement panelnumber for skipping
-            return false;
+        Panel panelmetadata = panel.getMetadata(); 
+        String panelid = panelmetadata.getPanelid();
+        Debug.trace("Current Panel: " + panelid);                
+        
+        if (panelmetadata.hasCondition()) {
+            Debug.log("Checking panelcondition");
+            return rules.isConditionTrue(panelmetadata.getCondition());
         }
-        else
-        {
-            return true;
+        else {        
+            if (!rules.canShowPanel(panelid, this.installdata.variables))
+            {
+                // skip panel, if conditions for panel aren't met
+                Debug.log("Skip panel with panelid=" + panelid);
+                // panel should be skipped, so we have to decrement panelnumber for skipping
+                return false;
+            }
+            else
+            {
+                return true;
+            }
         }
     }
 



More information about the izpack-changes mailing list