Ag. Vytvořené objednávky

• vložen kód pro barevné rozlišení Listitem v objednávkách pomocí stylů

closes #160
Verze_1.0
František Přibyl 10 years ago
parent 44178c52e6
commit 882993ef17

@ -13,6 +13,7 @@ import info.bukova.isspst.services.approved.OrderService;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.ListViewModel;
import info.bukova.isspst.ui.renderers.OrderCreatedItemRenderer;
import java.util.ArrayList;
import java.util.List;
@ -47,6 +48,8 @@ public class OrderList extends ListViewModel<Order>
protected List<OrderItem> orderItems;
protected OrderCreatedItemRenderer orderCreatedItemRenderer;
@Init(superclass = true)
public void initOrderList()
{
@ -55,6 +58,7 @@ public class OrderList extends ListViewModel<Order>
formZul = "orderForm.zul";
dataFilter = new OrderFilter(getFilterTemplate());
this.orderItems = new ArrayList<OrderItem>();
this.orderCreatedItemRenderer = new OrderCreatedItemRenderer();
}
public List<AddressEmb> getSuppAddresses()
@ -117,6 +121,16 @@ public class OrderList extends ListViewModel<Order>
this.orderItems = orderItems;
}
public OrderCreatedItemRenderer getOrderCreatedItemRenderer()
{
return orderCreatedItemRenderer;
}
public void setOrderCreatedItemRenderer(OrderCreatedItemRenderer orderCreatedItemRenderer)
{
this.orderCreatedItemRenderer = orderCreatedItemRenderer;
}
@Command
@NotifyChange("orderItems")
public void onChangeSelectOrder(@BindingParam("ctrl") Listbox lb)

@ -0,0 +1,50 @@
package info.bukova.isspst.ui.renderers;
import org.zkoss.bind.impl.BindListitemRenderer;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
@SuppressWarnings("serial")
public abstract class GenericListitemRenderer<T> extends BindListitemRenderer
{
protected abstract void changeProperties(Listbox lb, Listitem li, int index, String varnm);
protected T objectOfStates;
public T getObjectOfStates()
{
return objectOfStates;
}
public void setObjectOfStates(T objectOfStates)
{
this.objectOfStates = objectOfStates;
}
@SuppressWarnings("unchecked")
@Override
public void render(Listitem item, Object data, int index) throws Exception
{
this.objectOfStates = (T) data;
super.render(item, data, index);
}
@Override
protected void addItemReference(Component modelOwner, Component comp, int index, String varnm)
{
if (this.objectOfStates != null)
{
if (modelOwner != null && modelOwner instanceof Listbox)
{
if (comp != null && comp instanceof Listitem)
{
this.changeProperties((Listbox) modelOwner, (Listitem) comp, index, varnm);
}
}
}
super.addItemReference(modelOwner, comp, index, varnm);
}
}

@ -0,0 +1,38 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.Order;
import java.math.BigDecimal;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
@SuppressWarnings("serial")
public class OrderCreatedItemRenderer extends GenericListitemRenderer<Order>
{
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm)
{
Order order = this.getObjectOfStates();
boolean objednano = order.isOrdered();
BigDecimal invoiceTotal = order.getInvoiceTotal();
boolean zakoupeno = ((invoiceTotal != null) && (invoiceTotal.compareTo(BigDecimal.ZERO) != 0));
boolean doruceno = (zakoupeno && (order.getDeliveredDate() != null));
if (doruceno)
{
li.setSclass("order-select-delivered");
}
else if (zakoupeno)
{
li.setSclass("order-select-invoiced");
}
else if (objednano)
{
li.setSclass("order-select-ordered");
}
}
}

@ -8,10 +8,8 @@
text-shadow: 2px 2px 2px #000000;
}
.addScrollbar {
.addScrollbar {
overflow: auto;
}
.find-grid-cell {
@ -41,29 +39,41 @@
.find-grid-textbox-right {
width: 100%;
text-align: right;
text-align: right;
}
.grid-textbox-max {
.grid-textbox-max {
width: 100%;
}
.grid-textbox-max-right {
.grid-textbox-max-right {
width: 100%;
text-align: right;
}
.row-title {
.row-title {
/* ve formuláři zarovná u víceřádkových editů label nahoru */
vertical-align: top;
}
.z-listcell-content {
.z-listcell-content {
/* při úzkém sloupci gridu neodřádkuje slova podle mezer */
white-space: nowrap;
}
.combo {
.combo {
width: 100%;
min-width: 0;
}
.order-select-ordered {
background-color: #98fb98 !important;
}
.order-select-invoiced {
background-color: #fff44f !important;
}
.order-select-delivered {
background-color: #d19fe8 !important;
}

@ -21,6 +21,7 @@
<tabpanel>
<include src="/main/toolbar.zul" />
<listbox
itemRenderer="@load(vm.orderCreatedItemRenderer)"
vflex="1"
onSelect="@command('onChangeSelectOrder', ctrl=self)"
selectedItem="@bind(vm.dataBean)"

Loading…
Cancel
Save