on 03-30-2004 9:28 AM
In my WD-application I populate a Value Node with new entrys when a user clicks on the AddToList-Button.
I use the addElementMethod of the Node-Object. This works for a couple of times but then the Node is invalidated somehow and the application hangs.
In the onActionAdd-Method I use
IPSPListElement element;
element = wdContext.createPSPListElement();
element.set....
wdContext.nodePSPList().addElement(element);
My ContextNode has just a flat structure with about 5 attributes (no child nodes).
I understood that the supplyFunction is only needed when we deal with hierarchical node-structures?
What could be the reason for this strange behaviour?
Regards
Michael
Message was edited by: Michael Barth
Hi Stefan,
I don't know why, but your answer disappeared somehow from the forum. So did my reply from this morning.
When the node is invalid my onActionAddPosition-Method is not executed but the wdDoInit-Method. Then the wdDoModifyView and the supplyFunction.
In the SupplyFunction I repopulate the invalid Node now with the content of an extra Vector I created.Here I additionally store the data.
Also I would have to add the last element here since the onActionAddPosition method where I add the elements normally is not executed in the error-case.
This seems redundant to me. I'd like to get the data from the view and put it in the node and rely on the fact that it will be there when I need it. I don't need an extra collection in the first place. Or do I misunderstand the concept?
In my environment the error can be reproduced regularly.
Sometimes within the first couple of Add-Clicks.
Regards
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
yes, the forum lacks a little bit on "remembering performance" sometimes.
Anyway, the addElement() you are using in the action handler does (or should) not invalidate the node, so the supply function should not be called again, unless you explicitly call node.invalidate() somewhere.
Since the context is the designated data store of a controller, providing a redundant collection like a vector is normally not necessary.
So you did not misunderstand the concept. It's simply a matter of misleading behaviour in your environment.
The problems begin, when the framework restarts your controller lifecycle and forgets the action.
Isn't there a possibility for you to upgrade your WebAS?
Regards
Stefan
Hi Stefan,
I came to the same conclusion than you, that it must be a problem of the framework and opened an OSS-note meanwhile.
In the error-case my onActionAddPosition is not called but the wdDoInit Method:
MethodName: wdDoInit
MethodName: wdDoModifiyView
MethodName: supplyPSPList
===> First Click
Method Name: OnActionAddPosition
MethodName: wdDoModifiyView
===> Second Click (Error)
MethodName: wdDoInit
MethodName: wdDoModifiyView
MethodName: supplyPSPList
In the SupplyFunction I repopulate the invalid Node with the whole data that I stored in a Vector. Nevertheless the application hangs although the node should be ok again. The only entry missing is the new one I am adding in the addPositionMethod since this method is not called in the error-case.
Should I really do that in the supplyFunction as well, that means twice? Can't be the solution.
Regards
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
the wdDoInit method shouldn't be called twice at all. It looks like a complete "restart" of the View controller lifecycle (and, consequently recalling the supply function also).
So we are not able to solve the problem here. Let's wait and see, what the OSS note results in.
Regards
Stefan
Hi Michael,
i was able to reproduce the problem, but only once. From my point of view it has nothing to do with your code, it seems to be a problem of the client side framework, which get's confused somehow.
The supply function is not only useful for hierarchical node structures. There are three main benefits using a supply function:
1. You don't have to think about the "right" place and point of time where/when to fill the nodes. The framework will call you when the data is needed.
2. Contexts and context nodes are created in a lazy manner, when they are accessed the first time. If you prefill them in the wdDoInit() method for example without really using them in the ongoing application logic, it wastes runtime and ressources.
3. It's easier to structure and maintain your coding.
But this won't help you really in case of the current problem. The supply function is called, if the node is somehow invalid. Adding does <b>not</b> invalidate the node. And, if you invalidate the node by yourself, you will have to provide the complete list again.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.