parent
							
								
									1164e11107
								
							
						
					
					
						commit
						9fb1ef7601
					
				@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					package info.bukova.isspst.filters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import info.bukova.isspst.DateTimeUtils;
 | 
				
			||||||
 | 
					import info.bukova.isspst.StringUtils;
 | 
				
			||||||
 | 
					import info.bukova.isspst.data.SignedDocument;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.hamcrest.Description;
 | 
				
			||||||
 | 
					import org.hamcrest.Factory;
 | 
				
			||||||
 | 
					import org.hamcrest.Matcher;
 | 
				
			||||||
 | 
					import org.hamcrest.TypeSafeMatcher;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class SignedDocumentFilter implements Filter<SignedDocument>
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						private SignedDocument condition;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public SignedDocumentFilter(SignedDocument cond)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							this.condition = cond;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private static class SignedDocumentMatcher extends TypeSafeMatcher<SignedDocument>
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							private SignedDocument condition;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public SignedDocumentMatcher(SignedDocument cond)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.condition = cond;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							@Override
 | 
				
			||||||
 | 
							public void describeTo(Description desc)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								desc.appendText("SignedDocument matches");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							@Override
 | 
				
			||||||
 | 
							public boolean matchesSafely(SignedDocument item)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								boolean foundAgendaName = StringUtils.isEqualForFilter(item.getAgendaName(), condition.getAgendaName());
 | 
				
			||||||
 | 
								boolean foundNumSer = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
 | 
				
			||||||
 | 
								boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
 | 
				
			||||||
 | 
								boolean foundSignDate = DateTimeUtils.isEqualByDateForFilter(item.getSignDate(), condition.getSignDate());
 | 
				
			||||||
 | 
								return (foundAgendaName && foundNumSer && foundDescription && foundSignDate);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							@Factory
 | 
				
			||||||
 | 
							public static Matcher<SignedDocument> matchBuilding(SignedDocument item)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return new SignedDocumentMatcher(item);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public SignedDocumentMatcher matcher()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return new SignedDocumentMatcher(condition);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public String queryString()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return "";
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					package info.bukova.isspst.ui.signeddocs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import info.bukova.isspst.data.SignedDocument;
 | 
				
			||||||
 | 
					import info.bukova.isspst.data.SignedDocumentItem;
 | 
				
			||||||
 | 
					import info.bukova.isspst.filters.SignedDocumentFilter;
 | 
				
			||||||
 | 
					import info.bukova.isspst.services.signeddocs.SignedDocumentService;
 | 
				
			||||||
 | 
					import info.bukova.isspst.ui.ListViewModel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
 | 
					import org.zkoss.bind.annotation.BindingParam;
 | 
				
			||||||
 | 
					import org.zkoss.bind.annotation.Command;
 | 
				
			||||||
 | 
					import org.zkoss.bind.annotation.Init;
 | 
				
			||||||
 | 
					import org.zkoss.bind.annotation.NotifyChange;
 | 
				
			||||||
 | 
					import org.zkoss.zk.ui.select.annotation.WireVariable;
 | 
				
			||||||
 | 
					import org.zkoss.zul.Listbox;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class SignedDocsList extends ListViewModel<SignedDocument>
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						@SuppressWarnings("unused")
 | 
				
			||||||
 | 
						private final static Logger log = LoggerFactory.getLogger(SignedDocsList.class.getName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@WireVariable
 | 
				
			||||||
 | 
						protected SignedDocumentService signedDocumentService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						protected SignedDocumentItem signedDocumentItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						protected List<SignedDocumentItem> signedDocumentItems;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Init(superclass = true)
 | 
				
			||||||
 | 
						public void initSignedDocsList() {
 | 
				
			||||||
 | 
							service = signedDocumentService;
 | 
				
			||||||
 | 
							dataClass = SignedDocument.class;
 | 
				
			||||||
 | 
							formZul = "form.zul";
 | 
				
			||||||
 | 
							dataFilter = new SignedDocumentFilter(getFilterTemplate());
 | 
				
			||||||
 | 
							this.signedDocumentItem = null;
 | 
				
			||||||
 | 
							this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public SignedDocumentItem getSignedDocumentItem() {
 | 
				
			||||||
 | 
							return signedDocumentItem;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public void setSignedDocumentItem(SignedDocumentItem signedDocumentItem) {
 | 
				
			||||||
 | 
							this.signedDocumentItem = signedDocumentItem;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public List<SignedDocumentItem> getSignedDocumentItems() {
 | 
				
			||||||
 | 
							return signedDocumentItems;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public void setSignedDocumentItems(List<SignedDocumentItem> signedDocumentItems) {
 | 
				
			||||||
 | 
							this.signedDocumentItems = signedDocumentItems;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Command
 | 
				
			||||||
 | 
						@NotifyChange("signedDocumentItems")
 | 
				
			||||||
 | 
						public void onChangeSelectSignedDocs(@BindingParam("ctrl") Listbox lb) {
 | 
				
			||||||
 | 
							if (lb == null) {
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (lb.getSelectedIndex() > -1) {
 | 
				
			||||||
 | 
								this.signedDocumentItems = this.getDataBean().getItems();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else {
 | 
				
			||||||
 | 
								this.signedDocumentItems = new ArrayList<SignedDocumentItem>();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,209 @@
 | 
				
			|||||||
 | 
					<?page contentType="text/html;charset=UTF-8"?>
 | 
				
			||||||
 | 
					<zk>
 | 
				
			||||||
 | 
						<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
 | 
				
			||||||
 | 
						<window
 | 
				
			||||||
 | 
						vflex="1"
 | 
				
			||||||
 | 
							border="normal"
 | 
				
			||||||
 | 
							apply="org.zkoss.bind.BindComposer"
 | 
				
			||||||
 | 
							viewModel="@id('vm') @init('info.bukova.isspst.ui.signeddocs.SignedDocsList')">
 | 
				
			||||||
 | 
							<caption
 | 
				
			||||||
 | 
								image="/img/adobe-032.png"
 | 
				
			||||||
 | 
								zclass="form-caption"
 | 
				
			||||||
 | 
								label="${labels.AgendaSignedDocuments}" />
 | 
				
			||||||
 | 
							<tabbox
 | 
				
			||||||
 | 
								vflex="1"
 | 
				
			||||||
 | 
								orient="top">
 | 
				
			||||||
 | 
								<tabs width="500px">
 | 
				
			||||||
 | 
									<tab label="${labels.ActualDocuments}" />
 | 
				
			||||||
 | 
									<!-- tab label="${labels.Archive}" /-->
 | 
				
			||||||
 | 
								</tabs>
 | 
				
			||||||
 | 
								<tabpanels>
 | 
				
			||||||
 | 
									<tabpanel>
 | 
				
			||||||
 | 
										<include src="toolbar.zul" />
 | 
				
			||||||
 | 
										<hlayout vflex="1">
 | 
				
			||||||
 | 
											<listbox
 | 
				
			||||||
 | 
												vflex="1"
 | 
				
			||||||
 | 
												hflex="60"
 | 
				
			||||||
 | 
												selectedItem="@bind(vm.dataBean)"
 | 
				
			||||||
 | 
												onSelect="@command('onChangeSelectSignedDocs', ctrl=self)"
 | 
				
			||||||
 | 
												model="@load(vm.dataList)">
 | 
				
			||||||
 | 
												<listhead menupopup="auto">
 | 
				
			||||||
 | 
													<listheader
 | 
				
			||||||
 | 
														hflex="7"
 | 
				
			||||||
 | 
														sort="czech(agendaName)"
 | 
				
			||||||
 | 
														label="${labels.AgendaName}" />
 | 
				
			||||||
 | 
													<listheader
 | 
				
			||||||
 | 
														hflex="4"
 | 
				
			||||||
 | 
														sort="czech(numser)"
 | 
				
			||||||
 | 
														label="${labels.number}" />
 | 
				
			||||||
 | 
													<listheader
 | 
				
			||||||
 | 
														hflex="20"
 | 
				
			||||||
 | 
														sort="czech(description)"
 | 
				
			||||||
 | 
														label="${labels.OrderFormDescription}" />
 | 
				
			||||||
 | 
													<listheader
 | 
				
			||||||
 | 
														hflex="5"
 | 
				
			||||||
 | 
														onCreate="self.sort(false)"
 | 
				
			||||||
 | 
														sort="auto(signDate)"
 | 
				
			||||||
 | 
														label="${labels.SigningDate}" />
 | 
				
			||||||
 | 
												</listhead>
 | 
				
			||||||
 | 
												<auxhead visible="@load(vm.filter)">
 | 
				
			||||||
 | 
													<auxheader>
 | 
				
			||||||
 | 
														<div sclass="find-grid-cell">
 | 
				
			||||||
 | 
															<div sclass="find-grid-divtextbox">
 | 
				
			||||||
 | 
																<textbox
 | 
				
			||||||
 | 
																	value="@bind(vm.filterTemplate.agendaName)"
 | 
				
			||||||
 | 
																	instant="true"
 | 
				
			||||||
 | 
																	onChange="@command('doFilter')"
 | 
				
			||||||
 | 
																	maxlength="@load(vm.lengthText)"
 | 
				
			||||||
 | 
																	sclass="find-grid-textbox" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
															<div sclass="find-grid-img">
 | 
				
			||||||
 | 
																<image src="/img/funnel.png" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
													</auxheader>
 | 
				
			||||||
 | 
													<auxheader>
 | 
				
			||||||
 | 
														<div sclass="find-grid-cell">
 | 
				
			||||||
 | 
															<div sclass="find-grid-divtextbox">
 | 
				
			||||||
 | 
																<textbox
 | 
				
			||||||
 | 
																	value="@bind(vm.filterTemplate.numser)"
 | 
				
			||||||
 | 
																	instant="true"
 | 
				
			||||||
 | 
																	onChange="@command('doFilter')"
 | 
				
			||||||
 | 
																	maxlength="@load(vm.lengthText)"
 | 
				
			||||||
 | 
																	sclass="find-grid-textbox" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
															<div sclass="find-grid-img">
 | 
				
			||||||
 | 
																<image src="/img/funnel.png" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
													</auxheader>
 | 
				
			||||||
 | 
													<auxheader>
 | 
				
			||||||
 | 
														<div sclass="find-grid-cell">
 | 
				
			||||||
 | 
															<div sclass="find-grid-divtextbox">
 | 
				
			||||||
 | 
																<textbox
 | 
				
			||||||
 | 
																	value="@bind(vm.filterTemplate.description)"
 | 
				
			||||||
 | 
																	instant="true"
 | 
				
			||||||
 | 
																	onChange="@command('doFilter')"
 | 
				
			||||||
 | 
																	maxlength="@load(vm.lengthDescription)"
 | 
				
			||||||
 | 
																	sclass="find-grid-textbox" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
															<div sclass="find-grid-img">
 | 
				
			||||||
 | 
																<image src="/img/funnel.png" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
													</auxheader>
 | 
				
			||||||
 | 
													<auxheader>
 | 
				
			||||||
 | 
														<div sclass="find-grid-cell">
 | 
				
			||||||
 | 
															<div sclass="find-grid-divtextbox">
 | 
				
			||||||
 | 
																<datebox
 | 
				
			||||||
 | 
																	value="@bind(vm.filterTemplate.signDate)"
 | 
				
			||||||
 | 
																	format="${labels.DateFormat}"
 | 
				
			||||||
 | 
																	instant="true"
 | 
				
			||||||
 | 
																	onChange="@command('doFilter')"
 | 
				
			||||||
 | 
																	sclass="find-grid-textbox"
 | 
				
			||||||
 | 
																	width="100%" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
															<div sclass="find-grid-img">
 | 
				
			||||||
 | 
																<image src="/img/funnel.png" />
 | 
				
			||||||
 | 
															</div>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
													</auxheader>
 | 
				
			||||||
 | 
												</auxhead>
 | 
				
			||||||
 | 
												<template name="model">
 | 
				
			||||||
 | 
													<listitem>
 | 
				
			||||||
 | 
														<listcell label="@load(each.agendaName)" />
 | 
				
			||||||
 | 
														<listcell label="@load(each.numser)" />
 | 
				
			||||||
 | 
														<listcell label="@load(each.description)" />
 | 
				
			||||||
 | 
														<listcell label="@load(each.signDate) @converter('formatedDate', format=labels.DateFormat)" />
 | 
				
			||||||
 | 
													</listitem>
 | 
				
			||||||
 | 
												</template>
 | 
				
			||||||
 | 
											</listbox>
 | 
				
			||||||
 | 
											<listbox
 | 
				
			||||||
 | 
												vflex="1"
 | 
				
			||||||
 | 
												hflex="40"
 | 
				
			||||||
 | 
												selectedItem="@bind(vm.signedDocumentItem)"
 | 
				
			||||||
 | 
												model="@load(vm.signedDocumentItems)">
 | 
				
			||||||
 | 
												<listhead menupopup="auto">
 | 
				
			||||||
 | 
													<listheader
 | 
				
			||||||
 | 
														hflex="1"
 | 
				
			||||||
 | 
														sort="czech(actualReportName)"
 | 
				
			||||||
 | 
														label="${labels.PrintReports}" />
 | 
				
			||||||
 | 
													<listheader
 | 
				
			||||||
 | 
														hflex="2"
 | 
				
			||||||
 | 
														sort="czech(fileName)"
 | 
				
			||||||
 | 
														label="${labels.FileName}" />
 | 
				
			||||||
 | 
												</listhead>
 | 
				
			||||||
 | 
												<template name="model">
 | 
				
			||||||
 | 
													<listitem>
 | 
				
			||||||
 | 
														<listcell label="@load(each.actualReportName)" />
 | 
				
			||||||
 | 
														<listcell label="@load(each.fileName)" />
 | 
				
			||||||
 | 
													</listitem>
 | 
				
			||||||
 | 
												</template>
 | 
				
			||||||
 | 
											</listbox>
 | 
				
			||||||
 | 
										</hlayout>
 | 
				
			||||||
 | 
									</tabpanel>
 | 
				
			||||||
 | 
									<tabpanel>
 | 
				
			||||||
 | 
										<!-- listbox
 | 
				
			||||||
 | 
											vflex="1"
 | 
				
			||||||
 | 
											selectedItem="@bind(vm.selectedOrderItem)"
 | 
				
			||||||
 | 
											model="@load(vm.orderItems)">
 | 
				
			||||||
 | 
											<listhead menupopup="auto">
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="7"
 | 
				
			||||||
 | 
											sort="czech(code)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemCode}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="15"
 | 
				
			||||||
 | 
											sort="czech(name)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemName}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="20"
 | 
				
			||||||
 | 
											sort="czech(textItem)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemText}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="5"
 | 
				
			||||||
 | 
											sort="auto(quantity)"
 | 
				
			||||||
 | 
											align="right"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemQuantity}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="5"
 | 
				
			||||||
 | 
											sort="auto(munit.name)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemMUnit}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="7"
 | 
				
			||||||
 | 
											align="right"
 | 
				
			||||||
 | 
											sort="auto(unitPrice)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemUnitPrice}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="7"
 | 
				
			||||||
 | 
											align="right"
 | 
				
			||||||
 | 
											sort="auto(total)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemTotal}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="15"
 | 
				
			||||||
 | 
											sort="czech(description)"
 | 
				
			||||||
 | 
											label="${labels.RequirementItemDescription}" />
 | 
				
			||||||
 | 
											<listheader
 | 
				
			||||||
 | 
											hflex="5"
 | 
				
			||||||
 | 
											sort="auto(reqItem.orderNum)"
 | 
				
			||||||
 | 
											label="${labels.OrderAbr}" />
 | 
				
			||||||
 | 
											</listhead>
 | 
				
			||||||
 | 
											<template name="model">
 | 
				
			||||||
 | 
											<listitem>
 | 
				
			||||||
 | 
											<listcell label="@load(each.code)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.name)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.textItem)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.quantity) @converter(vm.standardBigDecimalConverter)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.munit.name)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.description)" />
 | 
				
			||||||
 | 
											<listcell label="@load(each.reqItem.orderNum)" />
 | 
				
			||||||
 | 
											</listitem>
 | 
				
			||||||
 | 
											</template>
 | 
				
			||||||
 | 
											</listbox-->
 | 
				
			||||||
 | 
									</tabpanel>
 | 
				
			||||||
 | 
								</tabpanels>
 | 
				
			||||||
 | 
							</tabbox>
 | 
				
			||||||
 | 
						</window>
 | 
				
			||||||
 | 
					</zk>
 | 
				
			||||||
@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					<?page title="toolbar" contentType="text/html;charset=UTF-8"?>
 | 
				
			||||||
 | 
					<zk>
 | 
				
			||||||
 | 
						<toolbar>
 | 
				
			||||||
 | 
							<toolbarbutton image="/img/funnel.png" tooltiptext="${labels.ToolbarRecFilter}" id="btnFilter" onClick="@command('filter')" />
 | 
				
			||||||
 | 
							<!-- toolbarbutton image="/img/print.png" tooltiptext="${labels.ToolbarPrint}" id="btnPrint" onClick="@command('onPrint')" /-->
 | 
				
			||||||
 | 
						</toolbar>
 | 
				
			||||||
 | 
					</zk>
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue