Yeah, what you want is:

value = [email protected];

John

On Wed, Aug 26, 2009 at 1:48 PM, Michael Shkutkov <[email protected]>wrote:

> I guess, the cause of this problem is the fact that NSArray implements
> NSKeyValueCoding interface and has valueForKey method.
>
> Obviously extending NSMutableArray is really bad idea...
>
>
> On Wed, Aug 26, 2009 at 9:20 PM, Francesco Romano 
> <[email protected]>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 shipmentAddress;
>>
>>
>>  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/shkutkov%40gmail.com
>>
>> This email sent to [email protected]
>>
>
>
>
> --
> Cheers, Michael
>
>  _______________________________________________
> 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/johnthuss%40gmail.com
>
> This email sent to [email protected]
>
 _______________________________________________
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]

Reply via email to