Agenda "Fakturace požadavků" nyní podporuje řazení.

Po otevření agendy je nastaveno řazení podle sloupce čísla požadavku.
U textových sloupců se data řadí podle CZ pravidel.
Přidána možnost řadit vnořené property podle CZ pravidel.


closes #189
Verze_1.0
František Přibyl 10 years ago
parent d37076cd27
commit 8e33bb8ef7

@ -1,5 +1,6 @@
package info.bukova.isspst;
import java.util.ArrayList;
import java.util.List;
import org.zkoss.util.resource.Labels;
@ -149,4 +150,47 @@ public class StringUtils
return result;
}
public static List<String> split(String value, String separator)
{
String tmp = value;
List<String> list = new ArrayList<String>();
if (tmp != null)
{
if ((separator == null) || separator.isEmpty() || tmp.isEmpty())
{
list.add(tmp);
}
else
{
int separatorLength = separator.length();
while (!tmp.isEmpty())
{
String part = "";
int idx = tmp.indexOf(separator);
if (idx > -1)
{
part = tmp.substring(0, idx);
list.add(part);
tmp = tmp.substring(idx + separatorLength);
if (tmp.isEmpty())
{
list.add("");
}
}
else
{
list.add(tmp);
tmp = "";
}
}
}
}
return list;
}
}

@ -1,19 +1,21 @@
package info.bukova.isspst.sort;
import info.bukova.isspst.StringUtils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.Collator;
import java.text.ParseException;
import java.text.RuleBasedCollator;
import java.util.Comparator;
import java.util.List;
import org.zkoss.zk.ui.util.Clients;
public class CzechStringComparator implements Comparator<Object> {
private String m_rule;
private final String m_property;
private final List<String> m_propertyPath;
private final boolean m_ascending;
private Method m_getter;
private Comparator<Object> m_comparator;
public CzechStringComparator(String property, boolean ascending) {
@ -47,7 +49,7 @@ public class CzechStringComparator implements Comparator<Object> {
m_rule += "< Y,y < Ý,ý ";
m_rule += "< Z,z < Ź,ź < Ž,ž ";
m_property = property;
m_propertyPath = StringUtils.split(property, ".");
m_ascending = ascending;
}
@ -72,21 +74,56 @@ public class CzechStringComparator implements Comparator<Object> {
return 0;
}
private Object getValue(Object caller)
{
Object obj = caller;
for (String property : m_propertyPath)
{
if (obj == null)
{
return null;
}
Method method = ReflectionTools.getGetterMethod(obj, property);
try
{
obj = method.invoke(obj);
}
catch (IllegalAccessException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (InvocationTargetException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return obj;
}
private int internalCompare(Object argL, Object argR)
throws ParseException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
if (m_getter == null) {
m_getter = ReflectionTools.getGetterMethod(argL, m_property);
}
if (m_comparator == null) {
if (m_comparator == null)
{
Collator c = new RuleBasedCollator(m_rule);
c.setStrength(Collator.TERTIARY);
m_comparator = c;
}
Object valL = m_getter.invoke(argL);
Object valR = m_getter.invoke(argR);
Object valL = this.getValue(argL);
Object valR = this.getValue(argR);
boolean isNullValL = (valL == null);
boolean isNullValR = (valR == null);

@ -29,10 +29,10 @@ public class SelectMaterialItems extends SelectItems
private MaterialFilter dataFilterMaterial;
@Init
public void init()
@Init(superclass = true)
public void initSelectMaterialItems()
{
super.init();
// super.init();
this.setFullMaterialList(materialService.getAll());
this.setMaterialList(this.getFullMaterialList());

@ -3,13 +3,14 @@ package info.bukova.isspst.ui.main.orders.requirements;
import info.bukova.isspst.data.MUnitEmb;
import info.bukova.isspst.data.RequirementSubject;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.ui.DocumentViewModel;
import java.util.List;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class SelectItems
public class SelectItems extends DocumentViewModel
{
protected RequirementSubject selectedItem;
@ -19,8 +20,8 @@ public class SelectItems
protected List<MUnitEmb> munitList;
@Init
public void init()
@Init(superclass = true)
public void initSelectItems()
{
this.setMunitList(munitService.getEmbAll());
}

@ -29,10 +29,10 @@ public class SelectServicesItems extends SelectItems
private ServiceItemFilter dataFilterService;
@Init
public void init()
@Init(superclass = true)
public void initSelectServicesItems()
{
super.init();
// super.init();
this.setFullServiceItemList(serviceItemService.getAll());
this.setServiceItemList(this.getFullServiceItemList());

@ -18,35 +18,43 @@
<listhead menupopup="auto">
<listheader
label="${labels.InvoicingRequirementNumber}"
sort="czech(requirement.numser)"
onCreate="self.sort(true)"
width="130px" />
<listheader
label="${labels.RequirementsGridReqDate}"
width="150px"/>
sort="auto(requirement.reqDate)"
width="150px" />
<listheader
label="${labels.RequirementsGridCenter}"
width="180px"/>
sort="czech(requirement.centre.fullName)"
width="180px" />
<listheader
label="${labels.RequirementsGridWorkgroup}"
width="180px"/>
sort="czech(requirement.workgroup.fullName)"
width="180px" />
<listheader
label="${labels.InvoicingApplicant}"
width="180px"/>
label="${labels.InvoicingApplicant}"
sort="czech(requirement.ownedBy.fullName)"
width="180px" />
<listheader
label="${labels.InvoicingDescription}"
width=""/>
label="${labels.InvoicingDescription}"
sort="czech(requirement.description)"
width="" />
<listheader
label="${labels.InvoicingRequirementPrice}"
sort="auto(requirement.sumTotal)"
align="right"
width="130px" />
<listheader
label="${labels.InvoicingInvoicedPrice}"
align="right"
sort="auto(totalInvoiced)"
width="130px" />
</listhead>
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
@ -133,34 +141,33 @@
<auxheader>
<!-- div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
<textbox
value="@bind(vm.filterTemplate.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
<image src="/img/funnel.png" />
</div>
</div -->
</div -->
</auxheader>
<auxheader>
<!-- div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
<textbox
value="@bind(vm.filterTemplate.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
instant="true"
onChange="@command('doFilter')"
maxlength="@load(vm.lengthText)"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
<image src="/img/funnel.png" />
</div>
</div-->
</div-->
</auxheader>
</auxhead>
<template name="model">
<listitem>
@ -171,7 +178,8 @@
<listcell label="@load(each.requirement.ownedBy)" />
<listcell label="@load(each.requirement.description)" />
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
<listcell
label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )" />
</listitem>
</template>

Loading…
Cancel
Save