parent
0ea29ce50e
commit
a310a438cb
@ -0,0 +1,7 @@
|
||||
package info.bukova.isspst.dao;
|
||||
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
|
||||
public interface MUnitDao extends BaseDao<MUnit> {
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package info.bukova.isspst.dao.jpa;
|
||||
|
||||
import info.bukova.isspst.dao.MUnitDao;
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
|
||||
public class MUnitDaoJPA extends BaseDaoJPA<MUnit> implements MUnitDao {
|
||||
|
||||
@Override
|
||||
public String getEntityName() {
|
||||
return "MUnit";
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package info.bukova.isspst.data;
|
||||
|
||||
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;
|
||||
|
||||
@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 name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description
|
||||
* the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package info.bukova.isspst.filters;
|
||||
|
||||
import static info.bukova.isspst.StringUtils.nullStr;
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
|
||||
public class MUnitFilter implements Filter<MUnit> {
|
||||
|
||||
private MUnit condMUnit;
|
||||
|
||||
public MUnitFilter(MUnit condMUnit) {
|
||||
this.condMUnit = condMUnit;
|
||||
}
|
||||
|
||||
private static class MUnitMatcher extends TypeSafeMatcher<MUnit> {
|
||||
|
||||
private MUnit condMUnit;
|
||||
|
||||
public MUnitMatcher(MUnit cond) {
|
||||
this.condMUnit = cond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(Description desc) {
|
||||
desc.appendText("munits matches");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(MUnit item) {
|
||||
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMUnit.getCode()).toLowerCase())
|
||||
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMUnit.getName()).toLowerCase())
|
||||
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMUnit.getDescription()).toLowerCase());
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<MUnit> matchMUnit(MUnit munit) {
|
||||
return new MUnitMatcher(munit);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MUnitMatcher matcher() {
|
||||
return new MUnitMatcher(condMUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryString() {
|
||||
// TODO query string
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package info.bukova.isspst.services.munits;
|
||||
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
import info.bukova.isspst.services.Service;
|
||||
|
||||
public interface MUnitService extends Service<MUnit> {
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package info.bukova.isspst.services.munits;
|
||||
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
import info.bukova.isspst.services.AbstractService;
|
||||
|
||||
public class MUnitServiceImpl extends AbstractService<MUnit> implements MUnitService{
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package info.bukova.isspst.ui;
|
||||
package info.bukova.isspst.ui.buildings;
|
||||
|
||||
import info.bukova.isspst.data.Building;
|
||||
import info.bukova.isspst.ui.FormViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
|
@ -1,8 +1,9 @@
|
||||
package info.bukova.isspst.ui;
|
||||
package info.bukova.isspst.ui.buildings;
|
||||
|
||||
import info.bukova.isspst.data.Building;
|
||||
import info.bukova.isspst.filters.BuildingFilter;
|
||||
import info.bukova.isspst.services.buildings.BuildingService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
@ -0,0 +1,14 @@
|
||||
package info.bukova.isspst.ui.munits;
|
||||
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
import info.bukova.isspst.ui.FormViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
|
||||
public class MUnitsForm extends FormViewModel<MUnit> {
|
||||
|
||||
@Init(superclass = true)
|
||||
public void init() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package info.bukova.isspst.ui.munits;
|
||||
|
||||
import info.bukova.isspst.data.MUnit;
|
||||
import info.bukova.isspst.filters.MUnitFilter;
|
||||
import info.bukova.isspst.services.munits.MUnitService;
|
||||
import info.bukova.isspst.ui.ListViewModel;
|
||||
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
|
||||
public class MUnitsList extends ListViewModel<MUnit> {
|
||||
|
||||
@WireVariable
|
||||
private MUnitService munitService;
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
service = munitService;
|
||||
dataClass = MUnit.class;
|
||||
formZul = "munitsForm.zul";
|
||||
dataFilter = new MUnitFilter(getFilterTemplate());
|
||||
}
|
||||
}
|
@ -1 +1,2 @@
|
||||
BuildingsFormCodeConstr=Zadejte k\u00f3d budovy...
|
||||
MUnitsFormCodeConstr=Zadejte k\u00f3d m\u011brn\u00e9 jednotky...
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@ -0,0 +1,10 @@
|
||||
<?page title="${labels.AgendaMUnits}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
|
||||
<zscript>
|
||||
String gridZul = "munitsGrid.zul";
|
||||
</zscript>
|
||||
|
||||
<include src="/app/template.zhtml"/>
|
||||
|
||||
</zk>
|
@ -0,0 +1,35 @@
|
||||
<?page title="${labels.MUnitsFormTitle}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.munits.MUnitsForm')">
|
||||
<caption src="/img/munits.png" zclass="form-caption" label="${labels.MUnitsFormTitle}" />
|
||||
<vlayout>
|
||||
<grid hflex="min">
|
||||
<columns>
|
||||
<column align="right" hflex="min" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.MUnitsFormCode} :</cell>
|
||||
<cell>
|
||||
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.code)" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.MUnitsFormName} :</cell>
|
||||
<cell>
|
||||
<textbox id="name" width="200px" value="@bind(vm.dataBean.name)" />
|
||||
</cell>
|
||||
</row>
|
||||
<row>
|
||||
<cell sclass="row-title">${labels.MUnitsFormDescription} :</cell>
|
||||
<cell>
|
||||
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
|
||||
</cell>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<include src="/app/formButtons.zul" />
|
||||
</vlayout>
|
||||
</window>
|
||||
</zk>
|
@ -0,0 +1,58 @@
|
||||
<?page title="${labels.AgendaMUnits}" contentType="text/html;charset=UTF-8"?>
|
||||
<zk>
|
||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.munits.MUnitsList')">
|
||||
<caption zclass="form-caption" label="${labels.AgendaMUnits}" />
|
||||
<include src="/app/toolbar.zul" />
|
||||
|
||||
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)">
|
||||
<listhead menupopup="auto">
|
||||
<listheader label="${labels.MUnitsGridColumnCode}" sort="czech(code)" width="10%" />
|
||||
<listheader label="${labels.MUnitsGridColumnName}" sort="czech(name)" width="30%" />
|
||||
<listheader label="${labels.MUnitsGridColumnDescription}" sort="czech(description)" width="60%" />
|
||||
</listhead>
|
||||
|
||||
<auxhead sclass="category-center" visible="@load(vm.filter)">
|
||||
<auxheader>
|
||||
<div sclass="find-grid-cell">
|
||||
<div sclass="find-grid-divtextbox">
|
||||
<textbox value="@bind(vm.filterTemplate.code)" instant="true" onChange="@command('doFilter')" 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.name)" instant="true" onChange="@command('doFilter')" 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')" sclass="find-grid-textbox" />
|
||||
</div>
|
||||
<div sclass="find-grid-img">
|
||||
<image src="/img/funnel.png" />
|
||||
</div>
|
||||
</div>
|
||||
</auxheader>
|
||||
</auxhead>
|
||||
|
||||
<template name="model">
|
||||
<listitem>
|
||||
<listcell label="@load(each.code)" />
|
||||
<listcell label="@load(each.name)" />
|
||||
<listcell label="@load(each.description)" />
|
||||
</listitem>
|
||||
</template>
|
||||
</listbox>
|
||||
|
||||
</window>
|
||||
</zk>
|
Loading…
Reference in New Issue