Re: ERXWORepetition sending null iterator item.
Re: ERXWORepetition sending null iterator item.
- Subject: Re: ERXWORepetition sending null iterator item.
- From: Dan Grec <email@hidden>
- Date: Thu, 2 Apr 2009 09:10:33 -0600
Sweet, thanks Chuck!
-Dan
On 1-Apr-09, at 11:03 PM, Chuck Hill wrote:
On Apr 1, 2009, at 7:18 AM, Dan Grec wrote:
Greg,
We use AjaxTabbedPanelTab very heavily in our apps - we were the
ones that pushed Mike & Chuck to add an isVisible binding.
So far, we've got two ways we make them behave more dynamically,
1. Just use the isVisible binding.
There is a slight hitch with this - The ajax request to switch tabs
will still render the tabs that are not even visible. So if those
tabs take a long time to render, it's a pain.
To get around this, we created our own TabbedPanelTab that has the
following:
@Override
public void takeChildrenValuesFromRequest(WORequest request,
WOContext context) {
if (hasChildrenElements()) {
int count = childrenElements().count();
context.appendZeroElementIDComponent();
for (int i = 0; i < count; i++) {
if (isVisble(context.component())) {
WOElement child = childrenElements().objectAtIndex(i);
child.takeValuesFromRequest(request, context);
context.incrementLastElementIDComponent();
}
}
context.deleteLastElementIDComponent();
}
}
@Override
public WOActionResults invokeChildrenAction(WORequest aRequest,
WOContext aContext) {
WOActionResults actionReturn = null;
if (hasChildrenElements()) {
int count = childrenElements().count();
aContext.appendZeroElementIDComponent();
for (int i = 0; i < count && actionReturn == null; i++) {
if (isVisble(aContext.component())) {
WOElement child = childrenElements().objectAtIndex(i);
actionReturn = child.invokeAction(aRequest, aContext);
aContext.incrementLastElementIDComponent();
}
}
aContext.deleteLastElementIDComponent();
}
return actionReturn;
}
I have no idea if the addition if the isVisble() call is really a
good idea, but for us it's working really well.
I have added this to Wonder so these methods should no longer be
required:
/**
* Do nothing if not visible.
*/
public void takeValuesFromRequest(WORequest request, WOContext
context)
{
if (isVisble(context.component())) {
super.takeChildrenValuesFromRequest(request, context);
}
}
/**
* Do nothing if not visible.
*/
public WOActionResults invokeAction(WORequest request, WOContext
context)
{
if (isVisble(context.component())) {
return super.invokeAction(request, context);
}
return null;
}
Chuck
2. Don't use the tabs at all, just have a WORepetition around
(Ajax)SubmitButtons and style them exactly the same as the tabs.
This works really well for us.
-Dan
On 31-Mar-09, at 9:34 PM, Chuck Hill wrote:
On Mar 31, 2009, at 8:26 PM, Greg Hulands wrote:
hmm,
So how does one dynamically generate tabs?
One doesn't. ;-)
Do you remember why it isn't working. If you can point me in the
general direction I will take a look at fixing it - if is
possible to fix ;-)
Well, there are some dirty little secrets in that implementation.
Ah, it is all coming back to me now. In AjaxTabbedPanel, see:
/**
* Looks through the child components to locate the
AjaxTabbedPanelTabs that are controlled by this panel.
* Tabs without an explicit id attributed are assigned a
calculated one.
*
* @param template the graph of elements passed to the
constructor.
*/
private void findTabs(WODynamicGroup template) {
In order to make this work the way that I wanted (without having
to explicitly set the tabs on the panel), the AjaxTabbedPanel has
to know the tabs before they are rendered. Which it can't. So it
peeks. In the template. Hey! You were warned above. But it
does not evaluate the repetition so, at most, it will see a single
panel. I could not think of a better way to make this that was
not far, far dirtier. There might be a way, but it has not
occurred to me yet.
Chuck
On Mar 31, 2009, at 8:20 PM, Chuck Hill wrote:
On Mar 31, 2009, at 7:45 PM, Greg Hulands wrote:
Hi,
I've got a component with the following in it:
<wo:AjaxTabbedPanel id="worksheetTabs" busyDiv="loading">
<wo:repeat list = "$session.worksheets" item="$worksheet">
<wo:AjaxTabbedPanelTab name = "$worksheet.title"
isSelected="$isActiveWorksheet">
<wo:Worksheet worksheet="$worksheet"/>
</wo:AjaxTabbedPanelTab>
</wo:repeat>
</wo:AjaxTabbedPanel>
First off, I am not sure if you can use a TabbedPanelTab in a
repetition. I know this did not work when I first wrote this.
IIRC, it still does not work.
When it renders the page I have 1 worksheet that should
display, but I get a tab with the title null. Stepping through
it, I see that the worksheet gets set, but then it gets set
again to null.
In the stack trace I see the oddly named
ERXWORepetition._cleanupAfterIteration() which is causing the
setting of null.
Does anyone know why this would be happening and how to rectify
it?
Right now that sounds normal. WORepetition and ERXWORepetition
set the item to null after the repetition finishes.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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
_______________________________________________
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
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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