From 4c033deffbd388ea8f8e6d74fe4b87d12ae9837e Mon Sep 17 00:00:00 2001 From: Franta Pribyl Date: Mon, 10 Nov 2014 07:56:15 +0100 Subject: [PATCH] =?UTF-8?q?Schv=C3=A1len=C3=BD=20studentsk=C3=BD=20projekt?= =?UTF-8?q?=20(karta=20V=C5=A1e)=20m=C3=A1=20modrou=20barvu.=20Schv=C3=A1l?= =?UTF-8?q?en=C3=BD=20nestudentsk=C3=BD=20projekt=20m=C3=A1=20zelenou=20ba?= =?UTF-8?q?rvu.=20=C4=8C=C3=A1ste=C4=8Dn=C4=9B=20schv=C3=A1len=C3=BD=20pro?= =?UTF-8?q?jekt=20m=C3=A1=20=C5=BElutou=20barvu.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #172 --- .../renderers/RequirementsItemRenderer.java | 39 +++++++++++++++++++ .../ui/requirement/RequirementSubpage.java | 14 +++++++ src/main/webapp/css/zk-modify.css | 14 ++++++- .../main/orders/requirements/reqListMy.zul | 3 +- .../main/orders/requirements/reqListMyAll.zul | 3 +- .../orders/requirements/reqListMyCenters.zul | 3 +- .../requirements/reqListMyWorkgroups.zul | 3 +- 7 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java diff --git a/src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java b/src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java new file mode 100644 index 00000000..1ebed322 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/renderers/RequirementsItemRenderer.java @@ -0,0 +1,39 @@ +package info.bukova.isspst.ui.renderers; + +import info.bukova.isspst.data.Requirement; +import info.bukova.isspst.data.RequirementState; + +import org.zkoss.zul.Listbox; +import org.zkoss.zul.Listitem; + +@SuppressWarnings("serial") +public class RequirementsItemRenderer extends GenericListitemRenderer +{ + @Override + protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) + { + Requirement requirement = this.getObjectOfStates(); + RequirementState state = requirement.getState(); + + if (state != null) + { + if (state == RequirementState.PARTIALLY) + { + li.setSclass("req-select-partially"); + } + else if (state == RequirementState.APPROVED) + { + Boolean isProject = requirement.getProject(); + + if ((isProject != null) && (isProject.booleanValue() == true)) + { + li.setSclass("req-select-approved-project"); + } + else + { + li.setSclass("req-select-approved"); + } + } + } + } +} diff --git a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java index a8168a3d..a49bb956 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java @@ -6,6 +6,7 @@ import info.bukova.isspst.services.requirement.RequirementBaseService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.ui.BigDecimalConverter; import info.bukova.isspst.ui.ListViewModel; +import info.bukova.isspst.ui.renderers.RequirementsItemRenderer; import java.util.List; @@ -20,6 +21,8 @@ public class RequirementSubpage extends ListViewModel @WireVariable protected UserService userService; + protected RequirementsItemRenderer requirementsItemRenderer; + public List getAllUsers() { return userService.getAll(); @@ -41,6 +44,7 @@ public class RequirementSubpage extends ListViewModel public void initRequirementSubpage() { this.bigDecimalConverter = new BigDecimalConverter(); + this.requirementsItemRenderer = new RequirementsItemRenderer(); } private RequirementBaseService getReqService() @@ -68,4 +72,14 @@ public class RequirementSubpage extends ListViewModel return false; } + + public RequirementsItemRenderer getRequirementsItemRenderer() + { + return requirementsItemRenderer; + } + + public void setRequirementsItemRenderer(RequirementsItemRenderer requirementsItemRenderer) + { + this.requirementsItemRenderer = requirementsItemRenderer; + } } diff --git a/src/main/webapp/css/zk-modify.css b/src/main/webapp/css/zk-modify.css index bcd15cd5..bb566f0e 100644 --- a/src/main/webapp/css/zk-modify.css +++ b/src/main/webapp/css/zk-modify.css @@ -76,4 +76,16 @@ .order-select-delivered { background-color: #d19fe8 !important; -} \ No newline at end of file +} + +.req-select-partially { + background-color: #fffb90 !important; +} + +.req-select-approved { + background-color: #afffb5 !important; +} + +.req-select-approved-project { + background-color: #87cefa !important; +} diff --git a/src/main/webapp/main/orders/requirements/reqListMy.zul b/src/main/webapp/main/orders/requirements/reqListMy.zul index f0d39069..7547347c 100644 --- a/src/main/webapp/main/orders/requirements/reqListMy.zul +++ b/src/main/webapp/main/orders/requirements/reqListMy.zul @@ -1,5 +1,6 @@