-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MID-3362 attemp to localize delta visualizations
- Loading branch information
Showing
11 changed files
with
261 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/PolyStringComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2010-2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.util; | ||
|
||
import java.text.Collator; | ||
import java.util.Comparator; | ||
|
||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.prism.polystring.PolyString; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class PolyStringComparator implements Comparator<PolyString> { | ||
|
||
public static final PolyStringComparator COMPARE_TRANSLATED = new PolyStringComparator(true); | ||
|
||
public static final PolyStringComparator COMPARE_ORIG = new PolyStringComparator(false); | ||
|
||
private boolean translate; | ||
|
||
public PolyStringComparator(boolean translate) { | ||
this.translate = translate; | ||
} | ||
|
||
@Override | ||
public int compare(PolyString o1, PolyString o2) { | ||
if (o1 == null && o2 == null) { | ||
return 0; | ||
} else if (o1 == null) { | ||
return -1; | ||
} else if (o2 == null) { | ||
return 1; | ||
} | ||
|
||
Collator collator = WebComponentUtil.getCollator(); | ||
String s1 = translate ? WebComponentUtil.getTranslatedPolyString(o1) : o1.getOrig(); | ||
String s2 = translate ? WebComponentUtil.getTranslatedPolyString(o2) : o2.getOrig(); | ||
|
||
return collator.compare(s1, s2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.