@@ -0,0 +1,81 @@
|
|||||||
|
package info.bukova.isspst.data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
|
@Embeddable
|
||||||
|
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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MUnitEmb(MUnit munit) {
|
||||||
|
this.id = munit.getId();
|
||||||
|
this.code = munit.getCode();
|
||||||
|
this.description = munit.getDescription();
|
||||||
|
this.name = munit.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.code + " - " + this.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package info.bukova.isspst.data;
|
package info.bukova.isspst.data;
|
||||||
|
|
||||||
|
import javax.persistence.Embedded;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@@ -7,6 +8,15 @@ import javax.persistence.Table;
|
|||||||
@Table(name="MATERIAL")
|
@Table(name="MATERIAL")
|
||||||
public class Material extends RequirementSubject {
|
public class Material extends RequirementSubject {
|
||||||
|
|
||||||
|
@Embedded
|
||||||
|
private MUnitEmb munit;
|
||||||
|
|
||||||
|
public MUnitEmb getMunit() {
|
||||||
|
return munit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMunit(MUnitEmb munit) {
|
||||||
|
this.munit = munit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,35 @@
|
|||||||
package info.bukova.isspst.ui.material;
|
package info.bukova.isspst.ui.material;
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.zkoss.bind.annotation.Init;
|
||||||
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
|
|
||||||
|
import info.bukova.isspst.data.MUnit;
|
||||||
|
import info.bukova.isspst.data.MUnitEmb;
|
||||||
import info.bukova.isspst.data.Material;
|
import info.bukova.isspst.data.Material;
|
||||||
|
import info.bukova.isspst.services.munits.MUnitService;
|
||||||
import info.bukova.isspst.ui.FormViewModel;
|
import info.bukova.isspst.ui.FormViewModel;
|
||||||
|
|
||||||
public class MaterialForm extends FormViewModel<Material> {
|
public class MaterialForm extends FormViewModel<Material> {
|
||||||
|
|
||||||
|
@WireVariable
|
||||||
|
private MUnitService munitService;
|
||||||
|
private List<MUnitEmb> munits;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init(superclass = true)
|
||||||
public void init() {
|
public void init() {
|
||||||
|
List<MUnit> mu = munitService.getAll();
|
||||||
|
munits = new ArrayList<MUnitEmb>();
|
||||||
|
for (MUnit m : mu) {
|
||||||
|
MUnitEmb muEmb = new MUnitEmb(m);
|
||||||
|
munits.add(muEmb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MUnitEmb> getMunits() {
|
||||||
|
return munits;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,7 @@ username=Uživatelské jméno
|
|||||||
|
|
||||||
#Skupiny
|
#Skupiny
|
||||||
centre=Středisko
|
centre=Středisko
|
||||||
members=Členové
|
members=Členové
|
||||||
|
|
||||||
|
#Materiál
|
||||||
|
munit=Měrná jednotka
|
||||||
@@ -8,8 +8,9 @@
|
|||||||
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" height="500px">
|
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" height="500px">
|
||||||
<listhead menupopup="auto">
|
<listhead menupopup="auto">
|
||||||
<listheader label="${labels.code}" sort="czech(code)" width="10%" />
|
<listheader label="${labels.code}" sort="czech(code)" width="10%" />
|
||||||
<listheader label="${labels.name}" sort="czech(name)" width="30%" />
|
<listheader label="${labels.name}" sort="czech(name)" width="25%" />
|
||||||
<listheader label="${labels.description}" sort="czech(description)" width="60%" />
|
<listheader label="${labels.description}" sort="czech(description)" width="55%" />
|
||||||
|
<listheader label="${labels.munit}" width="10%"/>
|
||||||
</listhead>
|
</listhead>
|
||||||
|
|
||||||
<auxhead sclass="category-center" visible="@load(vm.filter)">
|
<auxhead sclass="category-center" visible="@load(vm.filter)">
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
<listcell label="@load(each.code)" />
|
<listcell label="@load(each.code)" />
|
||||||
<listcell label="@load(each.name)" />
|
<listcell label="@load(each.name)" />
|
||||||
<listcell label="@load(each.description)" />
|
<listcell label="@load(each.description)" />
|
||||||
|
<listcell label="@load(each.munit.code)"/>
|
||||||
</listitem>
|
</listitem>
|
||||||
</template>
|
</template>
|
||||||
</listbox>
|
</listbox>
|
||||||
|
|||||||
@@ -28,6 +28,16 @@
|
|||||||
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
|
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<cell sclass="row-title">${labels.munit} :</cell>
|
||||||
|
<cell>
|
||||||
|
<combobox model="@load(vm.munits)" selectedItem="@bind(vm.dataBean.munit)" readonly="true">
|
||||||
|
<template name="model">
|
||||||
|
<comboitem label="@load(each.code)"/>
|
||||||
|
</template>
|
||||||
|
</combobox>
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<include src="/app/formButtons.zul" />
|
<include src="/app/formButtons.zul" />
|
||||||
|
|||||||
Reference in New Issue
Block a user