|
|
|
@ -7,6 +7,8 @@ import java.text.ParseException;
|
|
|
|
|
import java.text.RuleBasedCollator;
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
|
|
|
|
|
|
import org.zkoss.zk.ui.util.Clients;
|
|
|
|
|
|
|
|
|
|
public class CzechStringComparator implements Comparator<Object> {
|
|
|
|
|
private String m_rule;
|
|
|
|
|
private final String m_property;
|
|
|
|
@ -16,6 +18,7 @@ public class CzechStringComparator implements Comparator<Object> {
|
|
|
|
|
|
|
|
|
|
public CzechStringComparator(String property, boolean ascending) {
|
|
|
|
|
m_rule = "";
|
|
|
|
|
m_rule += "< 0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 ";
|
|
|
|
|
m_rule += "< A,a < Á,á < Ä,ä ";
|
|
|
|
|
m_rule += "< B,b ";
|
|
|
|
|
m_rule += "< C,c < Ć,ć < Č,č ";
|
|
|
|
@ -50,7 +53,6 @@ public class CzechStringComparator implements Comparator<Object> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(Object argL, Object argR) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
return this.internalCompare(argL, argR);
|
|
|
|
|
|
|
|
|
@ -90,24 +92,26 @@ public class CzechStringComparator implements Comparator<Object> {
|
|
|
|
|
|
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
|
|
if (isNullValL || isNullValR)
|
|
|
|
|
{
|
|
|
|
|
if (isNullValL && isNullValR)
|
|
|
|
|
{
|
|
|
|
|
if (isNullValL || isNullValR) {
|
|
|
|
|
if (isNullValL && isNullValR) {
|
|
|
|
|
result = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (isNullValL)
|
|
|
|
|
{
|
|
|
|
|
} else if (isNullValL) {
|
|
|
|
|
result = -1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
result = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (valL instanceof String) {
|
|
|
|
|
result = m_comparator.compare(valL, valR);
|
|
|
|
|
} else {
|
|
|
|
|
String className = valL.getClass().getName();
|
|
|
|
|
Clients.alert(
|
|
|
|
|
"Nepodporovaný datový typ '"
|
|
|
|
|
+ className
|
|
|
|
|
+ "' pro třídění 'sort=czech(...)'. Použít 'sort=auto(...)'",
|
|
|
|
|
"Franta", Clients.NOTIFICATION_TYPE_WARNING);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (m_ascending ? result : -result);
|
|
|
|
|