logo       

r1870 - in izpack-src/trunk: . src/lib/com/izforge/izpack/panels src/old-do: msg#00005

Subject: r1870 - in izpack-src/trunk: . src/lib/com/izforge/izpack/panels src/old-doc/XHTML
Author: jponge
Date: 2007-08-24 21:09:25 +0200 (Fri, 24 Aug 2007)
New Revision: 1870

Modified:
   izpack-src/trunk/Versions.txt
   
izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
   izpack-src/trunk/src/old-doc/XHTML/node4.html
Log:
InstallGroupPanel: sortable InstallGroups (Markus Schlegel via Julien Ponge)


Modified: izpack-src/trunk/Versions.txt
===================================================================
--- izpack-src/trunk/Versions.txt       2007-08-24 19:04:43 UTC (rev 1869)
+++ izpack-src/trunk/Versions.txt       2007-08-24 19:09:25 UTC (rev 1870)
@@ -31,6 +31,7 @@
 - File / fileset Os constraints: addition of a JRE version test (e.g., <os 
jre="1.5" />)
   (Gilles Wiart via Julien Ponge)
 - Hungarian langpack update (Kerekes Balazs via Julien Ponge)
+- InstallGroupPanel: sortable InstallGroups (Markus Schlegel via Julien Ponge)
 
   > 3.10.3 (build xxxx.xx.xx)
 

Modified: 
izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
===================================================================
--- 
izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java  
    2007-08-24 19:04:43 UTC (rev 1869)
+++ 
izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java  
    2007-08-24 19:09:25 UTC (rev 1870)
@@ -361,7 +361,8 @@
                 if (data == null)
                 {
                     String description = getGroupDescription(group);
-                    data = new GroupData(group, description);
+                    String sortKey = getGroupSortKey(group);
+                    data = new GroupData(group, description, sortKey);
                     installGroups.put(group, data);
                 }
             }
@@ -434,7 +435,32 @@
 
         return description;
     }
+    
+    /**
+     * Look for a key = InstallationGroupPanel.sortKey.[group] entry:
+     * by using idata.getVariable(key)
+     * if this variable is not defined, defaults to group
+     * @param group - the installation group name
+     * @return the group sortkey
+     */
+    protected String getGroupSortKey(String group)
+    {
+        String key = "InstallationGroupPanel.sortKey." + group;
+        String sortKey = idata.getVariable(key);
+        if (sortKey == null)
+            sortKey = group;
+        try
+        {
+            sortKey = URLDecoder.decode(sortKey, "UTF-8");
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            emitWarning("Failed to convert sortKey", e.getMessage());
+        }
 
+        return sortKey;
+    }
+
     protected TableModel getModel(HashMap groupData)
     {
         String c1 = 
parent.langpack.getString("InstallationGroupPanel.colNameSelected");
@@ -460,12 +486,12 @@
                GroupData g1 = (GroupData) o1;
                GroupData g2 = (GroupData) o2;
 
-               if (g1.name == null || g2.name==null)
+               if (g1.sortKey == null || g2.sortKey==null)
                {
                    return 0;
                }
 
-               return g1.name.compareTo(g2.name);
+               return g1.sortKey.compareTo(g2.sortKey);
            }
         });
 
@@ -521,13 +547,15 @@
 
         String name;
         String description;
+        String sortKey;
         long size;
         HashSet packNames = new HashSet();
 
-        GroupData(String name, String description)
+        GroupData(String name, String description, String sortKey)
         {
             this.name = name;
             this.description = description;
+            this.sortKey = sortKey;
         }
 
         String getSizeString()
@@ -557,6 +585,8 @@
             tmp.append(name);
             tmp.append("){description=");
             tmp.append(description);
+            tmp.append(", sortKey=");
+            tmp.append(sortKey);
             tmp.append(", size=");
             tmp.append(size);
             tmp.append(", sizeString=");

Modified: izpack-src/trunk/src/old-doc/XHTML/node4.html
===================================================================
--- izpack-src/trunk/src/old-doc/XHTML/node4.html       2007-08-24 19:04:43 UTC 
(rev 1869)
+++ izpack-src/trunk/src/old-doc/XHTML/node4.html       2007-08-24 19:09:25 UTC 
(rev 1870)
@@ -1384,10 +1384,22 @@
     </pre>
 
     In above example when InstallationGroupPanel is displayed, it contains 
three radios named Group1, Group2 and Group3.
-    Depending on what user selects respective Packs will be displayed in 
PacksPanel. InstallationGroupPanel will look
-    for description corresponding to key 
InstallationGroupPanel.description.Group1,
-    InstallationGroupPanel.description.Group2 etc in installation langpacks 
and displays this description for each of
-    the Group_i.
+    Depending on what user selects, the respective Packs will be displayed in 
PacksPanel. InstallationGroupPanel will look
+    for a description corresponding to the key 
"InstallationGroupPanel.description.Group1",
+    "InstallationGroupPanel.description.Group2" etc in installation langpacks 
and variables and displays this description for each of
+    the Group_i.</p>
+       <p>You may also define a sortKey in the variables section of the 
installer.xml to define an alternative sorting. The default sorting is based on 
the Group Name.
+       <br>Here is an example for alternative sorting of groups:
+       <pre>
+    (...)
+    &lt;variables&gt;
+       (...)
+        &lt;variable name=&quot;InstallationGroupPanel.sortKey.Group2&quot; 
value=&quot;A&quot;/&gt;
+        &lt;variable name=&quot;InstallationGroupPanel.sortKey.Group1&quot; 
value=&quot;B&quot;/&gt;
+        &lt;variable name=&quot;InstallationGroupPanel.sortKey.Group3&quot; 
value=&quot;C&quot;/&gt;
+    &lt;/variables&gt;
+    (...)
+       </pre>
 
 </p>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
web.pylons.gene...    hurd.l4/2002-10...    kernel.commits....    user-groups.lin...    yellowdog.gener...    java.drools.use...    security.openva...    package-managem...    linux.debian.us...    qnx.openqnx.dev...    genealogy.gramp...    file-systems.if...    voip.wengophone...    tex.context/200...    ietf.smime/2003...    audio.csound.de...    culture.region....    xfree86.devel/2...    mobile.kannel.u...    distributed.con...    education.engli...    org.user-groups...    bug-tracking.gn...    recreation.bicy...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe