[izpack-changes] r1870 - in izpack-src/trunk: . src/lib/com/izforge/izpack/panels src/old-doc/XHTML
noreply at berlios.de
noreply at berlios.de
Fri Aug 24 21:09:32 CEST 2007
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>
+ (...)
+ <variables>
+ (...)
+ <variable name="InstallationGroupPanel.sortKey.Group2" value="A"/>
+ <variable name="InstallationGroupPanel.sortKey.Group1" value="B"/>
+ <variable name="InstallationGroupPanel.sortKey.Group3" value="C"/>
+ </variables>
+ (...)
+ </pre>
</p>
More information about the izpack-changes
mailing list