diff --git a/src/main/java/info/bukova/isspst/StringUtils.java b/src/main/java/info/bukova/isspst/StringUtils.java index af9f23b1..e7402ed2 100644 --- a/src/main/java/info/bukova/isspst/StringUtils.java +++ b/src/main/java/info/bukova/isspst/StringUtils.java @@ -124,10 +124,29 @@ public class StringUtils for (int i = 0; i < list.size(); i++) { + String item = StringUtils.nullStr(list.get(i)); result = StringUtils.addSeparator(result, separator); - result += list.get(i); + result += item; } return result; } + + public static String joinNotEmpty(List list, String separator) + { + String result = ""; + + for (int i = 0; i < list.size(); i++) + { + String item = StringUtils.nullStr(list.get(i)); + + if (!item.isEmpty()) + { + result = StringUtils.addSeparator(result, separator); + result += item; + } + } + + return result; + } } diff --git a/src/main/java/info/bukova/isspst/ui/DocumentViewModel.java b/src/main/java/info/bukova/isspst/ui/DocumentViewModel.java index 70e2169b..678e88b3 100644 --- a/src/main/java/info/bukova/isspst/ui/DocumentViewModel.java +++ b/src/main/java/info/bukova/isspst/ui/DocumentViewModel.java @@ -1,11 +1,17 @@ package info.bukova.isspst.ui; +import info.bukova.isspst.StringUtils; + +import java.util.ArrayList; +import java.util.List; + import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.KeyEvent; import org.zkoss.zul.Combobox; +import org.zkoss.zul.Messagebox; public class DocumentViewModel { @@ -77,4 +83,22 @@ public class DocumentViewModel break; } } + + @Command + public void testPressKey(@BindingParam("keyEvent") KeyEvent keyEvent) + { + int keyCode = keyEvent.getKeyCode(); + boolean isCtrlKey = keyEvent.isCtrlKey(); + boolean isAltKey = keyEvent.isAltKey(); + boolean isShiftKey = keyEvent.isShiftKey(); + + List list = new ArrayList(); + list.add(isCtrlKey ? "Ctrl" : ""); + list.add(isAltKey ? "Alt" : ""); + list.add(isShiftKey ? "Shift" : ""); + list.add(Integer.toString(keyCode)); + String sMsg = StringUtils.joinNotEmpty(list, "+"); + + Messagebox.show(sMsg + " is pressed", "testPressKey", Messagebox.OK, Messagebox.EXCLAMATION); + } } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java index 1f1965a3..a5eb63ba 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/created/OrderList.java @@ -4,6 +4,7 @@ import info.bukova.isspst.AddressUtils; import info.bukova.isspst.data.Address; import info.bukova.isspst.data.AddressEmb; import info.bukova.isspst.data.Order; +import info.bukova.isspst.data.OrderItem; import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.User; import info.bukova.isspst.filters.OrderFilter; @@ -13,12 +14,17 @@ import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.ui.ListViewModel; +import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.zkoss.bind.annotation.BindingParam; +import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Init; +import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.zk.ui.select.annotation.WireVariable; +import org.zkoss.zul.Listbox; public class OrderList extends ListViewModel { @@ -37,6 +43,10 @@ public class OrderList extends ListViewModel @WireVariable protected UserService userService; + protected OrderItem selectedOrderItem; + + protected List orderItems; + @Init(superclass = true) public void initOrderList() { @@ -44,6 +54,7 @@ public class OrderList extends ListViewModel dataClass = Order.class; formZul = "orderForm.zul"; dataFilter = new OrderFilter(getFilterTemplate()); + this.orderItems = new ArrayList(); } public List getSuppAddresses() @@ -85,4 +96,43 @@ public class OrderList extends ListViewModel { return userService.getAll(); } + + public OrderItem getSelectedOrderItem() + { + return selectedOrderItem; + } + + public void setSelectedOrderItem(OrderItem selectedOrderItem) + { + this.selectedOrderItem = selectedOrderItem; + } + + public List getOrderItems() + { + return orderItems; + } + + public void setOrderItems(List orderItems) + { + this.orderItems = orderItems; + } + + @Command + @NotifyChange("orderItems") + public void onChangeSelectOrder(@BindingParam("ctrl") Listbox lb) + { + if (lb == null) + { + return; + } + + if (lb.getSelectedIndex() > -1) + { + this.orderItems = this.getDataBean().getItems(); + } + else + { + this.orderItems = new ArrayList(); + } + } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 1770af3b..8c126320 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -316,6 +316,8 @@ CreateOrder=Vytvořit objednávku NotYetFilled=Zatím nevyplněno DeliveryAddress=Dodací adresa BillingAddress=Fakturační adresa +AccountDocuments=Doklady +Items=Položky OrderFormNumber=Číslo objednávky OrderFormOrderDate=Datum objednávky diff --git a/src/main/webapp/app/info.zul b/src/main/webapp/app/info.zul index a1b78138..29fd3d7c 100644 --- a/src/main/webapp/app/info.zul +++ b/src/main/webapp/app/info.zul @@ -2,6 +2,7 @@ @@ -23,9 +24,15 @@ - + - +