Merge branch 'master' of https://git.bukova.info/repos/git/isspst
						commit
						05704827a4
					
				@ -1,90 +1,38 @@
 | 
			
		||||
package info.bukova.isspst.data;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.StringUtils;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.Column;
 | 
			
		||||
import javax.persistence.Entity;
 | 
			
		||||
import javax.persistence.Table;
 | 
			
		||||
 | 
			
		||||
import org.hibernate.validator.constraints.NotBlank;
 | 
			
		||||
 | 
			
		||||
@Entity
 | 
			
		||||
@Table(name = "MUNIT")
 | 
			
		||||
public class MUnit extends BaseData implements DataModel {
 | 
			
		||||
 | 
			
		||||
	@Column(name = "CODE", unique = true)
 | 
			
		||||
	private String code;
 | 
			
		||||
 | 
			
		||||
public class MUnit extends BaseData
 | 
			
		||||
{
 | 
			
		||||
	@Column(name = "NAME")
 | 
			
		||||
	private String name;
 | 
			
		||||
 | 
			
		||||
	@Column(name = "DESCRIPTION")
 | 
			
		||||
	private String description;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the code
 | 
			
		||||
	 */
 | 
			
		||||
	@NotBlank(message = "{MUnitsFormCodeConstr}")
 | 
			
		||||
	public String getCode() {
 | 
			
		||||
		return code;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param code
 | 
			
		||||
	 *            the code to set
 | 
			
		||||
	 */
 | 
			
		||||
	public void setCode(String code) {
 | 
			
		||||
		this.code = code;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the name
 | 
			
		||||
	 */
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return this.name;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param name
 | 
			
		||||
	 *            the name to set
 | 
			
		||||
	 */
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public String getNameSpecial()
 | 
			
		||||
	public String getName()
 | 
			
		||||
	{
 | 
			
		||||
		String special = this.getName();
 | 
			
		||||
		
 | 
			
		||||
		if (special != null)
 | 
			
		||||
		{
 | 
			
		||||
			special = special.replace("[up]2[/up]", "²");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return special;
 | 
			
		||||
		return StringUtils.decodeSpecialChars(this.name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setNameSpecial(String special)
 | 
			
		||||
	public void setName(String name)
 | 
			
		||||
	{
 | 
			
		||||
		if (special != null)
 | 
			
		||||
		{
 | 
			
		||||
			special = special.replace("²", "[up]2[/up]");
 | 
			
		||||
			
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		this.setName(special);
 | 
			
		||||
		this.name = StringUtils.encodeSpecialChars(name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the description
 | 
			
		||||
	 */
 | 
			
		||||
	public String getDescription() {
 | 
			
		||||
		return description;
 | 
			
		||||
	public String getDescription()
 | 
			
		||||
	{
 | 
			
		||||
		return StringUtils.decodeSpecialChars(this.description);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param description
 | 
			
		||||
	 *            the description to set
 | 
			
		||||
	 */
 | 
			
		||||
	public void setDescription(String description) {
 | 
			
		||||
		this.description = description;
 | 
			
		||||
	public void setDescription(String description)
 | 
			
		||||
	{
 | 
			
		||||
		this.description = StringUtils.encodeSpecialChars(description);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,81 +1,86 @@
 | 
			
		||||
package info.bukova.isspst.data;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.StringUtils;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.Column;
 | 
			
		||||
import javax.persistence.Embeddable;
 | 
			
		||||
 | 
			
		||||
@Embeddable
 | 
			
		||||
public class MUnitEmb {
 | 
			
		||||
public class MUnitEmb
 | 
			
		||||
{
 | 
			
		||||
	@Column(name = "MUNIT_ID")
 | 
			
		||||
	private Integer id;
 | 
			
		||||
	@Column(name = "MUNIT_CODE")
 | 
			
		||||
	private String code;
 | 
			
		||||
	@Column(name = "MUNIT_DESCRIPTION")
 | 
			
		||||
	private String description;
 | 
			
		||||
 | 
			
		||||
	@Column(name = "MUNIT_NAME")
 | 
			
		||||
	private String name;
 | 
			
		||||
 | 
			
		||||
	public MUnitEmb() {
 | 
			
		||||
	@Column(name = "MUNIT_DESCRIPTION")
 | 
			
		||||
	private String description;
 | 
			
		||||
 | 
			
		||||
	public MUnitEmb()
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public MUnitEmb(MUnit munit) {
 | 
			
		||||
		this.id = munit.getId();
 | 
			
		||||
		this.code = munit.getCode();
 | 
			
		||||
		this.description = munit.getDescription();
 | 
			
		||||
		this.name = munit.getName();
 | 
			
		||||
	public MUnitEmb(MUnit munit)
 | 
			
		||||
	{
 | 
			
		||||
		this.setId(munit.getId());
 | 
			
		||||
		this.setDescription(munit.getDescription());
 | 
			
		||||
		this.setName(munit.getName());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Integer getId() {
 | 
			
		||||
		return id;
 | 
			
		||||
	public Integer getId()
 | 
			
		||||
	{
 | 
			
		||||
		return this.id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setId(Integer id) {
 | 
			
		||||
	public void setId(Integer id)
 | 
			
		||||
	{
 | 
			
		||||
		this.id = id;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getCode() {
 | 
			
		||||
		return code;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setCode(String code) {
 | 
			
		||||
		this.code = code;
 | 
			
		||||
	public String getName()
 | 
			
		||||
	{
 | 
			
		||||
		return StringUtils.decodeSpecialChars(this.name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getDescription() {
 | 
			
		||||
		return description;
 | 
			
		||||
	public void setName(String name)
 | 
			
		||||
	{
 | 
			
		||||
		this.name = StringUtils.encodeSpecialChars(name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setDescription(String description) {
 | 
			
		||||
		this.description = description;
 | 
			
		||||
	public String getDescription()
 | 
			
		||||
	{
 | 
			
		||||
		return StringUtils.decodeSpecialChars(this.description);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public String getName() {
 | 
			
		||||
		return name;
 | 
			
		||||
	public void setDescription(String description)
 | 
			
		||||
	{
 | 
			
		||||
		this.description = StringUtils.encodeSpecialChars(description);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setName(String name) {
 | 
			
		||||
		this.name = name;
 | 
			
		||||
	}
 | 
			
		||||
	public boolean eqWith(MUnit munit)
 | 
			
		||||
	{
 | 
			
		||||
		if (munit == null)
 | 
			
		||||
		{
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	public boolean eqWith(MUnit munit) {
 | 
			
		||||
		return this.id == munit.getId() 
 | 
			
		||||
				&& this.code.equals(munit.getCode()) 
 | 
			
		||||
				&& this.name.equals(munit.getName())
 | 
			
		||||
				&& this.description.equals(munit.getDescription());
 | 
			
		||||
		return this.getId() == munit.getId() && this.getName().equals(munit.getName()) && this.getDescription().equals(munit.getDescription());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean equals(Object munit) {
 | 
			
		||||
	public boolean equals(Object munit)
 | 
			
		||||
	{
 | 
			
		||||
		return munit != null
 | 
			
		||||
				&& (munit instanceof MUnitEmb)
 | 
			
		||||
				&& this.id == ((MUnitEmb)munit).getId() 
 | 
			
		||||
				&& (this.code == ((MUnitEmb)munit).getCode() || this.code.equals(((MUnitEmb)munit).getCode())) 
 | 
			
		||||
				&& (this.name == ((MUnitEmb)munit).getName() || this.name.equals(((MUnitEmb)munit).getName()))
 | 
			
		||||
				&& (this.description == ((MUnitEmb)munit).getDescription() || this.description.equals(((MUnitEmb)munit).getDescription()));
 | 
			
		||||
				&& this.getId() == ((MUnitEmb) munit).getId()
 | 
			
		||||
				&& (this.getName() == ((MUnitEmb) munit).getName() || this.getName().equals(((MUnitEmb) munit).getName()))
 | 
			
		||||
				&& (this.getDescription() == ((MUnitEmb) munit).getDescription() || this.getDescription().equals(((MUnitEmb) munit).getDescription()));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String toString() {
 | 
			
		||||
		return this.code + " - " + this.name;
 | 
			
		||||
	public String toString()
 | 
			
		||||
	{
 | 
			
		||||
		return this.getName();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,12 @@
 | 
			
		||||
package info.bukova.isspst.services.munits;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.data.MUnit;
 | 
			
		||||
import info.bukova.isspst.data.MUnitEmb;
 | 
			
		||||
import info.bukova.isspst.services.Service;
 | 
			
		||||
 | 
			
		||||
public interface MUnitService  extends Service<MUnit> {
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public interface MUnitService extends Service<MUnit>
 | 
			
		||||
{
 | 
			
		||||
	public List<MUnitEmb> getEmbAll();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,29 @@
 | 
			
		||||
package info.bukova.isspst.services.munits;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.data.MUnit;
 | 
			
		||||
import info.bukova.isspst.data.MUnitEmb;
 | 
			
		||||
import info.bukova.isspst.services.AbstractService;
 | 
			
		||||
 | 
			
		||||
public class MUnitServiceImpl  extends AbstractService<MUnit> implements MUnitService{
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
public class MUnitServiceImpl extends AbstractService<MUnit> implements MUnitService
 | 
			
		||||
{
 | 
			
		||||
	@Override
 | 
			
		||||
	@Transactional
 | 
			
		||||
	public List<MUnitEmb> getEmbAll()
 | 
			
		||||
	{
 | 
			
		||||
		List<MUnit> munitList = this.getAll();
 | 
			
		||||
		List<MUnitEmb> munitEmbList = new ArrayList<MUnitEmb>();
 | 
			
		||||
 | 
			
		||||
		for (MUnit m : munitList)
 | 
			
		||||
		{
 | 
			
		||||
			MUnitEmb muEmb = new MUnitEmb(m);
 | 
			
		||||
			munitEmbList.add(muEmb);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return munitEmbList;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,62 @@
 | 
			
		||||
package info.bukova.isspst.ui;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.text.DecimalFormat;
 | 
			
		||||
import java.text.ParseException;
 | 
			
		||||
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.zkoss.bind.BindContext;
 | 
			
		||||
import org.zkoss.bind.Converter;
 | 
			
		||||
import org.zkoss.zk.ui.Component;
 | 
			
		||||
 | 
			
		||||
public class BigDecimalConverter implements Converter<String, BigDecimal, Component>
 | 
			
		||||
{
 | 
			
		||||
	private final static Logger log = LoggerFactory.getLogger(BigDecimalConverter.class.getName());
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public BigDecimal coerceToBean(String str, Component component, BindContext cx)
 | 
			
		||||
	{
 | 
			
		||||
		BigDecimal val = BigDecimal.ZERO;
 | 
			
		||||
		
 | 
			
		||||
		if (str != null)
 | 
			
		||||
		{
 | 
			
		||||
			try
 | 
			
		||||
			{
 | 
			
		||||
				DecimalFormat format = new DecimalFormat();
 | 
			
		||||
				format.setParseBigDecimal(true);
 | 
			
		||||
				val = (BigDecimal) format.parse(str);
 | 
			
		||||
			}
 | 
			
		||||
			catch (NumberFormatException e)
 | 
			
		||||
			{
 | 
			
		||||
				log.warn(str, e);
 | 
			
		||||
			}
 | 
			
		||||
			catch (ParseException e)
 | 
			
		||||
			{
 | 
			
		||||
				log.warn(str, e);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return val;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String coerceToUi(BigDecimal val, Component component, BindContext cx)
 | 
			
		||||
	{
 | 
			
		||||
		if (val == null)
 | 
			
		||||
		{
 | 
			
		||||
			val = BigDecimal.ZERO;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		val = val.setScale(2, BigDecimal.ROUND_DOWN);
 | 
			
		||||
 | 
			
		||||
		DecimalFormat format = new DecimalFormat();
 | 
			
		||||
		format.setMaximumFractionDigits(2);
 | 
			
		||||
		format.setMinimumFractionDigits(2);
 | 
			
		||||
		format.setGroupingUsed(true);
 | 
			
		||||
		format.setGroupingSize(3);
 | 
			
		||||
 | 
			
		||||
		return format.format(val);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -1,24 +1,45 @@
 | 
			
		||||
package info.bukova.isspst.ui.reqsubjects;
 | 
			
		||||
 | 
			
		||||
import org.zkoss.bind.annotation.Init;
 | 
			
		||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.data.MUnitEmb;
 | 
			
		||||
import info.bukova.isspst.data.Material;
 | 
			
		||||
import info.bukova.isspst.filters.MaterialFilter;
 | 
			
		||||
import info.bukova.isspst.services.munits.MUnitService;
 | 
			
		||||
import info.bukova.isspst.services.reqsubjects.MaterialService;
 | 
			
		||||
import info.bukova.isspst.ui.ListViewModel;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.zkoss.bind.annotation.Init;
 | 
			
		||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
 | 
			
		||||
 | 
			
		||||
public class MaterialList extends ListViewModel<Material> {
 | 
			
		||||
	
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private MaterialService materialService;
 | 
			
		||||
	
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private MUnitService munitService;
 | 
			
		||||
 | 
			
		||||
	private List<MUnitEmb> munitList;
 | 
			
		||||
 | 
			
		||||
	@Init
 | 
			
		||||
	public void init() {
 | 
			
		||||
		service = materialService;
 | 
			
		||||
		dataClass = Material.class;
 | 
			
		||||
		formZul = "materialForm.zul";
 | 
			
		||||
		dataFilter = new MaterialFilter(getFilterTemplate());
 | 
			
		||||
 | 
			
		||||
		this.setMunitList(munitService.getEmbAll());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<MUnitEmb> getMunitList()
 | 
			
		||||
	{
 | 
			
		||||
		return munitList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setMunitList(List<MUnitEmb> munitList)
 | 
			
		||||
	{
 | 
			
		||||
		this.munitList = munitList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,254 @@
 | 
			
		||||
package info.bukova.isspst.ui.requirement;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.data.MUnitEmb;
 | 
			
		||||
import info.bukova.isspst.data.Material;
 | 
			
		||||
import info.bukova.isspst.data.RequirementSubject;
 | 
			
		||||
import info.bukova.isspst.data.ServiceItem;
 | 
			
		||||
import info.bukova.isspst.filters.MaterialFilter;
 | 
			
		||||
import info.bukova.isspst.filters.ServiceItemFilter;
 | 
			
		||||
import info.bukova.isspst.services.munits.MUnitService;
 | 
			
		||||
import info.bukova.isspst.services.reqsubjects.MaterialService;
 | 
			
		||||
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class SelectItems
 | 
			
		||||
{
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private MaterialService materialService;
 | 
			
		||||
 | 
			
		||||
	private List<Material> materialList;
 | 
			
		||||
 | 
			
		||||
	private List<Material> fullMaterialList;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	private boolean activeFilterMaterial;
 | 
			
		||||
 | 
			
		||||
	private Material filterTmpMaterial;
 | 
			
		||||
 | 
			
		||||
	private MaterialFilter dataFilterMaterial;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private ServiceItemService serviceItemService;
 | 
			
		||||
 | 
			
		||||
	private List<ServiceItem> serviceItemList;
 | 
			
		||||
 | 
			
		||||
	private List<ServiceItem> fullServiceItemList;
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	private boolean activeFilterService;
 | 
			
		||||
 | 
			
		||||
	private ServiceItem filterTmpService;
 | 
			
		||||
 | 
			
		||||
	private ServiceItemFilter dataFilterService;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	private RequirementSubject selectedItem;
 | 
			
		||||
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private MUnitService munitService;
 | 
			
		||||
 | 
			
		||||
	private List<MUnitEmb> munitList;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Init
 | 
			
		||||
	public void init()
 | 
			
		||||
	{
 | 
			
		||||
		this.setFullMaterialList(materialService.getAll());
 | 
			
		||||
		this.setMaterialList(this.getFullMaterialList());
 | 
			
		||||
 | 
			
		||||
		this.setActiveFilterMaterial(false);
 | 
			
		||||
		this.setFilterTmpMaterial(new Material());
 | 
			
		||||
		this.setDataFilterMaterial(new MaterialFilter(this.getFilterTmpMaterial()));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		this.setFullServiceItemList(serviceItemService.getAll());
 | 
			
		||||
		this.setServiceItemList(this.getFullServiceItemList());
 | 
			
		||||
 | 
			
		||||
		this.setActiveFilterService(false);
 | 
			
		||||
		this.setFilterTmpService(new ServiceItem());
 | 
			
		||||
		this.setDataFilterService(new ServiceItemFilter(this.getFilterTmpService()));
 | 
			
		||||
 | 
			
		||||
		this.setMunitList(munitService.getEmbAll());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<Material> getMaterialList()
 | 
			
		||||
	{
 | 
			
		||||
		return materialList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setMaterialList(List<Material> materialList)
 | 
			
		||||
	{
 | 
			
		||||
		this.materialList = materialList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<Material> getFullMaterialList()
 | 
			
		||||
	{
 | 
			
		||||
		return fullMaterialList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setFullMaterialList(List<Material> fullMaterialList)
 | 
			
		||||
	{
 | 
			
		||||
		this.fullMaterialList = fullMaterialList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public boolean isActiveFilterMaterial()
 | 
			
		||||
	{
 | 
			
		||||
		return activeFilterMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setActiveFilterMaterial(boolean activeFilterMaterial)
 | 
			
		||||
	{
 | 
			
		||||
		this.activeFilterMaterial = activeFilterMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Material getFilterTmpMaterial()
 | 
			
		||||
	{
 | 
			
		||||
		return this.filterTmpMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void setFilterTmpMaterial(Material material)
 | 
			
		||||
	{
 | 
			
		||||
		this.filterTmpMaterial = material;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public MaterialFilter getDataFilterMaterial()
 | 
			
		||||
	{
 | 
			
		||||
		return dataFilterMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setDataFilterMaterial(MaterialFilter dataFilterMaterial)
 | 
			
		||||
	{
 | 
			
		||||
		this.dataFilterMaterial = dataFilterMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<ServiceItem> getServiceItemList()
 | 
			
		||||
	{
 | 
			
		||||
		return serviceItemList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setServiceItemList(List<ServiceItem> serviceItemList)
 | 
			
		||||
	{
 | 
			
		||||
		this.serviceItemList = serviceItemList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<ServiceItem> getFullServiceItemList()
 | 
			
		||||
	{
 | 
			
		||||
		return fullServiceItemList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setFullServiceItemList(List<ServiceItem> fullServiceItemList)
 | 
			
		||||
	{
 | 
			
		||||
		this.fullServiceItemList = fullServiceItemList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public boolean isActiveFilterService()
 | 
			
		||||
	{
 | 
			
		||||
		return activeFilterService;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setActiveFilterService(boolean activeFilterService)
 | 
			
		||||
	{
 | 
			
		||||
		this.activeFilterService = activeFilterService;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public ServiceItem getFilterTmpService()
 | 
			
		||||
	{
 | 
			
		||||
		return this.filterTmpService;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void setFilterTmpService(ServiceItem serviceItem)
 | 
			
		||||
	{
 | 
			
		||||
		this.filterTmpService = serviceItem;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public ServiceItemFilter getDataFilterService()
 | 
			
		||||
	{
 | 
			
		||||
		return dataFilterService;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setDataFilterService(ServiceItemFilter dataFilterService)
 | 
			
		||||
	{
 | 
			
		||||
		this.dataFilterService = dataFilterService;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public RequirementSubject getSelectedItem()
 | 
			
		||||
	{
 | 
			
		||||
		return selectedItem;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setSelectedItem(RequirementSubject selectedItem)
 | 
			
		||||
	{
 | 
			
		||||
		this.selectedItem = selectedItem;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<MUnitEmb> getMunitList()
 | 
			
		||||
	{
 | 
			
		||||
		return munitList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setMunitList(List<MUnitEmb> munitList)
 | 
			
		||||
	{
 | 
			
		||||
		this.munitList = munitList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Command
 | 
			
		||||
	@NotifyChange({ "activeFilterMaterial", "materialList", "selectedItem" })
 | 
			
		||||
	public void onFilterMaterial()
 | 
			
		||||
	{
 | 
			
		||||
		this.setSelectedItem(null);
 | 
			
		||||
 | 
			
		||||
		this.setActiveFilterMaterial(!this.isActiveFilterMaterial());
 | 
			
		||||
 | 
			
		||||
		if (this.isActiveFilterMaterial())
 | 
			
		||||
		{
 | 
			
		||||
			this.doFilterMaterial();
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			this.setMaterialList(this.getFullMaterialList());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Command
 | 
			
		||||
	@NotifyChange("materialList")
 | 
			
		||||
	public void doFilterMaterial()
 | 
			
		||||
	{
 | 
			
		||||
		this.setSelectedItem(null);
 | 
			
		||||
		List<Material> result = this.materialService.filterList(this.getFullMaterialList(), this.getDataFilterMaterial());
 | 
			
		||||
		this.setMaterialList(result);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Command
 | 
			
		||||
	@NotifyChange({ "activeFilterService", "serviceItemList", "selectedItem" })
 | 
			
		||||
	public void onFilterService()
 | 
			
		||||
	{
 | 
			
		||||
		this.setSelectedItem(null);
 | 
			
		||||
 | 
			
		||||
		this.setActiveFilterService(!this.isActiveFilterService());
 | 
			
		||||
 | 
			
		||||
		if (this.isActiveFilterService())
 | 
			
		||||
		{
 | 
			
		||||
			this.doFilterService();
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			this.setServiceItemList(this.getFullServiceItemList());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Command
 | 
			
		||||
	@NotifyChange("serviceItemList")
 | 
			
		||||
	public void doFilterService()
 | 
			
		||||
	{
 | 
			
		||||
		this.setSelectedItem(null);
 | 
			
		||||
		List<ServiceItem> result = this.serviceItemService.filterList(this.getFullServiceItemList(), this.getDataFilterService());
 | 
			
		||||
		this.setServiceItemList(result);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -1,82 +0,0 @@
 | 
			
		||||
package info.bukova.isspst.ui.requirements;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.data.Material;
 | 
			
		||||
import info.bukova.isspst.data.ServiceItem;
 | 
			
		||||
import info.bukova.isspst.services.reqsubjects.MaterialService;
 | 
			
		||||
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.zkoss.bind.annotation.Command;
 | 
			
		||||
import org.zkoss.bind.annotation.Init;
 | 
			
		||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
 | 
			
		||||
 | 
			
		||||
public class SelectItems
 | 
			
		||||
{
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private MaterialService materialService;
 | 
			
		||||
	
 | 
			
		||||
	@WireVariable
 | 
			
		||||
	private ServiceItemService serviceItemService;
 | 
			
		||||
 | 
			
		||||
	private List<Material> materialList;
 | 
			
		||||
	
 | 
			
		||||
	private List<ServiceItem> serviceItemList;
 | 
			
		||||
 | 
			
		||||
	private Material selectedMaterial;
 | 
			
		||||
 | 
			
		||||
	private ServiceItem selectedServiceItem;
 | 
			
		||||
 | 
			
		||||
	@Init
 | 
			
		||||
	public void init()
 | 
			
		||||
	{
 | 
			
		||||
		this.setMaterialList(materialService.getAll());
 | 
			
		||||
		this.setServiceItemList(serviceItemService.getAll());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<Material> getMaterialList()
 | 
			
		||||
	{
 | 
			
		||||
		return materialList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setMaterialList(List<Material> materialList)
 | 
			
		||||
	{
 | 
			
		||||
		this.materialList = materialList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public List<ServiceItem> getServiceItemList()
 | 
			
		||||
	{
 | 
			
		||||
		return serviceItemList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setServiceItemList(List<ServiceItem> serviceItemList)
 | 
			
		||||
	{
 | 
			
		||||
		this.serviceItemList = serviceItemList;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Material getSelectedMaterial()
 | 
			
		||||
	{
 | 
			
		||||
		return selectedMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setSelectedMaterial(Material selectedMaterial)
 | 
			
		||||
	{
 | 
			
		||||
		this.selectedMaterial = selectedMaterial;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public ServiceItem getSelectedServiceItem()
 | 
			
		||||
	{
 | 
			
		||||
		return selectedServiceItem;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void setSelectedServiceItem(ServiceItem selectedServiceItem)
 | 
			
		||||
	{
 | 
			
		||||
		this.selectedServiceItem = selectedServiceItem;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Command
 | 
			
		||||
	public void addItem()
 | 
			
		||||
	{
 | 
			
		||||
		//this
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,33 @@
 | 
			
		||||
package info.bukova.isspst.validators;
 | 
			
		||||
 | 
			
		||||
import info.bukova.isspst.StringUtils;
 | 
			
		||||
import info.bukova.isspst.data.Workgroup;
 | 
			
		||||
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.zkoss.bind.Property;
 | 
			
		||||
import org.zkoss.bind.ValidationContext;
 | 
			
		||||
 | 
			
		||||
public class RequirementFormValidator extends BaseValidator
 | 
			
		||||
{
 | 
			
		||||
	private final static Logger log = LoggerFactory.getLogger(RequirementFormValidator.class.getName());
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected Logger getLogger()
 | 
			
		||||
	{
 | 
			
		||||
		return log;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void validate(ValidationContext ctx)
 | 
			
		||||
	{
 | 
			
		||||
		Property propertyWorkgroup = ctx.getProperties("workgroup")[0];
 | 
			
		||||
		Workgroup workgroup = (Workgroup) propertyWorkgroup.getValue();
 | 
			
		||||
 | 
			
		||||
		if (workgroup == null)
 | 
			
		||||
		{
 | 
			
		||||
			this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"), "idReqCenter");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue