multitenant
Josef Rokos 11 years ago
commit 34c4144f46

@ -3,38 +3,33 @@ package info.bukova.isspst.data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
@Entity @Entity
@Table(name="BUILDING") @Table(name = "BUILDING")
public class Building extends BaseData implements DataModel { public class Building extends BaseData implements DataModel {
@Column(name = "CODE", unique = true)
@Column(name="CODE", unique=true)
private String code; private String code;
@Column(name="NAME") @Column(name = "NAME")
private String name; private String name;
@Column(name="DESCRIPTION") @Column(name = "DESCRIPTION")
private String description; private String description;
/** /**
* @return the code * @return the code
*/ */
@NotBlank(message = "${labels.BuildingsFormCodeConstr}") @NotBlank(message = "{BuildingsFormCodeConstr}")
@NotNull(message = "${labels.BuildingsFormCodeConstr}")
@NotEmpty(message = "${labels.BuildingsFormCodeConstr}")
public String getCode() { public String getCode() {
return code; return code;
} }
/** /**
* @param code the code to set * @param code
* the code to set
*/ */
public void setCode(String code) { public void setCode(String code) {
this.code = 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) { public void setName(String name) {
this.name = 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) { public void setDescription(String description) {
this.description = 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.Building;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class BuildingFilter implements Filter<Building> {
private Building condBuilding;
public BuildingFilter(Building condBuilding) {
this.condBuilding = condBuilding;
}
private static class BuildingMatcher extends TypeSafeMatcher<Building> {
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<Building> matchBuilding(Building building) {
return new BuildingMatcher(building);
}
}
@Override
public BuildingMatcher matcher() {
return new BuildingMatcher(condBuilding);
}
@Override
public String queryString() {
// TODO query string
return "";
}
}

@ -1,21 +1,23 @@
package info.bukova.isspst.ui; package info.bukova.isspst.ui;
import info.bukova.isspst.data.Building; import info.bukova.isspst.data.Building;
import info.bukova.isspst.filters.BuildingFilter;
import info.bukova.isspst.services.buildings.BuildingService; import info.bukova.isspst.services.buildings.BuildingService;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
public class BuildingList extends ListViewModel<Building> { public class BuildingList extends ListViewModel<Building> {
@WireVariable @WireVariable
private BuildingService buildingService; private BuildingService buildingService;
@Init @Init
public void init() { public void init() {
service = buildingService; service = buildingService;
dataClass = Building.class; dataClass = Building.class;
formZul = "buildingForm.zul"; formZul = "buildingForm.zul";
dataFilter = new BuildingFilter(getFilterTemplate());
} }
} }

@ -0,0 +1 @@
BuildingsFormCodeConstr=Zadejte k\u00f3d budovy...

@ -1,8 +1,9 @@
# Default file # Default file
AppName=Objednávkový systém SPŠ Třebíč
AgendaBuildings=Budovy AgendaBuildings=Budovy
BuildingsFormCode=Kód BuildingsFormCode=Kód
BuildingsFormCodeConstr=Zadejte kód budovy...
BuildingsFormName=Název BuildingsFormName=Název
BuildingsFormDescription=Popis BuildingsFormDescription=Popis
@ -15,6 +16,8 @@ ButtonSave=Uložit
FormBuilding=Budova FormBuilding=Budova
HeaderText=Hlavička
ToolbarRecNew=Nový záznam ToolbarRecNew=Nový záznam
ToolbarRecEdit=Úprava aktuálního záznamu ToolbarRecEdit=Úprava aktuálního záznamu
ToolbarRecDelete=Odstranit aktuální záznam ToolbarRecDelete=Odstranit aktuální záznam

@ -23,6 +23,12 @@
<addon-uri>/WEB-INF/ckez-bind-lang-addon.xml</addon-uri> <addon-uri>/WEB-INF/ckez-bind-lang-addon.xml</addon-uri>
</language-config> </language-config>
<desktop-config>
<theme-uri>/css/zk-modify.css</theme-uri>
<theme-uri>/css/form.css</theme-uri>
<theme-uri>/css/page.css</theme-uri>
</desktop-config>
<!-- <library-property> <!-- <library-property>
<name>org.zkoss.zul.progressbox.position</name> <name>org.zkoss.zul.progressbox.position</name>
<value>center</value> <value>center</value>

@ -5,8 +5,6 @@
viewModel="@id('vm') @init('info.bukova.isspst.ui.addressbook.AddressFindResult')" viewModel="@id('vm') @init('info.bukova.isspst.ui.addressbook.AddressFindResult')"
closable="true" width="700px"> closable="true" width="700px">
<style src="/app/form.css"/>
<listbox model="@load(vm.listResult)" height="300px" selectedItem="@bind(vm.selectedAddr)"> <listbox model="@load(vm.listResult)" height="300px" selectedItem="@bind(vm.selectedAddr)">
<listhead> <listhead>
<listheader label="Firma" sort="auto(company)"/> <listheader label="Firma" sort="auto(company)"/>

@ -5,8 +5,6 @@
viewModel="@id('vm') @init('info.bukova.isspst.ui.addressbook.AddressForm')" viewModel="@id('vm') @init('info.bukova.isspst.ui.addressbook.AddressForm')"
closable="true" width="600px"> closable="true" width="600px">
<style src="/app/form.css"/>
<grid width="580px"> <grid width="580px">
<columns> <columns>
<column label="" hflex="min"/> <column label="" hflex="min"/>

@ -6,8 +6,7 @@
viewModel="@id('vm') @init('info.bukova.isspst.ui.addressbook.AddressList')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.addressbook.AddressList')">
<include src="/app/toolbar.zul"/> <include src="/app/toolbar.zul"/>
<style src="/app/form.css"/>
<hbox width="100%"> <hbox width="100%">
<listbox id="dataGrid" model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" <listbox id="dataGrid" model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)"
onAfterRender="@command('afterRender')" selectedIndex="@load(vm.selIndex)" hflex="6" height="480px"> onAfterRender="@command('afterRender')" selectedIndex="@load(vm.selIndex)" hflex="6" height="480px">

@ -2,7 +2,6 @@
<zk> <zk>
<window id="editWin" title="Uživatel" border="normal" closable="true" width="550px" apply="org.zkoss.bind.BindComposer" <window id="editWin" title="Uživatel" border="normal" closable="true" width="550px" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.users.PermissionForm')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.users.PermissionForm')">
<style src="/app/form.css"/>
<label value="@load(vm.dataBean.description)" style="font-weight: bold;"/> <label value="@load(vm.dataBean.description)" style="font-weight: bold;"/>

@ -2,7 +2,7 @@
<zk> <zk>
<window id="editWin" title="Uživatel" border="normal" closable="true" width="450px" apply="org.zkoss.bind.BindComposer" <window id="editWin" title="Uživatel" border="normal" closable="true" width="450px" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.users.UserForm')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.users.UserForm')">
<style src="/app/form.css"/>
<grid width="440px"> <grid width="440px">
<columns> <columns>
<column hflex="min"></column> <column hflex="min"></column>

@ -0,0 +1,7 @@
<?page title="${labels.HeaderText}" contentType="text/html;charset=UTF-8"?>
<zk>
<style src="/css/page.css"/>
<div id="header">
${labels.AppName}
</div>
</zk>

@ -1,70 +0,0 @@
/*body {
font-family: sans-serif;
}*/
#container {
min-height:100%;
position:relative;
}
#header{
width: auto;
height:40px;
border: 1px solid #ccc;
padding:10px;
}
#leftcolumn{
width:140px;
/* margin: 20px 20px 20px 0px;*/
padding:10px;
float: left;
/* border: 1px solid #ccc;*/
}
#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 {
--1overflow:hidden;
font-weight: bold;
font-size: 20px;
}
/*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;
}*/

@ -6,7 +6,7 @@
apply="org.zkoss.bind.BindComposer" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.users.PasswdVM')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.users.PasswdVM')">
<caption src="/img/passwd.png" zclass="form-caption" label="Změnit heslo" /> <caption src="/img/passwd.png" zclass="form-caption" label="Změnit heslo" />
<style src="/app/form.css"/>
<grid> <grid>
<columns> <columns>
<column hflex="min"/> <column hflex="min"/>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="native" xmlns:u="zul" xmlns:zk="zk"> <html xmlns="native" xmlns:u="zul" xmlns:zk="zk">
<u:style src="/app/page.css"/> <u:style src="/css/page.css"/>
<script type="text/javascript"> <script type="text/javascript">
zk.afterLoad("zk", function () { zk.afterLoad("zk", function () {
@ -42,9 +42,9 @@
</script> </script>
<div id="container"> <div id="container">
<div id="header"> <div id="header">
hlavicka Objednávkový systém SPŠ Třebíč
</div> </div>
<div id="leftcolumn"> <div id="leftcolumn">
<u:include src="/app/navigation.zul"/> <u:include src="/app/navigation.zul"/>

@ -1,16 +1,48 @@
<?page title="${labels.AgendaBuildings}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.AgendaBuildings}" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window title="${labels.AgendaBuildings}" border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.BuildingList')"> <window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.BuildingList')">
<caption zclass="form-caption" label="${labels.AgendaBuildings}" />
<include src="/app/toolbar.zul"/> <include src="/app/toolbar.zul" />
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)"> <listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)">
<listhead> <listhead>
<listheader label="${labels.BuildingsGridColumnCode}" width="10%" /> <listheader label="${labels.BuildingsGridColumnCode}" sort="auto(code)" onSort="@command('onSort', column='code')" width="10%" />
<listheader label="${labels.BuildingsGridColumnName}" width="30%" /> <listheader label="${labels.BuildingsGridColumnName}" sort="auto(name)" onSort="@command('onSort', column='name')" width="30%" />
<listheader label="${labels.BuildingsGridColumnDescription}" width="60%" /> <listheader label="${labels.BuildingsGridColumnDescription}" sort="auto(description)" onSort="@command('onSort', column='description')" width="60%" />
</listhead> </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"> <template name="model">
<listitem> <listitem>
<listcell label="@load(each.code)" /> <listcell label="@load(each.code)" />

@ -1,5 +1,4 @@
<?page title="${labels.AgendaBuildings}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.AgendaBuildings}" contentType="text/html;charset=UTF-8"?>
<!--?link rel="stylesheet" type="text/css" href="/app/page.css"?-->
<zk> <zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.BuildingForm')"> <window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.BuildingForm')">
<caption src="/img/building.png" zclass="form-caption" label="${labels.FormBuilding}" /> <caption src="/img/building.png" zclass="form-caption" label="${labels.FormBuilding}" />
@ -19,13 +18,13 @@
<row> <row>
<cell sclass="row-title">${labels.BuildingsFormName} :</cell> <cell sclass="row-title">${labels.BuildingsFormName} :</cell>
<cell> <cell>
<textbox width="200px" value="@bind(vm.dataBean.name)" /> <textbox id="name" width="200px" value="@bind(vm.dataBean.name)" />
</cell> </cell>
</row> </row>
<row> <row>
<cell sclass="row-title">${labels.BuildingsFormDescription} :</cell> <cell sclass="row-title">${labels.BuildingsFormDescription} :</cell>
<cell> <cell>
<textbox width="300px" value="@bind(vm.dataBean.description)" /> <textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
</cell> </cell>
</row> </row>
</rows> </rows>

@ -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;
}*/

@ -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%;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Loading…
Cancel
Save