Re: Invoking Subcomponent Action
Re: Invoking Subcomponent Action
- Subject: Re: Invoking Subcomponent Action
- From: Mike Schrag <email@hidden>
- Date: Wed, 25 Feb 2009 10:22:41 -0500
In the parent project 'clearInnerComponentState' method I get the
child component (an AbstractComponent type) and call the clearState
method like this:
public void clearInnerComponentState() {
AbstractCreateComponent component =
(AbstractCreateComponent)
ERXWOContext.contextDictionary().objectForKey("KEY");
if (component != null) {
component.clearState();
}
}
if all you're trying to do is trigger cache/state invalidation, check
out ERXLazyValue, which has lots of hooks to do this kind of stuff ...
I use it to do cache change notifications across the page:
_newRequests = new ERXLazyValue<NSArray<Request>>(this,
"uncachedNewRequests", new
ERXLazyValue.AjaxPageUserInfoCacheKeyInvalidator("hatchRequests"));
public NSArray<Request> uncachedNewRequests() {
// fetches from the db
}
public NSArray<Request> newRequests() {
return _newRequests.value();
}
and in the saveRequest() of an ajax component across the page:
new
ERXLazyValue
.AjaxPageUserInfoCacheKeyInvalidator("hatchRequests").timestamp();
(in the general case, you would stick the invalidator somewhere in the
page so that everyone is talking to the same instance -- it just
happens that the impl of AjaxPageUserInfoCache is backed by a page-
global store and are stateless, so you can just make new ones)
there's a big pile of impls of the invalidators to support different
methods of invalidating ...
ms
_______________________________________________
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