Dropdown list in Letter Wizard are now ordered alphabetically
This commit is contained in:
committed by
Tor Lillqvist
parent
a1a1131c16
commit
ab6273ecec
@@ -27,6 +27,8 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
package com.sun.star.wizards.letter;
|
package com.sun.star.wizards.letter;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import com.sun.star.lang.IllegalArgumentException;
|
import com.sun.star.lang.IllegalArgumentException;
|
||||||
import com.sun.star.lang.WrappedTargetException;
|
import com.sun.star.lang.WrappedTargetException;
|
||||||
@@ -65,6 +67,20 @@ import com.sun.star.wizards.common.Helper;
|
|||||||
public class LetterWizardDialogImpl extends LetterWizardDialog
|
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)
|
protected void enterStep(int OldStep, int NewStep)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -1163,9 +1179,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector NormsVector = new Vector();
|
Vector StringsVector = new Vector();
|
||||||
Vector NormsPathVector = new Vector();
|
|
||||||
Vector LanguageLabelsVector = new Vector();
|
|
||||||
String[] LanguageLabels;
|
String[] LanguageLabels;
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
@@ -1202,21 +1217,25 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
|
|||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
NormsVector.add(cIsoCode);
|
StringsVector.add(new Strings(cIsoCode, (String)nameList[i], lc.getLanguageString(MSID)));
|
||||||
NormsPathVector.add(nameList[i]);
|
|
||||||
LanguageLabelsVector.add(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()];
|
Norms = new String[StringsVector.size()];
|
||||||
NormsVector.toArray(Norms);
|
NormPaths = new String[StringsVector.size()];
|
||||||
|
LanguageLabels = new String[StringsVector.size()];
|
||||||
|
|
||||||
NormPaths = new String[NormsPathVector.size()];
|
for(int i = 0; i<StringsVector.size(); i++) {
|
||||||
NormsPathVector.toArray(NormPaths);
|
Norms[i] = ((Strings)StringsVector.elementAt(i)).Norm;
|
||||||
|
NormPaths[i] = ((Strings)StringsVector.elementAt(i)).NormPath;
|
||||||
LanguageLabels = new String[LanguageLabelsVector.size()];
|
LanguageLabels[i] = ((Strings)StringsVector.elementAt(i)).LanguageLabel;
|
||||||
LanguageLabelsVector.toArray(LanguageLabels);
|
}
|
||||||
|
|
||||||
setControlProperty("lstLetterNorm", PropertyNames.STRING_ITEM_LIST, LanguageLabels);
|
setControlProperty("lstLetterNorm", PropertyNames.STRING_ITEM_LIST, LanguageLabels);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user