diff --git a/src/main/java/info/bukova/isspst/data/Building.java b/src/main/java/info/bukova/isspst/data/Building.java index e3be3304..7730055e 100644 --- a/src/main/java/info/bukova/isspst/data/Building.java +++ b/src/main/java/info/bukova/isspst/data/Building.java @@ -3,38 +3,33 @@ package info.bukova.isspst.data; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; -import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotBlank; -import org.hibernate.validator.constraints.NotEmpty; @Entity -@Table(name="BUILDING") +@Table(name = "BUILDING") public class Building extends BaseData implements DataModel { - - @Column(name="CODE", unique=true) + @Column(name = "CODE", unique = true) private String code; - - @Column(name="NAME") + + @Column(name = "NAME") private String name; - - @Column(name="DESCRIPTION") + + @Column(name = "DESCRIPTION") private String description; - /** * @return the code */ - @NotBlank(message = "${labels.BuildingsFormCodeConstr}") - @NotNull(message = "${labels.BuildingsFormCodeConstr}") - @NotEmpty(message = "${labels.BuildingsFormCodeConstr}") + @NotBlank(message = "{BuildingsFormCodeConstr}") public String getCode() { return code; } /** - * @param code the code to set + * @param code + * the code to set */ public void setCode(String code) { this.code = code; @@ -48,7 +43,8 @@ public class Building extends BaseData implements DataModel { } /** - * @param name the name to set + * @param name + * the name to set */ public void setName(String name) { this.name = name; @@ -62,7 +58,8 @@ public class Building extends BaseData implements DataModel { } /** - * @param description the description to set + * @param description + * the description to set */ public void setDescription(String description) { this.description = description; diff --git a/src/main/java/info/bukova/isspst/filters/BuildingFilter.java b/src/main/java/info/bukova/isspst/filters/BuildingFilter.java new file mode 100644 index 00000000..787c6a22 --- /dev/null +++ b/src/main/java/info/bukova/isspst/filters/BuildingFilter.java @@ -0,0 +1,56 @@ +package info.bukova.isspst.filters; + +import static info.bukova.isspst.StringUtils.nullStr; +import info.bukova.isspst.data.Building; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class BuildingFilter implements Filter { + + private Building condBuilding; + + public BuildingFilter(Building condBuilding) { + this.condBuilding = condBuilding; + } + + private static class BuildingMatcher extends TypeSafeMatcher { + + private Building condBuilding; + + public BuildingMatcher(Building cond) { + this.condBuilding = cond; + } + + @Override + public void describeTo(Description desc) { + desc.appendText("buildings matches"); + } + + @Override + public boolean matchesSafely(Building item) { + return nullStr(item.getCode()).toLowerCase().contains(nullStr(condBuilding.getCode()).toLowerCase()) + && nullStr(item.getName()).toLowerCase().contains(nullStr(condBuilding.getName()).toLowerCase()) + && nullStr(item.getDescription()).toLowerCase().contains(nullStr(condBuilding.getDescription()).toLowerCase()); + } + + @Factory + public static Matcher matchBuilding(Building building) { + return new BuildingMatcher(building); + } + } + + @Override + public BuildingMatcher matcher() { + return new BuildingMatcher(condBuilding); + } + + @Override + public String queryString() { + // TODO query string + return ""; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/BuildingList.java b/src/main/java/info/bukova/isspst/ui/BuildingList.java index 6b9d50e9..aadc1384 100644 --- a/src/main/java/info/bukova/isspst/ui/BuildingList.java +++ b/src/main/java/info/bukova/isspst/ui/BuildingList.java @@ -1,21 +1,23 @@ package info.bukova.isspst.ui; import info.bukova.isspst.data.Building; +import info.bukova.isspst.filters.BuildingFilter; import info.bukova.isspst.services.buildings.BuildingService; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.WireVariable; public class BuildingList extends ListViewModel { - + @WireVariable private BuildingService buildingService; - + @Init public void init() { service = buildingService; dataClass = Building.class; formZul = "buildingForm.zul"; + dataFilter = new BuildingFilter(getFilterTemplate()); } } diff --git a/src/main/resources/ValidationMessages.properties b/src/main/resources/ValidationMessages.properties new file mode 100644 index 00000000..ebe76fac --- /dev/null +++ b/src/main/resources/ValidationMessages.properties @@ -0,0 +1 @@ +BuildingsFormCodeConstr=Zadejte k\u00f3d budovy... \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/zk-label.properties b/src/main/webapp/WEB-INF/zk-label.properties index a072d70c..3a803204 100644 --- a/src/main/webapp/WEB-INF/zk-label.properties +++ b/src/main/webapp/WEB-INF/zk-label.properties @@ -1,8 +1,9 @@ # Default file +AppName=Objednávkový systém SPŠ Třebíč + AgendaBuildings=Budovy BuildingsFormCode=Kód -BuildingsFormCodeConstr=Zadejte kód budovy... BuildingsFormName=Název BuildingsFormDescription=Popis @@ -15,6 +16,8 @@ ButtonSave=Uložit FormBuilding=Budova +HeaderText=Hlavička + ToolbarRecNew=Nový záznam ToolbarRecEdit=Úprava aktuálního záznamu ToolbarRecDelete=Odstranit aktuální záznam diff --git a/src/main/webapp/WEB-INF/zk.xml b/src/main/webapp/WEB-INF/zk.xml index 3eec7dba..f67fd971 100644 --- a/src/main/webapp/WEB-INF/zk.xml +++ b/src/main/webapp/WEB-INF/zk.xml @@ -23,6 +23,12 @@ /WEB-INF/ckez-bind-lang-addon.xml + + /css/zk-modify.css + /css/form.css + /css/page.css + + @@ -19,13 +18,13 @@ ${labels.BuildingsFormName} : - + ${labels.BuildingsFormDescription} : - + diff --git a/src/main/webapp/app/form.css b/src/main/webapp/css/form.css similarity index 100% rename from src/main/webapp/app/form.css rename to src/main/webapp/css/form.css diff --git a/src/main/webapp/css/page.css b/src/main/webapp/css/page.css new file mode 100644 index 00000000..91072ff4 --- /dev/null +++ b/src/main/webapp/css/page.css @@ -0,0 +1,80 @@ +html { + /*vertical scrollbar allways visible */ + overflow: -moz-scrollbars-vertical; + overflow-y: scroll; + + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; +} + +#container { + min-height: 100%; + position: relative; +} + +#header { + width: auto; + height: 40px; + border: 1px solid #ccc; + padding: 10px; + background: url("/isspst/img/header-bg.png") 50% 0 repeat-x; + + color: #ffffff; + font-size: 35px; + font-weight: bold; + text-align: center; + text-shadow: 2px 2px 2px #000000; +} + +#leftcolumn { + width: 140px; + padding: 10px; + float: left; +} + +#navbar { + border: 1px solid #ccc; +} + +#maincolumn { + padding: 10px; + padding-bottom: 20px; /* Height of the footer */ + margin: 0px 0px 0px 160px; +} + +#footer { + clear: both; + position: absolute; + bottom: 0; + width: 100%; + height: 20px; /* Height of the footer */ + border: 1px solid #ccc; +} + +.form-caption { + overflow: hidden; + font-weight: bold; + font-size: 20px; + text-shadow: 2px 2px 2px #888888; + padding-left: 5px; +} +/*aaa*/ +.form-caption-content { + float: left; +} + +/* +a:link,a:visited { + font-size: 12px; + color: #0000A0; + background-color: #FFFFFF; + text-decoration: none; + target-new: none; +} + +a:hover { + font-size: 12px; + color: #0000A0; + background-color: #a3d3f8; + text-decoration: none; + target-new: none; +}*/ \ No newline at end of file diff --git a/src/main/webapp/css/zk-modify.css b/src/main/webapp/css/zk-modify.css new file mode 100644 index 00000000..84a1f57a --- /dev/null +++ b/src/main/webapp/css/zk-modify.css @@ -0,0 +1,18 @@ +.find-grid-cell { + display: table; + width: 100%; +} + +.find-grid-img { + display: table-cell; + width: 20px; + text-align: right; +} + +.find-grid-divtextbox { + display: table-cell; +} + +.find-grid-textbox { + width: 100%; +} \ No newline at end of file diff --git a/src/main/webapp/img/header-bg.png b/src/main/webapp/img/header-bg.png new file mode 100644 index 00000000..80548673 Binary files /dev/null and b/src/main/webapp/img/header-bg.png differ diff --git a/src/main/webapp/img/logo.png b/src/main/webapp/img/logo.png new file mode 100644 index 00000000..207bb45a Binary files /dev/null and b/src/main/webapp/img/logo.png differ