multitenant
Josef Rokos 11 years ago
commit b4a86ea5c2

@ -8,10 +8,10 @@ public class CzechSortListheader extends Listheader {
@Override @Override
public void setSort(String type) { public void setSort(String type) {
if (type.startsWith("auto")) if (type.startsWith("czech"))
{ {
// czech(propertyName) // czech(propertyName)
String propertyName = type.substring("auto(".length(), type.length() - 1); String propertyName = type.substring("czech(".length(), type.length() - 1);
this.setSortAscending(new CzechStringComparator(propertyName, true)); this.setSortAscending(new CzechStringComparator(propertyName, true));
this.setSortDescending(new CzechStringComparator(propertyName, false)); this.setSortDescending(new CzechStringComparator(propertyName, false));
} }

@ -7,6 +7,8 @@ import java.text.ParseException;
import java.text.RuleBasedCollator; import java.text.RuleBasedCollator;
import java.util.Comparator; import java.util.Comparator;
import org.zkoss.zk.ui.util.Clients;
public class CzechStringComparator implements Comparator<Object> { public class CzechStringComparator implements Comparator<Object> {
private String m_rule; private String m_rule;
private final String m_property; private final String m_property;
@ -16,6 +18,7 @@ public class CzechStringComparator implements Comparator<Object> {
public CzechStringComparator(String property, boolean ascending) { public CzechStringComparator(String property, boolean ascending) {
m_rule = ""; m_rule = "";
m_rule += "< 0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 ";
m_rule += "< A,a < Á,á < Ä,ä "; m_rule += "< A,a < Á,á < Ä,ä ";
m_rule += "< B,b "; m_rule += "< B,b ";
m_rule += "< C,c < Ć,ć < Č,č "; m_rule += "< C,c < Ć,ć < Č,č ";
@ -50,7 +53,6 @@ public class CzechStringComparator implements Comparator<Object> {
@Override @Override
public int compare(Object argL, Object argR) { public int compare(Object argL, Object argR) {
try { try {
return this.internalCompare(argL, argR); return this.internalCompare(argL, argR);
@ -87,29 +89,31 @@ public class CzechStringComparator implements Comparator<Object> {
Object valR = m_getter.invoke(argR); Object valR = m_getter.invoke(argR);
boolean isNullValL = (valL == null); boolean isNullValL = (valL == null);
boolean isNullValR = (valR == null); boolean isNullValR = (valR == null);
int result = 0; int result = 0;
if (isNullValL || isNullValR) if (isNullValL || isNullValR) {
{ if (isNullValL && isNullValR) {
if (isNullValL && isNullValR)
{
result = 0; result = 0;
} } else if (isNullValL) {
else if (isNullValL)
{
result = -1; result = -1;
} } else {
else
{
result = 1; result = 1;
} }
} 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);
}
} }
else
{
result = m_comparator.compare(valL, valR);
}
return (m_ascending ? result : -result); return (m_ascending ? result : -result);
} }
} }

@ -8,12 +8,12 @@
<hbox width="100%"> <hbox width="100%">
<listbox id="dataGrid" model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" onAfterRender="@command('afterRender')" selectedIndex="@load(vm.selIndex)" hflex="6" height="480px"> <listbox id="dataGrid" model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" onAfterRender="@command('afterRender')" selectedIndex="@load(vm.selIndex)" hflex="6" height="480px">
<listhead vflex="true" menupopup="auto"> <listhead vflex="true" menupopup="auto">
<listheader label="${labels.SuppliersGridColumnCompany}" sort="auto(company)" /> <listheader label="${labels.SuppliersGridColumnCompany}" sort="czech(company)" />
<listheader label="${labels.SuppliersGridColumnIC}" sort="auto(ic)" width="100px" /> <listheader label="${labels.SuppliersGridColumnIC}" sort="auto(ic)" width="100px" />
<listheader label="${labels.SuppliersGridColumnContact}" sort="auto(contactName)" /> <listheader label="${labels.SuppliersGridColumnContact}" sort="czech(contactName)" />
<listheader label="${labels.SuppliersGridColumnStreet}" sort="auto(street)" /> <listheader label="${labels.SuppliersGridColumnStreet}" sort="czech(street)" />
<listheader label="${labels.SuppliersGridColumnNo}" sort="auto(houseNumber)" width="80px" /> <listheader label="${labels.SuppliersGridColumnNo}" sort="czech(houseNumber)" width="80px" />
<listheader label="${labels.SuppliersGridColumnCity}" sort="auto(city)" /> <listheader label="${labels.SuppliersGridColumnCity}" sort="czech(city)" />
</listhead> </listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)"> <auxhead sclass="category-center" visible="@load(vm.filter)">

@ -11,7 +11,7 @@
<hbox width="100%"> <hbox width="100%">
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" width="300px"> <listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" width="300px">
<listhead> <listhead>
<listheader label="${labels.RightsGridRole}"/> <listheader label="${labels.RightsGridRole}" />
</listhead> </listhead>
<template name="model"> <template name="model">
<listitem> <listitem>

@ -8,10 +8,10 @@
<hbox width="100%" height="500px"> <hbox width="100%" height="500px">
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" width="650px" height="480px"> <listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" width="650px" height="480px">
<listhead menupopup="auto"> <listhead menupopup="auto">
<listheader label="${labels.UsersGridColumnLogin}" sort="auto(username)" /> <listheader label="${labels.UsersGridColumnLogin}" sort="czech(username)" />
<listheader label="${labels.UsersGridColumnPersonalID}" sort="auto(personalNumber)" /> <listheader label="${labels.UsersGridColumnPersonalID}" sort="czech(personalNumber)" />
<listheader label="${labels.UsersGridColumnFirstName}" sort="auto(firstName)" /> <listheader label="${labels.UsersGridColumnFirstName}" sort="czech(firstName)" />
<listheader label="${labels.UsersGridColumnSureName}" sort="auto(lastName)" /> <listheader label="${labels.UsersGridColumnSureName}" sort="czech(lastName)" />
</listhead> </listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)"> <auxhead sclass="category-center" visible="@load(vm.filter)">

@ -7,9 +7,9 @@
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)"> <listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)">
<listhead menupopup="auto"> <listhead menupopup="auto">
<listheader label="${labels.BuildingsGridColumnCode}" sort="auto(code)" width="10%" /> <listheader label="${labels.BuildingsGridColumnCode}" sort="czech(code)" width="10%" />
<listheader label="${labels.BuildingsGridColumnName}" sort="auto(name)" width="30%" /> <listheader label="${labels.BuildingsGridColumnName}" sort="czech(name)" width="30%" />
<listheader label="${labels.BuildingsGridColumnDescription}" sort="auto(description)" width="60%" /> <listheader label="${labels.BuildingsGridColumnDescription}" sort="czech(description)" width="60%" />
</listhead> </listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)"> <auxhead sclass="category-center" visible="@load(vm.filter)">

Loading…
Cancel
Save