summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/letter
diff options
context:
space:
mode:
authorSzabolcs Dezsi <dezsiszabi@hotmail.com>2012-03-04 00:57:53 +0100
committerTor Lillqvist <tml@iki.fi>2012-03-05 10:38:32 +0200
commitab6273ecece70432f3da35807b5484d9bfe91fdd (patch)
treef4e2d36678a3ac8b5be77fbfa8acbf372ab0aaec /wizards/com/sun/star/wizards/letter
parenta1a1131c16227327d17bcf5ad2a5209ddc0f01a1 (diff)
Dropdown list in Letter Wizard are now ordered alphabetically
Diffstat (limited to 'wizards/com/sun/star/wizards/letter')
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java45
1 files changed, 32 insertions, 13 deletions
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
index 736233c7dfd8..55a1a0e6de1d 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
@@ -27,6 +27,8 @@
************************************************************************/
package com.sun.star.wizards.letter;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Vector;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
@@ -65,6 +67,20 @@ import com.sun.star.wizards.common.Helper;
public class LetterWizardDialogImpl extends LetterWizardDialog
{
+ private class Strings
+ {
+ public String Norm;
+ public String NormPath;
+ public String LanguageLabel;
+
+ public Strings(String norm, String normPath, String languageLabel)
+ {
+ Norm = norm;
+ NormPath = normPath;
+ LanguageLabel = languageLabel;
+ }
+ }
+
protected void enterStep(int OldStep, int NewStep)
{
}
@@ -1163,9 +1179,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
e.printStackTrace();
}
- Vector NormsVector = new Vector();
- Vector NormsPathVector = new Vector();
- Vector LanguageLabelsVector = new Vector();
+ Vector StringsVector = new Vector();
+
String[] LanguageLabels;
boolean found = false;
@@ -1202,21 +1217,25 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
if (found)
{
- NormsVector.add(cIsoCode);
- NormsPathVector.add(nameList[i]);
- LanguageLabelsVector.add(lc.getLanguageString(MSID));
+ StringsVector.add(new Strings(cIsoCode, (String)nameList[i], lc.getLanguageString(MSID)));
}
}
+ Collections.sort(StringsVector, new Comparator() {
+ public int compare(Object a, Object b) {
+ return ((Strings)a).LanguageLabel.compareTo(((Strings)b).LanguageLabel);
+ }
+ });
- Norms = new String[NormsVector.size()];
- NormsVector.toArray(Norms);
-
- NormPaths = new String[NormsPathVector.size()];
- NormsPathVector.toArray(NormPaths);
+ Norms = new String[StringsVector.size()];
+ NormPaths = new String[StringsVector.size()];
+ LanguageLabels = new String[StringsVector.size()];
- LanguageLabels = new String[LanguageLabelsVector.size()];
- LanguageLabelsVector.toArray(LanguageLabels);
+ for(int i = 0; i<StringsVector.size(); i++) {
+ Norms[i] = ((Strings)StringsVector.elementAt(i)).Norm;
+ NormPaths[i] = ((Strings)StringsVector.elementAt(i)).NormPath;
+ LanguageLabels[i] = ((Strings)StringsVector.elementAt(i)).LanguageLabel;
+ }
setControlProperty("lstLetterNorm", PropertyNames.STRING_ITEM_LIST, LanguageLabels);
}