Josef Rokos 10 years ago
commit 9f07c52f2c

@ -0,0 +1,39 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementState;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
@SuppressWarnings("serial")
public class RequirementsItemRenderer extends GenericListitemRenderer<Requirement>
{
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm)
{
Requirement requirement = this.getObjectOfStates();
RequirementState state = requirement.getState();
if (state != null)
{
if (state == RequirementState.PARTIALLY)
{
li.setSclass("req-select-partially");
}
else if (state == RequirementState.APPROVED)
{
Boolean isProject = requirement.getProject();
if ((isProject != null) && (isProject.booleanValue() == true))
{
li.setSclass("req-select-approved-project");
}
else
{
li.setSclass("req-select-approved");
}
}
}
}
}

@ -6,6 +6,7 @@ import info.bukova.isspst.services.requirement.RequirementBaseService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.BigDecimalConverter; import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import info.bukova.isspst.ui.renderers.RequirementsItemRenderer;
import java.util.List; import java.util.List;
@ -20,6 +21,8 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
@WireVariable @WireVariable
protected UserService userService; protected UserService userService;
protected RequirementsItemRenderer requirementsItemRenderer;
public List<User> getAllUsers() public List<User> getAllUsers()
{ {
return userService.getAll(); return userService.getAll();
@ -41,6 +44,7 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
public void initRequirementSubpage() public void initRequirementSubpage()
{ {
this.bigDecimalConverter = new BigDecimalConverter(); this.bigDecimalConverter = new BigDecimalConverter();
this.requirementsItemRenderer = new RequirementsItemRenderer();
} }
private RequirementBaseService<T> getReqService() private RequirementBaseService<T> getReqService()
@ -69,6 +73,16 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
return false; return false;
} }
public RequirementsItemRenderer getRequirementsItemRenderer()
{
return requirementsItemRenderer;
}
public void setRequirementsItemRenderer(RequirementsItemRenderer requirementsItemRenderer)
{
this.requirementsItemRenderer = requirementsItemRenderer;
}
@Override @Override
protected void afterSelect() { protected void afterSelect() {
BindUtils.postNotifyChange(null, null, this, "canApprove"); BindUtils.postNotifyChange(null, null, this, "canApprove");

@ -77,3 +77,15 @@
.order-select-delivered { .order-select-delivered {
background-color: #d19fe8 !important; background-color: #d19fe8 !important;
} }
.req-select-partially {
background-color: #fffb90 !important;
}
.req-select-approved {
background-color: #afffb5 !important;
}
.req-select-approved-project {
background-color: #87cefa !important;
}

@ -1,5 +1,6 @@
<listbox <listbox
vflex="1" vflex="1"
itemRenderer="@load(vm.requirementsItemRenderer)"
selectedItem="@bind(vm.dataBean)" selectedItem="@bind(vm.dataBean)"
model="@load(vm.dataList)" model="@load(vm.dataList)"
onAfterRender="@command('afterRender')" onAfterRender="@command('afterRender')"
@ -144,7 +145,7 @@
</auxheader> </auxheader>
</auxhead> </auxhead>
<template name="model"> <template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))"> <listitem>
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" /> <listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" /> <listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" /> <listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />

@ -2,6 +2,7 @@
<listbox <listbox
vflex="1" vflex="1"
hflex="7" hflex="7"
itemRenderer="@load(vm.requirementsItemRenderer)"
selectedItem="@bind(vm.dataBean)" selectedItem="@bind(vm.dataBean)"
model="@load(vm.dataList)" model="@load(vm.dataList)"
onAfterRender="@command('afterRender')" onAfterRender="@command('afterRender')"
@ -171,7 +172,7 @@
</auxheader> </auxheader>
</auxhead> </auxhead>
<template name="model"> <template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))"> <listitem>
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" /> <listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" /> <listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" /> <listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />

@ -2,6 +2,7 @@
<listbox <listbox
vflex="1" vflex="1"
hflex="7" hflex="7"
itemRenderer="@load(vm.requirementsItemRenderer)"
selectedItem="@bind(vm.dataBean)" selectedItem="@bind(vm.dataBean)"
model="@load(vm.dataList)" model="@load(vm.dataList)"
onAfterRender="@command('afterRender')" onAfterRender="@command('afterRender')"
@ -171,7 +172,7 @@
</auxheader> </auxheader>
</auxhead> </auxhead>
<template name="model"> <template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))"> <listitem>
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" /> <listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" /> <listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" /> <listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />

@ -2,6 +2,7 @@
<listbox <listbox
vflex="1" vflex="1"
hflex="7" hflex="7"
itemRenderer="@load(vm.requirementsItemRenderer)"
selectedItem="@bind(vm.dataBean)" selectedItem="@bind(vm.dataBean)"
model="@load(vm.dataList)" model="@load(vm.dataList)"
onAfterRender="@command('afterRender')" onAfterRender="@command('afterRender')"
@ -171,7 +172,7 @@
</auxheader> </auxheader>
</auxhead> </auxhead>
<template name="model"> <template name="model">
<listitem style="@load((each.state eq 'PARTIALLY') ? 'background-color: #fffb90' : ((each.state eq 'APPROVED') ? 'background-color: #afffb5' : ''))"> <listitem>
<listcell label="@load(each.project) @converter(vm.standardBoolConverter)" /> <listcell label="@load(each.project) @converter(vm.standardBoolConverter)" />
<listcell label="@load(each.numser)" /> <listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" /> <listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />

Loading…
Cancel
Save