Re: Building a multizone update in a loop

2011-01-11 Thread Paul Stanton

have a read of this... you might find it useful.

https://issues.apache.org/jira/browse/TAP5-1407

On 11/01/2011 5:10 PM, Mark wrote:

Thank you. That makes sense now.

On Mon, Jan 10, 2011 at 11:44 PM, Josh Canfieldjoshcanfi...@gmail.com  wrote:

MultiZoneUpdate is confusing for sure.

public MultiZoneUpdate add(String zoneId, Object renderer)
{
return new MultiZoneUpdate(zoneId, renderer, this);
}

See how it returns a new instance of the update when you call add?

You can change your code like this and it should get things working:

MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
for(Item item : getItems) {
  update = update.add(itemZone- +item.getId(), itemZone);
}
return update;

There are some recent defects filed to get this interface fixed,
hopefully someone will get some time to look at it for the 5.3
release.

Josh

On Mon, Jan 10, 2011 at 9:32 PM, Markmark-li...@xeric.net  wrote:

I have a zone that is rendered in a loop.  It has a text field that
can be changed and it updates the cost for that row and the total cost
at the bottom of the page.  This all works fine regardless of how many
items are in the row. A user change to the qty in a row will update
that row's total and the total at the bottom of the page.

My code looked something like:
return new MultiZoneUpdate(totalPriceZone,totalPriceZone).add(itemZone-
+item.getId(), itemZone);

That works fine.

Now the requirements changed and I need to update the total on rows
other than the row that was changed.  My first through was something
like this:
MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
for(Item item : getItems) {
   update.add(itemZone- +item.getId(), itemZone);
}
return update;

But that doesn't work.  It only updates the totalPriceZone.  So I
tried going back to what I had before, but this time creating the
Update on one line and then adding the itemZone on the next like this:

MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
update.add(itemZone- +item.getId(), itemZone);
return update;

I expected the code above to have the same result as my original code,
but it doesn't.  It only updates the totalPriceZone.

Should I expect the first piece of code and the last to do the same
thing or is there some reason that you can't call add on the
MultiZoneUpdate after it is constructed?

Any other suggestions on how to create a multizone update when the
number of zones to add vary at runtime?

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Building a multizone update in a loop

2011-01-10 Thread Mark
I have a zone that is rendered in a loop.  It has a text field that
can be changed and it updates the cost for that row and the total cost
at the bottom of the page.  This all works fine regardless of how many
items are in the row. A user change to the qty in a row will update
that row's total and the total at the bottom of the page.

My code looked something like:
return new MultiZoneUpdate(totalPriceZone,totalPriceZone).add(itemZone-
+item.getId(), itemZone);

That works fine.

Now the requirements changed and I need to update the total on rows
other than the row that was changed.  My first through was something
like this:
MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
for(Item item : getItems) {
   update.add(itemZone- +item.getId(), itemZone);
}
return update;

But that doesn't work.  It only updates the totalPriceZone.  So I
tried going back to what I had before, but this time creating the
Update on one line and then adding the itemZone on the next like this:

MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
update.add(itemZone- +item.getId(), itemZone);
return update;

I expected the code above to have the same result as my original code,
but it doesn't.  It only updates the totalPriceZone.

Should I expect the first piece of code and the last to do the same
thing or is there some reason that you can't call add on the
MultiZoneUpdate after it is constructed?

Any other suggestions on how to create a multizone update when the
number of zones to add vary at runtime?

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Building a multizone update in a loop

2011-01-10 Thread Josh Canfield
MultiZoneUpdate is confusing for sure.

public MultiZoneUpdate add(String zoneId, Object renderer)
{
return new MultiZoneUpdate(zoneId, renderer, this);
}

See how it returns a new instance of the update when you call add?

You can change your code like this and it should get things working:

MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
for(Item item : getItems) {
  update = update.add(itemZone- +item.getId(), itemZone);
}
return update;

There are some recent defects filed to get this interface fixed,
hopefully someone will get some time to look at it for the 5.3
release.

Josh

On Mon, Jan 10, 2011 at 9:32 PM, Mark mark-li...@xeric.net wrote:
 I have a zone that is rendered in a loop.  It has a text field that
 can be changed and it updates the cost for that row and the total cost
 at the bottom of the page.  This all works fine regardless of how many
 items are in the row. A user change to the qty in a row will update
 that row's total and the total at the bottom of the page.

 My code looked something like:
 return new MultiZoneUpdate(totalPriceZone,totalPriceZone).add(itemZone-
 +item.getId(), itemZone);

 That works fine.

 Now the requirements changed and I need to update the total on rows
 other than the row that was changed.  My first through was something
 like this:
 MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
 for(Item item : getItems) {
   update.add(itemZone- +item.getId(), itemZone);
 }
 return update;

 But that doesn't work.  It only updates the totalPriceZone.  So I
 tried going back to what I had before, but this time creating the
 Update on one line and then adding the itemZone on the next like this:

 MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
 update.add(itemZone- +item.getId(), itemZone);
 return update;

 I expected the code above to have the same result as my original code,
 but it doesn't.  It only updates the totalPriceZone.

 Should I expect the first piece of code and the last to do the same
 thing or is there some reason that you can't call add on the
 MultiZoneUpdate after it is constructed?

 Any other suggestions on how to create a multizone update when the
 number of zones to add vary at runtime?

 Mark

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Building a multizone update in a loop

2011-01-10 Thread Mark
Thank you. That makes sense now.

On Mon, Jan 10, 2011 at 11:44 PM, Josh Canfield joshcanfi...@gmail.com wrote:
 MultiZoneUpdate is confusing for sure.

 public MultiZoneUpdate add(String zoneId, Object renderer)
    {
        return new MultiZoneUpdate(zoneId, renderer, this);
    }

 See how it returns a new instance of the update when you call add?

 You can change your code like this and it should get things working:

 MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
 for(Item item : getItems) {
  update = update.add(itemZone- +item.getId(), itemZone);
 }
 return update;

 There are some recent defects filed to get this interface fixed,
 hopefully someone will get some time to look at it for the 5.3
 release.

 Josh

 On Mon, Jan 10, 2011 at 9:32 PM, Mark mark-li...@xeric.net wrote:
 I have a zone that is rendered in a loop.  It has a text field that
 can be changed and it updates the cost for that row and the total cost
 at the bottom of the page.  This all works fine regardless of how many
 items are in the row. A user change to the qty in a row will update
 that row's total and the total at the bottom of the page.

 My code looked something like:
 return new MultiZoneUpdate(totalPriceZone,totalPriceZone).add(itemZone-
 +item.getId(), itemZone);

 That works fine.

 Now the requirements changed and I need to update the total on rows
 other than the row that was changed.  My first through was something
 like this:
 MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
 for(Item item : getItems) {
   update.add(itemZone- +item.getId(), itemZone);
 }
 return update;

 But that doesn't work.  It only updates the totalPriceZone.  So I
 tried going back to what I had before, but this time creating the
 Update on one line and then adding the itemZone on the next like this:

 MultiZoneUpdate update =  MultiZoneUpdate(totalPriceZone,totalPriceZone)
 update.add(itemZone- +item.getId(), itemZone);
 return update;

 I expected the code above to have the same result as my original code,
 but it doesn't.  It only updates the totalPriceZone.

 Should I expect the first piece of code and the last to do the same
 thing or is there some reason that you can't call add on the
 MultiZoneUpdate after it is constructed?

 Any other suggestions on how to create a multizone update when the
 number of zones to add vary at runtime?

 Mark

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org