Ag. Vytvořené objednávky
• vložen kód pro barevné rozlišení Listitem v objednávkách pomocí stylů closes #160Verze_1.0
parent
44178c52e6
commit
882993ef17
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue