Re: need help, editing an array
Re: need help, editing an array
- Subject: Re: need help, editing an array
- From: LD <email@hidden>
- Date: Mon, 22 Aug 2005 07:11:32 +1000
Hi there,
On 22/08/2005, at 6:34 AM, Amedeo Mantica wrote:
I have an Array and i display his content using a WORepetition.
for each row, I display data into a textfield...
How can i modify the data into the array?
let's say you have the following bindings:
MyRepetition: WORepetition {
list = theArray;
item = anObject;
}
MyTextField: WOTextField {
value = anObjectValue;
}
In your Java file you have:
/** @TypeInfo SomeType */
NSArray theArray; // assume populated with objects.
public SomeType anObject; //
public String anObjectValue() {
return anObject.someStringValue();
}
Here's two choices/examples...
1) the items stored in the array must be mutable. i.e., SomeType
values must be settable and not final.
public void setAnObjectValue( String aValue ) {
anObject.setSomeStringValue( aValue );
}
2) use an NSMutableArray.
public void setAValue( String aValue ) {
int i = theArray.indexOfObject( anObject );
SomeType newObject = new SomeType( aValue );
theArray.replaceObjectAtIndex( newObject, i );
}
with regards,
--
LD
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden