parent
							
								
									1283fe627d
								
							
						
					
					
						commit
						26f02b97fe
					
				| @ -0,0 +1,55 @@ | |||||||
|  | package info.bukova.isspst.ui.settings; | ||||||
|  | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | 
 | ||||||
|  | import org.zkoss.bind.annotation.BindingParam; | ||||||
|  | import org.zkoss.bind.annotation.Command; | ||||||
|  | import org.zkoss.bind.annotation.Init; | ||||||
|  | import org.zkoss.zk.ui.select.annotation.WireVariable; | ||||||
|  | import org.zkoss.zul.Window; | ||||||
|  | 
 | ||||||
|  | import info.bukova.isspst.Constants; | ||||||
|  | import info.bukova.isspst.Module; | ||||||
|  | import info.bukova.isspst.data.NumberSeries; | ||||||
|  | import info.bukova.isspst.services.numberseries.NumberSeriesService; | ||||||
|  | 
 | ||||||
|  | public class NumberSeriesVM { | ||||||
|  | 	 | ||||||
|  | 	@WireVariable | ||||||
|  | 	private NumberSeriesService numericSeriesService; | ||||||
|  | 	private List<NumberSeries> numberSeriesList; | ||||||
|  | 	private Map<String, Module> moduleMap; | ||||||
|  | 	 | ||||||
|  | 	@Init | ||||||
|  | 	public void init() { | ||||||
|  | 		numberSeriesList = new ArrayList<NumberSeries>(numericSeriesService.getAll()); | ||||||
|  | 		moduleMap = new HashMap<String, Module>(); | ||||||
|  | 		for (Module m : Constants.MODULES) { | ||||||
|  | 			moduleMap.put(m.getId(), m); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public List<NumberSeries> getNumberSeriesList() { | ||||||
|  | 		return numberSeriesList; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	public boolean isCanSave() { | ||||||
|  | 		return true; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	@Command | ||||||
|  | 	public void save(@BindingParam("window") Window window) { | ||||||
|  | 		for (NumberSeries ns : numberSeriesList) { | ||||||
|  | 			numericSeriesService.update(ns); | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
|  | 		window.detach(); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	public Map<String, Module> getModuleMap() { | ||||||
|  | 		return moduleMap; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | <?page title="NumberSeriesFormTitle" contentType="text/html;charset=UTF-8"?> | ||||||
|  | <zk> | ||||||
|  | <window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer" | ||||||
|  | viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.NumberSeriesVM')" closable="true" width="400px"> | ||||||
|  | 	<caption zclass="form-caption" label="${labels.NumberSeriesFormTitle}" /> | ||||||
|  | 	<!-- <combobox></combobox> --> | ||||||
|  | 	<grid model="@load(vm.numberSeriesList)"> | ||||||
|  | 		<columns> | ||||||
|  | 			<column hflex="min"/> | ||||||
|  | 			<column/> | ||||||
|  | 			<column hflex="min"/> | ||||||
|  | 			<column hflex="min"/> | ||||||
|  | 		</columns> | ||||||
|  | 		<rows> | ||||||
|  | 			<template name="model"> | ||||||
|  | 				<row> | ||||||
|  | 					<label value="@load(vm.moduleMap[each.module].name.concat(' - ').concat(labels.Prefix))"/> | ||||||
|  | 					<textbox value="@bind(each.prefix)"/> | ||||||
|  | 					<label value="${labels.Number}"/> | ||||||
|  | 					<label value="@load(each.number)"/> | ||||||
|  | 				</row> | ||||||
|  | 			</template> | ||||||
|  | 		</rows> | ||||||
|  | 	</grid> | ||||||
|  | 	<include src="/app/formButtons.zul"/> | ||||||
|  | </window> | ||||||
|  | </zk> | ||||||
					Loading…
					
					
				
		Reference in New Issue