the newest item on my XPages wishlist
Category xpages
I'm building a custom control that I hope will prove to be very useful... I'll leave its identity a mystery until it's a bit more complete, but one item I added to my "XPages wishlist" today will probably serve as a sufficient hint (I'll be requesting it later through a more official channel, but am posting it here mostly for accountability's sake to ensure that I don't forget to officially request it):
Support for recursive custom controls.
At the moment, Designer won't even let me compile a custom control if it contains a reference to itself. As a matter of fact, it pops up a MsgBox over and over and over and over and over again (in other words, on every keypress, not just at build time), reminding me that I've done something naughty until I finally manage to kill the self-reference. I understand why: simply including a custom control inside itself without specifying how many levels deep it should render would create an infinite loop and the server would go up in a sad little puff of smoke. I agree: infinite loops make Baby Jesus cry. But that's why we have the "rendered" attribute, compositeData, and viewScope - combine the first with either or both of the other two and you've got a perfect mechanism for ensuring that the control only recurses as deep as it needs to.
But in its current form the compiler prevents us from forgetting to enforce a limit, because it won't even perform the build if recursion is detected... and before you ask, no: it doesn't allow circular use either - if control A includes control B and B includes A, the same error is displayed. It knows you were trying to recurse and gets very upset.
So I'll be requesting that they replace the restriction with a warning, something scary that tries to talk the developer out of the recursion (with, of course, a "don't display this warning again" checkbox that does, in fact, prevent the warning from appearing every time) but still allows me to intentionally recurse if I think I know what I'm doing. Maybe give admins a policy that allows them to prevent recursion if their developers keep crashing the server with inadequate infinite loop checking, but disable the policy by default.
Granted, if the control I'm building were already a core control, I wouldn't need recursion... yet. But I suspect sooner or later I'd have encountered another reason for wishing it were allowed.
I'm building a custom control that I hope will prove to be very useful... I'll leave its identity a mystery until it's a bit more complete, but one item I added to my "XPages wishlist" today will probably serve as a sufficient hint (I'll be requesting it later through a more official channel, but am posting it here mostly for accountability's sake to ensure that I don't forget to officially request it):
Support for recursive custom controls.
At the moment, Designer won't even let me compile a custom control if it contains a reference to itself. As a matter of fact, it pops up a MsgBox over and over and over and over and over again (in other words, on every keypress, not just at build time), reminding me that I've done something naughty until I finally manage to kill the self-reference. I understand why: simply including a custom control inside itself without specifying how many levels deep it should render would create an infinite loop and the server would go up in a sad little puff of smoke. I agree: infinite loops make Baby Jesus cry. But that's why we have the "rendered" attribute, compositeData, and viewScope - combine the first with either or both of the other two and you've got a perfect mechanism for ensuring that the control only recurses as deep as it needs to.
But in its current form the compiler prevents us from forgetting to enforce a limit, because it won't even perform the build if recursion is detected... and before you ask, no: it doesn't allow circular use either - if control A includes control B and B includes A, the same error is displayed. It knows you were trying to recurse and gets very upset.
So I'll be requesting that they replace the restriction with a warning, something scary that tries to talk the developer out of the recursion (with, of course, a "don't display this warning again" checkbox that does, in fact, prevent the warning from appearing every time) but still allows me to intentionally recurse if I think I know what I'm doing. Maybe give admins a policy that allows them to prevent recursion if their developers keep crashing the server with inadequate infinite loop checking, but disable the policy by default.
Granted, if the control I'm building were already a core control, I wouldn't need recursion... yet. But I suspect sooner or later I'd have encountered another reason for wishing it were allowed.
Comments
I've got to get coding some of this XPages goodness!
Posted by Chris Blatnick At 12:15:40 AM On 03/09/2009 | - Website - |
Wonder if it would be a good idea to have some more "Admin" controls around them to help better manage things. Just imagine these things happen on your main business servers when you introduce that new xPages front intranet / public website. Thousands of people hitting the server soon as it comes back online
Gives me "the fear" as they say in scotland
Posted by ChrisC At 06:00:59 AM On 11/05/2009 | - Website - |