Little change...
Because some problem with refresh I moved the TemporaryOrder object
from the component to the session.
This does not change the problem..
PS:
How radio button &C. work??
(I've seen WORadioButtonList is deprecated.. Should I use
ERXRadioButtonMatrix?... but selection is not.. selected!)
Francesco
On 26/ago/09, at 19:20, Francesco Romano wrote:
Hi..
This is a very simple question, and I was able to find a
workaround.. but I'd like to know where is the problem...
I've this class:
public class OrderComponent extends ERXComponent {
private TemporaryOrder order;
public OrderComponent(WOContext context) {
super(context);
}
public void setOrder(TemporaryOrder order) {
this.order = order;
}
public TemporaryOrder order() {
return order;
}
@Override
public void awake() {
super.awake();
setOrder(null);
}
}
All my order classes inherit from that class. (this only to have the
order object without rewriting it every time..).
If I have this binding:
CartSubtotal: WOString {
value = order.cart.cartTotal;
numberformat = "$#0.00";
}
When I render the page I get this exception:
valueForKey(): lookup of unknown key: 'cartTotal'. This class does
not have an instance variable of the name cartTotal or _cartTotal,
nor a method of the name cartTotal, _cartTotal, getCartTotal, or
_getCartTotal' object
'com.portonapoleone.store.utils.carti...@eac903' key 'cartTotal'>
If I change the binding to this I have no problem:
CartSubtotal: WOString {
value = cartTotal;
numberformat = "$#0.00";
}
public double cartTotal() {
return order().cart().cartTotal();
}
These are the other classes involved:
public class TemporaryOrder {
private CartArray cart;
private String shippingAddress;
public TemporaryOrder(CartArray c) {
cart = c;
}
public CartArray cart() {
return cart;
}
public void setShipmentAddress(String shipmentAddress) {
this.shipmentAddress = shipmentAddress;
}
public String shipmentAddress() {
return shipmentAddress;
}
}
public class CartArray extends NSMutableArray<CartItem> {
public boolean add(Prodotto p) {
return add(p,1);
}
public boolean add(Prodotto p, int i) {
CartItem ci = new CartItem(p);
if (contains(ci)) {
CartItem oldCI = objectAtIndex(indexOf(ci));
oldCI.quantity += i;
return true;
}
else {
ci.quantity = i;
return super.add(ci);
}
}
public double cartTotal() {
double total = 0;
Iterator<CartItem> it = this.iterator();
CartItem ci = null;
while (it.hasNext()) {
ci = it.next();
total += ci.totalPrice();
}
return total;
}
}
Francesco
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]